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.1.5
VikingsVillage.dll
Decompiled 2 hours 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: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [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_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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_00df: 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_016c: Expected O, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Expected O, but got Unknown //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Expected O, but got Unknown //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Expected O, but got Unknown //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Expected O, but got Unknown //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Expected O, but got Unknown //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Expected O, but got Unknown //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: 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, 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 = ""; } 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) { //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: 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_022a: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) Blueprint blueprint = new Blueprint(); blueprint.File = path; blueprint.Name = Path.GetFileNameWithoutExtension(path); string text = Path.GetExtension(path).ToLowerInvariant(); string[] array = System.IO.File.ReadAllLines(path); bool flag = text != ".blueprint"; string[] array2 = array; foreach (string text2 in array2) { string text3 = text2.Trim(); if (text3.Length == 0) { continue; } if (text3.StartsWith("#")) { string text4 = text3.ToLowerInvariant(); if (text4.StartsWith("#name:")) { blueprint.Name = text3.Substring(6).Trim(); } else if (text4.StartsWith("#description:")) { blueprint.Description = text3.Substring(13).Trim().Trim('"'); } else if (text4.StartsWith("# name:")) { blueprint.Name = text3.Substring(7).Trim(); } else if (text4.StartsWith("# description:")) { blueprint.Description = text3.Substring(14).Trim(); } else if (text4.StartsWith("# ground:")) { float.TryParse(text3.Substring(9).Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out blueprint.Ground); } else if (text4.StartsWith("#pieces")) { flag = true; } else if (text4.StartsWith("#snappoints") || text4.StartsWith("#terrain")) { flag = false; } } else { if (!flag) { continue; } BpPiece bpPiece = new BpPiece(); if (text == ".vbuild") { string[] array3 = text3.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (array3.Length < 8) { continue; } bpPiece.Prefab = array3[0]; bpPiece.Rot = new Quaternion(F(array3[1]), F(array3[2]), F(array3[3]), F(array3[4])); bpPiece.Pos = new Vector3(F(array3[5]), F(array3[6]), F(array3[7])); } else if (text == ".blueprint") { string[] array4 = text3.Split(';'); if (array4.Length < 9) { continue; } bpPiece.Prefab = array4[0]; bpPiece.Pos = new Vector3(F(array4[2]), F(array4[3]), F(array4[4])); bpPiece.Rot = new Quaternion(F(array4[5]), F(array4[6]), F(array4[7]), F(array4[8])); } else { string[] array5 = text3.Split(';'); if (array5.Length < 8) { continue; } bpPiece.Prefab = array5[0]; bpPiece.Pos = new Vector3(F(array5[1]), F(array5[2]), F(array5[3])); bpPiece.Rot = new Quaternion(F(array5[4]), F(array5[5]), F(array5[6]), F(array5[7])); if (array5.Length > 8) { bpPiece.Data = array5[8].Trim(); } } 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) { 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) + (string.IsNullOrEmpty(piece.Data) ? "" : (";" + piece.Data))); } Directory.CreateDirectory(Path.GetDirectoryName(path)); System.IO.File.WriteAllText(path, stringBuilder.ToString()); File = path; } } internal static class Architect { private const float W = 860f; private const float H = 640f; 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 readonly Queue<Vector3> _levelQueue = new Queue<Vector3>(); private static float _levelRadius = 3.2f; 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; public static readonly List<KeyValuePair<string, ZDOID>> LastPlaced = new List<KeyValuePair<string, ZDOID>>(); private static GameObject _levelPrefab; private static bool _levelSearched; 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; _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_0175: 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_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: 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_0249: 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)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))) { Place(_bp, _ghost.transform.position, _ghost.transform.rotation); CancelPlace(); } } 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_0099: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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(); if (_level && (Object)(object)LevelPrefab() != (Object)null) { float num = MedianGround(bp, at, rot); at.y = num - bp.Ground; _placeAt = at; Vector3 val = Vector3.positiveInfinity; Vector3 val2 = Vector3.negativeInfinity; foreach (BpPiece piece in bp.Pieces) { val = Vector3.Min(val, piece.Pos); val2 = Vector3.Max(val2, piece.Pos); } float num2 = Mathf.Max(1f, _levelRadius * 1.4f); ClearArea(at, rot, val - new Vector3(3f, 0f, 3f), val2 + new Vector3(3f, 0f, 3f)); for (float num3 = val.x - 3f; num3 <= val2.x + 3f; num3 += num2) { for (float num4 = val.z - 3f; num4 <= val2.z + 3f; num4 += num2) { Vector3 val3 = at + rot * new Vector3(num3, 0f, num4); _levelQueue.Enqueue(new Vector3(val3.x, num, val3.z)); } } } foreach (BpPiece piece2 in bp.Pieces) { GameObject prefab = ZNetScene.instance.GetPrefab(piece2.Prefab); if (!((Object)(object)prefab == (Object)null)) { _queue.Enqueue(new KeyValuePair<GameObject, BpPiece>(prefab, piece2)); if (_queue.Count >= Plugin.MaxBlueprintPieces.Value) { break; } } } Message(Loc.T("arch_building", bp.Name, _queue.Count)); } private static void PlaceQueued() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) if (_levelQueue.Count > 0) { for (int i = 0; i < 12; i++) { if (_levelQueue.Count <= 0) { break; } LevelAt(_levelQueue.Dequeue()); } } else { if (_queue.Count == 0) { return; } long num = (((Object)(object)Player.m_localPlayer != (Object)null) ? Player.m_localPlayer.GetPlayerID() : 0); for (int j = 0; j < 40; j++) { if (_queue.Count <= 0) { break; } KeyValuePair<GameObject, BpPiece> keyValuePair = _queue.Dequeue(); Vector3 val = _placeAt + _placeRot * keyValuePair.Value.Pos; Quaternion val2 = _placeRot * keyValuePair.Value.Rot; GameObject val3 = Object.Instantiate<GameObject>(keyValuePair.Key, val, val2); if (!string.IsNullOrEmpty(keyValuePair.Value.Data)) { ZNetView component = val3.GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.IsValid() && (Object)(object)val3.GetComponent<VillageMarker>() != (Object)null) { if (keyValuePair.Value.Data.StartsWith("r:") && float.TryParse(keyValuePair.Value.Data.Substring(2), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { component.GetZDO().Set("vv_vrad", result); } else { component.GetZDO().Set("vv_mrole", keyValuePair.Value.Data); } } } ZNetView component2 = val3.GetComponent<ZNetView>(); if ((Object)(object)component2 != (Object)null && component2.IsValid()) { LastPlaced.Add(new KeyValuePair<string, ZDOID>(keyValuePair.Value.Prefab, component2.GetZDO().m_uid)); } Piece component3 = val3.GetComponent<Piece>(); if ((Object)(object)component3 != (Object)null && num != 0) { try { component3.SetCreator(num, Rpc.LocalPlatformId()); } catch { } } _placed++; } if (_queue.Count == 0) { Message(Loc.T("arch_done", _placed)); } } } private static GameObject LevelPrefab() { if (_levelSearched) { return _levelPrefab; } _levelSearched = true; float num = 0f; foreach (GameObject prefab in ZNetScene.instance.m_prefabs) { if ((Object)(object)prefab == (Object)null) { continue; } TerrainOp component = prefab.GetComponent<TerrainOp>(); if (!((Object)(object)component == (Object)null) && component.m_settings != null && component.m_settings.m_level && !component.m_settings.m_raise) { float num2 = component.m_settings.m_levelRadius + (component.m_settings.m_paintCleared ? 0f : 0.5f) + (((Object)(object)component.m_spawnOnPlaced == (Object)null) ? 0.2f : 0f); if (num2 > num) { num = num2; _levelPrefab = prefab; } } } if ((Object)(object)_levelPrefab != (Object)null) { _levelRadius = Mathf.Max(0.5f, _levelPrefab.GetComponent<TerrainOp>().m_settings.m_levelRadius); Plugin.Log.LogInfo((object)("Terrain levelling with " + ((Object)_levelPrefab).name + " (radius " + _levelRadius + ").")); } else { Plugin.Log.LogWarning((object)"No levelling terrain operation found — blueprints are placed without levelling."); } return _levelPrefab; } private static void LevelAt(Vector3 p) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) GameObject val = LevelPrefab(); if ((Object)(object)val == (Object)null) { _levelQueue.Clear(); return; } try { Object.Instantiate<GameObject>(val, p, Quaternion.identity); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Terrain levelling failed: " + ex.Message)); _levelQueue.Clear(); } } 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(Blueprint bp, Vector3 at, Quaternion rot) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_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_0023: 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_002f: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00be: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.positiveInfinity; Vector3 val2 = Vector3.negativeInfinity; foreach (BpPiece piece in bp.Pieces) { val = Vector3.Min(val, piece.Pos); val2 = Vector3.Max(val2, piece.Pos); } List<float> list = new List<float>(); float item = default(float); for (float num = val.x; num <= val2.x; num += 3f) { for (float num2 = val.z; num2 <= val2.z; num2 += 3f) { Vector3 val3 = at + rot * new Vector3(num, 0f, num2); if ((Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetGroundHeight(new Vector3(val3.x, val3.y + 100f, val3.z), ref item)) { list.Add(item); } } } if (list.Count == 0) { return at.y + bp.Ground; } 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 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_06b1: 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); } string prefab4 = g.Pick("wood_pole_log", "wood_pole2"); float num12 = 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 num15 = FloorY; num15 < num3 - 0.1f; num15 += num12) { g.Center(prefab4, x4, num15, 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>(); 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 missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) GameObject prefab2 = ZNetScene.instance.GetPrefab(prefab); Bounds result = default(Bounds); ((Bounds)(ref result))..ctor(Vector3.zero, Vector3.zero); bool flag = false; if ((Object)(object)prefab2 == (Object)null) { return result; } MeshFilter[] componentsInChildren = prefab2.GetComponentsInChildren<MeshFilter>(false); foreach (MeshFilter val in componentsInChildren) { if ((Object)(object)val.sharedMesh == (Object)null) { continue; } Bounds bounds = val.sharedMesh.bounds; for (int j = 0; j < 8; j++) { Vector3 val2 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((j & 1) != 0) ? 1 : (-1)), (float)(((j & 2) != 0) ? 1 : (-1)), (float)(((j & 4) != 0) ? 1 : (-1)))); Vector3 val3 = prefab2.transform.InverseTransformPoint(((Component)val).transform.TransformPoint(val2)); if (!flag) { result = new Bounds(val3, Vector3.zero); flag = true; } else { ((Bounds)(ref result)).Encapsulate(val3); } } } if (!flag) { return Box(prefab); } return result; } private void OnWall(string prefab, Vector3 wallPoint, Vector3 inward, float topY) { //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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) if (!Has(prefab)) { return; } Bounds b = MeshBox(prefab); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((Bounds)(ref b)).center.x, 0f, ((Bounds)(ref b)).center.z); float num = float.MinValue; float yaw = 0f; for (int i = 0; i < 4; i++) { float num2 = (float)i * 90f; Bounds val2 = Rotated(b, num2); float num3 = Mathf.Abs(Vector3.Dot(((Bounds)(ref val2)).size, new Vector3(Mathf.Abs(inward.x), 0f, Mathf.Abs(inward.z)))); float num4 = (0f - num3) * 10f + Vector3.Dot(Quaternion.Euler(0f, num2, 0f) * val, inward); if (num4 > num) { num = num4; yaw = num2; } } Bounds val3 = Rotated(b, yaw); float num5 = Vector3.Dot(((Bounds)(ref val3)).center, inward) - Vector3.Dot(((Bounds)(ref val3)).extents, new Vector3(Mathf.Abs(inward.x), 0f, Mathf.Abs(inward.z))); Vector3 val4 = wallPoint + inward * (0.06f - num5); Vector3 val5 = Vector3.Cross(Vector3.up, inward); val4 -= val5 * Vector3.Dot(((Bounds)(ref val3)).center, val5); val4.y = topY - ((Bounds)(ref val3)).max.y; Add(prefab, val4, yaw, null); } public void OnWallX(string prefab, float wallX, float topY, float z, float inwardX) { //IL_000a: 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) OnWall(prefab, new Vector3(wallX, 0f, z), new Vector3(Mathf.Sign(inwardX), 0f, 0f), topY); } public void OnWallZ(string prefab, float x, float topY, float wallZ, float inwardZ) { //IL_000a: 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) OnWall(prefab, new Vector3(x, 0f, wallZ), new Vector3(0f, 0f, Mathf.Sign(inwardZ)), topY); } public void Stairs(float edgeX, float centerZ, float topY, Vector3 up) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) string text = Pick("wood_stair", "stone_stair"); if (text == null) { return; } Box(text); float num = Mathf.Max(0.3f, Size(text).y); float num2 = Mathf.Max(0.5f, RoofRun(text)); int num3 = Mathf.Max(1, Mathf.RoundToInt(topY / num)); float num4 = ((up.x < 0f) ? 1f : (-1f)); float num5 = Size("wood_pole2").y; if (num5 < 0.5f) { num5 = 2f; } for (int i = 0; i < num3; i++) { float num6 = edgeX + num4 * num2 * (float)(num3 - 1 - i); float x = num6 + num4 * num2 * 0.5f; Roof(text, x, (float)i * num, centerZ, up); if (i == 0) { continue; } float x2 = num6 + num4 * num2; float[] array = new float[2] { -0.8f, 0.8f }; foreach (float num7 in array) { for (float num8 = 0f; num8 < (float)i * num - 0.05f; num8 += num5) { Center("wood_pole2", x2, num8, centerZ + num7, 0f); } } } } public void Sub(Action<Gen> build, float x, float z, float yaw) { //IL_003b: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) Gen gen = new Gen(); try { build(gen); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Template part failed: " + ex.Message)); return; } Quaternion val = Quaternion.Euler(0f, yaw, 0f); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(x, 0f, z); foreach (BpPiece piece in gen.Pieces) { BpPiece bpPiece = new BpPiece(); bpPiece.Prefab = piece.Prefab; bpPiece.Pos = val2 + val * piece.Pos; bpPiece.Rot = val * piece.Rot; bpPiece.Data = piece.Data; Pieces.Add(bpPiece); } } public void Marker(string kind, float x, float y, float z, float yaw, string role) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0033: 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_004d: Unknown result type (might be due to invalid IL or missing references) string prefab = Markers.PrefabName(kind); if (Has(prefab)) { Bounds val = Rotated(Box(prefab), yaw); Add(prefab, new Vector3(x - ((Bounds)(ref val)).center.x, y - ((Bounds)(ref val)).min.y, z - ((Bounds)(ref val)).center.z), yaw, role); } } } private const string Version = "6"; private static bool _done; public static void EnsureStarterSet() { if (_done || (Object)(object)ZNetScene.instance == (Object)null) { return; } _done = true; try { Directory.CreateDirectory(Blueprint.Dir); Make("Jarl's longhouse", "The jarl's hall: hearth with a smoke hole, long tables, a high seat and banners. Spawns the jarl.", JarlHall); Make("Viking house", "A small family house with a bed, a chest and a fire pit. Spawns a villager.", House); Make("Tavern", "Mead hall with tables, benches, a cauldron and a fermenter. Spawns the brewer and the skald.", Tavern); Make("Smithy", "Open roofed workshop with a forge, workbench and smelter. Smith's work spot and stall.", Smithy); string[] array = new string[5] { "merchant", "hunter", "fisher", "farmer", "brewer" }; foreach (string text in array) { string r = text; Make("Market stall (" + text + ")", "A roofed market stall with a table and wares. Work spot of the " + text + ".", delegate(Gen g) { Stall(g, r); }); } Make("Woodcutter's hut", "A house with a woodpile and a stockpile chest outside. Spawns the woodcutter, who chops trees nearby.", delegate(Gen g) { WorkerHut(g, "woodcutter", "lumber"); }); Make("Stonemason's yard", "A house with a stone pile and a stockpile chest. Spawns the stonemason, who breaks rocks nearby.", delegate(Gen g) { WorkerHut(g, "stonemason", "quarry"); }); Make("Forager's hut", "A house with baskets and a stockpile chest. Spawns the forager, who gathers berries and mushrooms nearby.", delegate(Gen g) { WorkerHut(g, "forager", "forage"); }); Make("Huntsman's lodge", "A house with hides and a stockpile chest. Spawns the huntsman, who hunts deer, boars and hares with a bow nearby.", delegate(Gen g) { WorkerHut(g, "huntsman", "hunt"); }); Make("Beekeeper's apiary", "A house with beehives around the apiary spot and a chest. Spawns the beekeeper, who collects the honey.", delegate(Gen g) { WorkerHut(g, "beekeeper", "apiary"); }); Make("Shrine square", "Stone square with the five shrines (Favor of the Gods), a fire bowl and the gothi's post.", ShrineSquare); Make("Watchtower", "Four-post tower with a lookout platform and a ladder. Guards patrol around it.", Watchtower); Make("Palisade with gate", "Twelve metres of stake wall with a wooden gate in the middle.", Palisade); Make("Village well", "Stone well with a small roof.", Well); Make("Pier", "Wooden pier on posts with a fishing spot at its end. Place it at the shore.", Pier); Make("Village green", "The village stone, the notice board, a fire pit and the evening gathering spot.", delegate(Gen g) { Green(g, 0, homes: true); }); Make("Farm plot", "A fenced field with work spots for the farmer and villagers.", FarmPlot); Make("Template - Hamlet", "A small complete village (radius 40 m): green, jarl's longhouse, tavern, smithy, 2 stalls, 2 houses, woodcutter, farm plot, watchtower, well.", Hamlet); Make("Template - Market town", "A large complete village (radius 60 m): every building and role — market with 5 stalls, longhouse, tavern, smithy, shrine square, 3 houses, all five workers, farm, 2 watchtowers, gate.", MarketTown); Make("Template - Fishing village", "A coastal village (radius 45 m) with a pier, fisher, tavern, smithy, longhouse, huntsman, forager and a tower. Place it with the pier towards the water.", FishingVillage); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Starter buildings: " + ex)); } } private static void Make(string name, string desc, Action<Gen> build) { string path = Path.Combine(Blueprint.Dir, "Village - " + name.Replace("'", "").Replace("(", "").Replace(")", "") + ".vvb"); if (File.Exists(path)) { string text = ""; try { text = File.ReadAllText(path); } catch { } int num = text.IndexOf("(generated, v", StringComparison.Ordinal); if (num < 0 || text.IndexOf("(generated, v6)", StringComparison.Ordinal) >= 0) { return; } } Gen gen = new Gen(); try { build(gen); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Building '" + name + "' failed: " + ex.Message)); return; } if (gen.Pieces.Count != 0) { Blueprint blueprint = new Blueprint(); blueprint.Name = "Village - " + name; blueprint.Description = desc + " (generated, v6)"; blueprint.Pieces.AddRange(gen.Pieces); blueprint.Normalize(); blueprint.Save(path); } } private static void JarlHall(Gen g) { Hall hall = new Hall(g, 4, 7, 2); hall.DoorsLeft.Add(3); hall.DoorsRight.Add(3); hall.SmokeHole = 3; hall.Build(); float floorY = hall.FloorY; g.Center(g.Pick("hearth", "fire_pit"), 0f, floorY, 0f, 0f); for (int i = -1; i <= 1; i += 2) { for (int j = 0; j < 2; j++) { float z = -4.5f + (float)j * 3f + ((j > 0) ? 4f : 0f); g.Center(g.Pick("piece_table", "piece_table_oak"), (float)i * 2.4f, floorY, z, 0f); g.Center(g.Pick("piece_bench01", "piece_chair"), (float)i * 3.3f, floorY, z, (i > 0) ? 270f : 90f); g.Center(g.Pick("piece_bench01", "piece_chair"), (float)i * 1.5f, floorY, z, (i > 0) ? 90f : 270f); } g.OnWallX(g.Pick("piece_walltorch"), (float)i * hall.HalfW, floorY + 2.1f, -3f, -i); g.OnWallX(g.Pick("piece_walltorch"), (float)i * hall.HalfW, floorY + 2.1f, 3f, -i); } float num = hall.HalfL - 1.2f; g.Center(g.Pick("piece_throne01", "piece_chair03", "piece_chair02", "piece_chair"), 0f, floorY, num, 180f); g.OnWallZ(g.Pick("piece_banner01"), -2f, hall.Eave - 0.15f, hall.HalfL, -1f); g.OnWallZ(g.Pick("piece_banner02", "piece_banner01"), 2f, hall.Eave - 0.15f, hall.HalfL, -1f); g.Center(g.Pick("rug_fur", "rug_wolf", "rug_deer"), 0f, floorY, num - 2f, 0f); g.Center(g.Pick("piece_chest_wood"), -2.8f, floorY, num, 180f); g.Marker("generic", 0f, floorY, num - 1.4f, 180f, "jarl"); g.Marker("home", 2.8f, floorY, num - 0.5f, 180f, "jarl"); g.Marker("gather", 0f, floorY, 2.2f, 0f, ""); g.Marker("gather", 0f, floorY, -2.2f, 180f, ""); } private static void House(Gen g) { Hall hall = new Hall(g, 4, 3, 1); hall.DoorsLeft.Add(1); hall.SmokeHole = 1; hall.Build(); float floorY = hall.FloorY; g.Center(g.Pick("fire_pit", "hearth"), 0.9f, floorY, 0f, 0f); g.Center(g.Pick("bed", "piece_bed02"), 2.7f, floorY, 1.8f, 270f); g.Center(g.Pick("piece_chest_wood"), 3.3f, floorY, -2.1f, 270f); g.Center(g.Pick("piece_table"), -2.2f, floorY, 2.3f, 0f); g.Center(g.Pick("piece_chair", "piece_bench01"),