Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BDTHPlugin/BDTHPlugin.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Dalamud.NET.Sdk/12.0.2">
<Project Sdk="Dalamud.NET.Sdk/13.0.0">
<PropertyGroup>
<Version>1.6.9</Version>
<TargetFramework>net9.0-windows</TargetFramework>
Expand Down
2 changes: 1 addition & 1 deletion BDTHPlugin/BDTHPlugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"RepoUrl": "https://github.com/LeonBlade/BDTHPlugin",
"ApplicableVersion": "any",
"Tags": ["bdth", "housing", "float", "place", "glitch", "furnishing", "LeonBlade"],
"DalamudApiLevel": 12,
"DalamudApiLevel": 13,
"IconUrl": "https://github.com/LeonBlade/BDTHPlugin/raw/main/icon.png"
}
2 changes: 1 addition & 1 deletion BDTHPlugin/Interface/Components/ItemControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Dalamud.Interface;
using Dalamud.Interface.Components;

using ImGuiNET;
using Dalamud.Bindings.ImGui;

namespace BDTHPlugin.Interface.Components
{
Expand Down
14 changes: 7 additions & 7 deletions BDTHPlugin/Interface/Gizmo.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Net.WebSockets;
using System.Numerics;
using Dalamud.Interface.Utility;
using ImGuiNET;
using ImGuizmoNET;
using Dalamud.Bindings.ImGui;
using Dalamud.Bindings.ImGuizmo;

namespace BDTHPlugin.Interface
{
Expand All @@ -13,7 +13,7 @@ public class Gizmo

private static unsafe bool CanEdit => Configuration.UseGizmo && Memory.CanEditItem() && Memory.HousingStructure->ActiveItem != null;

public MODE Mode = MODE.LOCAL;
public ImGuizmoMode Mode = ImGuizmoMode.Local;

private Vector3 translate;
private Vector3 rotation;
Expand Down Expand Up @@ -82,7 +82,7 @@ private unsafe void DrawGizmo(Vector2 pos, Vector2 size)

var snap = Configuration.DoSnap ? new(Configuration.Drag, Configuration.Drag, Configuration.Drag) : Vector3.Zero;

if (Manipulate(ref view.M11, ref proj.M11, OPERATION.TRANSLATE, Mode, ref matrix.M11, ref snap.X))
if (Manipulate(ref view.M11, ref proj.M11, ImGuizmoOperation.Translate, Mode, ref matrix.M11, ref snap.X))
WriteMatrix();

ImGuizmo.SetID(-1);
Expand All @@ -107,7 +107,7 @@ private void WriteMatrix()
Memory.WritePosition(translate);
}

private unsafe bool Manipulate(ref float view, ref float proj, OPERATION op, MODE mode, ref float matrix, ref float snap)
private unsafe bool Manipulate(ref float view, ref float proj, ImGuizmoOperation op, ImGuizmoMode mode, ref float matrix, ref float snap)
{
fixed (float* native_view = &view)
{
Expand All @@ -117,7 +117,7 @@ private unsafe bool Manipulate(ref float view, ref float proj, OPERATION op, MOD
{
fixed (float* native_snap = &snap)
{
return ImGuizmoNative.ImGuizmo_Manipulate(
return ImGuizmo.Manipulate(
native_view,
native_proj,
op,
Expand All @@ -127,7 +127,7 @@ private unsafe bool Manipulate(ref float view, ref float proj, OPERATION op, MOD
native_snap,
null,
null
) != 0;
) != false;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion BDTHPlugin/Interface/Windows/DebugWindow.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Dalamud.Interface.Windowing;

using ImGuiNET;
using Dalamud.Bindings.ImGui;

namespace BDTHPlugin.Interface.Windows
{
Expand Down
2 changes: 1 addition & 1 deletion BDTHPlugin/Interface/Windows/FurnitureList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Dalamud.Interface.Windowing;

using ImGuiNET;
using Dalamud.Bindings.ImGui;

namespace BDTHPlugin.Interface.Windows
{
Expand Down
12 changes: 6 additions & 6 deletions BDTHPlugin/Interface/Windows/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using Dalamud.Interface.Components;
using Dalamud.Interface.Windowing;

using ImGuiNET;
using ImGuizmoNET;
using Dalamud.Bindings.ImGui;
using Dalamud.Bindings.ImGuizmo;

using BDTHPlugin.Interface.Components;

Expand Down Expand Up @@ -78,12 +78,12 @@ public unsafe override void Draw()
DrawTooltip("Enables snapping of gizmo movement based on the drag value set below.");

ImGui.SameLine();
if (ImGuiComponents.IconButton(1, Gizmo.Mode == MODE.LOCAL ? Dalamud.Interface.FontAwesomeIcon.ArrowsAlt : Dalamud.Interface.FontAwesomeIcon.Globe))
Gizmo.Mode = Gizmo.Mode == MODE.LOCAL ? MODE.WORLD : MODE.LOCAL;
if (ImGuiComponents.IconButton(1, Gizmo.Mode == ImGuizmoMode.Local ? Dalamud.Interface.FontAwesomeIcon.ArrowsAlt : Dalamud.Interface.FontAwesomeIcon.Globe))
Gizmo.Mode = Gizmo.Mode == ImGuizmoMode.Local ? ImGuizmoMode.World : ImGuizmoMode.Local;

DrawTooltip(
[
$"Mode: {(Gizmo.Mode == MODE.LOCAL ? "Local" : "World")}",
$"Mode: {(Gizmo.Mode == ImGuizmoMode.Local ? "Local" : "World")}",
"Changes gizmo mode between local and world movement."
]);

Expand Down Expand Up @@ -113,7 +113,7 @@ public unsafe override void Draw()
}
DrawTooltip("Sets the amount to change when dragging the controls, also influences the gizmo snap feature.");

var dummyHousingGoods = PluginMemory.HousingGoods != null && PluginMemory.HousingGoods->IsVisible;
var dummyHousingGoods = PluginMemory.HousingGoods != null && PluginMemory.HousingGoods.IsVisible;
var dummyInventory = Memory.InventoryVisible;

if (ImGui.Checkbox("Display in-game list", ref dummyHousingGoods))
Expand Down
6 changes: 3 additions & 3 deletions BDTHPlugin/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using Dalamud.IoC;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using ImGuiNET;
using ImGuizmoNET;
using Dalamud.Bindings.ImGui;
using Dalamud.Bindings.ImGuizmo;
using Lumina.Excel.Sheets;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -122,7 +122,7 @@ public static void DrawIcon(ushort icon, Vector2 size)
if (icon < 65000)
{
var iconTexture = TextureProvider.GetFromGameIcon(new GameIconLookup(icon));
ImGui.Image(iconTexture.GetWrapOrEmpty().ImGuiHandle, size);
ImGui.Image(iconTexture.GetWrapOrEmpty().Handle, size);
}
}

Expand Down
79 changes: 43 additions & 36 deletions BDTHPlugin/PluginMemory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using FFXIVClientStructs.FFXIV.Component.GUI;
using Dalamud.Game.NativeWrapper;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -34,55 +35,56 @@ public class PluginMemory
public unsafe HousingObjectManager* CurrentManager => HousingModule->GetCurrentManager();
public unsafe Camera* Camera => &CameraManager.Instance()->GetActiveCamera()->CameraBase.SceneCamera;

public static unsafe AtkUnitBase* HousingLayout => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("HousingLayout", 1);
public static unsafe bool GamepadMode => !(HousingLayout != null && HousingLayout->IsVisible);

public static unsafe AtkUnitBase* HousingGoods => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("HousingGoods", 1);
public static unsafe AtkUnitBase* InventoryExpansion => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryExpansion", 1);
public static unsafe AtkUnitBase* InventoryGrid0E => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGrid0E", 1);
public static unsafe AtkUnitBase* InventoryGrid1E => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGrid1E", 1);
public static unsafe AtkUnitBase* InventoryGrid2E => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGrid2E", 1);
public static unsafe AtkUnitBase* InventoryGrid3E => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGrid3E", 1);
public static unsafe AtkUnitBase* InventoryLarge => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryLarge", 1);
public static unsafe AtkUnitBase* Inventory => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("Inventory", 1);
public static unsafe AtkUnitBase* InventoryGrid0 => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGrid0", 1);
public static unsafe AtkUnitBase* InventoryGrid1 => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGrid1", 1);
public static unsafe AtkUnitBase* InventoryEventGrid0 => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryEventGrid0", 1);
public static unsafe AtkUnitBase* InventoryEventGrid1 => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryEventGrid1", 1);
public static unsafe AtkUnitBase* InventoryEventGrid2 => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryEventGrid2", 1);
public static unsafe AtkUnitBase* InventoryGrid => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGrid", 1);
public static unsafe AtkUnitBase* InventoryEventGrid0E => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryEventGrid0E", 1);
public static unsafe AtkUnitBase* InventoryEventGrid1E => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryEventGrid1E", 1);
public static unsafe AtkUnitBase* InventoryEventGrid2E => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryEventGrid2E", 1);
public static unsafe AtkUnitBase* InventoryGridCrystal => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGridCrystal", 1);
public static unsafe AtkUnitBase* InventoryCrystalGrid => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryCrystalGrid", 1);
public static unsafe AtkUnitBase* InventoryCrystalGrid2 => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryCrystalGrid", 2);
public static unsafe AtkUnitBasePtr HousingLayout => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("HousingLayout", 1);
public static unsafe bool GamepadMode => !(HousingLayout != null && HousingLayout.IsVisible);

public static unsafe AtkUnitBasePtr HousingGoods => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("HousingGoods", 1);
public static unsafe AtkUnitBasePtr InventoryExpansion => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryExpansion", 1);
public static unsafe AtkUnitBasePtr InventoryGrid0E => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGrid0E", 1);
public static unsafe AtkUnitBasePtr InventoryGrid1E => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGrid1E", 1);
public static unsafe AtkUnitBasePtr InventoryGrid2E => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGrid2E", 1);
public static unsafe AtkUnitBasePtr InventoryGrid3E => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGrid3E", 1);
public static unsafe AtkUnitBasePtr InventoryLarge => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryLarge", 1);
public static unsafe AtkUnitBasePtr Inventory => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("Inventory", 1);
public static unsafe AtkUnitBasePtr InventoryGrid0 => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGrid0", 1);
public static unsafe AtkUnitBasePtr InventoryGrid1 => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGrid1", 1);
public static unsafe AtkUnitBasePtr InventoryEventGrid0 => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryEventGrid0", 1);
public static unsafe AtkUnitBasePtr InventoryEventGrid1 => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryEventGrid1", 1);
public static unsafe AtkUnitBasePtr InventoryEventGrid2 => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryEventGrid2", 1);
public static unsafe AtkUnitBasePtr InventoryGrid => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGrid", 1);
public static unsafe AtkUnitBasePtr InventoryEventGrid0E => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryEventGrid0E", 1);
public static unsafe AtkUnitBasePtr InventoryEventGrid1E => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryEventGrid1E", 1);
public static unsafe AtkUnitBasePtr InventoryEventGrid2E => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryEventGrid2E", 1);
public static unsafe AtkUnitBasePtr InventoryGridCrystal => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGridCrystal", 1);
public static unsafe AtkUnitBasePtr InventoryCrystalGrid => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryCrystalGrid", 1);
public static unsafe AtkUnitBasePtr InventoryCrystalGrid2 => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryCrystalGrid", 2);

public unsafe bool InventoryVisible
{
get => InventoryExpansion != null && InventoryExpansion->IsVisible ||
InventoryLarge != null && InventoryLarge->IsVisible ||
Inventory != null && Inventory->IsVisible;
get => InventoryExpansion != null && InventoryExpansion.IsVisible ||
InventoryLarge != null && InventoryLarge.IsVisible ||
Inventory != null && Inventory.IsVisible;

set
{
if (HousingGoods == null || InventoryExpansion == null || InventoryLarge == null || Inventory == null)
return;

// Determine which inventory is open assuming it's visible
if (InventoryExpansion->IsVisible || InventoryLarge->IsVisible || Inventory->IsVisible)
if (InventoryExpansion.IsVisible || InventoryLarge.IsVisible || Inventory.IsVisible)
{
if (InventoryExpansion->IsVisible) inventoryType = 1;
else if (InventoryLarge->IsVisible) inventoryType = 2;
else if (Inventory->IsVisible) inventoryType = 3;
if (InventoryExpansion.IsVisible) inventoryType = 1;
else if (InventoryLarge.IsVisible) inventoryType = 2;
else if (Inventory.IsVisible) inventoryType = 3;
}

try
{
switch (inventoryType)
switch (inventoryType) // these values are read only with the Dalamud 13 implementation of AtkUnitBasePtr
{
case 1:
InventoryExpansion->IsVisible = value;
/*
InventoryExpansion.Address.ToPointer->IsVisible = value;
InventoryGrid0E->IsVisible = value;
InventoryGrid1E->IsVisible = value;
InventoryGrid2E->IsVisible = value;
Expand All @@ -91,20 +93,25 @@ public unsafe bool InventoryVisible
InventoryEventGrid1E->IsVisible = value;
InventoryEventGrid2E->IsVisible = value;
InventoryCrystalGrid2->IsVisible = value;
*/
break;
case 2:
/*
InventoryLarge->IsVisible = value;
InventoryGrid0->IsVisible = value;
InventoryGrid1->IsVisible = value;
InventoryEventGrid0->IsVisible = value;
InventoryEventGrid1->IsVisible = value;
InventoryEventGrid2->IsVisible = value;
InventoryCrystalGrid->IsVisible = value;
*/
break;
case 3:
/*
Inventory->IsVisible = value;
InventoryGrid->IsVisible = value;
InventoryGridCrystal->IsVisible = value;
*/
break;
default:
break;
Expand Down Expand Up @@ -180,8 +187,8 @@ public PluginMemory()

public unsafe void ShowFurnishingList(bool state)
{
if (HousingGoods != null)
HousingGoods->IsVisible = state;
if (HousingGoods != null)
;//HousingGoods->IsVisible = state;//same as above, this value is read only with dalamud 13
}

public void ShowInventory(bool state) => InventoryVisible = state;
Expand All @@ -196,8 +203,8 @@ public unsafe void Dispose()
// Disable the place anywhere in case it's on.
SetPlaceAnywhere(false);

// Enable the housing goods menu again.
if (HousingGoods != null) HousingGoods->IsVisible = true;
// Enable the housing goods menu again.
if (HousingGoods != null) ;// HousingGoods->IsVisible = true;//same as above, this value is read only with dalamud 13
}
catch (Exception ex)
{
Expand Down
10 changes: 5 additions & 5 deletions BDTHPlugin/Structs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ public unsafe struct HousingModule
public unsafe struct HousingGameObject
{
[FieldOffset(0x30)] public fixed byte Name[64];
[FieldOffset(0x80)] public uint HousingRowId;
[FieldOffset(0xA0)] public float X;
[FieldOffset(0xA4)] public float Y;
[FieldOffset(0xA8)] public float Z;
[FieldOffset(0xF8)] public HousingItem* Item;
[FieldOffset(0x84)] public uint HousingRowId;
[FieldOffset(0xB0)] public float X;
[FieldOffset(0xB4)] public float Y;
[FieldOffset(0xB8)] public float Z;
[FieldOffset(0x108)] public HousingItem* Item;
}

[StructLayout(LayoutKind.Explicit)]
Expand Down
Loading