refactor: pull out hq offset into const

This commit is contained in:
Anna 2021-11-23 16:09:52 -05:00
parent b81b2a850b
commit 6fa3023ae0
4 changed files with 7 additions and 6 deletions

View File

@ -203,7 +203,7 @@ namespace Glamaholic {
var source = MirageSource.GlamourDresser;
var info = (0, 0u, (byte) 0);
// find an item in the dresser that matches
var matchingIds = dresser.FindAll(mirage => mirage.ItemId % 1_000_000 == item.ItemId);
var matchingIds = dresser.FindAll(mirage => mirage.ItemId % Util.HqItemOffset == item.ItemId);
if (matchingIds.Count == 0) {
// if not in the glamour dresser, look in the armoire
if (this.ArmoireIndexIfPresent(item.ItemId) is { } armoireIdx) {
@ -334,7 +334,7 @@ namespace Glamaholic {
this._filterIds.Add(itemId);
}
this._tryOn(0xFF, itemId % 1_000_000, stainId, 0, 0);
this._tryOn(0xFF, itemId % Util.HqItemOffset, stainId, 0, 0);
}
}

View File

@ -31,9 +31,8 @@ namespace Glamaholic.Ui.Helpers {
private void DrawDropdown() {
if (ImGui.Selectable("Create glamour plate")) {
var items = GetTryOnItems();
this.Ui.Plugin.Config.AddPlate(new SavedPlate("Fitting Room") {
Items = items,
Items = GetTryOnItems(),
});
this.Ui.Plugin.SaveConfig();
@ -62,7 +61,7 @@ namespace Glamaholic.Ui.Helpers {
// TODO: remove this logic in endwalker
var slot = item->Slot > 5 ? item->Slot - 1 : item->Slot;
items[(PlateSlot) slot] =new SavedGlamourItem {
ItemId = itemId % 1_000_000,
ItemId = itemId % Util.HqItemOffset,
StainId = item->StainId,
};
}

View File

@ -442,7 +442,7 @@ namespace Glamaholic.Ui {
// check for item
if (mirage != null && mirage.ItemId != 0 && editingPlate) {
var has = GameFunctions.DresserContents.Any(saved => saved.ItemId % 1_000_000 == mirage.ItemId) || this.Ui.Plugin.Functions.IsInArmoire(mirage.ItemId);
var has = GameFunctions.DresserContents.Any(saved => saved.ItemId % Util.HqItemOffset == mirage.ItemId) || this.Ui.Plugin.Functions.IsInArmoire(mirage.ItemId);
if (!has) {
borderColour = ImGuiColors.DalamudYellow;
}

View File

@ -11,6 +11,8 @@ namespace Glamaholic {
private const string BoxAddon = "MiragePrismPrismBox";
private const string ArmoireAddon = "CabinetWithdraw";
internal const uint HqItemOffset = 1_000_000;
private static unsafe bool IsOpen(AtkUnitBase* addon) {
return addon != null && addon->IsVisible;
}