Change to GeneratedSheets2
This commit is contained in:
@@ -2,10 +2,10 @@ using Dalamud;
|
|||||||
using Lumina;
|
using Lumina;
|
||||||
using Lumina.Data;
|
using Lumina.Data;
|
||||||
using Lumina.Excel;
|
using Lumina.Excel;
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets2;
|
||||||
using System;
|
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using Action = Lumina.Excel.GeneratedSheets.Action;
|
using Action = Lumina.Excel.GeneratedSheets2.Action;
|
||||||
|
using ItemFood = Lumina.Excel.GeneratedSheets.ItemFood; // BaseParam is too annoying with SoA
|
||||||
|
|
||||||
namespace Craftimizer.Plugin;
|
namespace Craftimizer.Plugin;
|
||||||
|
|
||||||
|
|||||||
@@ -6,17 +6,17 @@ using Dalamud.Utility;
|
|||||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets2;
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Action = Lumina.Excel.GeneratedSheets.Action;
|
using Action = Lumina.Excel.GeneratedSheets2.Action;
|
||||||
using ActionType = Craftimizer.Simulator.Actions.ActionType;
|
using ActionType = Craftimizer.Simulator.Actions.ActionType;
|
||||||
using ClassJob = Craftimizer.Simulator.ClassJob;
|
using ClassJob = Craftimizer.Simulator.ClassJob;
|
||||||
using Condition = Craftimizer.Simulator.Condition;
|
using Condition = Craftimizer.Simulator.Condition;
|
||||||
using Status = Lumina.Excel.GeneratedSheets.Status;
|
using Status = Lumina.Excel.GeneratedSheets2.Status;
|
||||||
|
|
||||||
namespace Craftimizer.Plugin;
|
namespace Craftimizer.Plugin;
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ internal static class ClassJobUtils
|
|||||||
PlayerState.Instance()->ClassJobLevelArray[me.GetExpArrayIdx()];
|
PlayerState.Instance()->ClassJobLevelArray[me.GetExpArrayIdx()];
|
||||||
|
|
||||||
public static unsafe bool CanPlayerUseManipulation(this ClassJob me) =>
|
public static unsafe bool CanPlayerUseManipulation(this ClassJob me) =>
|
||||||
UIState.Instance()->IsUnlockLinkUnlockedOrQuestCompleted(ActionType.Manipulation.GetActionRow(me).Action!.UnlockLink);
|
UIState.Instance()->IsUnlockLinkUnlockedOrQuestCompleted(ActionType.Manipulation.GetActionRow(me).Action!.UnlockLink.Row);
|
||||||
|
|
||||||
public static string GetName(this ClassJob me)
|
public static string GetName(this ClassJob me)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Craftimizer.Plugin;
|
using Craftimizer.Plugin;
|
||||||
using Craftimizer.Plugin.Utils;
|
using Craftimizer.Plugin.Utils;
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets2;
|
||||||
using System.Collections.Frozen;
|
using System.Collections.Frozen;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
@@ -68,7 +68,7 @@ public static class FoodStatus
|
|||||||
if (stat.BaseParam == 0)
|
if (stat.BaseParam == 0)
|
||||||
continue;
|
continue;
|
||||||
var foodStat = new FoodStat(stat.IsRelative, stat.Value, stat.Max, stat.ValueHQ, stat.MaxHQ);
|
var foodStat = new FoodStat(stat.IsRelative, stat.Value, stat.Max, stat.ValueHQ, stat.MaxHQ);
|
||||||
switch (stat.BaseParam)
|
switch ((uint)stat.BaseParam)
|
||||||
{
|
{
|
||||||
case Gearsets.ParamCraftsmanship: craftsmanship = foodStat; break;
|
case Gearsets.ParamCraftsmanship: craftsmanship = foodStat; break;
|
||||||
case Gearsets.ParamControl: control = foodStat; break;
|
case Gearsets.ParamControl: control = foodStat; break;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Dalamud.Utility;
|
|||||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
|
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets2;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -16,9 +16,9 @@ public static unsafe class Gearsets
|
|||||||
|
|
||||||
private static readonly GearsetStats BaseStats = new(180, 0, 0);
|
private static readonly GearsetStats BaseStats = new(180, 0, 0);
|
||||||
|
|
||||||
public const int ParamCP = 11;
|
public const uint ParamCP = 11;
|
||||||
public const int ParamCraftsmanship = 70;
|
public const uint ParamCraftsmanship = 70;
|
||||||
public const int ParamControl = 71;
|
public const uint ParamControl = 71;
|
||||||
|
|
||||||
private static readonly int[] LevelToCLvlLUT;
|
private static readonly int[] LevelToCLvlLUT;
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ public static unsafe class Gearsets
|
|||||||
|
|
||||||
int cp = 0, craftsmanship = 0, control = 0;
|
int cp = 0, craftsmanship = 0, control = 0;
|
||||||
|
|
||||||
void IncreaseStat(int baseParam, int amount)
|
void IncreaseStat(uint baseParam, int amount)
|
||||||
{
|
{
|
||||||
if (baseParam == ParamCP)
|
if (baseParam == ParamCP)
|
||||||
cp += amount;
|
cp += amount;
|
||||||
@@ -77,11 +77,11 @@ public static unsafe class Gearsets
|
|||||||
control += amount;
|
control += amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var statIncrease in item.UnkData59)
|
foreach (var statIncrease in item.BaseParam.Zip(item.BaseParamValue))
|
||||||
IncreaseStat(statIncrease.BaseParam, statIncrease.BaseParamValue);
|
IncreaseStat(statIncrease.First.Row, statIncrease.Second);
|
||||||
if (gearsetItem.isHq)
|
if (gearsetItem.isHq)
|
||||||
foreach (var statIncrease in item.UnkData73)
|
foreach (var statIncrease in item.BaseParamSpecial.Zip(item.BaseParamValueSpecial))
|
||||||
IncreaseStat(statIncrease.BaseParamSpecial, statIncrease.BaseParamValueSpecial);
|
IncreaseStat(statIncrease.First.Row, statIncrease.Second);
|
||||||
|
|
||||||
foreach (var gearsetMateria in gearsetItem.materia)
|
foreach (var gearsetMateria in gearsetItem.materia)
|
||||||
{
|
{
|
||||||
@@ -89,7 +89,7 @@ public static unsafe class Gearsets
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
var materia = LuminaSheets.MateriaSheet.GetRow(gearsetMateria.Type)!;
|
var materia = LuminaSheets.MateriaSheet.GetRow(gearsetMateria.Type)!;
|
||||||
IncreaseStat((int)materia.BaseParam.Row, materia.Value[gearsetMateria.Grade]);
|
IncreaseStat(materia.BaseParam.Row, materia.Value[gearsetMateria.Grade]);
|
||||||
}
|
}
|
||||||
|
|
||||||
cp = Math.Min(cp, CalculateParamCap(item, ParamCP));
|
cp = Math.Min(cp, CalculateParamCap(item, ParamCP));
|
||||||
@@ -152,10 +152,10 @@ public static unsafe class Gearsets
|
|||||||
throw new ArgumentOutOfRangeException(nameof(level), level, "Level is out of range.");
|
throw new ArgumentOutOfRangeException(nameof(level), level, "Level is out of range.");
|
||||||
|
|
||||||
// https://github.com/ffxiv-teamcraft/ffxiv-teamcraft/blob/24d0db2d9676f264edf53651b21005305267c84c/apps/client/src/app/modules/gearsets/materia.service.ts#L265
|
// https://github.com/ffxiv-teamcraft/ffxiv-teamcraft/blob/24d0db2d9676f264edf53651b21005305267c84c/apps/client/src/app/modules/gearsets/materia.service.ts#L265
|
||||||
private static int CalculateParamCap(Item item, int paramId)
|
private static int CalculateParamCap(Item item, uint paramId)
|
||||||
{
|
{
|
||||||
var ilvl = item.LevelItem.Value!;
|
var ilvl = item.LevelItem.Value!;
|
||||||
var param = LuminaSheets.BaseParamSheet.GetRow((uint)paramId)!;
|
var param = LuminaSheets.BaseParamSheet.GetRow(paramId)!;
|
||||||
|
|
||||||
var baseValue = paramId switch
|
var baseValue = paramId switch
|
||||||
{
|
{
|
||||||
@@ -167,26 +167,27 @@ public static unsafe class Gearsets
|
|||||||
// https://github.com/ffxiv-teamcraft/ffxiv-teamcraft/blob/24d0db2d9676f264edf53651b21005305267c84c/apps/data-extraction/src/extractors/items.extractor.ts#L6
|
// https://github.com/ffxiv-teamcraft/ffxiv-teamcraft/blob/24d0db2d9676f264edf53651b21005305267c84c/apps/data-extraction/src/extractors/items.extractor.ts#L6
|
||||||
var slotMod = item.EquipSlotCategory.Row switch
|
var slotMod = item.EquipSlotCategory.Row switch
|
||||||
{
|
{
|
||||||
1 => param.oneHWpnPct,
|
1 => param.OneHandWeaponPercent, // column 4
|
||||||
2 => param.OHPct,
|
2 => param.OffHandPercent, // column 5
|
||||||
3 => param.HeadPct,
|
3 => param.HeadPercent, // ...
|
||||||
4 => param.ChestPct,
|
4 => param.ChestPercent,
|
||||||
5 => param.HandsPct,
|
5 => param.HandsPercent,
|
||||||
6 => param.WaistPct,
|
6 => param.WaistPercent,
|
||||||
7 => param.LegsPct,
|
7 => param.LegsPercent,
|
||||||
8 => param.FeetPct,
|
8 => param.FeetPercent,
|
||||||
9 => param.EarringPct,
|
9 => param.EarringPercent,
|
||||||
10 => param.NecklacePct,
|
10 => param.NecklacePercent,
|
||||||
11 => param.BraceletPct,
|
11 => param.BraceletPercent,
|
||||||
12 => param.RingPct,
|
12 => param.RingPercent,
|
||||||
13 => param.twoHWpnPct,
|
13 => param.TwoHandWeaponPercent,
|
||||||
14 => param.oneHWpnPct,
|
14 => param.OneHandWeaponPercent,
|
||||||
15 => param.ChestHeadPct,
|
15 => param.ChestHeadPercent,
|
||||||
16 => param.ChestHeadLegsFeetPct,
|
16 => param.ChestHeadLegsFeetPercent,
|
||||||
18 => param.LegsFeetPct,
|
17 => 0,
|
||||||
19 => param.HeadChestHandsLegsFeetPct,
|
18 => param.LegsFeetPercent,
|
||||||
20 => param.ChestLegsGlovesPct,
|
19 => param.HeadChestHandsLegsFeetPercent,
|
||||||
21 => param.ChestLegsFeetPct,
|
20 => param.ChestLegsGlovesPercent,
|
||||||
|
21 => param.ChestLegsFeetPercent,
|
||||||
_ => 0
|
_ => 0
|
||||||
};
|
};
|
||||||
var roleMod = param.MeldParam[item.BaseParamModifier];
|
var roleMod = param.MeldParam[item.BaseParamModifier];
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Craftimizer.Plugin;
|
using Craftimizer.Plugin;
|
||||||
using Craftimizer.Simulator;
|
using Craftimizer.Simulator;
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets2;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -47,30 +47,34 @@ public sealed record RecipeData
|
|||||||
};
|
};
|
||||||
|
|
||||||
CollectableThresholds = null;
|
CollectableThresholds = null;
|
||||||
switch (Recipe.Unknown45)
|
switch (Recipe.Unknown1)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
var data1 = LuminaSheets.CollectablesShopRefineSheet.GetRow(Recipe.Unknown46);
|
var data1 = LuminaSheets.CollectablesShopRefineSheet.GetRow(Recipe.Unknown0);
|
||||||
if (data1 == null)
|
if (data1 == null)
|
||||||
break;
|
break;
|
||||||
CollectableThresholds = new int?[] { data1.LowCollectability, data1.MidCollectability, data1.HighCollectability };
|
CollectableThresholds = new int?[] { data1.LowCollectability, data1.MidCollectability, data1.HighCollectability };
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
var data2 = LuminaSheets.HWDCrafterSupplySheet.GetRow(Recipe.Unknown46);
|
var data2 = LuminaSheets.HWDCrafterSupplySheet.GetRow(Recipe.Unknown0);
|
||||||
if (data2 == null)
|
if (data2 == null)
|
||||||
break;
|
break;
|
||||||
var idx = Array.FindIndex(data2.ItemTradeIn, i => i.Row == Recipe.ItemResult.Row);
|
foreach (var entry in data2.HWDCrafterSupplyParams)
|
||||||
if (idx == -1)
|
{
|
||||||
break;
|
if (entry.ItemTradeIn.Row == Recipe.ItemResult.Row)
|
||||||
CollectableThresholds = new int?[] { data2.BaseCollectableRating[idx], data2.MidCollectableRating[idx], data2.HighCollectableRating[idx] };
|
{
|
||||||
|
CollectableThresholds = new int?[] { entry.BaseCollectableRating, entry.MidCollectableRating, entry.HighCollectableRating };
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
var subRowCount = LuminaSheets.SatisfactionSupplySheet.GetSubRowCount(Recipe.Unknown46);
|
var subRowCount = LuminaSheets.SatisfactionSupplySheet.GetSubRowCount(Recipe.Unknown0);
|
||||||
if (subRowCount is not { } subRowValue)
|
if (subRowCount is not { } subRowValue)
|
||||||
break;
|
break;
|
||||||
for (uint i = 0; i < subRowValue; ++i)
|
for (uint i = 0; i < subRowValue; ++i)
|
||||||
{
|
{
|
||||||
var data3 = LuminaSheets.SatisfactionSupplySheet.GetRow(Recipe.Unknown46, i);
|
var data3 = LuminaSheets.SatisfactionSupplySheet.GetRow(Recipe.Unknown0, i);
|
||||||
if (data3 == null)
|
if (data3 == null)
|
||||||
continue;
|
continue;
|
||||||
if (data3.Item.Row == Recipe.ItemResult.Row)
|
if (data3.Item.Row == Recipe.ItemResult.Row)
|
||||||
@@ -81,7 +85,7 @@ public sealed record RecipeData
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
var data4 = LuminaSheets.SharlayanCraftWorksSupplySheet.GetRow(Recipe.Unknown46);
|
var data4 = LuminaSheets.SharlayanCraftWorksSupplySheet.GetRow(Recipe.Unknown0);
|
||||||
if (data4 == null)
|
if (data4 == null)
|
||||||
break;
|
break;
|
||||||
foreach (var item in data4.Items)
|
foreach (var item in data4.Items)
|
||||||
@@ -97,10 +101,11 @@ public sealed record RecipeData
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ingredients = Recipe.UnkData5.Take(6)
|
Ingredients = Recipe.Ingredient.Zip(Recipe.AmountIngredient)
|
||||||
.Where(i => i != null && i.ItemIngredient != 0)
|
.Take(6)
|
||||||
.Select(i => (LuminaSheets.ItemSheet.GetRow((uint)i.ItemIngredient)!, (int)i.AmountIngredient))
|
.Where(i => i.First.Value != null)
|
||||||
.Where(i => i.Item1 != null).ToList();
|
.Select(i => (i.First.Value!, (int)i.Second))
|
||||||
|
.ToList();
|
||||||
MaxStartingQuality = (int)Math.Floor(Recipe.MaterialQualityFactor * RecipeInfo.MaxQuality / 100f);
|
MaxStartingQuality = (int)Math.Floor(Recipe.MaterialQualityFactor * RecipeInfo.MaxQuality / 100f);
|
||||||
|
|
||||||
TotalHqILvls = (int)Ingredients.Where(i => i.Item.CanBeHq).Sum(i => i.Item.LevelItem.Row * i.Amount);
|
TotalHqILvls = (int)Ingredients.Where(i => i.Item.CanBeHq).Sum(i => i.Item.LevelItem.Row * i.Amount);
|
||||||
|
|||||||
@@ -1043,9 +1043,15 @@ public sealed unsafe class RecipeNote : Window, IDisposable
|
|||||||
var level = LuminaSheets.LevelSheet.GetRow(levelRowId) ??
|
var level = LuminaSheets.LevelSheet.GetRow(levelRowId) ??
|
||||||
throw new ArgumentNullException(nameof(levelRowId), $"Invalid level row {levelRowId}");
|
throw new ArgumentNullException(nameof(levelRowId), $"Invalid level row {levelRowId}");
|
||||||
var territory = level.Territory.Value!.PlaceName.Value!.Name.ToDalamudString().ToString();
|
var territory = level.Territory.Value!.PlaceName.Value!.Name.ToDalamudString().ToString();
|
||||||
var location = MapUtil.WorldToMap(new(level.X, level.Z), level.Map.Value!);
|
var location = WorldToMap2(new(level.X, level.Z), level.Map.Value!);
|
||||||
|
|
||||||
return (ResolveNpcResidentName(level.Object), territory, location, new(level.Territory.Row, level.Map.Row, location.X, location.Y));
|
return (ResolveNpcResidentName(level.Object.Row), territory, location, new(level.Territory.Row, level.Map.Row, location.X, location.Y));
|
||||||
|
}
|
||||||
|
|
||||||
|
// MapUtil.WorldToMap but for GeneratedSheets2
|
||||||
|
private static Vector2 WorldToMap2(Vector2 worldCoordinates, Lumina.Excel.GeneratedSheets2.Map map)
|
||||||
|
{
|
||||||
|
return MapUtil.WorldToMap(worldCoordinates, map.OffsetX, map.OffsetY, map.SizeFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string ResolveNpcResidentName(uint npcRowId)
|
private static string ResolveNpcResidentName(uint npcRowId)
|
||||||
|
|||||||
Reference in New Issue
Block a user