muffin v7.5.12

This commit is contained in:
alydev 2026-08-19 13:19:57 +10:00
parent 3102923ce2
commit 911ed68baa
65 changed files with 2356 additions and 1539 deletions

View file

@ -92,6 +92,10 @@ internal static class EquipRecommended
private bool _smartApplied;
private bool _useDirectEquip;
private uint _smartClassJobId;
private int _directEquipCursor;
private bool _directEquipStarted;
@ -150,8 +154,9 @@ internal static class EquipRecommended
EClassJob job = (EClassJob)rowId;
StatPriority priority = StatPriority.ForJob(job);
byte playerLevel = GetPlayerLevel(job);
RaptureGearsetModule.GearsetEntry* entry = (RaptureGearsetModule.GearsetEntry*)Unsafe.AsPointer(in ptr->Entries[currentGearsetIndex]);
if (!TryComputeUpgradesAndMoves(job, priority, playerLevel, entry, out _smartUpgrades, out _smartMoves))
_smartClassJobId = rowId;
_useDirectEquip = configuration.General.PreserveGearset || !CurrentGearsetMatchesEquippedItems();
if (!TryComputeUpgradesAndMoves(job, priority, playerLevel, out _smartUpgrades, out _smartMoves))
{
_smartUpgrades = null;
_smartMoves = null;
@ -196,7 +201,11 @@ internal static class EquipRecommended
}
return ETaskResult.StillRunning;
}
if (configuration.General.PreserveGearset)
if (!_useDirectEquip && !CurrentGearsetMatchesEquippedItems())
{
_useDirectEquip = true;
}
if (_useDirectEquip)
{
return DirectEquipPhase();
}
@ -403,10 +412,20 @@ internal static class EquipRecommended
return true;
}
private unsafe bool TryComputeUpgradesAndMoves(EClassJob job, StatPriority priority, byte playerLevel, RaptureGearsetModule.GearsetEntry* entry, out List<(int Slot, BestItemRef Item)> upgrades, out List<PendingMove> moves)
private unsafe bool TryComputeUpgradesAndMoves(EClassJob job, StatPriority priority, byte playerLevel, out List<(int Slot, BestItemRef Item)> upgrades, out List<PendingMove> moves)
{
upgrades = new List<(int, BestItemRef)>();
moves = new List<PendingMove>();
InventoryManager* ptr = InventoryManager.Instance();
if (ptr == null)
{
return false;
}
InventoryContainer* inventoryContainer = ptr->GetInventoryContainer(InventoryType.EquippedItems);
if (inventoryContainer == null)
{
return false;
}
BestItemRef? bestItemRef = null;
bool flag = job.IsCrafter() || job.IsGatherer();
Dictionary<InventoryType, int> cursors = new Dictionary<InventoryType, int>();
@ -434,7 +453,8 @@ internal static class EquipRecommended
{
bestItemRef = bestItemRef2;
}
if (((ItemHandle)entry->GetItem((RaptureGearsetModule.GearsetItemIndex)i).ItemId).Id == ((ItemHandle)bestItemRef2.Value.ItemId).Id)
InventoryItem* inventorySlot = inventoryContainer->GetInventorySlot(i);
if (((inventorySlot != null) ? ItemHandle.FromInventorySlot(inventorySlot).Id : 0) == ((ItemHandle)bestItemRef2.Value.ItemId).Id)
{
continue;
}
@ -457,6 +477,48 @@ internal static class EquipRecommended
return true;
}
private unsafe bool CurrentGearsetMatchesEquippedItems()
{
RaptureGearsetModule* ptr = RaptureGearsetModule.Instance();
if (ptr == null)
{
return false;
}
int currentGearsetIndex = ptr->CurrentGearsetIndex;
if (currentGearsetIndex < 0 || !ptr->IsValidGearset(currentGearsetIndex))
{
return false;
}
RaptureGearsetModule.GearsetEntry* ptr2 = (RaptureGearsetModule.GearsetEntry*)Unsafe.AsPointer(in ptr->Entries[currentGearsetIndex]);
if (ptr2->ClassJob != _smartClassJobId)
{
return false;
}
InventoryManager* ptr3 = InventoryManager.Instance();
if (ptr3 == null)
{
return false;
}
InventoryContainer* inventoryContainer = ptr3->GetInventoryContainer(InventoryType.EquippedItems);
if (inventoryContainer == null)
{
return false;
}
for (int i = 0; i <= 13; i++)
{
if (i != 5)
{
InventoryItem* inventorySlot = inventoryContainer->GetInventorySlot(i);
uint num = ((inventorySlot != null) ? ItemHandle.FromInventorySlot(inventorySlot).Id : 0u);
if (((ItemHandle)ptr2->GetItem((RaptureGearsetModule.GearsetItemIndex)i).ItemId).Id != num)
{
return false;
}
}
}
return true;
}
private static bool IsBagContainer(InventoryType type)
{
if (type <= InventoryType.Inventory4)