Originally Posted by Fizzlemizz
This makes it a bit more complicated as you're getting mutiple items for each row so you have to have them all cached before you can do the format().
I have to head out so I'll look at it in the morning.
|
Thank you very much, good luck in your business. Maybe this code will help you
Lua Code:
local Item = Class('Item', Reward)
function Item:Initialize(attrs)
Reward.Initialize(self, attrs)
if not self.item then
error('Item() reward requires an item id to be set')
end
self.itemLink = L['retrieving']
self.itemIcon = 'Interface\\Icons\\Inv_misc_questionmark'
local item = _G.Item:CreateFromItemID(self.item)
if not item:IsItemEmpty() then
item:ContinueOnItemLoad(function()
self.itemLink = item:GetItemLink()
self.itemIcon = item:GetItemIcon()
end)
end
end
function Item:Prepare() ns.PrepareLinks(self.note) end
function Item:IsObtained()
if self.quest then return C_QuestLog.IsQuestFlaggedCompleted(self.quest) end
if self.bag then return ns.PlayerHasItem(self.item) end
return true
end
function Item:GetText()
local text = self.itemLink
if self.type then -- mount, pet, toy, etc
text = text .. ' (' .. self.type .. ')'
end
if self.count then
text = text .. string.format(' (%sx)', BreakUpLargeNumbers(self.count))
end
if self.note then -- additional info
text = text .. ' (' .. ns.RenderLinks(self.note, true) .. ')'
end
return Icon(self.itemIcon) .. text
end
function Item:GetStatus()
if self.bag then
local collected = ns.PlayerHasItem(self.item)
return collected and Green(L['completed']) or Red(L['incomplete'])
elseif self.status then
return format('(%s)', self.status)
elseif self.quest then
local completed = C_QuestLog.IsQuestFlaggedCompleted(self.quest)
return completed and Green(L['completed']) or Red(L['incomplete'])
elseif self.weekly then
local completed = C_QuestLog.IsQuestFlaggedCompleted(self.weekly)
return completed and Green(L['weekly']) or Red(L['weekly'])
end
end
And an additional question. -
https://www.wowinterface.com/forums/...t=59795&page=2
In the last topic you helped me make a timer.
I plan to make another addon in the future that also uses this timer. The problem is that if a player installs 2 of these addons, the timer will not work correctly. I thought it was enough to fix
ZAMROTimer to
ZAMRO1Timer, but it looks like something else needs to be done?