From d5716d7ae613d7853bfb5508657df344321812ca Mon Sep 17 00:00:00 2001 From: Andrew Zhu Date: Thu, 14 Apr 2022 16:32:41 -0700 Subject: [PATCH] feat: update for 6.1, read purchase info from HWI packet --- AutoSweep.csproj | 36 +++++++++++++++++------------------ Paissa/Client.cs | 2 ++ Structures/HousingCommon.cs | 11 +++++++++++ Structures/HousingWardInfo.cs | 14 +++++++++++++- autoSweep.json | 2 +- 5 files changed, 45 insertions(+), 20 deletions(-) diff --git a/AutoSweep.csproj b/AutoSweep.csproj index f1faca3..cff30f2 100644 --- a/AutoSweep.csproj +++ b/AutoSweep.csproj @@ -14,7 +14,7 @@ $(appdata)\XIVLauncher\addon\Hooks\dev\ true autoSweep - 1.2.2.0 + 1.2.3.0 @@ -64,11 +64,11 @@ - - - - - + + + + + @@ -80,29 +80,29 @@ - - + + - + - + - + - - + + - + - - - - + + + + \ No newline at end of file diff --git a/Paissa/Client.cs b/Paissa/Client.cs index 6fab06c..2c5941a 100644 --- a/Paissa/Client.cs +++ b/Paissa/Client.cs @@ -87,6 +87,8 @@ public void PostWardInfo(HousingWardInfo wardInfo, int serverTimestamp) { { "server_timestamp", serverTimestamp }, { "HouseInfoEntries", wardInfo.HouseInfoEntries }, { "LandIdent", wardInfo.LandIdent }, + { "PurchaseType", wardInfo.PurchaseType }, + { "TenantFlags", wardInfo.TenantFlags } }; queueIngest(data); } diff --git a/Structures/HousingCommon.cs b/Structures/HousingCommon.cs index 4639ae8..9c72d45 100644 --- a/Structures/HousingCommon.cs +++ b/Structures/HousingCommon.cs @@ -33,4 +33,15 @@ public enum HousingFlags : byte { HouseBuilt = 1 << 3, OwnedByFC = 1 << 4 } + + public enum PurchaseType : byte { + FCFS = 1, + Lottery = 2 + } + + [Flags] + public enum TenantFlags : byte { + FreeCompany = 1, + Personal = 2 + } } diff --git a/Structures/HousingWardInfo.cs b/Structures/HousingWardInfo.cs index 372e719..8e20eee 100644 --- a/Structures/HousingWardInfo.cs +++ b/Structures/HousingWardInfo.cs @@ -6,10 +6,12 @@ namespace AutoSweep.Structures { public class HousingWardInfo { public HouseInfoEntry[] HouseInfoEntries; public LandIdent LandIdent; + public PurchaseType PurchaseType; + public TenantFlags TenantFlags; public static unsafe HousingWardInfo Read(IntPtr dataPtr) { var wardInfo = new HousingWardInfo(); - using (var unmanagedMemoryStream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 2656L)) { + using (var unmanagedMemoryStream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 2664L)) { using (var binaryReader = new BinaryReader(unmanagedMemoryStream)) { wardInfo.LandIdent = LandIdent.ReadFromBinaryReader(binaryReader); wardInfo.HouseInfoEntries = new HouseInfoEntry[60]; @@ -27,6 +29,16 @@ public static unsafe HousingWardInfo Read(IntPtr dataPtr) { if ((infoEntry.InfoFlags & HousingFlags.PlotOwned) == 0) infoEntry.EstateOwnerName = ""; } + + // 0x2440 + wardInfo.PurchaseType = (PurchaseType)binaryReader.ReadByte(); + // 0x2441 - padding byte? + binaryReader.ReadByte(); + // 0x2442 + wardInfo.TenantFlags = (TenantFlags)binaryReader.ReadByte(); + // 0x2443 - padding byte? + binaryReader.ReadByte(); + // 0x2444 - 0x2447 appear to be padding bytes } } return wardInfo; diff --git a/autoSweep.json b/autoSweep.json index 3cb8446..2ba18f3 100644 --- a/autoSweep.json +++ b/autoSweep.json @@ -9,5 +9,5 @@ ], "IconUrl": "https://raw.githubusercontent.com/zhudotexe/FFXIV_PaissaHouse/main/images/icon.png", "Punchline": "Chat alerts for player housing.", - "DalamudApiLevel": 5 + "DalamudApiLevel": 6 }