Skip to content

Commit

Permalink
add itemQuery into professions and add itemCount
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoizame committed Jul 11, 2019
1 parent c4c5aeb commit 669427f
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 89 deletions.
8 changes: 8 additions & 0 deletions AtlasLootClassic/Button/Button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,14 @@ end
function Proto:SetDifficultyID(diffID)
self.__atlaslootinfo.difficulty = diffID
end

function Proto:GetTypeFunctions()
return button_types[self.__atlaslootinfo.type[1]]
end

function Proto:GetSecTypeFunctions()
return button_types[self.__atlaslootinfo.secType[1]]
end
--################################
-- Enhanced Description
--################################
Expand Down
8 changes: 7 additions & 1 deletion AtlasLootClassic/Button/Item_type.lua
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,14 @@ Query.EventFrame = CreateFrame("FRAME")
local function EventFrame_OnEvent(frame, event, arg1, arg2)
if event == "GET_ITEM_INFO_RECEIVED" then
if arg1 and button_list[arg1] then
local button
for i = 1, #button_list[arg1] do
Item.Refresh(button_list[arg1][i])
button = button_list[arg1][i]
if button.type == "secButton" then
button:GetSecTypeFunctions().Refresh(button_list[arg1][i])
else
button:GetTypeFunctions().Refresh(button_list[arg1][i])
end
end
button_list[arg1] = nil
end
Expand Down
28 changes: 20 additions & 8 deletions AtlasLootClassic/Button/Profession_type.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local AtlasLoot = _G.AtlasLoot
local Prof = AtlasLoot.Button:AddType("Profession", "prof")
local ItemQuery = AtlasLoot.Button:GetType("Item").Query
local AL = AtlasLoot.Locales
local GetAlTooltip = AtlasLoot.Tooltip.GetTooltip
local Profession = AtlasLoot.Data.Profession
Expand Down Expand Up @@ -51,12 +52,14 @@ function Prof.OnSet(button, second)
end

function Prof.OnClear(button)
ItemQuery:Remove(button)
ItemQuery:Remove(button.secButton)
button.Profession = nil
button.SpellID = nil
button.tsLink, button.tsName = nil, nil
button.ItemID = nil
button.secButton.Profession = nil
button.secButton.SpellID = nil
button.secButton.tsLink, button.secButton.tsName = nil, nil
button.secButton.ItemID = nil
if button.ExtraFrameShown then
AtlasLoot.Button:ExtraItemFrame_ClearFrame()
button.ExtraFrameShown = false
Expand Down Expand Up @@ -93,12 +96,18 @@ function Prof.Refresh(button)
local spellName, _, spellTexture = GetSpellInfo(button.SpellID)

if Profession.IsProfessionSpell(button.SpellID) then
local itemName, _, itemQuality, _, _, _, _, _, _, itemTexture
if Profession.GetCreatedItemID(button.SpellID) then
itemName, _, itemQuality, _, _, _, _, _, _, itemTexture = GetItemInfo(Profession.GetCreatedItemID(button.SpellID))
local _, itemName, itemQuality, itemTexture, itemCount
button.ItemID = Profession.GetCreatedItemID(button.SpellID)
if button.ItemID then
itemName, _, itemQuality, _, _, _, _, _, _, itemTexture = GetItemInfo(button.ItemID)
if not itemName then
ItemQuery:Add(button)
return false
end
itemCount = Profession.GetNumCreatedItems(button.SpellID)
end
itemQuality = itemQuality or 0

--ItemQuery
button.overlay:Show()
button.overlay:SetTexture(WHITE_ICON_FRAME)
button.overlay:SetAtlas(LOOT_BORDER_BY_QUALITY[itemQuality] or LOOT_BORDER_BY_QUALITY[LE_ITEM_QUALITY_UNCOMMON])
Expand All @@ -110,13 +119,16 @@ function Prof.Refresh(button)

else
if itemName then
button.name:SetText("|c"..ITEM_COLORS[itemQuality or 0]..itemName)
button.name:SetText("|c"..ITEM_COLORS[itemQuality or 0]..(spellName or itemName))
else
button.name:SetText(PROF_COLOR..spellName)
end
button.extra:SetText(Profession.GetSpellDescription(button.SpellID).." ( "..Profession.GetColorSkillRank(button.SpellID).." )")
end

if itemCount > 1 then
button.count:SetText(itemCount)
button.count:Show()
end
button.icon:SetTexture(itemTexture or Profession.GetIcon(button.SpellID) or spellTexture)
end

Expand Down
Loading

0 comments on commit 669427f

Please sign in to comment.