Compare commits

..

No commits in common. "master" and "master" have entirely different histories.

10 changed files with 102 additions and 114 deletions

View File

@ -1,6 +1,6 @@
<Project Sdk="Dalamud.NET.Sdk/11.0.0">
<Project Sdk="Dalamud.NET.Sdk/9.0.2">
<PropertyGroup>
<Version>6.0</Version>
<Version>5.5</Version>
<OutputPath>dist</OutputPath>
</PropertyGroup>

View File

@ -218,11 +218,11 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
{
if (CharacterConfiguration.CachedPlayerName != _clientState.LocalPlayer!.Name.ToString() ||
CharacterConfiguration.CachedWorldName !=
_clientState.LocalPlayer.HomeWorld.Value.Name.ToString())
_clientState.LocalPlayer.HomeWorld.GameData!.Name.ToString())
{
CharacterConfiguration.CachedPlayerName = _clientState.LocalPlayer!.Name.ToString();
CharacterConfiguration.CachedWorldName =
_clientState.LocalPlayer.HomeWorld.Value.Name.ToString();
_clientState.LocalPlayer.HomeWorld.GameData!.Name.ToString();
CharacterConfiguration.Save(_pluginInterface);
}
@ -242,7 +242,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
}
}
private void Logout(int type, int code)
private void Logout()
{
CharacterConfiguration = null;
}

View File

@ -1,12 +1,13 @@
using System.Data;
using System;
using System.Data;
using System.Diagnostics.CodeAnalysis;
using System.Text.RegularExpressions;
using Dalamud.Game.Text;
using Dalamud.Plugin.Services;
using LLib;
using Lumina.Excel;
using Lumina.Excel.Sheets;
using Lumina.Text.ReadOnly;
using Lumina.Excel.CustomSheets;
using Lumina.Excel.GeneratedSheets;
namespace Deliveroo.GameData;
@ -26,7 +27,7 @@ internal sealed class GameStrings
dataManager.GetString<Addon>(102434, addon => addon.Text, pluginLog)?.ReplaceLineEndings("")
?? throw new ConstraintException($"Unable to resolve {nameof(TradeHighQualityItem)}");
var rankUpFc = dataManager.GetExcelSheet<LogMessage>().GetRow(3123);
var rankUpFc = dataManager.GetExcelSheet<LogMessage>()!.GetRow(3123)!;
RankUpFc = rankUpFc.GetRegex(logMessage => logMessage.Text, pluginLog)
?? throw new ConstraintException($"Unable to resolve {nameof(RankUpFc)}");
RankUpFcType = (XivChatType)rankUpFc.LogKind;
@ -42,16 +43,7 @@ internal sealed class GameStrings
[Sheet("custom/000/ComDefGrandCompanyOfficer_00073")]
[SuppressMessage("Performance", "CA1812")]
private readonly struct ComDefGrandCompanyOfficer(ExcelPage page, uint offset, uint row)
: IQuestDialogueText, IExcelRow<ComDefGrandCompanyOfficer>
private sealed class ComDefGrandCompanyOfficer : QuestDialogueText
{
public uint RowId => row;
public ReadOnlySeString Key => page.ReadString(offset, offset);
public ReadOnlySeString Value => page.ReadString(offset + 4, offset);
static ComDefGrandCompanyOfficer IExcelRow<ComDefGrandCompanyOfficer>.Create(ExcelPage page, uint offset,
uint row) =>
new(page, offset, row);
}
}

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using Dalamud.Plugin.Services;
using Lumina.Excel.Sheets;
using Lumina.Excel.GeneratedSheets;
using GrandCompany = FFXIVClientStructs.FFXIV.Client.UI.Agent.GrandCompany;
namespace Deliveroo.GameData;
@ -10,32 +10,31 @@ internal sealed class GcRewardsCache
{
public GcRewardsCache(IDataManager dataManager)
{
var categories = dataManager.GetExcelSheet<GCScripShopCategory>()
var categories = dataManager.GetExcelSheet<GCScripShopCategory>()!
.Where(x => x.RowId > 0)
.ToDictionary(x => x.RowId,
x =>
(GrandCompany: (GrandCompany)x.GrandCompany.RowId,
(GrandCompany: (GrandCompany)x.GrandCompany.Row,
Tier: (RewardTier)x.Tier,
SubCategory: (RewardSubCategory)x.SubCategory));
Rewards = dataManager.GetSubrowExcelSheet<GCScripShopItem>()
.SelectMany(x => x)
.Where(x => x.RowId > 0 && x.Item.RowId > 0)
Rewards = dataManager.GetExcelSheet<GCScripShopItem>()!
.Where(x => x.RowId > 0 && x.Item.Row > 0)
.GroupBy(item =>
{
var category = categories[item.RowId];
return new
{
ItemId = item.Item.RowId,
Name = item.Item.Value.Name.ToString(),
IconId = item.Item.RowId == ItemIds.Venture ? 25917 : item.Item.Value.Icon,
ItemId = item.Item.Row,
Name = item.Item.Value!.Name.ToString(),
IconId = item.Item.Row == ItemIds.Venture ? 25917 : item.Item.Value!.Icon,
category.Tier,
category.SubCategory,
RequiredRank = item.RequiredGrandCompanyRank.RowId,
item.Item.Value.StackSize,
RequiredRank = item.RequiredGrandCompanyRank.Row,
item.Item!.Value.StackSize,
SealCost = item.CostGCSeals,
InventoryLimit = item.Item.Value.IsUnique ? 1
: item.Item.RowId == ItemIds.Venture ? item.Item.Value.StackSize
InventoryLimit = item.Item.Value!.IsUnique ? 1
: item.Item.Row == ItemIds.Venture ? item.Item.Value!.StackSize
: int.MaxValue,
};
})

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
using Dalamud.Plugin.Services;
using Lumina.Excel.Sheets;
using Lumina.Excel.GeneratedSheets;
namespace Deliveroo.GameData;
@ -10,7 +10,7 @@ internal sealed class ItemCache
public ItemCache(IDataManager dataManager)
{
foreach (var item in dataManager.GetExcelSheet<Item>())
foreach (var item in dataManager.GetExcelSheet<Item>()!)
{
string name = item.Name.ToString();
if (string.IsNullOrWhiteSpace(name))
@ -19,7 +19,7 @@ internal sealed class ItemCache
if (_itemNamesToIds.TryGetValue(name, out HashSet<uint>? itemIds))
itemIds.Add(item.RowId);
else
_itemNamesToIds.Add(name, [item.RowId]);
_itemNamesToIds.Add(name, new HashSet<uint>{item.RowId});
}
}

View File

@ -15,10 +15,8 @@ using FFXIVClientStructs.FFXIV.Client.Game.Control;
using FFXIVClientStructs.FFXIV.Client.Game.UI;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using FFXIVClientStructs.FFXIV.Common.Math;
using FFXIVClientStructs.FFXIV.Component.Excel;
using Lumina.Excel;
using Lumina.Excel.Sheets;
using Lumina.Text.ReadOnly;
using Lumina.Excel.GeneratedSheets;
using GrandCompany = FFXIVClientStructs.FFXIV.Client.UI.Agent.GrandCompany;
namespace Deliveroo;
@ -43,7 +41,7 @@ internal sealed class GameFunctions : IDisposable
_pluginLog = pluginLog;
_gcRankInfo = dataManager.GetExcelSheet<GrandCompanyRank>().Where(x => x.RowId > 0)
_gcRankInfo = dataManager.GetExcelSheet<GrandCompanyRank>()!.Where(x => x.RowId > 0)
.ToDictionary(x => x.RowId, x => new GcRankInfo
{
NameTwinAddersMale = ExtractRankName<GCRankGridaniaMaleText>(dataManager, x.RowId, r => r.Singular),
@ -55,7 +53,7 @@ internal sealed class GameFunctions : IDisposable
ExtractRankName<GCRankUldahFemaleText>(dataManager, x.RowId, r => r.Singular),
MaxSeals = x.MaxSeals,
RequiredSeals = x.RequiredSeals,
RequiredHuntingLog = x.Unknown0,
RequiredHuntingLog = x.Unknown10,
})
.AsReadOnly();
@ -63,14 +61,14 @@ internal sealed class GameFunctions : IDisposable
_clientState.TerritoryChanged += TerritoryChanged;
}
private static string ExtractRankName<T>(IDataManager dataManager, uint rankId, Func<T, ReadOnlySeString> func)
where T : struct, IExcelRow<T>
private static string ExtractRankName<T>(IDataManager dataManager, uint rankId, Func<T, Lumina.Text.SeString> func)
where T : ExcelRow
{
return func(dataManager.GetExcelSheet<T>().GetRow(rankId)).ToString();
return func(dataManager.GetExcelSheet<T>()!.GetRow(rankId)!).ToString();
}
private void Logout(int type, int code)
private void Logout()
{
_retainerItemCache.Clear();
}

View File

@ -103,66 +103,66 @@ internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
_configuration.ItemsAvailableToPurchase.Count == 1 && purchaseOption.ItemId == ItemIds.Venture);
var item = _itemLookup[purchaseOption.ItemId];
using (var icon = _iconCache.GetIcon(item.IconId))
var icon = _iconCache.GetIcon(item.IconId);
Vector2 pos = ImGui.GetCursorPos();
Vector2 iconSize = new Vector2(ImGui.GetTextLineHeight() + ImGui.GetStyle().ItemSpacing.Y);
icon.TryGetWrap(out IDalamudTextureWrap? wrap, out _);
if (wrap != null)
{
Vector2 pos = ImGui.GetCursorPos();
Vector2 iconSize = new Vector2(ImGui.GetTextLineHeight() + ImGui.GetStyle().ItemSpacing.Y);
ImGui.SetCursorPos(pos + new Vector2(iconSize.X + ImGui.GetStyle().FramePadding.X,
ImGui.GetStyle().ItemSpacing.Y / 2));
}
if (icon != null)
ImGui.Selectable($"{item.Name}{(item.Limited ? $" {SeIconChar.Hyadelyn.ToIconString()}" : "")}{(purchaseOption.SameQuantityForAllLists ? $" {((SeIconChar)57412).ToIconString()} (Limit: {purchaseOption.GlobalLimit:N0})" : "")}",
false, ImGuiSelectableFlags.SpanAllColumns);
if (ImGui.BeginDragDropSource())
{
ImGui.SetDragDropPayload("DeliverooDragDrop", nint.Zero, 0);
_dragDropSource = purchaseOption;
ImGui.EndDragDropSource();
}
if (ImGui.BeginDragDropTarget())
{
if (_dragDropSource != null &&
ImGui.AcceptDragDropPayload("DeliverooDragDrop").NativePtr != null)
{
ImGui.SetCursorPos(pos + new Vector2(iconSize.X + ImGui.GetStyle().FramePadding.X,
ImGui.GetStyle().ItemSpacing.Y / 2));
itemToAdd = _dragDropSource;
indexToAdd = i;
_dragDropSource = null;
}
ImGui.Selectable(
$"{item.Name}{(item.Limited ? $" {SeIconChar.Hyadelyn.ToIconString()}" : "")}{(purchaseOption.SameQuantityForAllLists ? $" {((SeIconChar)57412).ToIconString()} (Limit: {purchaseOption.GlobalLimit:N0})" : "")}",
false, ImGuiSelectableFlags.SpanAllColumns);
ImGui.EndDragDropTarget();
}
if (ImGui.BeginDragDropSource())
ImGui.OpenPopupOnItemClick($"###ctx{i}", ImGuiPopupFlags.MouseButtonRight);
if (ImGui.BeginPopup($"###ctx{i}"))
{
bool sameQuantityForAllLists = purchaseOption.SameQuantityForAllLists;
if (ImGui.MenuItem("Use same quantity for global and character-specific lists", null,
ref sameQuantityForAllLists))
{
ImGui.SetDragDropPayload("DeliverooDragDrop", nint.Zero, 0);
_dragDropSource = purchaseOption;
ImGui.EndDragDropSource();
purchaseOption.SameQuantityForAllLists = sameQuantityForAllLists;
Save();
}
if (ImGui.BeginDragDropTarget())
{
if (_dragDropSource != null &&
ImGui.AcceptDragDropPayload("DeliverooDragDrop").NativePtr != null)
{
itemToAdd = _dragDropSource;
indexToAdd = i;
if (ImGui.MenuItem($"Remove {_itemLookup[purchaseOption.ItemId].Name}"))
itemToRemove = purchaseOption;
_dragDropSource = null;
}
ImGui.EndPopup();
}
ImGui.EndDragDropTarget();
}
if (wrap != null)
{
ImGui.SameLine(0, 0);
ImGui.SetCursorPos(pos);
ImGui.Image(wrap.ImGuiHandle, iconSize);
ImGui.OpenPopupOnItemClick($"###ctx{i}", ImGuiPopupFlags.MouseButtonRight);
if (ImGui.BeginPopup($"###ctx{i}"))
{
bool sameQuantityForAllLists = purchaseOption.SameQuantityForAllLists;
if (ImGui.MenuItem("Use same quantity for global and character-specific lists", null,
ref sameQuantityForAllLists))
{
purchaseOption.SameQuantityForAllLists = sameQuantityForAllLists;
Save();
}
if (ImGui.MenuItem($"Remove {_itemLookup[purchaseOption.ItemId].Name}"))
itemToRemove = purchaseOption;
ImGui.EndPopup();
}
if (icon != null)
{
ImGui.SameLine(0, 0);
ImGui.SetCursorPos(pos);
ImGui.Image(icon.ImGuiHandle, iconSize);
}
wrap.Dispose();
}
ImGui.EndDisabled();
@ -202,14 +202,14 @@ internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
foreach (var item in comboValues.Where(x =>
x.Name.Contains(_searchString, StringComparison.OrdinalIgnoreCase)))
{
using (var icon = _iconCache.GetIcon(item.IconId))
var icon = _iconCache.GetIcon(item.IconId);
if (icon.TryGetWrap(out IDalamudTextureWrap? wrap, out _))
{
if (icon != null)
{
ImGui.Image(icon.ImGuiHandle, new Vector2(ImGui.GetFrameHeight()));
ImGui.SameLine();
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + ImGui.GetStyle().FramePadding.X);
}
ImGui.Image(wrap.ImGuiHandle, new Vector2(ImGui.GetFrameHeight()));
ImGui.SameLine();
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + ImGui.GetStyle().FramePadding.X);
wrap.Dispose();
}
bool addThis =
@ -217,8 +217,7 @@ internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
$"{item.Name}{(item.Limited ? $" {SeIconChar.Hyadelyn.ToIconString()}" : "")}##SelectVenture{item.IconId}");
if (addThis || addFirst)
{
_configuration.ItemsAvailableToPurchase.Add(new Configuration.PurchaseOption
{ ItemId = item.ItemId });
_configuration.ItemsAvailableToPurchase.Add(new Configuration.PurchaseOption { ItemId = item.ItemId });
if (addFirst)
{
@ -244,7 +243,7 @@ internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
if (_clientState is { IsLoggedIn: true, LocalContentId: > 0 })
{
string currentCharacterName = _clientState.LocalPlayer!.Name.ToString();
string currentWorldName = _clientState.LocalPlayer.HomeWorld.Value.Name.ToString();
string currentWorldName = _clientState.LocalPlayer.HomeWorld.GameData!.Name.ToString();
ImGui.Text($"Current Character: {currentCharacterName} @ {currentWorldName}");
ImGui.Spacing();
ImGui.Separator();

View File

@ -126,7 +126,7 @@ internal sealed class TurnInWindow : LWindow, IPersistableWindowConfig
private bool IsOnHomeWorld =>
_clientState.LocalPlayer == null ||
_clientState.LocalPlayer.HomeWorld.RowId == _clientState.LocalPlayer.CurrentWorld.RowId;
_clientState.LocalPlayer.HomeWorld.Id == _clientState.LocalPlayer.CurrentWorld.Id;
private IItemsToPurchase ItemsWrapper => UseCharacterSpecificItemsToPurchase
? new CharacterSpecificItemsToPurchase(_plugin.CharacterConfiguration!, _pluginInterface)
@ -516,13 +516,13 @@ internal sealed class TurnInWindow : LWindow, IPersistableWindowConfig
}
var comboItem = comboValues[comboValueIndex];
using (var icon = _iconCache.GetIcon(comboItem.Item.IconId))
var icon = _iconCache.GetIcon(comboItem.Item.IconId);
if (icon.TryGetWrap(out IDalamudTextureWrap? wrap, out _))
{
if (icon != null)
{
ImGui.Image(icon.ImGuiHandle, new Vector2(ImGui.GetFrameHeight()));
ImGui.SameLine(0, 3);
}
ImGui.Image(wrap.ImGuiHandle, new Vector2(ImGui.GetFrameHeight()));
ImGui.SameLine(0, 3);
wrap.Dispose();
}
indentX = ImGui.GetCursorPosX() - indentX;

View File

@ -4,9 +4,9 @@
"net8.0-windows7.0": {
"DalamudPackager": {
"type": "Direct",
"requested": "[11.0.0, )",
"resolved": "11.0.0",
"contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA=="
"requested": "[2.1.13, )",
"resolved": "2.1.13",
"contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ=="
},
"DotNet.ReproducibleBuilds": {
"type": "Direct",
@ -79,7 +79,7 @@
"llib": {
"type": "Project",
"dependencies": {
"DalamudPackager": "[11.0.0, )"
"DalamudPackager": "[2.1.13, )"
}
}
}

2
LLib

@ -1 +1 @@
Subproject commit 538329a1e80acbcd09e28bd6dd459c35b5563c0a
Subproject commit 7027d291efbbff6a55944dd521d3907210ddecbe