forked from liza/Workshoppa
API 11
This commit is contained in:
parent
e93819da5b
commit
3eda727219
2
LLib
2
LLib
@ -1 +1 @@
|
||||
Subproject commit fde09c705b648f03c287814191a554f0a4b92cc4
|
||||
Subproject commit e4bbc05ede6f6f01e7028b24614ed8cb333e909c
|
@ -4,8 +4,8 @@ using System.Text.RegularExpressions;
|
||||
using Dalamud.Plugin.Services;
|
||||
using LLib;
|
||||
using Lumina.Excel;
|
||||
using Lumina.Excel.CustomSheets;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Lumina.Excel.Sheets;
|
||||
using Lumina.Text.ReadOnly;
|
||||
|
||||
namespace Workshoppa.GameData;
|
||||
|
||||
@ -38,7 +38,16 @@ internal sealed class GameStrings
|
||||
|
||||
[Sheet("custom/001/CmnDefCompanyManufactory_00150")]
|
||||
[SuppressMessage("Performance", "CA1812")]
|
||||
private sealed class WorkshopDialogue : QuestDialogueText
|
||||
private readonly struct WorkshopDialogue(ExcelPage page, uint offset, uint row)
|
||||
: IQuestDialogueText, IExcelRow<WorkshopDialogue>
|
||||
{
|
||||
public uint RowId => row;
|
||||
|
||||
public ReadOnlySeString Key => page.ReadString(offset, offset);
|
||||
public ReadOnlySeString Value => page.ReadString(offset + 4, offset);
|
||||
|
||||
static WorkshopDialogue IExcelRow<WorkshopDialogue>.Create(ExcelPage page, uint offset,
|
||||
uint row) =>
|
||||
new(page, offset, row);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Lumina.Excel.GeneratedSheets2;
|
||||
using Lumina.Excel.Sheets;
|
||||
|
||||
namespace Workshoppa.GameData;
|
||||
|
||||
@ -31,9 +31,10 @@ internal sealed class RecipeTree
|
||||
262211, // Z'ranmaia, upper decks
|
||||
};
|
||||
|
||||
_shopItemsOnly = _dataManager.GetExcelSheet<GilShopItem>()!
|
||||
_shopItemsOnly = _dataManager.GetSubrowExcelSheet<GilShopItem>()
|
||||
.Flatten()
|
||||
.Where(x => shopVendorIds.Contains(x.RowId))
|
||||
.Select(x => x.Item.Row)
|
||||
.Select(x => x.Item.RowId)
|
||||
.Where(x => x > 0)
|
||||
.Distinct()
|
||||
.ToList()
|
||||
@ -121,32 +122,32 @@ internal sealed class RecipeTree
|
||||
|
||||
for (int i = 0; i < 8; ++ i)
|
||||
{
|
||||
var ingredient = recipe.Ingredient[i];
|
||||
if (ingredient == null || ingredient.Row == 0)
|
||||
var ingredient = recipe.Value.Ingredient[i];
|
||||
if (!ingredient.IsValid || ingredient.RowId == 0)
|
||||
continue;
|
||||
|
||||
Item? item = ingredient.Value;
|
||||
if (item == null || !IsValidItem(item.RowId))
|
||||
Item item = ingredient.Value;
|
||||
if (!IsValidItem(item.RowId))
|
||||
continue;
|
||||
|
||||
Recipe? ingredientRecipe = GetFirstRecipeForItem(ingredient.Row);
|
||||
Recipe? ingredientRecipe = GetFirstRecipeForItem(ingredient.RowId);
|
||||
|
||||
//_pluginLog.Information($"Adding {item.Name}");
|
||||
ingredients.Add(new RecipeInfo
|
||||
{
|
||||
ItemId = ingredient.Row,
|
||||
Name = item.Name,
|
||||
TotalQuantity = material.TotalQuantity * recipe.AmountIngredient[i],
|
||||
ItemId = ingredient.RowId,
|
||||
Name = item.Name.ToString(),
|
||||
TotalQuantity = material.TotalQuantity * recipe.Value.AmountIngredient[i],
|
||||
Type =
|
||||
_shopItemsOnly.Contains(ingredient.Row) ? Ingredient.EType.ShopItem :
|
||||
_shopItemsOnly.Contains(ingredient.RowId) ? Ingredient.EType.ShopItem :
|
||||
ingredientRecipe != null ? Ingredient.EType.Craftable :
|
||||
GetGatheringItem(ingredient.Row) != null ? Ingredient.EType.Gatherable :
|
||||
GetVentureItem(ingredient.Row) != null ? Ingredient.EType.Gatherable :
|
||||
GetGatheringItem(ingredient.RowId) != null ? Ingredient.EType.Gatherable :
|
||||
GetVentureItem(ingredient.RowId) != null ? Ingredient.EType.Gatherable :
|
||||
Ingredient.EType.Other,
|
||||
|
||||
AmountCrafted = ingredientRecipe?.AmountResult ?? 1,
|
||||
DependsOn = ingredientRecipe?.Ingredient.Where(x => x != null && IsValidItem(x.Row))
|
||||
.Select(x => x.Row)
|
||||
DependsOn = ingredientRecipe?.Ingredient.Where(x => x.IsValid && IsValidItem(x.RowId))
|
||||
.Select(x => x.RowId)
|
||||
.ToList()
|
||||
?? new(),
|
||||
});
|
||||
@ -170,9 +171,9 @@ internal sealed class RecipeTree
|
||||
Name = x.Ingredient.Name,
|
||||
TotalQuantity = x.Ingredient.TotalQuantity,
|
||||
Type = _shopItemsOnly.Contains(x.Ingredient.ItemId) ? Ingredient.EType.ShopItem : x.Ingredient.Type,
|
||||
AmountCrafted = x.Recipe!.AmountResult,
|
||||
DependsOn = x.Recipe.Ingredient.Where(y => y != null && IsValidItem(y.Row))
|
||||
.Select(y => y.Row)
|
||||
AmountCrafted = x.Recipe!.Value.AmountResult,
|
||||
DependsOn = x.Recipe.Value.Ingredient.Where(y => y.IsValid && IsValidItem(y.RowId))
|
||||
.Select(y => y.RowId)
|
||||
.ToList(),
|
||||
})
|
||||
.ToList();
|
||||
@ -180,18 +181,18 @@ internal sealed class RecipeTree
|
||||
|
||||
private Recipe? GetFirstRecipeForItem(uint itemId)
|
||||
{
|
||||
return _dataManager.GetExcelSheet<Recipe>()!.FirstOrDefault(x => x.RowId > 0 && x.ItemResult.Row == itemId);
|
||||
return _dataManager.GetExcelSheet<Recipe>().FirstOrDefault(x => x.RowId > 0 && x.ItemResult.RowId == itemId);
|
||||
}
|
||||
|
||||
private GatheringItem? GetGatheringItem(uint itemId)
|
||||
{
|
||||
return _dataManager.GetExcelSheet<GatheringItem>()!.FirstOrDefault(x => x.RowId > 0 && x.Item.Row == itemId);
|
||||
return _dataManager.GetExcelSheet<GatheringItem>().FirstOrDefault(x => x.RowId > 0 && x.Item.RowId == itemId);
|
||||
}
|
||||
|
||||
private RetainerTaskNormal? GetVentureItem(uint itemId)
|
||||
{
|
||||
return _dataManager.GetExcelSheet<RetainerTaskNormal>()!
|
||||
.FirstOrDefault(x => x.RowId > 0 && x.Item.Row == itemId);
|
||||
return _dataManager.GetExcelSheet<RetainerTaskNormal>()
|
||||
.FirstOrDefault(x => x.RowId > 0 && x.Item.RowId == itemId);
|
||||
}
|
||||
|
||||
private static bool IsValidItem(uint itemId)
|
||||
|
@ -1,9 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Lumina.Excel.Sheets;
|
||||
|
||||
namespace Workshoppa.GameData;
|
||||
|
||||
@ -15,41 +16,45 @@ internal sealed class WorkshopCache
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<ushort, Item> itemMapping = dataManager.GetExcelSheet<CompanyCraftSupplyItem>()!
|
||||
Dictionary<uint, Item> itemMapping = dataManager.GetExcelSheet<CompanyCraftSupplyItem>()
|
||||
.Where(x => x.RowId > 0)
|
||||
.ToDictionary(x => (ushort)x.RowId, x => x.Item.Value!);
|
||||
.ToDictionary(x => x.RowId, x => x.Item.Value);
|
||||
|
||||
Crafts = dataManager.GetExcelSheet<CompanyCraftSequence>()!
|
||||
Crafts = dataManager.GetExcelSheet<CompanyCraftSequence>()
|
||||
.Where(x => x.RowId > 0)
|
||||
.Select(x => new WorkshopCraft
|
||||
{
|
||||
WorkshopItemId = x.RowId,
|
||||
ResultItem = x.ResultItem.Row,
|
||||
Name = x.ResultItem.Value!.Name.ToString(),
|
||||
IconId = x.ResultItem.Value!.Icon,
|
||||
Category = (WorkshopCraftCategory)x.CompanyCraftDraftCategory.Row,
|
||||
Type = x.CompanyCraftType.Row,
|
||||
Phases = x.CompanyCraftPart.Where(part => part.Row != 0)
|
||||
ResultItem = x.ResultItem.RowId,
|
||||
Name = x.ResultItem.Value.Name.ToString(),
|
||||
IconId = x.ResultItem.Value.Icon,
|
||||
Category = (WorkshopCraftCategory)x.CompanyCraftDraftCategory.RowId,
|
||||
Type = x.CompanyCraftType.RowId,
|
||||
Phases = x.CompanyCraftPart.Where(part => part.RowId != 0)
|
||||
.SelectMany(part =>
|
||||
part.Value!.CompanyCraftProcess
|
||||
.Where(y => y.Value!.UnkData0.Any(z => z.SupplyItem > 0))
|
||||
.Select(y => (Type: part.Value!.CompanyCraftType.Value, Process: y)))
|
||||
part.Value.CompanyCraftProcess
|
||||
.Select(y => new WorkshopCraftPhase
|
||||
{
|
||||
Name = y.Type!.Name.ToString(),
|
||||
Items = y.Process.Value!.UnkData0
|
||||
.Where(item => item.SupplyItem > 0)
|
||||
Name = part.Value.CompanyCraftType.Value.Name.ToString(),
|
||||
Items = Enumerable.Range(0, y.Value.SupplyItem.Count)
|
||||
.Select(i => new
|
||||
{
|
||||
SupplyItem = y.Value.SupplyItem[i],
|
||||
SetsRequired = y.Value.SetsRequired[i],
|
||||
SetQuantity = y.Value.SetQuantity[i],
|
||||
})
|
||||
.Where(item => item.SupplyItem.RowId > 0)
|
||||
.Select(item => new WorkshopCraftItem
|
||||
{
|
||||
ItemId = itemMapping[item.SupplyItem].RowId,
|
||||
Name = itemMapping[item.SupplyItem].Name.ToString(),
|
||||
IconId = itemMapping[item.SupplyItem].Icon,
|
||||
ItemId = itemMapping[item.SupplyItem.RowId].RowId,
|
||||
Name = itemMapping[item.SupplyItem.RowId].Name.ToString(),
|
||||
IconId = itemMapping[item.SupplyItem.RowId].Icon,
|
||||
SetQuantity = item.SetQuantity,
|
||||
SetsRequired = item.SetsRequired,
|
||||
})
|
||||
.ToList()
|
||||
.AsReadOnly(),
|
||||
})
|
||||
}))
|
||||
.ToList()
|
||||
.AsReadOnly(),
|
||||
})
|
||||
|
@ -70,7 +70,7 @@ internal sealed class MainWindow : LWindow, IPersistableWindowConfig
|
||||
public ButtonState State { get; set; } = ButtonState.None;
|
||||
|
||||
private bool IsDiscipleOfHand =>
|
||||
_clientState.LocalPlayer != null && _clientState.LocalPlayer.ClassJob.Id is >= 8 and <= 15;
|
||||
_clientState.LocalPlayer != null && _clientState.LocalPlayer.ClassJob.RowId is >= 8 and <= 15;
|
||||
|
||||
public WindowConfig WindowConfig => _configuration.MainWindowConfig;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Dalamud.NET.Sdk/9.0.2">
|
||||
<Project Sdk="Dalamud.NET.Sdk/11.0.0">
|
||||
<PropertyGroup>
|
||||
<Version>6.2</Version>
|
||||
<Version>7.0</Version>
|
||||
<OutputPath>dist</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -4,9 +4,9 @@
|
||||
"net8.0-windows7.0": {
|
||||
"DalamudPackager": {
|
||||
"type": "Direct",
|
||||
"requested": "[2.1.13, )",
|
||||
"resolved": "2.1.13",
|
||||
"contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ=="
|
||||
"requested": "[11.0.0, )",
|
||||
"resolved": "11.0.0",
|
||||
"contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA=="
|
||||
},
|
||||
"DotNet.ReproducibleBuilds": {
|
||||
"type": "Direct",
|
||||
@ -79,7 +79,7 @@
|
||||
"llib": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"DalamudPackager": "[2.1.13, )"
|
||||
"DalamudPackager": "[11.0.0, )"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user