mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Fix changed item event.
This commit is contained in:
parent
e72479c046
commit
387b6da4d5
1 changed files with 19 additions and 5 deletions
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using Dalamud.Data;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Penumbra.Api.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
using Action = Lumina.Excel.GeneratedSheets.Action;
|
||||
|
||||
namespace Penumbra.GameData.Enums;
|
||||
|
|
@ -10,10 +12,22 @@ public static class ChangedItemExtensions
|
|||
{
|
||||
return item switch
|
||||
{
|
||||
null => (ChangedItemType.None, 0),
|
||||
EquipItem i => (ChangedItemType.Item, i.Id),
|
||||
Action a => (ChangedItemType.Action, a.RowId),
|
||||
_ => (ChangedItemType.Customization, 0),
|
||||
null => (ChangedItemType.None, 0),
|
||||
Item i => (ChangedItemType.Item, i.RowId),
|
||||
Action a => (ChangedItemType.Action, a.RowId),
|
||||
_ => (ChangedItemType.Customization, 0),
|
||||
};
|
||||
}
|
||||
|
||||
public static object? GetObject(this ChangedItemType type, DataManager manager, uint id)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
ChangedItemType.None => null,
|
||||
ChangedItemType.Item => manager.GetExcelSheet<Item>()?.GetRow(id),
|
||||
ChangedItemType.Action => manager.GetExcelSheet<Action>()?.GetRow(id),
|
||||
ChangedItemType.Customization => null,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue