diff --git a/Glamourer/Automation/AutoDesignApplier.cs b/Glamourer/Automation/AutoDesignApplier.cs index ddc8636..deb9e43 100644 --- a/Glamourer/Automation/AutoDesignApplier.cs +++ b/Glamourer/Automation/AutoDesignApplier.cs @@ -39,8 +39,8 @@ public class AutoDesignApplier : IDisposable private readonly IClientState _clientState; private ActorState? _jobChangeState; - private readonly Dictionary _jobChangeMainhand = new(); - private readonly Dictionary _jobChangeOffhand = new(); + private readonly Dictionary _jobChangeMainhand = []; + private readonly Dictionary _jobChangeOffhand = []; private void ResetJobChange() { diff --git a/Glamourer/Glamourer.csproj b/Glamourer/Glamourer.csproj index 7ecb3b6..12ec3a7 100644 --- a/Glamourer/Glamourer.csproj +++ b/Glamourer/Glamourer.csproj @@ -108,8 +108,9 @@ - - + + + @@ -122,6 +123,7 @@ PreserveNewest + diff --git a/Glamourer/Gui/Equipment/EquipDrawData.cs b/Glamourer/Gui/Equipment/EquipDrawData.cs index ce2ba04..8ea3972 100644 --- a/Glamourer/Gui/Equipment/EquipDrawData.cs +++ b/Glamourer/Gui/Equipment/EquipDrawData.cs @@ -28,7 +28,7 @@ public ref struct EquipDrawData(EquipSlot slot, in DesignData designData) public static EquipDrawData FromDesign(DesignManager manager, Design design, EquipSlot slot) => new(slot, design.DesignData) { - ItemSetter = i => manager.ChangeEquip(design, slot, i), + ItemSetter = slot.IsEquipmentPiece() ? i => manager.ChangeEquip(design, slot, i) : i => manager.ChangeWeapon(design, slot, i), StainSetter = i => manager.ChangeStain(design, slot, i), ApplySetter = b => manager.ChangeApplyEquip(design, slot, b), ApplyStainSetter = b => manager.ChangeApplyStain(design, slot, b), diff --git a/Glamourer/Gui/GlamourerChangelog.cs b/Glamourer/Gui/GlamourerChangelog.cs index 3411bf2..ae9227f 100644 --- a/Glamourer/Gui/GlamourerChangelog.cs +++ b/Glamourer/Gui/GlamourerChangelog.cs @@ -24,6 +24,7 @@ public class GlamourerChangelog Add1_0_4_0(Changelog); Add1_0_5_0(Changelog); Add1_0_6_0(Changelog); + Add1_0_7_0(Changelog); } private (int, ChangeLogDisplayType) ConfigData() @@ -44,6 +45,16 @@ public class GlamourerChangelog } } + private static void Add1_0_7_0(Changelog log) + => log.NextVersion("Version 1.0.7.0") + .RegisterHighlight("Glamourer now can set the free company crests on body slots, head slots and shields.") + .RegisterEntry("Fixed an issue with tooltips in certain combo selectors.") + .RegisterEntry("Fixed some issues with Hide Hat Gear and monsters turned into humans.") + .RegisterEntry( + "Hopefully fixed issues with icons used by Glamourer that are modified through Penumbra preventing Glamourer to even start in some cases.") + .RegisterEntry("Those icons might still not appear if they fail to load, but Glamourer should at least still work.", 1) + .RegisterEntry("Pre-emptively fixed a potential issue for the holidays."); + private static void Add1_0_6_0(Changelog log) => log.NextVersion("Version 1.0.6.0") .RegisterHighlight("Added the option to define custom color groups and associate designs with them.") diff --git a/Glamourer/Services/TextureService.cs b/Glamourer/Services/TextureService.cs index 8f65bfa..e740677 100644 --- a/Glamourer/Services/TextureService.cs +++ b/Glamourer/Services/TextureService.cs @@ -37,9 +37,9 @@ public sealed class TextureService : TextureCache, IDisposable } } - private static IDalamudTextureWrap[] CreateSlotIcons(UiBuilder uiBuilder) + private static IDalamudTextureWrap?[] CreateSlotIcons(UiBuilder uiBuilder) { - var ret = new IDalamudTextureWrap[12]; + var ret = new IDalamudTextureWrap?[12]; using var uldWrapper = uiBuilder.LoadUld("ui/uld/ArmouryBoard.uld"); @@ -49,20 +49,33 @@ public sealed class TextureService : TextureCache, IDisposable return ret; } - ret[0] = uldWrapper.LoadTexturePart("ui/uld/ArmouryBoard_hr1.tex", 1)!; - ret[1] = uldWrapper.LoadTexturePart("ui/uld/ArmouryBoard_hr1.tex", 2)!; - ret[2] = uldWrapper.LoadTexturePart("ui/uld/ArmouryBoard_hr1.tex", 3)!; - ret[3] = uldWrapper.LoadTexturePart("ui/uld/ArmouryBoard_hr1.tex", 5)!; - ret[4] = uldWrapper.LoadTexturePart("ui/uld/ArmouryBoard_hr1.tex", 6)!; - ret[5] = uldWrapper.LoadTexturePart("ui/uld/ArmouryBoard_hr1.tex", 8)!; - ret[6] = uldWrapper.LoadTexturePart("ui/uld/ArmouryBoard_hr1.tex", 9)!; - ret[7] = uldWrapper.LoadTexturePart("ui/uld/ArmouryBoard_hr1.tex", 10)!; - ret[8] = uldWrapper.LoadTexturePart("ui/uld/ArmouryBoard_hr1.tex", 11)!; - ret[9] = ret[8]; - ret[10] = uldWrapper.LoadTexturePart("ui/uld/ArmouryBoard_hr1.tex", 0)!; - ret[11] = uldWrapper.LoadTexturePart("ui/uld/ArmouryBoard_hr1.tex", 7)!; + SetIcon(EquipSlot.Head, 1); + SetIcon(EquipSlot.Body, 2); + SetIcon(EquipSlot.Hands, 3); + SetIcon(EquipSlot.Legs, 5); + SetIcon(EquipSlot.Feet, 6); + SetIcon(EquipSlot.Ears, 8); + SetIcon(EquipSlot.Neck, 9); + SetIcon(EquipSlot.Wrists, 10); + SetIcon(EquipSlot.RFinger, 11); + SetIcon(EquipSlot.MainHand, 0); + SetIcon(EquipSlot.OffHand, 7); + ret[EquipSlot.LFinger.ToIndex()] = ret[EquipSlot.RFinger.ToIndex()]; - uldWrapper.Dispose(); return ret; + + void SetIcon(EquipSlot slot, int index) + { + try + { + ret[slot.ToIndex()] = uldWrapper.LoadTexturePart("ui/uld/ArmouryBoard_hr1.tex", index)!; + } + catch (Exception ex) + { + Glamourer.Log.Error($"Could not get empty slot texture for {slot.ToName()}, icon will be left empty. " + + $"This may be because of incompatible mods affecting your character screen interface:\n{ex}"); + ret[slot.ToIndex()] = null; + } + } } } diff --git a/Glamourer/State/WeaponState.cs b/Glamourer/State/WeaponState.cs deleted file mode 100644 index a06ff79..0000000 --- a/Glamourer/State/WeaponState.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Glamourer.Events; -using Glamourer.Services; -using Penumbra.GameData.Enums; -using Penumbra.GameData.Structs; - -namespace Glamourer.State; - -/// Currently unused. -public unsafe struct WeaponState -{ - private fixed ulong _weapons[FullEquipTypeExtensions.NumWeaponTypes]; - private fixed byte _sources[FullEquipTypeExtensions.NumWeaponTypes]; - - public CustomItemId? this[FullEquipType type] - { - get - { - if (!ToIndex(type, out var idx)) - return null; - - var weapon = _weapons[idx]; - if (weapon == 0) - return null; - - return new CustomItemId(weapon); - } - } - - public EquipItem Get(ItemManager items, EquipItem value) - { - var id = this[value.Type]; - if (id == null) - return value; - - var item = items.Resolve(value.Type, id.Value); - return item.Type != value.Type ? value : item; - } - - public void Set(FullEquipType type, EquipItem value, StateChanged.Source source) - { - if (!ToIndex(type, out var idx)) - return; - - _weapons[idx] = value.Id.Id; - _sources[idx] = (byte)source; - } - - public void RemoveFixedDesignSources() - { - for (var i = 0; i < FullEquipTypeExtensions.NumWeaponTypes; ++i) - { - if (_sources[i] is (byte) StateChanged.Source.Fixed) - _sources[i] = (byte) StateChanged.Source.Manual; - } - } - - private static bool ToIndex(FullEquipType type, out int index) - { - index = ToIndex(type); - return index is >= 0 and < FullEquipTypeExtensions.NumWeaponTypes; - } - - private static int ToIndex(FullEquipType type) - => (int)type - FullEquipTypeExtensions.WeaponTypesOffset; -} diff --git a/repo.json b/repo.json index cbeeea3..46cd000 100644 --- a/repo.json +++ b/repo.json @@ -17,8 +17,8 @@ "Character" ], "InternalName": "Glamourer", - "AssemblyVersion": "1.0.6.1", - "TestingAssemblyVersion": "1.0.6.3", + "AssemblyVersion": "1.0.7.0", + "TestingAssemblyVersion": "1.0.7.0", "RepoUrl": "https://github.com/Ottermandias/Glamourer", "ApplicableVersion": "any", "DalamudApiLevel": 9, @@ -26,9 +26,9 @@ "IsTestingExclusive": "False", "DownloadCount": 1, "LastUpdate": 1618608322, - "DownloadLinkInstall": "https://github.com/Ottermandias/Glamourer/releases/download/1.0.6.1/Glamourer.zip", - "DownloadLinkUpdate": "https://github.com/Ottermandias/Glamourer/releases/download/1.0.6.1/Glamourer.zip", - "DownloadLinkTesting": "https://github.com/Ottermandias/Glamourer/releases/download/testing_1.0.6.3/Glamourer.zip", + "DownloadLinkInstall": "https://github.com/Ottermandias/Glamourer/releases/download/1.0.7.0/Glamourer.zip", + "DownloadLinkUpdate": "https://github.com/Ottermandias/Glamourer/releases/download/1.0.7.0/Glamourer.zip", + "DownloadLinkTesting": "https://github.com/Ottermandias/Glamourer/releases/download/1.0.7.0/Glamourer.zip", "IconUrl": "https://raw.githubusercontent.com/Ottermandias/Glamourer/main/images/icon.png" } ]