diff --git a/AutoSweep.csproj b/AutoSweep.csproj index f50d106..7a1ecdb 100644 --- a/AutoSweep.csproj +++ b/AutoSweep.csproj @@ -14,7 +14,7 @@ true true autoSweep - 1.4.5.0 + 1.4.6.0 @@ -68,7 +68,7 @@ - + diff --git a/Paissa/Client.cs b/Paissa/Client.cs index c4c4b07..c57cbf2 100644 --- a/Paissa/Client.cs +++ b/Paissa/Client.cs @@ -59,13 +59,12 @@ public void Dispose() { public void Hello() { IPlayerCharacter player = Plugin.ClientState.LocalPlayer; if (player == null) return; - var homeworld = player.HomeWorld.GameData; - if (homeworld == null) return; + var homeworld = player.HomeWorld.Value; var charInfo = new Dictionary { { "cid", Plugin.ClientState.LocalContentId }, { "name", player.Name.ToString() }, { "world", homeworld.Name.ToString() }, - { "worldId", player.HomeWorld.Id } + { "worldId", homeworld.RowId } }; string content = JsonConvert.SerializeObject(charInfo); Plugin.PluginLog.Debug(content); diff --git a/Paissa/LotteryObserver.cs b/Paissa/LotteryObserver.cs index 1aa0649..61d96b8 100644 --- a/Paissa/LotteryObserver.cs +++ b/Paissa/LotteryObserver.cs @@ -2,7 +2,7 @@ using AutoSweep.Structures; using Dalamud.Hooking; using Dalamud.Utility.Signatures; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; using Lumina.Text; namespace AutoSweep.Paissa { @@ -60,14 +60,14 @@ long a8 $"housingType={housingType}, territoryTypeId={territoryTypeId}, wardId={wardId}, plotId={plotId}, apartmentNumber={apartmentNumber}, placardSaleInfoPtr={placardSaleInfoPtr}, a8={a8}"); // get information about the world from the clientstate - World world = Plugin.ClientState.LocalPlayer?.CurrentWorld.GameData; + World? world = Plugin.ClientState.LocalPlayer?.CurrentWorld.ValueNullable; if (world is null) return; - SeString place = plugin.Territories.GetRow(territoryTypeId)?.PlaceName.Value?.Name; - SeString worldName = world.Name; + var place = plugin.Territories.GetRow(territoryTypeId).PlaceName.Value.Name; + var worldName = world.Value.Name; Plugin.PluginLog.Info($"Plot {place} {wardId + 1}-{plotId + 1} ({worldName}) has {saleInfo.EntryCount} lottery entries."); - plugin.PaissaClient.PostLotteryInfo(world.RowId, territoryTypeId, wardId, plotId, saleInfo); + plugin.PaissaClient.PostLotteryInfo(world.Value.RowId, territoryTypeId, wardId, plotId, saleInfo); } } diff --git a/Paissa/Utils.cs b/Paissa/Utils.cs index dc40807..0f9ef0e 100644 --- a/Paissa/Utils.cs +++ b/Paissa/Utils.cs @@ -1,4 +1,5 @@ -using Lumina.Excel.GeneratedSheets; + +using Lumina.Excel.Sheets; namespace AutoSweep.Paissa { public class Utils { @@ -44,9 +45,9 @@ public static bool ConfigEnabledForPlot(Plugin plugin, ushort worldId, ushort di // does the config want notifs for this world? World eventWorld = plugin.Worlds.GetRow(worldId); if (!(plugin.Configuration.AllNotifs - || plugin.Configuration.HomeworldNotifs && worldId == Plugin.ClientState.LocalPlayer?.HomeWorld.Id - || plugin.Configuration.DatacenterNotifs && eventWorld?.DataCenter.Row == - Plugin.ClientState.LocalPlayer?.HomeWorld.GameData?.DataCenter.Row)) + || plugin.Configuration.HomeworldNotifs && worldId == Plugin.ClientState.LocalPlayer?.HomeWorld.RowId + || plugin.Configuration.DatacenterNotifs && eventWorld.DataCenter.RowId == + Plugin.ClientState.LocalPlayer?.HomeWorld.Value.DataCenter.RowId)) return false; // get the district config DistrictNotifConfig districtNotifs; diff --git a/Paissa/WardObserver.cs b/Paissa/WardObserver.cs index 9945f7e..af23957 100644 --- a/Paissa/WardObserver.cs +++ b/Paissa/WardObserver.cs @@ -46,8 +46,8 @@ IntPtr dataPtr // reset last sweep info to the current sweep SweepState.StartDistrictSweep(wardInfo); - SeString districtName = plugin.Territories.GetRow((uint)wardInfo.LandIdent.TerritoryTypeId)?.PlaceName.Value?.Name; - SeString worldName = plugin.Worlds.GetRow((uint)wardInfo.LandIdent.WorldId)?.Name; + var districtName = plugin.Territories.GetRow((uint)wardInfo.LandIdent.TerritoryTypeId).PlaceName.Value.Name; + var worldName = plugin.Worlds.GetRow((uint)wardInfo.LandIdent.WorldId).Name; if (plugin.Configuration.ChatSweepAlert) { Plugin.Chat.Print($"Began sweep for {districtName} ({worldName})"); } @@ -77,7 +77,7 @@ IntPtr dataPtr private void OnFinishedDistrictSweep(HousingWardInfo housingWardInfo) { if (!plugin.Configuration.ChatSweepAlert) return; - SeString districtName = plugin.Territories.GetRow((uint)SweepState.DistrictId)?.PlaceName.Value?.Name; + var districtName = plugin.Territories.GetRow((uint)SweepState.DistrictId).PlaceName.Value.Name; Plugin.Chat.Print($"Swept all {Utils.NumWardsPerDistrict} wards. Thank you for your contribution!"); Plugin.Chat.Print($"Here's a summary of open plots in {districtName}:"); diff --git a/Plugin.cs b/Plugin.cs index 6124cfb..f51f24f 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -9,7 +9,7 @@ using Dalamud.Plugin; using Dalamud.Plugin.Services; using Lumina.Excel; -using Lumina.Excel.GeneratedSheets; +using Lumina.Excel.Sheets; namespace AutoSweep { public sealed class Plugin : IDalamudPlugin { @@ -141,7 +141,7 @@ private void OnPlotOpened(object sender, PlotOpenedEventArgs e) { World eventWorld = Worlds.GetRow(e.PlotDetail.world_id); OnFoundOpenHouse(e.PlotDetail.world_id, e.PlotDetail.district_id, e.PlotDetail.ward_number, e.PlotDetail.plot_number, e.PlotDetail.price, - $"New plot available for purchase on {eventWorld?.Name}: "); + $"New plot available for purchase on {eventWorld.Name}: "); } private void OnPlotUpdate(object sender, PlotUpdateEventArgs e) { @@ -156,7 +156,7 @@ private void OnPlotUpdate(object sender, PlotUpdateEventArgs e) { World eventWorld = Worlds.GetRow(e.PlotUpdate.world_id); OnFoundOpenHouse(e.PlotUpdate.world_id, e.PlotUpdate.district_id, e.PlotUpdate.ward_number, e.PlotUpdate.plot_number, e.PlotUpdate.price, - $"New plot available for purchase on {eventWorld?.Name}: "); + $"New plot available for purchase on {eventWorld.Name}: "); } @@ -165,19 +165,18 @@ private void OnPlotUpdate(object sender, PlotUpdateEventArgs e) { /// internal void OnFoundOpenHouse(uint worldId, uint territoryTypeId, int wardNumber, int plotNumber, uint? price, string messagePrefix = "") { - PlaceName place = Territories.GetRow(territoryTypeId)?.PlaceName.Value; + PlaceName place = Territories.GetRow(territoryTypeId).PlaceName.Value; // languages like German do not use NameNoArticle (#2) - Lumina.Text.SeString districtName = - place?.NameNoArticle.RawString.Length > 0 ? place.NameNoArticle : place?.Name; - Lumina.Text.SeString worldName = Worlds.GetRow(worldId)?.Name; + var districtName = + !place.NameNoArticle.IsEmpty ? place.NameNoArticle : place.Name; + var worldName = Worlds.GetRow(worldId).Name; HousingLandSet landSet = HousingLandSets.GetRow(Utils.TerritoryTypeIdToLandSetId(territoryTypeId)); - byte? houseSize = landSet?.PlotSize[plotNumber]; + byte? houseSize = landSet.LandSet[plotNumber].PlotSize; uint realPrice = - price.GetValueOrDefault(landSet?.InitialPrice[plotNumber] ?? - 0); // if price is null, it's probably the default price (landupdate) + price.GetValueOrDefault(landSet.LandSet[plotNumber].InitialPrice); // if price is null, it's probably the default price (landupdate) - string districtNameNoSpaces = districtName?.ToString().Replace(" ", ""); + string districtNameNoSpaces = districtName.ToString().Replace(" ", ""); int wardNum = wardNumber + 1; int plotNum = plotNumber + 1; float housePriceMillions = realPrice / 1000000f; @@ -195,8 +194,8 @@ internal void OnFoundOpenHouse(uint worldId, uint territoryTypeId, int wardNumbe break; case OutputFormat.Custom: var template = $"{messagePrefix}{Configuration.OutputFormatString}"; - output = Utils.FormatCustomOutputString(template, districtName?.ToString(), districtNameNoSpaces, - worldName, wardNum.ToString(), + output = Utils.FormatCustomOutputString(template, districtName.ToString(), districtNameNoSpaces, + worldName.ToString(), wardNum.ToString(), plotNum.ToString(), realPrice.ToString(), housePriceMillions.ToString("F3"), houseSizeName); break; default: diff --git a/packages.lock.json b/packages.lock.json index 0c68f30..aaba9e6 100644 --- a/packages.lock.json +++ b/packages.lock.json @@ -4,9 +4,9 @@ "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==" }, "DebounceThrottle": { "type": "Direct",