Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
DengSir committed Aug 23, 2024
1 parent 7585682 commit b02024b
Show file tree
Hide file tree
Showing 16 changed files with 1,078 additions and 33 deletions.
10 changes: 10 additions & 0 deletions Addon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ local ns = select(2, ...)

local ShowUIPanel = LibStub('LibShowUIPanel-1.0').ShowUIPanel

---@class UI
---@field BaseItem UI.BaseItem
---@field GearItem UI.GearItem
---@field GearFrame UI.GearFrame
---@field GemItem UI.GemItem
---@field EnchantItem UI.EnchantItem
---@field InspectFrame UI.InspectFrame
---@field InspectGearFrame UI.InspectGearFrame
ns.UI = {}
ns.L = LibStub('AceLocale-3.0'):GetLocale('tdInspect')

Expand Down Expand Up @@ -75,6 +83,8 @@ end

function Addon:SetupUI()
self.InspectFrame = ns.UI.InspectFrame:Bind(InspectFrame)
self.InspectGearFrame = ns.UI.InspectGearFrame:Create(self.InspectFrame)
self.InspectGearFrame:SetPoint('TOPLEFT', self.InspectFrame, 'TOPRIGHT', -33, -12)
end

function Addon:ADDON_LOADED(_, addon)
Expand Down
23 changes: 23 additions & 0 deletions Api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,26 @@ function ns.ResolveTalent(class, data)
local talent = ns.Talent:New(class, data)
return talent:ToString()
end

local function FlagTest(value, flag)
return bit.band(value, bit.lshift(1, flag)) > 0
end

function ns.GetItemEnchantInfo(link)
if not link then
return
end
local enchantId = tonumber(link:match('item:%d+:(%d*):'))
if enchantId then
local itemId, _, _, _, _, classId, subClassId = GetItemInfoInstant(link)
local invType = C_Item.GetItemInventoryTypeByID(itemId)

for _, v in ipairs(ns.ItemEnchants) do
if v.enchantId == enchantId and v.classId == classId and
(not v.subClassMask or FlagTest(v.subClassMask, subClassId)) and
(not v.invTypeMask or FlagTest(v.invTypeMask, invType)) then
return v
end
end
end
end
18 changes: 18 additions & 0 deletions Data/DataLoader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ns.ItemSets = {}
ns.Glyphes = {}
ns.SpellGlyphes = {}
ns.GlyphSlots = {}
ns.ItemEnchants = {}

local strsplittable = strsplittable or function(delimiter, str, pieces)
return {strsplit(delimiter, str, pieces)}
Expand Down Expand Up @@ -162,3 +163,20 @@ function ns.GlyphMake()

setfenv(2, {D = Data, S = Slot})
end

function ns.ItemEnchantMake()
ns.ItemEnchantMake = nil

local Data = function(enchantId, spellId, itemId, classId, subClassMask, invTypeMask)
tinsert(ns.ItemEnchants, {
enchantId = enchantId,
spellId = spellId,
itemId = itemId,
classId = classId,
subClassMask = subClassMask,
invTypeMask = invTypeMask,
})
end

setfenv(2, {D = Data})
end
Loading

0 comments on commit b02024b

Please sign in to comment.