mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-23 16:07:44 +01:00
Update gamedata and services.
This commit is contained in:
parent
36d95c37bc
commit
a982c0a1c1
74 changed files with 907 additions and 960 deletions
|
|
@ -12,7 +12,7 @@ using Glamourer.Unlocks;
|
|||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.GameData.Data;
|
||||
using Penumbra.GameData.DataContainers;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Structs;
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ public class EquipmentDrawer
|
|||
|
||||
private readonly ItemManager _items;
|
||||
private readonly GlamourerColorCombo _stainCombo;
|
||||
private readonly StainData _stainData;
|
||||
private readonly DictStains _stainData;
|
||||
private readonly ItemCombo[] _itemCombo;
|
||||
private readonly Dictionary<FullEquipType, WeaponCombo> _weaponCombo;
|
||||
private readonly CodeService _codes;
|
||||
|
|
@ -66,8 +66,8 @@ public class EquipmentDrawer
|
|||
_iconSize = new Vector2(2 * ImGui.GetFrameHeight() + ImGui.GetStyle().ItemSpacing.Y);
|
||||
_comboLength = DefaultWidth * ImGuiHelpers.GlobalScale;
|
||||
if (_requiredComboWidthUnscaled == 0)
|
||||
_requiredComboWidthUnscaled = _items.ItemService.AwaitedService.AllItems(true)
|
||||
.Concat(_items.ItemService.AwaitedService.AllItems(false))
|
||||
_requiredComboWidthUnscaled = _items.ItemData.AllItems(true)
|
||||
.Concat(_items.ItemData.AllItems(false))
|
||||
.Max(i => ImGui.CalcTextSize($"{i.Item2.Name} ({i.Item2.ModelString})").X)
|
||||
/ ImGuiHelpers.GlobalScale;
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ public class EquipmentDrawer
|
|||
|
||||
public void DrawWeapons(EquipDrawData mainhand, EquipDrawData offhand, bool allWeapons)
|
||||
{
|
||||
if (mainhand.CurrentItem.ModelId.Id == 0)
|
||||
if (mainhand.CurrentItem.PrimaryId.Id == 0)
|
||||
return;
|
||||
|
||||
if (_config.HideApplyCheckmarks)
|
||||
|
|
@ -202,24 +202,24 @@ public class EquipmentDrawer
|
|||
|
||||
void DrawWeapon(in EquipDrawData current)
|
||||
{
|
||||
int setId = current.CurrentItem.ModelId.Id;
|
||||
int type = current.CurrentItem.WeaponType.Id;
|
||||
int setId = current.CurrentItem.PrimaryId.Id;
|
||||
int type = current.CurrentItem.SecondaryId.Id;
|
||||
int variant = current.CurrentItem.Variant.Id;
|
||||
ImGui.SetNextItemWidth(80 * ImGuiHelpers.GlobalScale);
|
||||
if (ImGui.InputInt("##setId", ref setId, 0, 0))
|
||||
{
|
||||
var newSetId = (SetId)Math.Clamp(setId, 0, ushort.MaxValue);
|
||||
if (newSetId.Id != current.CurrentItem.ModelId.Id)
|
||||
current.ItemSetter(_items.Identify(current.Slot, newSetId, current.CurrentItem.WeaponType, current.CurrentItem.Variant));
|
||||
var newSetId = (PrimaryId)Math.Clamp(setId, 0, ushort.MaxValue);
|
||||
if (newSetId.Id != current.CurrentItem.PrimaryId.Id)
|
||||
current.ItemSetter(_items.Identify(current.Slot, newSetId, current.CurrentItem.SecondaryId, current.CurrentItem.Variant));
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.SetNextItemWidth(80 * ImGuiHelpers.GlobalScale);
|
||||
if (ImGui.InputInt("##type", ref type, 0, 0))
|
||||
{
|
||||
var newType = (WeaponType)Math.Clamp(type, 0, ushort.MaxValue);
|
||||
if (newType.Id != current.CurrentItem.WeaponType.Id)
|
||||
current.ItemSetter(_items.Identify(current.Slot, current.CurrentItem.ModelId, newType, current.CurrentItem.Variant));
|
||||
var newType = (SecondaryId)Math.Clamp(type, 0, ushort.MaxValue);
|
||||
if (newType.Id != current.CurrentItem.SecondaryId.Id)
|
||||
current.ItemSetter(_items.Identify(current.Slot, current.CurrentItem.PrimaryId, newType, current.CurrentItem.Variant));
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
|
@ -228,7 +228,8 @@ public class EquipmentDrawer
|
|||
{
|
||||
var newVariant = (Variant)Math.Clamp(variant, 0, byte.MaxValue);
|
||||
if (newVariant.Id != current.CurrentItem.Variant.Id)
|
||||
current.ItemSetter(_items.Identify(current.Slot, current.CurrentItem.ModelId, current.CurrentItem.WeaponType, newVariant));
|
||||
current.ItemSetter(_items.Identify(current.Slot, current.CurrentItem.PrimaryId, current.CurrentItem.SecondaryId,
|
||||
newVariant));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -249,13 +250,13 @@ public class EquipmentDrawer
|
|||
/// <summary> Draw an input for armor that can set arbitrary values instead of choosing items. </summary>
|
||||
private void DrawArmorArtisan(EquipDrawData data)
|
||||
{
|
||||
int setId = data.CurrentItem.ModelId.Id;
|
||||
int setId = data.CurrentItem.PrimaryId.Id;
|
||||
int variant = data.CurrentItem.Variant.Id;
|
||||
ImGui.SetNextItemWidth(80 * ImGuiHelpers.GlobalScale);
|
||||
if (ImGui.InputInt("##setId", ref setId, 0, 0))
|
||||
{
|
||||
var newSetId = (SetId)Math.Clamp(setId, 0, ushort.MaxValue);
|
||||
if (newSetId.Id != data.CurrentItem.ModelId.Id)
|
||||
var newSetId = (PrimaryId)Math.Clamp(setId, 0, ushort.MaxValue);
|
||||
if (newSetId.Id != data.CurrentItem.PrimaryId.Id)
|
||||
data.ItemSetter(_items.Identify(data.Slot, newSetId, data.CurrentItem.Variant));
|
||||
}
|
||||
|
||||
|
|
@ -265,7 +266,7 @@ public class EquipmentDrawer
|
|||
{
|
||||
var newVariant = (byte)Math.Clamp(variant, 0, byte.MaxValue);
|
||||
if (newVariant != data.CurrentItem.Variant)
|
||||
data.ItemSetter(_items.Identify(data.Slot, data.CurrentItem.ModelId, newVariant));
|
||||
data.ItemSetter(_items.Identify(data.Slot, data.CurrentItem.PrimaryId, newVariant));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -454,7 +455,7 @@ public class EquipmentDrawer
|
|||
else if (combo.CustomVariant.Id > 0)
|
||||
data.ItemSetter(_items.Identify(data.Slot, combo.CustomSetId, combo.CustomVariant));
|
||||
|
||||
if (!data.Locked && data.CurrentItem.ModelId.Id != 0)
|
||||
if (!data.Locked && data.CurrentItem.PrimaryId.Id != 0)
|
||||
{
|
||||
if (clear || ImGui.IsItemClicked(ImGuiMouseButton.Right))
|
||||
data.ItemSetter(ItemManager.NothingItem(data.Slot));
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ using Dalamud.Interface.Utility.Raii;
|
|||
using Glamourer.Unlocks;
|
||||
using ImGuiNET;
|
||||
using OtterGui.Widgets;
|
||||
using Penumbra.GameData.Data;
|
||||
using Penumbra.GameData.DataContainers;
|
||||
using Penumbra.GameData.Structs;
|
||||
|
||||
namespace Glamourer.Gui.Equipment;
|
||||
|
||||
public sealed class GlamourerColorCombo(float _comboWidth, StainData _stains, FavoriteManager _favorites)
|
||||
public sealed class GlamourerColorCombo(float _comboWidth, DictStains _stains, FavoriteManager _favorites)
|
||||
: FilterComboColors(_comboWidth, CreateFunc(_stains, _favorites), Glamourer.Log)
|
||||
{
|
||||
protected override bool DrawSelectable(int globalIdx, bool selected)
|
||||
|
|
@ -40,8 +40,9 @@ public sealed class GlamourerColorCombo(float _comboWidth, StainData _stains, Fa
|
|||
return base.DrawSelectable(globalIdx, selected);
|
||||
}
|
||||
|
||||
private static Func<IReadOnlyList<KeyValuePair<byte, (string Name, uint Color, bool Gloss)>>> CreateFunc(StainData stains,
|
||||
private static Func<IReadOnlyList<KeyValuePair<byte, (string Name, uint Color, bool Gloss)>>> CreateFunc(DictStains stains,
|
||||
FavoriteManager favorites)
|
||||
=> () => stains.Data.Select(kvp => (kvp, favorites.Contains((StainId)kvp.Key))).OrderBy(p => !p.Item2).Select(p => p.kvp)
|
||||
.Prepend(new KeyValuePair<byte, (string Name, uint Dye, bool Gloss)>(0, ("None", 0, false))).ToList();
|
||||
=> () => stains.Select(kvp => (kvp, favorites.Contains(kvp.Key))).OrderBy(p => !p.Item2).Select(p => p.kvp)
|
||||
.Prepend(new KeyValuePair<StainId, Stain>(Stain.None.RowIndex, Stain.None)).Select(kvp
|
||||
=> new KeyValuePair<byte, (string, uint, bool)>(kvp.Key.Id, (kvp.Value.Name, kvp.Value.RgbaColor, kvp.Value.Gloss))).ToList();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ public sealed class ItemCombo : FilterComboCache<EquipItem>
|
|||
private ItemId _currentItem;
|
||||
private float _innerWidth;
|
||||
|
||||
public SetId CustomSetId { get; private set; }
|
||||
public Variant CustomVariant { get; private set; }
|
||||
public PrimaryId CustomSetId { get; private set; }
|
||||
public Variant CustomVariant { get; private set; }
|
||||
|
||||
public ItemCombo(IDataManager gameData, ItemManager items, EquipSlot slot, Logger log, FavoriteManager favorites)
|
||||
: base(() => GetItems(favorites, items, slot), log)
|
||||
|
|
@ -83,7 +83,7 @@ public sealed class ItemCombo : FilterComboCache<EquipItem>
|
|||
}
|
||||
|
||||
protected override bool IsVisible(int globalIndex, LowerString filter)
|
||||
=> base.IsVisible(globalIndex, filter) || filter.IsContained(Items[globalIndex].ModelId.Id.ToString());
|
||||
=> base.IsVisible(globalIndex, filter) || filter.IsContained(Items[globalIndex].PrimaryId.Id.ToString());
|
||||
|
||||
protected override string ToString(EquipItem obj)
|
||||
=> obj.Name;
|
||||
|
|
@ -111,7 +111,7 @@ public sealed class ItemCombo : FilterComboCache<EquipItem>
|
|||
private static IReadOnlyList<EquipItem> GetItems(FavoriteManager favorites, ItemManager items, EquipSlot slot)
|
||||
{
|
||||
var nothing = ItemManager.NothingItem(slot);
|
||||
if (!items.ItemService.AwaitedService.TryGetValue(slot.ToEquipType(), out var list))
|
||||
if (!items.ItemData.ByType.TryGetValue(slot.ToEquipType(), out var list))
|
||||
return new[]
|
||||
{
|
||||
nothing,
|
||||
|
|
|
|||
|
|
@ -60,12 +60,12 @@ public sealed class WeaponCombo : FilterComboCache<EquipItem>
|
|||
var ret = ImGui.Selectable(name, selected);
|
||||
ImGui.SameLine();
|
||||
using var color = ImRaii.PushColor(ImGuiCol.Text, 0xFF808080);
|
||||
ImGuiUtil.RightAlign($"({obj.ModelId.Id}-{obj.WeaponType.Id}-{obj.Variant})");
|
||||
ImGuiUtil.RightAlign($"({obj.PrimaryId.Id}-{obj.SecondaryId.Id}-{obj.Variant})");
|
||||
return ret;
|
||||
}
|
||||
|
||||
protected override bool IsVisible(int globalIndex, LowerString filter)
|
||||
=> base.IsVisible(globalIndex, filter) || filter.IsContained(Items[globalIndex].ModelId.Id.ToString());
|
||||
=> base.IsVisible(globalIndex, filter) || filter.IsContained(Items[globalIndex].PrimaryId.Id.ToString());
|
||||
|
||||
protected override string ToString(EquipItem obj)
|
||||
=> obj.Name;
|
||||
|
|
@ -80,14 +80,14 @@ public sealed class WeaponCombo : FilterComboCache<EquipItem>
|
|||
var enumerable = Array.Empty<EquipItem>().AsEnumerable();
|
||||
foreach (var t in Enum.GetValues<FullEquipType>().Where(e => e.ToSlot() is EquipSlot.MainHand))
|
||||
{
|
||||
if (items.ItemService.AwaitedService.TryGetValue(t, out var l))
|
||||
if (items.ItemData.ByType.TryGetValue(t, out var l))
|
||||
enumerable = enumerable.Concat(l);
|
||||
}
|
||||
|
||||
return enumerable.OrderBy(e => e.Name).ToList();
|
||||
}
|
||||
|
||||
if (!items.ItemService.AwaitedService.TryGetValue(type, out var list))
|
||||
if (!items.ItemData.ByType.TryGetValue(type, out var list))
|
||||
return Array.Empty<EquipItem>();
|
||||
|
||||
if (type.AllowsNothing())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue