Skip to content

Commit

Permalink
Fixed a few more issues with recognizing learned / unlearned items
Browse files Browse the repository at this point in the history
  • Loading branch information
Caerdon committed Nov 28, 2022
1 parent f4e9489 commit 3fc530a
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CaerdonWardrobe.toc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## Title: Caerdon Wardrobe
## Notes: Shows BOE / BOA, openable, and unlearned pets, toys, mounts and wardrobe indicator on bank / bag / auction / merchant / guild bank / loot frame / loot roll / encounter journal slots
## Author: Caerdon
## Version: v3.3.3
## Version: v3.3.4
## SavedVariables: CaerdonWardrobeConfig
## OptionalDeps: WagoAnalytics, WoWUnit, AdiBags, AngrierWorldQuests, ArkInventory, Bagnon, BaudBag, cargBags_Nivaya, Combuctor, ElvUI, Inventorian, KkthnxUI, Pawn, Sorted, VenturePlan, WorldQuestsList, WorldQuestTab, WorldQuestTracker, ZygorGuidesViewer

Expand Down
6 changes: 4 additions & 2 deletions features/Tooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,10 @@ function TooltipMixin:OnProcessInfo(tooltip, tooltipInfo)
elseif tooltipInfo.getterName == "GetMerchantCostItem" then
local slot, costIndex = unpack(tooltipInfo.getterArgs)
local itemTexture, itemValue, itemLink, currencyName = GetMerchantItemCostItem(slot, costIndex);
local item = CaerdonItem:CreateFromItemLink(itemLink)
Tooltip:ProcessTooltip(tooltip, item)
if itemLink then
local item = CaerdonItem:CreateFromItemLink(itemLink)
Tooltip:ProcessTooltip(tooltip, item)
end
elseif tooltipInfo.getterName == "GetMerchantItem" then
local slot = unpack(tooltipInfo.getterArgs)
local itemLink = GetMerchantItemLink(slot);
Expand Down
2 changes: 1 addition & 1 deletion tests/LeatherTests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function Tests:ImbuedPioneerBracersNeed()
AreEqual(info.canEquip, info.needsItem)
AreEqual(UnitLevel("player") >= item:GetMinLevel(), info.hasMetRequirements)
AreEqual(not info.canEquip, info.otherNeedsItem)
AreEqual(false, info.isCompletionistItem)
AreEqual(true, info.isCompletionistItem)
AreEqual(true, info.matchesLootSpec)
end

Expand Down
54 changes: 44 additions & 10 deletions types/EquipmentMixin.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
CaerdonEquipment = {}
CaerdonEquipmentMixin = {}

local slotTable = {
INVTYPE_HEAD = 1,
INVTYPE_NECK = 2,
INVTYPE_SHOULDER = 3,
INVTYPE_BODY = 4,
INVTYPE_CHEST = 5,
INVTYPE_WAIST = 6,
INVTYPE_LEGS = 7,
INVTYPE_FEET = 8,
INVTYPE_WRIST = 9,
INVTYPE_HAND = 10,
INVTYPE_FINGER = 11,
INVTYPE_TRINKET = 13,
INVTYPE_WEAPON = 16,
INVTYPE_SHIELD = 17,
INVTYPE_RANGED = 16,
INVTYPE_CLOAK = 15,
INVTYPE_2HWEAPON = 16,
INVTYPE_BAG = 0,
INVTYPE_TABARD = 19,
INVTYPE_ROBE = 5,
INVTYPE_WEAPONMAINHAND = 16,
INVTYPE_WEAPONOFFHAND = 16,
INVTYPE_HOLDABLE = 17,
INVTYPE_AMMO = 0,
INVTYPE_THROWN = 16,
INVTYPE_RANGEDRIGHT = 17,
INVTYPE_QUIVER = 0,
INVTYPE_RELIC = 0
}

--[[static]] function CaerdonEquipment:CreateFromCaerdonItem(caerdonItem)
if type(caerdonItem) ~= "table" or not caerdonItem.GetCaerdonItemType then
error("Usage: CaerdonEquipment:CreateFromCaerdonItem(caerdonItem)", 2)
Expand Down Expand Up @@ -169,8 +200,8 @@ function CaerdonEquipmentMixin:GetTransmogInfo()
else
appearanceID, sourceID = C_TransmogCollection.GetItemInfo(itemLink)
if not sourceID and C_Item.IsDressableItemByID(item:GetItemID()) then -- not finding via transmog collection so need to do the DressUp hack
-- local slotName = item:GetInventoryTypeName()
local slotID = C_Item.GetItemInventoryTypeByID(item:GetItemLink())
local inventoryType = item:GetInventoryTypeName()
local slotID = slotTable[inventoryType]

-- print(item:GetItemLink() .. " is dressable")

Expand All @@ -179,14 +210,17 @@ function CaerdonEquipmentMixin:GetTransmogInfo()
self.dressUp:SetUnit('player')
end

self.dressUp:Undress()
self.dressUp:TryOn(itemLink, slotID)
-- print("CHECKING FOR SLOT: " .. tostring(slotID))
local transmogInfo = self.dressUp:GetItemTransmogInfo(slotID)
if transmogInfo then
sourceID = transmogInfo.appearanceID -- I don't know why, but it is.
if sourceID and sourceID ~= NO_TRANSMOG_SOURCE_ID then
appearanceID = select(2, C_TransmogCollection.GetAppearanceSourceInfo(sourceID))
if slotID and slotID > 0 then
self.dressUp:Undress()
self.dressUp:TryOn(itemLink, slotID)
-- print("CHECKING FOR SLOT: " .. tostring(slotID))
local transmogInfo = self.dressUp:GetItemTransmogInfo(slotID)

if transmogInfo then
sourceID = transmogInfo.appearanceID -- I don't know why, but it is.
if sourceID and sourceID ~= NO_TRANSMOG_SOURCE_ID then
appearanceID = select(2, C_TransmogCollection.GetAppearanceSourceInfo(sourceID))
end
end
end
end
Expand Down

0 comments on commit 3fc530a

Please sign in to comment.