Originally Posted by Phanx
Please post your entire, actual code, not a snippet of "kinda like" code.
|
Oh okay, sorry. I should mention that this code project I'm working on is an update of the addon called SpellLight, I've tried to get in contact with the author for more than 1 year now without any reply. So I've been keeping it for my personal use only.
Anyway, it looks like this:
Code:
function My_New_Addon:UpdateSpellBook()
for slot=1,120 do self:ACTIONBAR_SLOT_CHANGED(slot) end
if self:PLAYER_REGEN_ENABLED(true) then
if SpellBookSpellIconsFrame:IsShown() then for id=1,12 do SpellButton_UpdateButton(_G['SpellButton'..id]) end end
end
end
function My_New_Addon:ACTIONBAR_SLOT_CHANGED(slot)
local action_Type, action_ID, action_subType, action_spellID = GetActionInfo(slot)
if action_ID then idslots[action_ID] = slot end
actionids[slot] = action_ID
self:UpdateSpellBook()
end
function My_New_Addon:ACTIONBAR_HIDEGRID()
self:UpdateSpellBook(true)
end
function My_New_Addon:SpellButton_UpdateButton(frame)
local name = frame:GetName()
frame:SetAlpha(1)
_G[name..'IconTexture']:SetDesaturated(false)
_G[name..'IconTexture']:SetVertexColor(1,1,1)
local Spellbook_slot = SpellBook_GetSpellBookSlot(frame)
local color_The_Slot_id = Spellbook_slot and select(2, GetSpellBookItemInfo(Spellbook_slot, BOOKTYPE_SPELL))
print (color_The_Slot_id)
-- !! This prints the Spell ID found in chat.
print (idslots[color_The_Slot_id])
-- !! This prints the corresponding Slot for that ID found in chat. This is where it goes wrong.
if idslots[color_The_Slot_id] then
frame:SetAlpha(.4)
_G[name..'IconTexture']:SetDesaturated(true)
_G[name..'IconTexture']:SetVertexColor(0.4,0.4,0.4)
end
if IsPassiveSpell(Spellbook_slot, BOOKTYPE_SPELL) then
frame:SetAlpha(.5)
_G[name..'IconTexture']:SetDesaturated(true)
_G[name..'IconTexture']:SetVertexColor(0.8,0.8,0.8)
end
end