Change to GeneratedSheets2
This commit is contained in:
@@ -2,10 +2,10 @@ using Dalamud;
|
||||
using Lumina;
|
||||
using Lumina.Data;
|
||||
using Lumina.Excel;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using System;
|
||||
using Lumina.Excel.GeneratedSheets2;
|
||||
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;
|
||||
|
||||
|
||||
@@ -6,17 +6,17 @@ using Dalamud.Utility;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Lumina.Excel.GeneratedSheets2;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using Action = Lumina.Excel.GeneratedSheets.Action;
|
||||
using Action = Lumina.Excel.GeneratedSheets2.Action;
|
||||
using ActionType = Craftimizer.Simulator.Actions.ActionType;
|
||||
using ClassJob = Craftimizer.Simulator.ClassJob;
|
||||
using Condition = Craftimizer.Simulator.Condition;
|
||||
using Status = Lumina.Excel.GeneratedSheets.Status;
|
||||
using Status = Lumina.Excel.GeneratedSheets2.Status;
|
||||
|
||||
namespace Craftimizer.Plugin;
|
||||
|
||||
@@ -156,7 +156,7 @@ internal static class ClassJobUtils
|
||||
PlayerState.Instance()->ClassJobLevelArray[me.GetExpArrayIdx()];
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Craftimizer.Plugin;
|
||||
using Craftimizer.Plugin.Utils;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Lumina.Excel.GeneratedSheets2;
|
||||
using System.Collections.Frozen;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
@@ -68,7 +68,7 @@ public static class FoodStatus
|
||||
if (stat.BaseParam == 0)
|
||||
continue;
|
||||
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.ParamControl: control = foodStat; break;
|
||||
|
||||
@@ -3,7 +3,7 @@ using Dalamud.Utility;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Lumina.Excel.GeneratedSheets2;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
@@ -16,9 +16,9 @@ public static unsafe class Gearsets
|
||||
|
||||
private static readonly GearsetStats BaseStats = new(180, 0, 0);
|
||||
|
||||
public const int ParamCP = 11;
|
||||
public const int ParamCraftsmanship = 70;
|
||||
public const int ParamControl = 71;
|
||||
public const uint ParamCP = 11;
|
||||
public const uint ParamCraftsmanship = 70;
|
||||
public const uint ParamControl = 71;
|
||||
|
||||
private static readonly int[] LevelToCLvlLUT;
|
||||
|
||||
@@ -67,7 +67,7 @@ public static unsafe class Gearsets
|
||||
|
||||
int cp = 0, craftsmanship = 0, control = 0;
|
||||
|
||||
void IncreaseStat(int baseParam, int amount)
|
||||
void IncreaseStat(uint baseParam, int amount)
|
||||
{
|
||||
if (baseParam == ParamCP)
|
||||
cp += amount;
|
||||
@@ -77,11 +77,11 @@ public static unsafe class Gearsets
|
||||
control += amount;
|
||||
}
|
||||
|
||||
foreach (var statIncrease in item.UnkData59)
|
||||
IncreaseStat(statIncrease.BaseParam, statIncrease.BaseParamValue);
|
||||
foreach (var statIncrease in item.BaseParam.Zip(item.BaseParamValue))
|
||||
IncreaseStat(statIncrease.First.Row, statIncrease.Second);
|
||||
if (gearsetItem.isHq)
|
||||
foreach (var statIncrease in item.UnkData73)
|
||||
IncreaseStat(statIncrease.BaseParamSpecial, statIncrease.BaseParamValueSpecial);
|
||||
foreach (var statIncrease in item.BaseParamSpecial.Zip(item.BaseParamValueSpecial))
|
||||
IncreaseStat(statIncrease.First.Row, statIncrease.Second);
|
||||
|
||||
foreach (var gearsetMateria in gearsetItem.materia)
|
||||
{
|
||||
@@ -89,7 +89,7 @@ public static unsafe class Gearsets
|
||||
continue;
|
||||
|
||||
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));
|
||||
@@ -152,10 +152,10 @@ public static unsafe class Gearsets
|
||||
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
|
||||
private static int CalculateParamCap(Item item, int paramId)
|
||||
private static int CalculateParamCap(Item item, uint paramId)
|
||||
{
|
||||
var ilvl = item.LevelItem.Value!;
|
||||
var param = LuminaSheets.BaseParamSheet.GetRow((uint)paramId)!;
|
||||
var param = LuminaSheets.BaseParamSheet.GetRow(paramId)!;
|
||||
|
||||
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
|
||||
var slotMod = item.EquipSlotCategory.Row switch
|
||||
{
|
||||
1 => param.oneHWpnPct,
|
||||
2 => param.OHPct,
|
||||
3 => param.HeadPct,
|
||||
4 => param.ChestPct,
|
||||
5 => param.HandsPct,
|
||||
6 => param.WaistPct,
|
||||
7 => param.LegsPct,
|
||||
8 => param.FeetPct,
|
||||
9 => param.EarringPct,
|
||||
10 => param.NecklacePct,
|
||||
11 => param.BraceletPct,
|
||||
12 => param.RingPct,
|
||||
13 => param.twoHWpnPct,
|
||||
14 => param.oneHWpnPct,
|
||||
15 => param.ChestHeadPct,
|
||||
16 => param.ChestHeadLegsFeetPct,
|
||||
18 => param.LegsFeetPct,
|
||||
19 => param.HeadChestHandsLegsFeetPct,
|
||||
20 => param.ChestLegsGlovesPct,
|
||||
21 => param.ChestLegsFeetPct,
|
||||
1 => param.OneHandWeaponPercent, // column 4
|
||||
2 => param.OffHandPercent, // column 5
|
||||
3 => param.HeadPercent, // ...
|
||||
4 => param.ChestPercent,
|
||||
5 => param.HandsPercent,
|
||||
6 => param.WaistPercent,
|
||||
7 => param.LegsPercent,
|
||||
8 => param.FeetPercent,
|
||||
9 => param.EarringPercent,
|
||||
10 => param.NecklacePercent,
|
||||
11 => param.BraceletPercent,
|
||||
12 => param.RingPercent,
|
||||
13 => param.TwoHandWeaponPercent,
|
||||
14 => param.OneHandWeaponPercent,
|
||||
15 => param.ChestHeadPercent,
|
||||
16 => param.ChestHeadLegsFeetPercent,
|
||||
17 => 0,
|
||||
18 => param.LegsFeetPercent,
|
||||
19 => param.HeadChestHandsLegsFeetPercent,
|
||||
20 => param.ChestLegsGlovesPercent,
|
||||
21 => param.ChestLegsFeetPercent,
|
||||
_ => 0
|
||||
};
|
||||
var roleMod = param.MeldParam[item.BaseParamModifier];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Craftimizer.Plugin;
|
||||
using Craftimizer.Simulator;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Lumina.Excel.GeneratedSheets2;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -47,30 +47,34 @@ public sealed record RecipeData
|
||||
};
|
||||
|
||||
CollectableThresholds = null;
|
||||
switch (Recipe.Unknown45)
|
||||
switch (Recipe.Unknown1)
|
||||
{
|
||||
case 1:
|
||||
var data1 = LuminaSheets.CollectablesShopRefineSheet.GetRow(Recipe.Unknown46);
|
||||
var data1 = LuminaSheets.CollectablesShopRefineSheet.GetRow(Recipe.Unknown0);
|
||||
if (data1 == null)
|
||||
break;
|
||||
CollectableThresholds = new int?[] { data1.LowCollectability, data1.MidCollectability, data1.HighCollectability };
|
||||
break;
|
||||
case 2:
|
||||
var data2 = LuminaSheets.HWDCrafterSupplySheet.GetRow(Recipe.Unknown46);
|
||||
var data2 = LuminaSheets.HWDCrafterSupplySheet.GetRow(Recipe.Unknown0);
|
||||
if (data2 == null)
|
||||
break;
|
||||
var idx = Array.FindIndex(data2.ItemTradeIn, i => i.Row == Recipe.ItemResult.Row);
|
||||
if (idx == -1)
|
||||
foreach (var entry in data2.HWDCrafterSupplyParams)
|
||||
{
|
||||
if (entry.ItemTradeIn.Row == Recipe.ItemResult.Row)
|
||||
{
|
||||
CollectableThresholds = new int?[] { entry.BaseCollectableRating, entry.MidCollectableRating, entry.HighCollectableRating };
|
||||
break;
|
||||
CollectableThresholds = new int?[] { data2.BaseCollectableRating[idx], data2.MidCollectableRating[idx], data2.HighCollectableRating[idx] };
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
var subRowCount = LuminaSheets.SatisfactionSupplySheet.GetSubRowCount(Recipe.Unknown46);
|
||||
var subRowCount = LuminaSheets.SatisfactionSupplySheet.GetSubRowCount(Recipe.Unknown0);
|
||||
if (subRowCount is not { } subRowValue)
|
||||
break;
|
||||
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)
|
||||
continue;
|
||||
if (data3.Item.Row == Recipe.ItemResult.Row)
|
||||
@@ -81,7 +85,7 @@ public sealed record RecipeData
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
var data4 = LuminaSheets.SharlayanCraftWorksSupplySheet.GetRow(Recipe.Unknown46);
|
||||
var data4 = LuminaSheets.SharlayanCraftWorksSupplySheet.GetRow(Recipe.Unknown0);
|
||||
if (data4 == null)
|
||||
break;
|
||||
foreach (var item in data4.Items)
|
||||
@@ -97,10 +101,11 @@ public sealed record RecipeData
|
||||
break;
|
||||
}
|
||||
|
||||
Ingredients = Recipe.UnkData5.Take(6)
|
||||
.Where(i => i != null && i.ItemIngredient != 0)
|
||||
.Select(i => (LuminaSheets.ItemSheet.GetRow((uint)i.ItemIngredient)!, (int)i.AmountIngredient))
|
||||
.Where(i => i.Item1 != null).ToList();
|
||||
Ingredients = Recipe.Ingredient.Zip(Recipe.AmountIngredient)
|
||||
.Take(6)
|
||||
.Where(i => i.First.Value != null)
|
||||
.Select(i => (i.First.Value!, (int)i.Second))
|
||||
.ToList();
|
||||
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);
|
||||
|
||||
@@ -1043,9 +1043,15 @@ public sealed unsafe class RecipeNote : Window, IDisposable
|
||||
var level = LuminaSheets.LevelSheet.GetRow(levelRowId) ??
|
||||
throw new ArgumentNullException(nameof(levelRowId), $"Invalid level row {levelRowId}");
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user