diff --git a/Glamourer/Designs/Design.cs b/Glamourer/Designs/Design.cs index cf7af5d..848e7d6 100644 --- a/Glamourer/Designs/Design.cs +++ b/Glamourer/Designs/Design.cs @@ -280,8 +280,8 @@ public sealed class Design : DesignBase, ISavable, IDesignStandIn { var name = tok["Name"]?.ToObject(); var directory = tok["Directory"]?.ToObject(); - var enabled = tok["Enabled"]?.ToObject() ?? false; - if (name == null || directory == null) + var enabled = tok["Enabled"]?.ToObject(); + if (name == null || directory == null || enabled == null) { Glamourer.Messager.NotificationMessage("The loaded design contains an invalid mod, skipped.", NotificationType.Warning); continue; @@ -295,7 +295,7 @@ public sealed class Design : DesignBase, ISavable, IDesignStandIn settings.Add(key, value); var priority = tok["Priority"]?.ToObject() ?? 0; if (!design.AssociatedMods.TryAdd(new Mod(name, directory), - new ModSettings(settings, priority, enabled, forceInherit, removeSetting))) + new ModSettings(settings, priority, enabled.Value, forceInherit, removeSetting))) Glamourer.Messager.NotificationMessage("The loaded design contains a mod more than once, skipped.", NotificationType.Warning); } } diff --git a/Glamourer/Designs/History/DesignTransaction.cs b/Glamourer/Designs/History/DesignTransaction.cs index 65086db..98e3eec 100644 --- a/Glamourer/Designs/History/DesignTransaction.cs +++ b/Glamourer/Designs/History/DesignTransaction.cs @@ -1,7 +1,6 @@ using Glamourer.GameData; using Glamourer.Interop.Material; using Glamourer.Interop.Penumbra; -using Glamourer.State; using Penumbra.GameData.Enums; namespace Glamourer.Designs.History; @@ -126,10 +125,7 @@ public readonly record struct MaterialTransaction(MaterialValueIndex Index, Colo => older is MaterialTransaction other && Index == other.Index ? new MaterialTransaction(Index, other.Old, New) : null; public void Revert(IDesignEditor editor, object data) - { - if (editor is DesignManager e) - e.ChangeMaterialValue((Design)data, Index, Old); - } + => ((DesignManager)editor).ChangeMaterialValue((Design)data, Index, Old); } /// Only Designs. diff --git a/Glamourer/Gui/Tabs/UnlocksTab/UnlockTable.cs b/Glamourer/Gui/Tabs/UnlocksTab/UnlockTable.cs index d2297ca..d75f2dc 100644 --- a/Glamourer/Gui/Tabs/UnlocksTab/UnlockTable.cs +++ b/Glamourer/Gui/Tabs/UnlocksTab/UnlockTable.cs @@ -194,7 +194,7 @@ public class UnlockTable : Table, IDisposable ImGui.Dummy(new Vector2(ImGui.GetFrameHeight())); ImGui.SameLine(); ImGui.AlignTextToFramePadding(); - if (ImGui.Selectable(item.Name) && item.Id is { IsBonusItem: false, IsCustom: false }) + if (ImGui.Selectable(item.Name)) Glamourer.Messager.Chat.Print(new SeStringBuilder().AddItemLink(item.ItemId.Id, false).BuiltString); if (ImGui.IsItemClicked(ImGuiMouseButton.Right) && _tooltip.Player(out var state)) diff --git a/Glamourer/Interop/Penumbra/ModUsageInformer.cs b/Glamourer/Interop/Penumbra/ModUsageInformer.cs deleted file mode 100644 index f6d992e..0000000 --- a/Glamourer/Interop/Penumbra/ModUsageInformer.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Glamourer.Automation; -using Glamourer.Designs; -using OtterGui.Services; - -namespace Glamourer.Interop.Penumbra; - -public sealed class ModUsageInformer : IDisposable, IRequiredService -{ - private readonly PenumbraService _penumbra; - private readonly DesignManager _designs; - private readonly AutoDesignManager _automation; - - public ModUsageInformer(PenumbraService penumbra, DesignManager designs, AutoDesignManager automation) - { - _penumbra = penumbra; - _designs = designs; - _automation = automation; - - _penumbra.ModUsageQueried += OnModUsageQueried; - } - - private void OnModUsageQueried(string modPath, string modName, Dictionary notes) - { - var sb = new StringBuilder(); - var inUse = false; - foreach (var design in _designs.Designs) - { - if (!design.AssociatedMods.Any(p => ModMatches(modPath, modName, p.Key))) - continue; - - sb.AppendLine($"Contained in Design {design.Name}."); - if (_automation.EnabledSets.Values.Any(s => s.Designs.Any(d => d.Type is not 0 && d.Design == design))) - { - inUse = true; - break; - } - } - - if (inUse) - notes.TryAdd(Assembly.GetAssembly(typeof(ModUsageInformer))!, (true, string.Empty)); - else if (sb.Length > 0) - notes.TryAdd(Assembly.GetAssembly(typeof(ModUsageInformer))!, (false, sb.ToString())); - } - - private static bool ModMatches(string modPath, string modName, in Mod mod) - { - if (mod.DirectoryName.Equals(modPath, StringComparison.OrdinalIgnoreCase)) - return true; - - if (mod.Name.Equals(modName, StringComparison.OrdinalIgnoreCase)) - return true; - - return false; - } - - public void Dispose() - => _penumbra.ModUsageQueried -= OnModUsageQueried; -} diff --git a/Glamourer/Interop/Penumbra/PenumbraService.cs b/Glamourer/Interop/Penumbra/PenumbraService.cs index b43a0b5..b2813cd 100644 --- a/Glamourer/Interop/Penumbra/PenumbraService.cs +++ b/Glamourer/Interop/Penumbra/PenumbraService.cs @@ -44,16 +44,15 @@ public class PenumbraService : IDisposable private const int KeyManual = -6160; private const string NameManual = "Glamourer (Manually)"; - private readonly IDalamudPluginInterface _pluginInterface; - private readonly Configuration _config; - private readonly EventSubscriber _tooltipSubscriber; - private readonly EventSubscriber _clickSubscriber; - private readonly EventSubscriber _creatingCharacterBase; - private readonly EventSubscriber _createdCharacterBase; - private readonly EventSubscriber _modSettingChanged; - private readonly EventSubscriber _pcpParsed; - private readonly EventSubscriber _pcpCreated; - private readonly EventSubscriber> _modUsageQueried; + private readonly IDalamudPluginInterface _pluginInterface; + private readonly Configuration _config; + private readonly EventSubscriber _tooltipSubscriber; + private readonly EventSubscriber _clickSubscriber; + private readonly EventSubscriber _creatingCharacterBase; + private readonly EventSubscriber _createdCharacterBase; + private readonly EventSubscriber _modSettingChanged; + private readonly EventSubscriber _pcpParsed; + private readonly EventSubscriber _pcpCreated; private global::Penumbra.Api.IpcSubscribers.GetCollectionsByIdentifier? _collectionByIdentifier; private global::Penumbra.Api.IpcSubscribers.GetCollections? _collections; @@ -110,7 +109,6 @@ public class PenumbraService : IDisposable _modSettingChanged = global::Penumbra.Api.IpcSubscribers.ModSettingChanged.Subscriber(pi); _pcpCreated = global::Penumbra.Api.IpcSubscribers.CreatingPcp.Subscriber(pi); _pcpParsed = global::Penumbra.Api.IpcSubscribers.ParsingPcp.Subscriber(pi); - _modUsageQueried = global::Penumbra.Api.IpcSubscribers.ModUsageQueried.Subscriber(pi); Reattach(); } @@ -157,12 +155,6 @@ public class PenumbraService : IDisposable remove => _pcpParsed.Event -= value; } - public event Action> ModUsageQueried - { - add => _modUsageQueried.Event += value; - remove => _modUsageQueried.Event -= value; - } - public event Action? DrawSettingsSection; private void InvokeDrawSettingsSection() @@ -581,7 +573,7 @@ public class PenumbraService : IDisposable _changedItems = new global::Penumbra.Api.IpcSubscribers.GetChangedItemAdapterList(_pluginInterface).Invoke(); _checkCurrentChangedItems = new global::Penumbra.Api.IpcSubscribers.CheckCurrentChangedItemFunc(_pluginInterface).Invoke(); - _registerSettingsSection = new global::Penumbra.Api.IpcSubscribers.RegisterSettingsSection(_pluginInterface); + _registerSettingsSection = new global::Penumbra.Api.IpcSubscribers.RegisterSettingsSection(_pluginInterface); _unregisterSettingsSection = new global::Penumbra.Api.IpcSubscribers.UnregisterSettingsSection(_pluginInterface); _registerSettingsSection.Invoke(InvokeDrawSettingsSection); diff --git a/Glamourer/State/StateListener.cs b/Glamourer/State/StateListener.cs index 16e9a70..4b70718 100644 --- a/Glamourer/State/StateListener.cs +++ b/Glamourer/State/StateListener.cs @@ -9,6 +9,7 @@ using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; using Dalamud.Game.ClientState.Conditions; using Dalamud.Plugin.Services; +using FFXIVClientStructs.FFXIV.Client.Game.Character; using FFXIVClientStructs.FFXIV.Client.Game.Object; using Glamourer.GameData; using Penumbra.GameData.DataContainers; @@ -601,21 +602,14 @@ public class StateListener : IDisposable change = UpdateState.Change; } - var idsDiffer = baseData.Skeleton.Id != weapon.Skeleton.Id - || baseData.Weapon.Id != weapon.Weapon.Id - || baseData.Variant != weapon.Variant; - // Special case when nothing is equipped to the offhand which is already nothing, but we need to update the type. - var nothingDiffers = baseData.Skeleton.Id is 0 && slot is EquipSlot.OffHand; - - if (idsDiffer || nothingDiffers) + if (baseData.Skeleton.Id != weapon.Skeleton.Id || baseData.Weapon.Id != weapon.Weapon.Id || baseData.Variant != weapon.Variant) { if (_isPlayerNpc) return UpdateState.Transformed; var item = _items.Identify(slot, weapon.Skeleton, weapon.Weapon, weapon.Variant, slot is EquipSlot.OffHand ? state.BaseData.MainhandType : FullEquipType.Unknown); - if (idsDiffer || item.Type != state.BaseData.OffhandType) - state.BaseData.SetItem(slot, item); + state.BaseData.SetItem(slot, item); change = UpdateState.Change; } diff --git a/Penumbra.Api b/Penumbra.Api index a79ff8d..52a3216 160000 --- a/Penumbra.Api +++ b/Penumbra.Api @@ -1 +1 @@ -Subproject commit a79ff8d87c5b1ac12192f18563fb4247173ff4f0 +Subproject commit 52a3216a525592205198303df2844435e382cf87 diff --git a/repo.json b/repo.json index 5254ecb..73f3e21 100644 --- a/repo.json +++ b/repo.json @@ -17,8 +17,8 @@ "Character" ], "InternalName": "Glamourer", - "AssemblyVersion": "1.5.1.8", - "TestingAssemblyVersion": "1.5.1.8", + "AssemblyVersion": "1.5.1.6", + "TestingAssemblyVersion": "1.5.1.6", "RepoUrl": "https://github.com/Ottermandias/Glamourer", "ApplicableVersion": "any", "DalamudApiLevel": 14, @@ -27,9 +27,9 @@ "IsTestingExclusive": "False", "DownloadCount": 1, "LastUpdate": 1618608322, - "DownloadLinkInstall": "https://github.com/Ottermandias/Glamourer/releases/download/1.5.1.8/Glamourer.zip", - "DownloadLinkUpdate": "https://github.com/Ottermandias/Glamourer/releases/download/1.5.1.8/Glamourer.zip", - "DownloadLinkTesting": "https://github.com/Ottermandias/Glamourer/releases/download/1.5.1.8/Glamourer.zip", + "DownloadLinkInstall": "https://github.com/Ottermandias/Glamourer/releases/download/1.5.1.6/Glamourer.zip", + "DownloadLinkUpdate": "https://github.com/Ottermandias/Glamourer/releases/download/1.5.1.6/Glamourer.zip", + "DownloadLinkTesting": "https://github.com/Ottermandias/Glamourer/releases/download/1.5.1.6/Glamourer.zip", "IconUrl": "https://raw.githubusercontent.com/Ottermandias/Glamourer/main/images/icon.png" } ]