From 3afe17275c06dec0574ae8ba6f2266197c8e84fd Mon Sep 17 00:00:00 2001 From: Drakansoul Date: Wed, 20 Nov 2024 16:52:51 -0800 Subject: [PATCH] update for 7.1 --- DisPlacePlugin.json | 10 ++-- DisPlacePlugin.sln | 10 +++- DisPlacePlugin/DisPlacePlugin.cs | 33 +++++------- DisPlacePlugin/DisPlacePlugin.csproj | 4 +- DisPlacePlugin/Gui/ConfigurationWindow.cs | 10 ++-- DisPlacePlugin/HousingData.cs | 44 +++++++++------- DisPlacePlugin/HousingLandSet.cs | 55 ------------------- DisPlacePlugin/Memory.cs | 6 +-- DisPlacePlugin/Objects/HousingItem.cs | 4 +- DisPlacePlugin/Objects/Structs.cs | 14 ++--- DisPlacePlugin/SaveLayoutManager.cs | 41 +++++++-------- DisPlacePlugin/Util/Utils.cs | 2 +- DisPlacePlugin/packages.lock.json | 64 +++++++++++++++++++++-- 13 files changed, 151 insertions(+), 146 deletions(-) delete mode 100644 DisPlacePlugin/HousingLandSet.cs diff --git a/DisPlacePlugin.json b/DisPlacePlugin.json index 9aef2e5..58eef0a 100644 --- a/DisPlacePlugin.json +++ b/DisPlacePlugin.json @@ -2,7 +2,7 @@ "Author": "Drakansoul", "Name": "DisPlace Plugin", "InternalName": "DisPlacePlugin", - "AssemblyVersion":"3.7.2", + "AssemblyVersion":"3.7.3", "Punchline": "Automatically save & load furniture layouts in ANY house.", "Description": "Automatically save & load the positions of house furniture. Copy other housing layouts. Import/export layouts from the MakePlace program.", "ApplicableVersion": "any", @@ -15,13 +15,13 @@ "drakansoul", "displace" ], - "DalamudApiLevel": 10, + "DalamudApiLevel": 11, "LoadPriority": 0, "IconUrl": "https://raw.githubusercontent.com/Drakansoul/DisPlaced/master/icon.png", "DownloadCount": 0, - "DownloadLinkInstall": "https://github.com/Drakansoul/DisPlaced/releases/download/v3.7.2/DisPlacePlugin.zip", - "DownloadLinkTesting": "https://github.com/Drakansoul/DisPlaced/releases/download/v3.7.2/DisPlacePlugin.zip", - "DownloadLinkUpdate": "https://github.com/Drakansoul/DisPlaced/releases/download/v3.7.2/DisPlacePlugin.zip", + "DownloadLinkInstall": "https://github.com/Drakansoul/DisPlaced/releases/download/v3.7.3/DisPlacePlugin.zip", + "DownloadLinkTesting": "https://github.com/Drakansoul/DisPlaced/releases/download/v3.7.3/DisPlacePlugin.zip", + "DownloadLinkUpdate": "https://github.com/Drakansoul/DisPlaced/releases/download/v3.7.3/DisPlacePlugin.zip", "_isDip17Plugin": false, "_Dip17Channel": null }] diff --git a/DisPlacePlugin.sln b/DisPlacePlugin.sln index f4d6109..7f83352 100644 --- a/DisPlacePlugin.sln +++ b/DisPlacePlugin.sln @@ -1,20 +1,26 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30204.135 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35013.160 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DisPlacePlugin", "DisPlacePlugin\DisPlacePlugin.csproj", "{479ADEA9-780A-4A8E-98A1-82C0399176E4}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {479ADEA9-780A-4A8E-98A1-82C0399176E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {479ADEA9-780A-4A8E-98A1-82C0399176E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {479ADEA9-780A-4A8E-98A1-82C0399176E4}.Debug|x64.ActiveCfg = Debug|x64 + {479ADEA9-780A-4A8E-98A1-82C0399176E4}.Debug|x64.Build.0 = Debug|x64 {479ADEA9-780A-4A8E-98A1-82C0399176E4}.Release|Any CPU.ActiveCfg = Release|Any CPU {479ADEA9-780A-4A8E-98A1-82C0399176E4}.Release|Any CPU.Build.0 = Release|Any CPU + {479ADEA9-780A-4A8E-98A1-82C0399176E4}.Release|x64.ActiveCfg = Release|x64 + {479ADEA9-780A-4A8E-98A1-82C0399176E4}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/DisPlacePlugin/DisPlacePlugin.cs b/DisPlacePlugin/DisPlacePlugin.cs index e0bbcac..c5af674 100644 --- a/DisPlacePlugin/DisPlacePlugin.cs +++ b/DisPlacePlugin/DisPlacePlugin.cs @@ -1,7 +1,6 @@ using Dalamud.Game.Command; using Dalamud.Plugin; -using FFXIVClientStructs.FFXIV.Client.Game; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; using DisPlacePlugin.Objects; using DisPlacePlugin.Util; using System; @@ -10,8 +9,7 @@ using System.Numerics; using System.Threading; using static DisPlacePlugin.Memory; -using HousingFurniture = Lumina.Excel.GeneratedSheets.HousingFurniture; -using Lumina.Excel; +using HousingFurniture = Lumina.Excel.Sheets.HousingFurniture; namespace DisPlacePlugin { @@ -90,7 +88,7 @@ public DisPlacePlugin(IDalamudPluginInterface pi) Memory.Instance.SetPlaceAnywhere(true); LayoutManager = new SaveLayoutManager(this, Config); - DalamudApi.PluginLog.Info("DisPlace Plugin v3.7.2 initialized"); + DalamudApi.PluginLog.Info("DisPlace Plugin v3.7.3 initialized"); } public void Initialize() { @@ -107,7 +105,7 @@ public void Initialize() GetObjectFromIndexHook = HookManager.Hook("81 fa 90 01 00 00 75 08 48 8b 81 88 0c 00 00 c3 0f b7 81 90 0c 00 00 3b d0 72 03 33 c0 c3", GetObjectFromIndex); - GetYardIndexHook = HookManager.Hook("48 89 6c 24 18 56 48 83 ec 20 0f b6 ?? 0f b6 ?? ?? ?? ?? ?? ?? ?? ??", GetYardIndex); + GetYardIndexHook = HookManager.Hook("48 89 5C 24 ?? ?? 48 83 ec 20 0f b6 ?? 0f b6 ?? 84 ??", GetYardIndex); MaybePlaceh = HookManager.Hook("40 55 56 57 48 8D AC 24 70 FF FF FF 48 81 EC 90", MaybePlace); // MaybePlace0 ResetItemPlacementh = HookManager.Hook("48 89 5C 24 08 57 48 83 EC 20 48 83 79 18 00 0F", Hc1); // reset item to previous position on failed placement @@ -573,13 +571,8 @@ public unsafe void GetPlotLocation() DalamudApi.PluginLog.Debug($"Housing plot: {plotNumber}"); } var territoryId = Memory.Instance.GetTerritoryTypeId(); - TerritoryType row = null; - try { - row = DalamudApi.DataManager.GetExcelSheet().GetRow(territoryId); - } catch (Exception e) { - LogError($"Error: {e.Message}", e.StackTrace); - } - if (row == null) + TerritoryType row = DalamudApi.DataManager.GetExcelSheet().GetRow(territoryId); + if (row.Equals(null)) { LogError("Plugin Cannot identify territory"); return; @@ -617,9 +610,9 @@ public unsafe void LoadExterior() { uint furnitureKey = gameObject.housingRowId; var furniture = DalamudApi.DataManager.GetExcelSheet().GetRow(furnitureKey); - Item item = furniture?.Item?.Value; + Item? item = furniture.Item.Value; if (item == null) continue; - if (item.RowId == 0) continue; + if (item.Equals(0)) continue; /* I could probably do this better if I was fully rested and wanted to do vector math properly but I'm just going to do it the easy way. Drakansoul is very tired. @@ -648,7 +641,7 @@ public unsafe void LoadExterior() } - var housingItem = new HousingItem(item, gameObject); + var housingItem = new HousingItem(item.Value, gameObject); housingItem.ItemStruct = (IntPtr)gameObject.Item; var location = new Vector3(housingItem.X, housingItem.Y, housingItem.Z); @@ -700,9 +693,9 @@ public unsafe void LoadInterior() uint furnitureKey = gameObject.housingRowId; var furniture = DalamudApi.DataManager.GetExcelSheet().GetRow(furnitureKey); - Item item = furniture?.Item?.Value; + Item item = furniture.Item.Value; - if (item == null) continue; + if (item.Equals(null)) continue; if (item.RowId == 0) continue; if (!IsSelectedFloor(gameObject.Y)) continue; @@ -736,9 +729,9 @@ public unsafe void LoadIsland() { uint furnitureKey = gameObject.housingRowId; var furniture = DalamudApi.DataManager.GetExcelSheet().GetRow(furnitureKey); - Item item = furniture?.Item?.Value; + Item item = furniture.Item.Value; - if (item == null) continue; + if (item.Equals(null)) continue; if (item.RowId == 0) continue; var housingItem = new HousingItem(item, gameObject); diff --git a/DisPlacePlugin/DisPlacePlugin.csproj b/DisPlacePlugin/DisPlacePlugin.csproj index 535442a..6d29b9e 100644 --- a/DisPlacePlugin/DisPlacePlugin.csproj +++ b/DisPlacePlugin/DisPlacePlugin.csproj @@ -1,8 +1,8 @@ - + $(AppData)\XIVLauncher\addon\Hooks\dev\ - 3.7.2 + 3.7.3 diff --git a/DisPlacePlugin/Gui/ConfigurationWindow.cs b/DisPlacePlugin/Gui/ConfigurationWindow.cs index a2ae0e6..145aa7b 100644 --- a/DisPlacePlugin/Gui/ConfigurationWindow.cs +++ b/DisPlacePlugin/Gui/ConfigurationWindow.cs @@ -1,7 +1,7 @@ using Dalamud.Interface.ImGuiFileDialog; using Dalamud.Utility; using ImGuiNET; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; using DisPlacePlugin.Objects; using System; using System.Collections.Generic; @@ -361,7 +361,7 @@ private void DrawRow(int i, HousingItem housingItem, bool showSetPosition = true var stain = DalamudApi.DataManager.GetExcelSheet().GetRow(housingItem.Stain); - var colorName = stain?.Name; + var colorName = stain.Name; if (housingItem.Stain != 0) { @@ -378,7 +378,7 @@ private void DrawRow(int i, HousingItem housingItem, bool showSetPosition = true else if (housingItem.MaterialItemKey != 0) { var item = DalamudApi.DataManager.GetExcelSheet().GetRow(housingItem.MaterialItemKey); - if (item != null) + if (!item.Equals(null)) { if (!housingItem.DyeMatch) ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(0.5f, 0.5f, 0.5f, 1)); @@ -447,7 +447,7 @@ private void DrawFixtureList(List fixtureList) var item = DalamudApi.DataManager.GetExcelSheet().GetRow(fixture.itemId); - if (item != null) + if (!item.Equals(null)) { DrawIcon(item.Icon, new Vector2(20, 20)); ImGui.SameLine(); @@ -526,7 +526,7 @@ private void DrawItemList(List itemList, bool isUnused = false) var displayName = housingItem.Name; var item = DalamudApi.DataManager.GetExcelSheet().GetRow(housingItem.ItemKey); - if (item != null) + if (!item.Equals(null)) { DrawIcon(item.Icon, new Vector2(20, 20)); ImGui.SameLine(); diff --git a/DisPlacePlugin/HousingData.cs b/DisPlacePlugin/HousingData.cs index ff13da1..286794c 100644 --- a/DisPlacePlugin/HousingData.cs +++ b/DisPlacePlugin/HousingData.cs @@ -1,15 +1,13 @@ using System.Collections.Generic; using System.Linq; -using Dalamud.Data; -using Dalamud.Logging; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; namespace DisPlacePlugin { public class HousingData { private readonly Dictionary _furnitureDict; - private readonly Dictionary _itemDict; + private readonly Dictionary _itemDict; private readonly Dictionary _stainDict; private readonly Dictionary> _territoryToLandSetDict; @@ -33,14 +31,14 @@ private HousingData() _territoryToLandSetDict = new Dictionary>(); - for (uint i = 0; i < sheet.RowCount && i < terriKeys.Length; i++) + for (uint i = 0; i < sheet.Count && i < terriKeys.Length; i++) { var row = sheet.GetRow(i); var rowDict = new Dictionary(); - for (var j = 0; j < row.LandSets.Length; j++) + for (var j = 0; j < row.LandSet.Count; j++) { - var cset = CommonLandSet.FromExd(row.LandSets[j], j); + var cset = CommonLandSet.FromExd(row.LandSet[j], j); rowDict[cset.PlacardId] = cset; } @@ -50,12 +48,20 @@ private HousingData() var unitedExteriorSheet = DalamudApi.DataManager.GetExcelSheet(); _unitedDict = new Dictionary(); foreach (var row in unitedExteriorSheet) - foreach (var item in row.Item) - _unitedDict[item.Row] = row.RowId; + { + _unitedDict[row.Roof.RowId] = row.RowId; + _unitedDict[row.Walls.RowId] = row.RowId; + _unitedDict[row.Windows.RowId] = row.RowId; + _unitedDict[row.Door.RowId] = row.RowId; + _unitedDict[row.OptionalRoof.RowId] = row.RowId; + _unitedDict[row.OptionalWall.RowId] = row.RowId; + _unitedDict[row.OptionalSignboard.RowId] = row.RowId; + _unitedDict[row.Fence.RowId] = row.RowId; + } _itemDict = DalamudApi.DataManager.GetExcelSheet() - .Where(item => item.AdditionalData != 0 && (item.ItemSearchCategory.Row == 65 || item.ItemSearchCategory.Row == 66)) - .ToDictionary(row => row.AdditionalData, row => row); + .Where(item => item.AdditionalData.RowId != 0 && (item.ItemSearchCategory.RowId == 65 || item.ItemSearchCategory.RowId == 66)) + .ToDictionary(row => row.AdditionalData.RowId, row => (Item?) row); _stainDict = DalamudApi.DataManager.GetExcelSheet().ToDictionary(row => row.RowId, row => row); _furnitureDict = DalamudApi.DataManager.GetExcelSheet().ToDictionary(row => row.RowId, row => row); @@ -82,12 +88,12 @@ private HousingData() var id = row.RowId; if (id < 1000) continue; - else if (id > 1000 && id < 2000) _painting.TryAdd(row.Unknown0, row.Item.Row); - else if (id > 2000 && id < 3000) _wallpaper.TryAdd(row.Unknown0, row.Item.Row); - else if (id > 3000 && id < 4000) _smallFishprint.TryAdd(row.Unknown0, row.Item.Row); - else if (id > 4000 && id < 5000) _mediumFishprint.TryAdd(row.Unknown0, row.Item.Row); - else if (id > 5000 && id < 6000) _largeFishprint.TryAdd(row.Unknown0, row.Item.Row); - else if (id > 6000 && id < 7000) _extraLargeFishprint.TryAdd(row.Unknown0, row.Item.Row); + else if (id > 1000 && id < 2000) _painting.TryAdd(row.Unknown0, row.Item.RowId); + else if (id > 2000 && id < 3000) _wallpaper.TryAdd(row.Unknown0, row.Item.RowId); + else if (id > 3000 && id < 4000) _smallFishprint.TryAdd(row.Unknown0, row.Item.RowId); + else if (id > 4000 && id < 5000) _mediumFishprint.TryAdd(row.Unknown0, row.Item.RowId); + else if (id > 5000 && id < 6000) _largeFishprint.TryAdd(row.Unknown0, row.Item.RowId); + else if (id > 6000 && id < 7000) _extraLargeFishprint.TryAdd(row.Unknown0, row.Item.RowId); } } @@ -110,7 +116,7 @@ public bool TryGetFurniture(uint id, out HousingFurniture furniture) return _furnitureDict.TryGetValue(id, out furniture); } - public bool IsUnitedExteriorPart(uint id, out Item item) + public bool IsUnitedExteriorPart(uint id, out Item? item) { item = null; if (!_unitedDict.TryGetValue(id, out var unitedId)) @@ -126,7 +132,7 @@ public bool TryGetLandSetDict(uint id, out Dictionary dict) return _territoryToLandSetDict.TryGetValue(id, out dict); } - public bool TryGetItem(uint id, out Item item) + public bool TryGetItem(uint id, out Item? item) { return _itemDict.TryGetValue(id, out item); } diff --git a/DisPlacePlugin/HousingLandSet.cs b/DisPlacePlugin/HousingLandSet.cs deleted file mode 100644 index 5b5c142..0000000 --- a/DisPlacePlugin/HousingLandSet.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Runtime.InteropServices; -using Lumina; -using Lumina.Data; -using Lumina.Excel; - -namespace DisPlacePlugin -{ - [Sheet("HousingLandSet")] - public class HousingLandSet : ExcelRow - { - public LandSet[] LandSets; - - public uint UnknownRange { get; private set; } - public uint UnknownRange2 { get; private set; } - - public override void PopulateData(RowParser parser, GameData data, Language language) - { - RowId = parser.RowId; - SubRowId = parser.SubRowId; - - LandSets = new LandSet[60]; - - ushort offset = 0; - for (int i = 0; i < LandSets.Length; i++) - { - LandSets[i].LandRange = parser.ReadOffset(offset); - offset += 4; - LandSets[i].PlacardId = parser.ReadOffset(offset); - offset += 4; - LandSets[i].UnknownRange1 = parser.ReadOffset(offset); - offset += 4; - LandSets[i].InitialPrice = parser.ReadOffset(offset); - offset += 4; - LandSets[i].Size = parser.ReadOffset(offset); - offset += 4; - } - UnknownRange = parser.ReadColumn(300); - UnknownRange2 = parser.ReadColumn(301); - } - - [StructLayout(LayoutKind.Sequential)] - public unsafe struct LandSet - { - public uint LandRange; - public uint PlacardId; - - public uint UnknownRange1; - - // public uint ExitPopRange; - public uint InitialPrice; - public byte Size; - private fixed byte padding[3]; - } - } -} \ No newline at end of file diff --git a/DisPlacePlugin/Memory.cs b/DisPlacePlugin/Memory.cs index 32910d8..05a4e15 100644 --- a/DisPlacePlugin/Memory.cs +++ b/DisPlacePlugin/Memory.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using FFXIVClientStructs.FFXIV.Client.Game; using FFXIVClientStructs.FFXIV.Client.Game.MJI; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; using static DisPlacePlugin.DisPlacePlugin; namespace DisPlacePlugin @@ -82,7 +82,7 @@ public string GetIndoorHouseSize() var territoryId = Memory.Instance.GetTerritoryTypeId(); var row = DalamudApi.DataManager.GetExcelSheet().GetRow(territoryId); - if (row == null) return null; + if (row.Equals(null)) return null; var placeName = row.Name.ToString(); var sizeName = placeName.Substring(1, 3); @@ -282,7 +282,7 @@ public enum HousingArea public unsafe HousingArea GetCurrentTerritory() // this gets called every window draw for some reason, should probably looke to refactor to only call this when something needs to be changed or might have been updated. { var territoryRow = DalamudApi.DataManager.GetExcelSheet().GetRow(GetTerritoryTypeId()); - if (territoryRow == null || territoryRow.Name.ToString().Equals("r1i5")) // blacklist company workshop from editing since it's not actually a housing area + if (territoryRow.Equals(null) || territoryRow.Name.ToString().Equals("r1i5")) // blacklist company workshop from editing since it's not actually a housing area { return HousingArea.None; } diff --git a/DisPlacePlugin/Objects/HousingItem.cs b/DisPlacePlugin/Objects/HousingItem.cs index 81fb5cf..f41f4fd 100644 --- a/DisPlacePlugin/Objects/HousingItem.cs +++ b/DisPlacePlugin/Objects/HousingItem.cs @@ -1,4 +1,4 @@ -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; using System; using System.Numerics; @@ -23,7 +23,7 @@ public class HousingItem public HousingItem(Item item, byte stain, float x, float y, float z, float rotate) { ItemKey = item.RowId; - Name = item.Name; + Name = item.Name.ToString(); IsTableOrWallMounted = item.ItemUICategory.Value.RowId == 78 || item.ItemUICategory.Value.RowId == 79; Stain = stain; diff --git a/DisPlacePlugin/Objects/Structs.cs b/DisPlacePlugin/Objects/Structs.cs index c13efe8..04ed12f 100644 --- a/DisPlacePlugin/Objects/Structs.cs +++ b/DisPlacePlugin/Objects/Structs.cs @@ -1,7 +1,7 @@ using System; using System.Numerics; using System.Runtime.InteropServices; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; namespace DisPlacePlugin { @@ -55,14 +55,14 @@ public struct CommonLandSet public byte Size; public int PlotIndex; - public static CommonLandSet FromExd(HousingLandSet.LandSet lset, int index) + public static CommonLandSet FromExd(HousingLandSet.LandSetStruct lset, int index) { var ret = new CommonLandSet(); - ret.LandRange = lset.LandRange; + ret.LandRange = lset.UnknownRange1; ret.PlacardId = lset.PlacardId; ret.UnknownRange1 = lset.UnknownRange1; ret.InitialPrice = lset.InitialPrice; - ret.Size = lset.Size; + ret.Size = lset.PlotSize; ret.PlotIndex = index; return ret; } @@ -84,10 +84,10 @@ public struct CommonFixture public bool IsExterior; public int FixtureType; public int FixtureKey; - public Stain Stain; - public Item Item; + public Stain? Stain; + public Item? Item; - public CommonFixture(bool isExterior, int fixtureType, int fixtureKey, Stain stain, Item item) + public CommonFixture(bool isExterior, int fixtureType, int fixtureKey, Stain? stain, Item? item) { IsExterior = isExterior; FixtureType = fixtureType; diff --git a/DisPlacePlugin/SaveLayoutManager.cs b/DisPlacePlugin/SaveLayoutManager.cs index ee74766..5439b38 100644 --- a/DisPlacePlugin/SaveLayoutManager.cs +++ b/DisPlacePlugin/SaveLayoutManager.cs @@ -1,6 +1,4 @@ -using Dalamud.Game.Gui; -using Dalamud.Logging; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; using DisPlacePlugin.Objects; using System; using System.Collections.Generic; @@ -16,9 +14,8 @@ using System.Drawing; using System.Globalization; using System.Text.Json.Serialization; -using ImGuiNET; using FFXIVClientStructs.FFXIV.Client.Game.MJI; -using System.Xml.Linq; +using Lumina.Extensions; namespace DisPlacePlugin { @@ -217,17 +214,17 @@ List RotationToQuat(float rotation) static HousingItem ConvertToHousingItem(Furniture furniture) { var ItemSheet = DalamudApi.DataManager.GetExcelSheet(); - var itemRow = ItemSheet.FirstOrDefault(row => row.Name.ToString().Equals(furniture.name)); + var itemRow = ItemSheet.FirstOrNull(row => row.Name.ToString().Equals(furniture.name)); - if (itemRow == null) itemRow = ItemSheet.FirstOrDefault(row => row.RowId == furniture.itemId); + if (itemRow.Equals(null)) itemRow = ItemSheet.FirstOrDefault(row => row.RowId == furniture.itemId); - if (itemRow == null) return null; + if (itemRow.Equals(null)) return null; var r = furniture.transform.rotation; var quat = new Quaternion(r[0], r[1], r[2], r[3]); var houseItem = new HousingItem( - itemRow, + itemRow.Value, (byte)furniture.GetClosestStain(ColorList), descale(furniture.transform.location[0]), descale(furniture.transform.location[2]), // switch Y & Z axis @@ -286,7 +283,7 @@ public static void ImportLayout(string path) foreach (var stain in StainList) { - if (stain.Unknown6) // bool for whether the dye can be used for housing + if (stain.Unknown2) // bool for whether the dye can be used for housing { ColorList.Add((Color.FromArgb((int)stain.Color), stain.RowId)); } @@ -322,8 +319,8 @@ public unsafe static void LoadExteriorFixtures() { var fixture = new Fixture(); fixture.type = Utils.GetExteriorPartDescriptor(ExteriorPartsType.Walls); - fixture.name = roofItem.Name.ToString(); - fixture.itemId = roofItem.RowId; + fixture.name = roofItem.Value.Name.ToString(); + fixture.itemId = roofItem.Value.RowId; exterior.Add(fixture); } @@ -337,8 +334,8 @@ public unsafe static void LoadExteriorFixtures() var fixture = new Fixture(); fixture.type = Utils.GetExteriorPartDescriptor(type); - fixture.name = item.Name.ToString(); - fixture.itemId = item.RowId; + fixture.name = item.Value.Name.ToString(); + fixture.itemId = item.Value.RowId; exterior.Add(fixture); } @@ -399,7 +396,7 @@ string ToRoman(byte id) } } - var BuildingSheet = DalamudApi.DataManager.GetExcelSheet(); + var BuildingSheet = DalamudApi.DataManager.GetSubrowExcelSheet(); var workshop = state.Workshops; for (int i = 0; i < 4; i++) @@ -408,7 +405,7 @@ string ToRoman(byte id) var fixture = new Fixture("Facility"); fixture.level = "Facility " + ToRoman(workshop.PlaceId[i]); - fixture.name = BuildingSheet.GetRow(1, workshop.GlamourLevel[i])?.Name.Value.Text.ToString(); + fixture.name = BuildingSheet.GetSubrowOrDefault(1, workshop.GlamourLevel[i])?.Name.Value.Text.ToString(); exterior.Add(fixture); } @@ -418,7 +415,7 @@ string ToRoman(byte id) if (granary.PlaceId[i] == 0) continue; var fixture = new Fixture("Facility"); fixture.level = "Facility " + ToRoman(granary.PlaceId[i]); - fixture.name = BuildingSheet.GetRow(2, fixture.itemId)?.Name.Value.Text.ToString(); + fixture.name = BuildingSheet.GetSubrowOrDefault(2, granary.BuildingLevel[i])?.Name.Value.Text.ToString(); exterior.Add(fixture); } @@ -430,7 +427,7 @@ string ToRoman(byte id) var fixture = new Fixture("Landmark"); fixture.level = "Landmark " + ToRoman((byte)(i + 1)); - fixture.name = LandmarkSheet.GetRow(id)?.Name.Value.Text.ToString(); + fixture.name = LandmarkSheet.GetRowOrDefault(id)?.Name.Value.Text.ToString(); exterior.Add(fixture); } } @@ -453,8 +450,8 @@ public static void LoadInteriorFixtures() var fixture = new Fixture(); fixture.type = Utils.GetInteriorPartDescriptor((InteriorPartsType)j); fixture.level = Utils.GetFloorDescriptor((InteriorFloor)i); - fixture.name = fixtures[j].Item.Name.ToString(); - fixture.itemId = fixtures[j].Item.RowId; + fixture.name = fixtures[j].Item.Value.Name.ToString(); + fixture.itemId = fixtures[j].Item.Value.RowId; layout.interiorFixture.Add(fixture); } @@ -465,7 +462,7 @@ public static void LoadInteriorFixtures() var territoryId = Memory.Instance.GetTerritoryTypeId(); var row = DalamudApi.DataManager.GetExcelSheet().GetRow(territoryId); - if (row != null) + if (row.Equals(null)) { var placeName = row.Name.ToString(); @@ -528,7 +525,7 @@ void RecordFurniture(List furnitureList, List itemList) else if (gameObject.MaterialItemKey != 0) { var item = DalamudApi.DataManager.GetExcelSheet().GetRow(gameObject.MaterialItemKey); - if (item != null) + if (!item.Equals(null)) { var basicItem = new BasicItem(); basicItem.name = item.Name.ToString(); diff --git a/DisPlacePlugin/Util/Utils.cs b/DisPlacePlugin/Util/Utils.cs index 6419c04..9a037f1 100644 --- a/DisPlacePlugin/Util/Utils.cs +++ b/DisPlacePlugin/Util/Utils.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Numerics; using ImGuiNET; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; using DisPlacePlugin.Objects; namespace DisPlacePlugin diff --git a/DisPlacePlugin/packages.lock.json b/DisPlacePlugin/packages.lock.json index 19fcea9..1e9317e 100644 --- a/DisPlacePlugin/packages.lock.json +++ b/DisPlacePlugin/packages.lock.json @@ -4,9 +4,67 @@ "net8.0-windows7.0": { "DalamudPackager": { "type": "Direct", - "requested": "[2.1.13, )", - "resolved": "2.1.13", - "contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ==" + "requested": "[11.0.0, )", + "resolved": "11.0.0", + "contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA==" + }, + "DotNet.ReproducibleBuilds": { + "type": "Direct", + "requested": "[1.1.1, )", + "resolved": "1.1.1", + "contentHash": "+H2t/t34h6mhEoUvHi8yGXyuZ2GjSovcGYehJrS2MDm2XgmPfZL2Sdxg+uL2lKgZ4M6tTwKHIlxOob2bgh0NRQ==", + "dependencies": { + "Microsoft.SourceLink.AzureRepos.Git": "1.1.1", + "Microsoft.SourceLink.Bitbucket.Git": "1.1.1", + "Microsoft.SourceLink.GitHub": "1.1.1", + "Microsoft.SourceLink.GitLab": "1.1.1" + } + }, + "Microsoft.Build.Tasks.Git": { + "type": "Transitive", + "resolved": "1.1.1", + "contentHash": "AT3HlgTjsqHnWpBHSNeR0KxbLZD7bztlZVj7I8vgeYG9SYqbeFGh0TM/KVtC6fg53nrWHl3VfZFvb5BiQFcY6Q==" + }, + "Microsoft.SourceLink.AzureRepos.Git": { + "type": "Transitive", + "resolved": "1.1.1", + "contentHash": "qB5urvw9LO2bG3eVAkuL+2ughxz2rR7aYgm2iyrB8Rlk9cp2ndvGRCvehk3rNIhRuNtQaeKwctOl1KvWiklv5w==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "Microsoft.SourceLink.Bitbucket.Git": { + "type": "Transitive", + "resolved": "1.1.1", + "contentHash": "cDzxXwlyWpLWaH0em4Idj0H3AmVo3L/6xRXKssYemx+7W52iNskj/SQ4FOmfCb8YQt39otTDNMveCZzYtMoucQ==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "Microsoft.SourceLink.Common": { + "type": "Transitive", + "resolved": "1.1.1", + "contentHash": "WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg==" + }, + "Microsoft.SourceLink.GitHub": { + "type": "Transitive", + "resolved": "1.1.1", + "contentHash": "IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "Microsoft.SourceLink.GitLab": { + "type": "Transitive", + "resolved": "1.1.1", + "contentHash": "tvsg47DDLqqedlPeYVE2lmiTpND8F0hkrealQ5hYltSmvruy/Gr5nHAKSsjyw5L3NeM/HLMI5ORv7on/M4qyZw==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } } } }