Skip to content

Commit

Permalink
feat: update for 6.1, read purchase info from HWI packet
Browse files Browse the repository at this point in the history
  • Loading branch information
zhudotexe committed Apr 14, 2022
1 parent 9ab4054 commit d5716d7
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 20 deletions.
36 changes: 18 additions & 18 deletions AutoSweep.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AssemblyName>autoSweep</AssemblyName>
<AssemblyVersion>1.2.2.0</AssemblyVersion>
<AssemblyVersion>1.2.3.0</AssemblyVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down Expand Up @@ -64,11 +64,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.3"/>
<PackageReference Include="DebounceThrottle" Version="1.0.0"/>
<PackageReference Include="ILRepack" Version="2.0.18"/>
<PackageReference Include="JWT" Version="8.2.3"/>
<PackageReference Include="WebSocketSharp.Standard" Version="1.0.3"/>
<PackageReference Include="DalamudPackager" Version="2.1.6" />
<PackageReference Include="DebounceThrottle" Version="1.0.0" />
<PackageReference Include="ILRepack" Version="2.0.18" />
<PackageReference Include="JWT" Version="8.9.0" />
<PackageReference Include="WebSocketSharp.Standard" Version="1.0.3" />
</ItemGroup>

<ItemGroup>
Expand All @@ -80,29 +80,29 @@

<Target Name="PostBuild" AfterTargets="Build">
<ItemGroup>
<InputAssemblies Include="$(TargetPath)"/>
<InputAssemblies Include="$(TargetDir)*.dll" Exclude="$(TargetPath)"/>
<InputAssemblies Include="$(TargetPath)" />
<InputAssemblies Include="$(TargetDir)*.dll" Exclude="$(TargetPath)" />
</ItemGroup>
<Exec Command="$(PkgILRepack)\tools\ILRepack.exe /union /lib:$(DalamudLibPath) /out:$(TargetDir)$(TargetFileName) @(InputAssemblies, ' ')"/>
<Exec Command="$(PkgILRepack)\tools\ILRepack.exe /union /lib:$(DalamudLibPath) /out:$(TargetDir)$(TargetFileName) @(InputAssemblies, ' ')" />
</Target>

<Target Name="PostBuild_Debug" AfterTargets="PostBuild" Condition="'$(Configuration)' == 'Debug'">
<ItemGroup>
<CleanAssemblies Include="$(TargetDir)*.dll" Exclude="$(TargetDir)$(TargetFileName)"/>
<CleanAssemblies Include="$(TargetDir)*.dll" Exclude="$(TargetDir)$(TargetFileName)" />
</ItemGroup>
<Delete Files="@(CleanAssemblies)"/>
<Delete Files="@(CleanAssemblies)" />
</Target>

<Target Name="PostBuild_Release" AfterTargets="PostBuild" Condition=" '$(Configuration)' == 'Release' ">
<MakeDir Directories="$(TargetDir)out\"/>
<Exec Command="copy $(TargetDir)$(TargetFileName) $(TargetDir)out\$(TargetFileName)"/>
<MakeDir Directories="$(TargetDir)out\" />
<Exec Command="copy $(TargetDir)$(TargetFileName) $(TargetDir)out\$(TargetFileName)" />
<ItemGroup>
<DeleteFiles Include="$(TargetDir)out\*.dll" Exclude="$(TargetDir)out\$(TargetFileName)"/>
<DeleteFiles Include="$(TargetDir)out\*.dll" Exclude="$(TargetDir)out\$(TargetFileName)" />
</ItemGroup>
<Delete Files="@(DeleteFiles)"/>
<DalamudPackager ProjectDir="$(ProjectDir)" OutputPath="$(OutputPath)out\" AssemblyName="$(AssemblyName)" VersionComponents="4" MakeZip="true"/>
<MakeDir Directories="$(TargetDir)out\$(AssemblyName)\images"/>
<Exec Command="copy $(ProjectDir)\images\*.png $(TargetDir)out\$(AssemblyName)\images\*.png"/>
<Delete Files="@(DeleteFiles)" />
<DalamudPackager ProjectDir="$(ProjectDir)" OutputPath="$(OutputPath)out\" AssemblyName="$(AssemblyName)" VersionComponents="4" MakeZip="true" />
<MakeDir Directories="$(TargetDir)out\$(AssemblyName)\images" />
<Exec Command="copy $(ProjectDir)\images\*.png $(TargetDir)out\$(AssemblyName)\images\*.png" />
</Target>

</Project>
2 changes: 2 additions & 0 deletions Paissa/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
11 changes: 11 additions & 0 deletions Structures/HousingCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
14 changes: 13 additions & 1 deletion Structures/HousingWardInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion autoSweep.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit d5716d7

Please sign in to comment.