Handle some dubious item stats
This commit is contained in:
parent
37dedcc09e
commit
3176f6b736
@ -11,6 +11,7 @@ namespace LLib.Gear;
|
|||||||
|
|
||||||
public sealed class GearStatsCalculator
|
public sealed class GearStatsCalculator
|
||||||
{
|
{
|
||||||
|
private const uint EternityRingItemId = 8575;
|
||||||
private static readonly uint[] CanHaveOffhand = [2, 6, 8, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32];
|
private static readonly uint[] CanHaveOffhand = [2, 6, 8, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32];
|
||||||
|
|
||||||
private readonly ExcelSheet<Item> _itemSheet;
|
private readonly ExcelSheet<Item> _itemSheet;
|
||||||
@ -83,6 +84,8 @@ public sealed class GearStatsCalculator
|
|||||||
{
|
{
|
||||||
List<(uint, byte)> materias = [];
|
List<(uint, byte)> materias = [];
|
||||||
byte materiaCount = 0;
|
byte materiaCount = 0;
|
||||||
|
if (item->ItemId != EternityRingItemId)
|
||||||
|
{
|
||||||
for (int i = 0; i < 5; ++i)
|
for (int i = 0; i < 5; ++i)
|
||||||
{
|
{
|
||||||
var materia = item->Materia[i];
|
var materia = item->Materia[i];
|
||||||
@ -92,6 +95,7 @@ public sealed class GearStatsCalculator
|
|||||||
materias.Add((materia, item->MateriaGrades[i]));
|
materias.Add((materia, item->MateriaGrades[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return CalculateGearStats(_itemSheet.GetRow(item->ItemId), item->Flags.HasFlag(InventoryItem.ItemFlags.HighQuality), materias) with
|
return CalculateGearStats(_itemSheet.GetRow(item->ItemId), item->Flags.HasFlag(InventoryItem.ItemFlags.HighQuality), materias) with
|
||||||
{
|
{
|
||||||
@ -173,12 +177,16 @@ public sealed class GearStatsCalculator
|
|||||||
}
|
}
|
||||||
|
|
||||||
public short GetMaximumStatValue(Item item, EBaseParam baseParamValue)
|
public short GetMaximumStatValue(Item item, EBaseParam baseParamValue)
|
||||||
|
{
|
||||||
|
if (_itemLevelStatCaps.TryGetValue((item.LevelItem.RowId, baseParamValue), out var stat))
|
||||||
{
|
{
|
||||||
return (short)Math.Round(
|
return (short)Math.Round(
|
||||||
_itemLevelStatCaps[(item.LevelItem.RowId, baseParamValue)] *
|
stat * _equipSlotCategoryPct[(baseParamValue, (int)item.EquipSlotCategory.RowId)] / 1000f,
|
||||||
_equipSlotCategoryPct[(baseParamValue, (int)item.EquipSlotCategory.RowId)] / 1000f,
|
|
||||||
MidpointRounding.AwayFromZero);
|
MidpointRounding.AwayFromZero);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// From caraxi/SimpleTweaks
|
// From caraxi/SimpleTweaks
|
||||||
public unsafe short CalculateAverageItemLevel(InventoryContainer* container)
|
public unsafe short CalculateAverageItemLevel(InventoryContainer* container)
|
||||||
|
Loading…
Reference in New Issue
Block a user