Skip to content

Commit

Permalink
Merge pull request #17 from Kirri777:Kirri777/issue14
Browse files Browse the repository at this point in the history
Fix for Cosmetics
  • Loading branch information
Kirri777 authored Oct 27, 2024
2 parents 0286d14 + 432166a commit 2d88beb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,20 @@ function AddOn:checkOther(itemLink, looter)
self.Debug("playerKnowsPet: true")
return
end

-- Check if the item is a cosmetics and if the player knows it
if CanIMogIt and AddOn:isCosmetic(itemLink) then
self.Debug("isCosmetic: true")

if not CanIMogIt:PlayerKnowsTransmog(itemLink) then
self.Debug("playerKnowsCosmetic: false")
-- Add the item to the loot table with a specific level for cosmetics
return AddOn:addItem(itemLink, looter, 6666, '')
end

self.Debug("playerKnowsCosmetic: true")
return
end
end

--[[
Expand Down Expand Up @@ -394,6 +408,27 @@ function AddOn:playerKnowsPet(itemLink)
return C_PetJournal.GetNumCollectedInfo(speciesID) > 0
end


--[[
Determines if the given item link is cosmetic.
@param itemLink string: The item link to check.
@return boolean: True if the item is cosmetic, false otherwise.
]]
function AddOn:isCosmetic(itemLink)
-- Retrieve the item subclass using the item link
local itemSubClass = select(3, C_Item.GetItemInfoInstant(itemLink))

if itemSubClass == nil then
-- If the subclass could not be determined, return false
return false
end

-- Check if the item subclass is cosmetic
return select(1, C_Item.GetItemSubClassInfo(4, 5)) == itemSubClass
end

--[[
Checks if an item is transmogable or upgrade currently equipped.
Expand Down Expand Up @@ -1163,6 +1198,7 @@ local function SlashCommandHandler(msg)
local itemLink = item:GetItemLink()
local itemLevel = item:GetCurrentItemLevel()
local _, _, rarity, _, _, type, _, _, equipLoc, _, _, itemClass, itemSubClass = GetItemInfo(itemLink)
AddOn.Debug("Item type: " .. type)

-- If not Armor/Weapon
if (type ~= ARMOR and type ~= AUCTION_CATEGORY_ARMOR and type ~= WEAPON) then
Expand Down
2 changes: 1 addition & 1 deletion DoYouNeedThat.toc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Title: DoYouNeedThat?
## Author: Kraffs <Numinous-TarrenMill LootCouncil-TarrenMill>
## Version: 1.2.5
## Version: 1.2.6
## Notes: Pesters people for loot because Personal Loot is fun! (Kirri mod)
## OptionalDeps: CanIMogIt
## SavedVariables: DyntDB
Expand Down

0 comments on commit 2d88beb

Please sign in to comment.