Compare commits
No commits in common. "master" and "v2.0" have entirely different histories.
@ -84,8 +84,6 @@ internal sealed class GlamourSetter : Window, IDisposable
|
||||
private readonly IAddonLifecycle _addonLifecycle;
|
||||
private readonly Configuration _configuration;
|
||||
private readonly ReadOnlyCollection<GlamourSet> _glamourSets;
|
||||
|
||||
private readonly Dictionary<uint, int> _ownedCurrencies = [];
|
||||
private Configuration.CharacterData? _characterData;
|
||||
|
||||
public GlamourSetter(IDalamudPluginInterface pluginInterface, IDataManager dataManager, IClientState clientState,
|
||||
@ -100,10 +98,6 @@ internal sealed class GlamourSetter : Window, IDisposable
|
||||
_addonLifecycle = addonLifecycle;
|
||||
_configuration = configuration;
|
||||
|
||||
SizeConstraints = new WindowSizeConstraints
|
||||
{
|
||||
MinimumSize = new(300, 400)
|
||||
};
|
||||
|
||||
var armoireItems = dataManager.GetExcelSheet<Cabinet>()
|
||||
.Where(x => x.RowId > 0)
|
||||
@ -233,19 +227,6 @@ internal sealed class GlamourSetter : Window, IDisposable
|
||||
return;
|
||||
}
|
||||
|
||||
unsafe
|
||||
{
|
||||
InventoryManager* inventoryManager = InventoryManager.Instance();
|
||||
if (inventoryManager != null)
|
||||
{
|
||||
_ownedCurrencies[ItemMgp] = inventoryManager->GetItemCountInContainer(ItemMgp, InventoryType.Currency);
|
||||
_ownedCurrencies[ItemWolfMarks] = (int)inventoryManager->GetWolfMarks();
|
||||
_ownedCurrencies[ItemTrophyCrystals] = inventoryManager->GetInventoryItemCount(ItemTrophyCrystals);
|
||||
}
|
||||
else
|
||||
_ownedCurrencies.Clear();
|
||||
}
|
||||
|
||||
var ownedSets = _glamourSets.Where(x => _characterData.GlamourDresserItems.Contains(x.ItemId)).ToList();
|
||||
ImGui.Text(
|
||||
$"Complete Sets: {ownedSets.Count} / {_glamourSets.Count(x => x.SetType != ESetType.Unobtainable || ownedSets.Contains(x))}");
|
||||
@ -286,9 +267,7 @@ internal sealed class GlamourSetter : Window, IDisposable
|
||||
|
||||
var ownedItems = GetOwnedItems();
|
||||
DrawMissingItemHeader(glamourSets, setType, ownedSets, ownedItems);
|
||||
|
||||
using (ImRaii.Child("Sets"))
|
||||
DrawSetRange(glamourSets, ownedSets, ownedItems);
|
||||
DrawSetRange(glamourSets, ownedSets, ownedItems);
|
||||
}
|
||||
|
||||
private void DrawSpecialtyTab(List<GlamourSet> ownedSets)
|
||||
@ -311,7 +290,7 @@ internal sealed class GlamourSetter : Window, IDisposable
|
||||
DrawSetRange(glamourSets.Where(x => UndyedRathalosSets.Contains(x.ItemId)).ToList(), ownedSets, ownedItems);
|
||||
}
|
||||
|
||||
private void DrawMissingItemHeader(List<GlamourSet> glamourSets, ESetType setType, List<GlamourSet> ownedSets,
|
||||
private static void DrawMissingItemHeader(List<GlamourSet> glamourSets, ESetType setType, List<GlamourSet> ownedSets,
|
||||
HashSet<uint> ownedItems)
|
||||
{
|
||||
var missingItems = glamourSets
|
||||
@ -321,15 +300,15 @@ internal sealed class GlamourSetter : Window, IDisposable
|
||||
if (setType == ESetType.PvP)
|
||||
{
|
||||
ImGui.Text(
|
||||
$"Wolf Marks: {_ownedCurrencies.GetValueOrDefault(ItemWolfMarks):N0} / {missingItems.Where(x => x is { ShopItem.CostItemId: ItemWolfMarks }).Sum(x => x.ShopItem!.CostQuantity):N0}");
|
||||
$"Wolf Marks: {missingItems.Where(x => x is { ShopItem.CostItemId: ItemWolfMarks }).Sum(x => x.ShopItem!.CostQuantity):N0}");
|
||||
ImGui.Text(
|
||||
$"Trophy Crystals: {_ownedCurrencies.GetValueOrDefault(ItemTrophyCrystals):N0} / {missingItems.Where(x => x is { ShopItem.CostItemId: ItemTrophyCrystals }).Sum(x => x.ShopItem!.CostQuantity):N0}");
|
||||
$"Trophy Crystals: {missingItems.Where(x => x is { ShopItem.CostItemId: ItemTrophyCrystals }).Sum(x => x.ShopItem!.CostQuantity):N0}");
|
||||
ImGui.Separator();
|
||||
}
|
||||
else if (setType is ESetType.MGP or ESetType.Special)
|
||||
{
|
||||
ImGui.Text(
|
||||
$"MGP: {_ownedCurrencies.GetValueOrDefault(ItemMgp):N0} / {missingItems.Where(x => x is { ShopItem.CostItemId: ItemMgp }).Sum(x => x.ShopItem!.CostQuantity):N0}");
|
||||
$"MGP: {missingItems.Where(x => x is { ShopItem.CostItemId: ItemMgp }).Sum(x => x.ShopItem!.CostQuantity):N0}");
|
||||
ImGui.Separator();
|
||||
}
|
||||
}
|
||||
@ -346,13 +325,12 @@ internal sealed class GlamourSetter : Window, IDisposable
|
||||
int ownedCount = glamourSet.Items.Count(x => ownedItems.Contains(x.ItemId));
|
||||
if (ownedCount == glamourSet.Items.Count)
|
||||
ImGui.TextColored(ImGuiColors.ParsedBlue, $"{glamourSet.Name} (Can be completed)");
|
||||
else if (CanAffordAllMissingGearPieces(glamourSet, ownedItems))
|
||||
ImGui.TextColored(ImGuiColors.DalamudViolet, $"{glamourSet.Name} (Can afford)");
|
||||
else if (ownedCount > 0)
|
||||
ImGui.TextColored(ImGuiColors.DalamudYellow, glamourSet.Name);
|
||||
else
|
||||
ImGui.Text(glamourSet.Name);
|
||||
|
||||
|
||||
using (ImRaii.PushIndent())
|
||||
{
|
||||
foreach (var item in glamourSet.Items)
|
||||
@ -406,25 +384,6 @@ internal sealed class GlamourSetter : Window, IDisposable
|
||||
return ownedItems;
|
||||
}
|
||||
|
||||
private bool CanAffordAllMissingGearPieces(GlamourSet glamourSet, HashSet<uint> ownedItems)
|
||||
{
|
||||
uint costItemId = 0;
|
||||
uint costQuantity = 0;
|
||||
foreach (var item in glamourSet.Items)
|
||||
{
|
||||
if (ownedItems.Contains(item.ItemId))
|
||||
continue;
|
||||
|
||||
if (item.ShopItem == null)
|
||||
return false;
|
||||
|
||||
costItemId = item.ShopItem.CostItemId;
|
||||
costQuantity += item.ShopItem.CostQuantity;
|
||||
}
|
||||
|
||||
return costQuantity <= _ownedCurrencies.GetValueOrDefault(costItemId);
|
||||
}
|
||||
|
||||
private unsafe void UpdateFromGlamourDresser(AddonEvent type, AddonArgs args)
|
||||
{
|
||||
if (_characterData == null)
|
||||
|
@ -1,6 +1,6 @@
|
||||
<Project Sdk="Dalamud.NET.Sdk/11.0.0">
|
||||
<PropertyGroup>
|
||||
<Version>2.1</Version>
|
||||
<Version>2.0</Version>
|
||||
<OutputPath>dist</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user