Track InventoryNotifications
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAgentInventory_002Ecs_002Fl_003AC_0021_003FUsers_003FJeffro_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F9e458ae8a124476099a99b081d71ce27826848_003F26_003F0a847424_003FAgentInventory_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAgentSatisfactionSupply_002Ecs_002Fl_003AC_0021_003FUsers_003FJeffro_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb2cd0663609440e590f52980cafc1ba3822648_003F28_003Ffa48b62e_003FAgentSatisfactionSupply_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAgentUpdateFlag_002Ecs_002Fl_003AC_0021_003FUsers_003FJeffro_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003F7097e6bfd2288e8ff8dacc8d1e21863898453e58b9546b9752e0c0a5bed4dc_003FAgentUpdateFlag_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAtkValue_002Ecs_002Fl_003AC_0021_003FUsers_003FJeffro_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003F1b966bf9f0d5b3eb39a7ee3ff6ab5c83f5bea8a841eafd7c8a1e55532d2d952_003FAtkValue_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACurrencyManager_002Ecs_002Fl_003AC_0021_003FUsers_003FJeffro_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fe66db7cd515142b9bbfb1b4e18f82ace825448_003Ffc_003F78df30c7_003FCurrencyManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AInventoryItem_002Ecs_002Fl_003AC_0021_003FUsers_003FJeffro_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F9e458ae8a124476099a99b081d71ce27826848_003F6f_003Ffa56b446_003FInventoryItem_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
|
||||
@@ -9,6 +9,7 @@ using AetherBags.Nodes.Inventory;
|
||||
using AetherBags.Nodes.Layout;
|
||||
using Dalamud.Game.Addon.Lifecycle;
|
||||
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
|
||||
using Dalamud.Game.Gui;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
using KamiToolKit;
|
||||
@@ -22,6 +23,7 @@ public class AddonInventoryWindow : NativeAddon
|
||||
private readonly InventoryCategoryHoverCoordinator _hoverCoordinator = new();
|
||||
private readonly HashSet<InventoryCategoryNode> _hoverSubscribed = new();
|
||||
|
||||
private InventoryNotificationNode _notificationNode = null!;
|
||||
private WrappingGridNode<InventoryCategoryNode> _categoriesNode = null!;
|
||||
private TextInputWithHintNode _searchInputNode = null!;
|
||||
private CircleButtonNode _settingsButtonNode = null!;
|
||||
@@ -69,13 +71,12 @@ public class AddonInventoryWindow : NativeAddon
|
||||
float x = headerX + (headerW - size.X) * 0.5f;
|
||||
float y = headerY + (headerH - size.Y) * 0.5f;
|
||||
|
||||
InventoryNotificationNode notificationNode = new InventoryNotificationNode
|
||||
_notificationNode = new InventoryNotificationNode
|
||||
{
|
||||
Position = new Vector2(WindowNode!.X - 4f, WindowNode!.Y - 32f),
|
||||
Size = new Vector2(headerW, 28f),
|
||||
};
|
||||
notificationNode.AttachNode(this);
|
||||
//notificationNode.NotificationType = InventoryNotificationType.SaddleBag;
|
||||
_notificationNode.AttachNode(this);
|
||||
|
||||
_searchInputNode = new TextInputWithHintNode
|
||||
{
|
||||
@@ -113,7 +114,6 @@ public class AddonInventoryWindow : NativeAddon
|
||||
base.OnSetup(addon);
|
||||
}
|
||||
|
||||
|
||||
protected override unsafe void OnUpdate(AtkUnitBase* addon)
|
||||
{
|
||||
if (_refreshQueued)
|
||||
@@ -125,6 +125,9 @@ public class AddonInventoryWindow : NativeAddon
|
||||
RefreshCategoriesCore(doAutosize);
|
||||
}
|
||||
|
||||
InventoryNotificationType currentNotificationType = (InventoryNotificationType) AgentInventory.Instance()->OpenTitleId;
|
||||
if(currentNotificationType != _notificationNode.NotificationType) _notificationNode.NotificationType = currentNotificationType;
|
||||
|
||||
base.OnUpdate(addon);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
using System.Collections.Generic;
|
||||
using Lumina.Excel;
|
||||
using Lumina.Excel.Sheets;
|
||||
using Lumina.Text.ReadOnly;
|
||||
|
||||
namespace AetherBags.Inventory;
|
||||
|
||||
public class InventoryNotificationState
|
||||
{
|
||||
private readonly Dictionary<InventoryNotificationType, InventoryNotificationInfo> notificationCache;
|
||||
|
||||
public InventoryNotificationState()
|
||||
{
|
||||
var addonSheet = Services.DataManager.GetExcelSheet<Addon>();
|
||||
notificationCache = new Dictionary<InventoryNotificationType, InventoryNotificationInfo>
|
||||
{
|
||||
{ InventoryNotificationType.Sell, new InventoryNotificationInfo(addonSheet.GetRow(530).Text, addonSheet.GetRow(3576).Text) },
|
||||
{ InventoryNotificationType.Trade, new InventoryNotificationInfo(addonSheet.GetRow(531).Text, addonSheet.GetRow(3572).Text) },
|
||||
{ InventoryNotificationType.Letters, new InventoryNotificationInfo(addonSheet.GetRow(549).Text, addonSheet.GetRow(3575).Text) },
|
||||
{ InventoryNotificationType.Retainer, new InventoryNotificationInfo(addonSheet.GetRow(532).Text, addonSheet.GetRow(3573).Text) },
|
||||
{ InventoryNotificationType.RetainerEquip, new InventoryNotificationInfo(addonSheet.GetRow(778).Text, addonSheet.GetRow(3585).Text) },
|
||||
{ InventoryNotificationType.Equip, new InventoryNotificationInfo(addonSheet.GetRow(538).Text, addonSheet.GetRow(3577).Text) },
|
||||
{ InventoryNotificationType.Armory, new InventoryNotificationInfo(addonSheet.GetRow(775).Text, addonSheet.GetRow(3578).Text) },
|
||||
{ InventoryNotificationType.Markets, new InventoryNotificationInfo(addonSheet.GetRow(548).Text, addonSheet.GetRow(3574).Text) },
|
||||
{ InventoryNotificationType.Trade2, new InventoryNotificationInfo(addonSheet.GetRow(531).Text, addonSheet.GetRow(3572).Text) },
|
||||
{ InventoryNotificationType.CompanyChest, new InventoryNotificationInfo(addonSheet.GetRow(776).Text, addonSheet.GetRow(3579).Text) },
|
||||
{ InventoryNotificationType.Exterior, new InventoryNotificationInfo(addonSheet.GetRow(3583).Text, addonSheet.GetRow(3581).Text) },
|
||||
{ InventoryNotificationType.Interior, new InventoryNotificationInfo(addonSheet.GetRow(3584).Text, addonSheet.GetRow(3582).Text) },
|
||||
{ InventoryNotificationType.Layout, new InventoryNotificationInfo(addonSheet.GetRow(6237).Text, addonSheet.GetRow(3580).Text) },
|
||||
{ InventoryNotificationType.Plant, new InventoryNotificationInfo(addonSheet.GetRow(6416).Text, addonSheet.GetRow(6418).Text) },
|
||||
{ InventoryNotificationType.Fertilize, new InventoryNotificationInfo(addonSheet.GetRow(6417).Text, addonSheet.GetRow(6419).Text) },
|
||||
{ InventoryNotificationType.Transmutation, new InventoryNotificationInfo(addonSheet.GetRow(3911).Text, addonSheet.GetRow(3901).Text) },
|
||||
{ InventoryNotificationType.Reward, new InventoryNotificationInfo(addonSheet.GetRow(6503).Text, addonSheet.GetRow(6502).Text) },
|
||||
{ InventoryNotificationType.Feed, new InventoryNotificationInfo(addonSheet.GetRow(6519).Text, addonSheet.GetRow(6518).Text) },
|
||||
{ InventoryNotificationType.Charge, new InventoryNotificationInfo(addonSheet.GetRow(8638).Text, addonSheet.GetRow(8637).Text) },
|
||||
{ InventoryNotificationType.Convert, new InventoryNotificationInfo(addonSheet.GetRow(8647).Text, addonSheet.GetRow(8646).Text) },
|
||||
{ InventoryNotificationType.Covering, new InventoryNotificationInfo(addonSheet.GetRow(9029).Text, addonSheet.GetRow(9028).Text) },
|
||||
{ InventoryNotificationType.Feed2, new InventoryNotificationInfo(addonSheet.GetRow(9041).Text, addonSheet.GetRow(9040).Text) },
|
||||
{ InventoryNotificationType.Manual, new InventoryNotificationInfo(addonSheet.GetRow(9044).Text, addonSheet.GetRow(9043).Text) },
|
||||
{ InventoryNotificationType.Chocobo, new InventoryNotificationInfo(addonSheet.GetRow(9073).Text, addonSheet.GetRow(9072).Text) },
|
||||
{ InventoryNotificationType.Outfit, new InventoryNotificationInfo(addonSheet.GetRow(6578).Text, addonSheet.GetRow(6579).Text) },
|
||||
{ InventoryNotificationType.Outfit2, new InventoryNotificationInfo(addonSheet.GetRow(6578).Text, addonSheet.GetRow(6579).Text) },
|
||||
{ InventoryNotificationType.Plant2, new InventoryNotificationInfo(addonSheet.GetRow(6416).Text, addonSheet.GetRow(6418).Text) },
|
||||
{ InventoryNotificationType.Aquarium, new InventoryNotificationInfo(addonSheet.GetRow(6808).Text, addonSheet.GetRow(6807).Text) },
|
||||
{ InventoryNotificationType.SaddleBag, new InventoryNotificationInfo(addonSheet.GetRow(891).Text, addonSheet.GetRow(892).Text) },
|
||||
{ InventoryNotificationType.Donate, new InventoryNotificationInfo(addonSheet.GetRow(11595).Text, addonSheet.GetRow(11596).Text) },
|
||||
{ InventoryNotificationType.Trade3, new InventoryNotificationInfo(addonSheet.GetRow(531).Text, addonSheet.GetRow(3572).Text) },
|
||||
{ InventoryNotificationType.Trade4, new InventoryNotificationInfo(addonSheet.GetRow(531).Text, addonSheet.GetRow(3572).Text) },
|
||||
{ InventoryNotificationType.Exterior2, new InventoryNotificationInfo(addonSheet.GetRow(3583).Text, addonSheet.GetRow(3581).Text) },
|
||||
{ InventoryNotificationType.Interior2, new InventoryNotificationInfo(addonSheet.GetRow(6237).Text, addonSheet.GetRow(3580).Text) },
|
||||
};
|
||||
}
|
||||
|
||||
public InventoryNotificationInfo? GetNotificationInfo(uint openTitleId)
|
||||
{
|
||||
return notificationCache.GetValueOrDefault((InventoryNotificationType)openTitleId);
|
||||
}
|
||||
|
||||
public record InventoryNotificationInfo(ReadOnlySeString Title, ReadOnlySeString Message);
|
||||
}
|
||||
|
||||
public enum InventoryNotificationType : uint
|
||||
{
|
||||
None = 0,
|
||||
Sell = 1,
|
||||
Trade = 2,
|
||||
Letters = 3,
|
||||
Retainer = 4,
|
||||
RetainerEquip = 5,
|
||||
Equip = 6,
|
||||
Armory = 7,
|
||||
Markets = 8,
|
||||
Trade2 = 9,
|
||||
CompanyChest = 10,
|
||||
Exterior = 11,
|
||||
Interior = 12,
|
||||
Layout = 13,
|
||||
Plant = 14,
|
||||
Fertilize = 15,
|
||||
Transmutation = 16,
|
||||
Reward = 17,
|
||||
Feed = 18,
|
||||
Charge = 19,
|
||||
Convert = 20,
|
||||
Covering = 21,
|
||||
Feed2 = 22,
|
||||
Manual = 23,
|
||||
Chocobo = 24,
|
||||
Outfit = 25,
|
||||
Outfit2 = 26,
|
||||
Plant2 = 27,
|
||||
Aquarium = 28,
|
||||
SaddleBag = 29,
|
||||
Donate = 30,
|
||||
Trade3 = 31,
|
||||
Trade4 = 32,
|
||||
Exterior2 = 33,
|
||||
Interior2 = 34
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using AetherBags.Inventory;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
using KamiToolKit;
|
||||
using KamiToolKit.Classes;
|
||||
@@ -18,12 +19,10 @@ public sealed class InventoryNotificationNode : SimpleComponentNode
|
||||
private readonly TextNode titleTextNode;
|
||||
private readonly TextNode messageTextNode;
|
||||
|
||||
private Dictionary<InventoryNotificationType, InventoryNotificationInfo> notificationCache = null!;
|
||||
private static readonly InventoryNotificationState NotificationState = new();
|
||||
|
||||
public InventoryNotificationNode()
|
||||
{
|
||||
PopulateNotificationCache();
|
||||
|
||||
AddTimeline(ParentLabels);
|
||||
|
||||
glowNode = new SimpleNineGridNode {
|
||||
@@ -76,26 +75,6 @@ public sealed class InventoryNotificationNode : SimpleComponentNode
|
||||
messageTextNode.Size = Size with { Y = 16 };
|
||||
}
|
||||
|
||||
private void PopulateNotificationCache()
|
||||
{
|
||||
ExcelSheet<Addon> addonSheet = Services.DataManager.GetExcelSheet<Addon>();
|
||||
notificationCache = new Dictionary<InventoryNotificationType, InventoryNotificationInfo>
|
||||
{
|
||||
{
|
||||
InventoryNotificationType.SaddleBag,
|
||||
new InventoryNotificationInfo(addonSheet.GetRow(891).Text, addonSheet.GetRow(892).Text)
|
||||
},
|
||||
{
|
||||
InventoryNotificationType.RetainerEntrust,
|
||||
new InventoryNotificationInfo(addonSheet.GetRow(910).Text, addonSheet.GetRow(3573).Text)
|
||||
},
|
||||
{
|
||||
InventoryNotificationType.RetainerEquip,
|
||||
new InventoryNotificationInfo(addonSheet.GetRow(910).Text, addonSheet.GetRow(3585).Text)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public InventoryNotificationType NotificationType
|
||||
{
|
||||
get;
|
||||
@@ -108,11 +87,15 @@ public sealed class InventoryNotificationNode : SimpleComponentNode
|
||||
messageTextNode.String = string.Empty;
|
||||
Timeline?.PlayAnimation(17); // Hide
|
||||
}
|
||||
else if (notificationCache.TryGetValue(value, out var texts))
|
||||
else
|
||||
{
|
||||
titleTextNode.SeString = texts.Title;
|
||||
messageTextNode.SeString = texts.Message;
|
||||
Timeline?.PlayAnimation(101); // Show
|
||||
var info = NotificationState.GetNotificationInfo((uint)value);
|
||||
if (info != null)
|
||||
{
|
||||
titleTextNode.SeString = info.Title;
|
||||
messageTextNode.SeString = info.Message;
|
||||
Timeline?.PlayAnimation(101); // Show
|
||||
}
|
||||
}
|
||||
}
|
||||
} = InventoryNotificationType.None;
|
||||
@@ -148,15 +131,4 @@ public sealed class InventoryNotificationNode : SimpleComponentNode
|
||||
.AddFrame(59, alpha: 255, addColor: new Vector3(0, 0, 0))
|
||||
.EndFrameSet()
|
||||
.Build();
|
||||
|
||||
|
||||
private record InventoryNotificationInfo(ReadOnlySeString Title, ReadOnlySeString Message);
|
||||
}
|
||||
|
||||
public enum InventoryNotificationType
|
||||
{
|
||||
None,
|
||||
SaddleBag,
|
||||
RetainerEntrust,
|
||||
RetainerEquip
|
||||
}
|
||||
@@ -13,6 +13,7 @@ public class Services
|
||||
[PluginService] public static IDataManager DataManager { get; set; } = null!;
|
||||
[PluginService] public static IDalamudPluginInterface PluginInterface { get; private set; } = null!;
|
||||
[PluginService] public static IFramework Framework { get; private set; } = null!;
|
||||
[PluginService] public static IGameGui GameGui { get; private set; } = null!;
|
||||
[PluginService] public static IKeyState KeyState { get; private set; } = null!;
|
||||
[PluginService] public static IPluginLog Logger { get; private set; } = null!;
|
||||
[PluginService] public static INotificationManager NotificationManager { get; private set; } = null!;
|
||||
|
||||
Reference in New Issue
Block a user