v1.0.8.0: Action Chat Link, hotbar job-specific persistence fix
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -541,16 +541,32 @@ namespace HSUI.Helpers
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Sets a slot and persists to disk. For shared hotbars, explicitly writes to classJobId 0 to ensure persistence across job changes and teleports.</summary>
|
||||
/// <summary>Sets a slot and persists to disk. For shared hotbars, explicitly writes to classJobId 0.
|
||||
/// For job-specific hotbars, explicitly writes to current class job ID to ensure persistence when switching jobs.</summary>
|
||||
public static unsafe void SetAndSaveSlotInternal(RaptureHotbarModule* module, uint barId, uint slotId, RaptureHotbarModule.HotbarSlotType slotType, uint commandId, RaptureHotbarModule.HotbarSlot* slotPtr = null)
|
||||
{
|
||||
var ptr = slotPtr != null ? slotPtr : module->GetSlotById(barId, slotId);
|
||||
if (module->IsHotbarShared(barId) && ptr != null)
|
||||
if (ptr == null) return;
|
||||
|
||||
if (module->IsHotbarShared(barId))
|
||||
{
|
||||
// Shared hotbars: explicitly write to classJobId 0 (shared storage) for correct persistence across teleports/job changes
|
||||
// Shared hotbars: explicitly write to classJobId 0 (shared storage) for persistence across job changes and teleports
|
||||
module->WriteSavedSlot(0, barId, slotId, ptr, false, false);
|
||||
}
|
||||
// SetAndSaveSlot triggers file save; for shared bars also ensures save is queued (WriteSavedSlot may only update _savedHotbars)
|
||||
else
|
||||
{
|
||||
// Job-specific hotbars: explicitly write to current class job ID so saves persist when switching jobs
|
||||
uint classJobId = (uint)(module->ActiveHotbarClassJobId & 0x7F); // strip 0x80 flag if set
|
||||
if (classJobId == 0)
|
||||
{
|
||||
var player = Plugin.ObjectTable?.LocalPlayer;
|
||||
if (player != null)
|
||||
classJobId = player.ClassJob.RowId;
|
||||
}
|
||||
if (classJobId != 0)
|
||||
module->WriteSavedSlot(classJobId, barId, slotId, ptr, false, false);
|
||||
}
|
||||
// SetAndSaveSlot updates live slot and triggers file save
|
||||
module->SetAndSaveSlot(barId, slotId, slotType, commandId, ignoreSharedHotbars: false, allowSaveToPvP: true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user