comparison classes/MultiCastButton.lua @ 168:07c76dbc0236

minor cleanup for multicastbutton (drycoded)
author Flick <flickerstreak@gmail.com>
date Tue, 19 Oct 2010 17:08:48 +0000
parents eab7e7642dd6
children 8cc187143acd
comparison
equal deleted inserted replaced
167:eab7e7642dd6 168:07c76dbc0236
109 totemIDsBySlot = newtable() 109 totemIDsBySlot = newtable()
110 for i = 1, slotsPerPage do 110 for i = 1, slotsPerPage do
111 totemIDsBySlot[i] = self:GetAttribute("TOTEM_PRIORITY_"..i) 111 totemIDsBySlot[i] = self:GetAttribute("TOTEM_PRIORITY_"..i)
112 end 112 end
113 113
114 summonSpells = summonSpells or newtable() -- set up in bar:SetupBarHeader() 114 -- these are set up in bar:SetupBarHeader()
115 flyoutChildren = flyoutChildren or newtable()
116 summonSpells = summonSpells or newtable()
115 ]] 117 ]]
116 118
117 local _onstate_multispellpage = -- function(self, stateid, newstate) 119 local _onstate_multispellpage = -- function(self, stateid, newstate)
118 [[ 120 [[
119 currentPage = tonumber(newstate) 121 currentPage = tonumber(newstate)
164 lastPage = page 166 lastPage = page
165 end 167 end
166 else 168 else
167 local offset = summonSlot or 0 169 local offset = summonSlot or 0
168 local totemID = totemIDsBySlot[slot - offset] 170 local totemID = totemIDsBySlot[slot - offset]
169 local spells = newtable( 0, GetMultiCastTotemSpells(totemID) ) 171 local spell = select(page, 0, GetMultiCastTotemSpells(totemID) )
170 if spells[page] then 172 if spell then
171 b:SetAttribute("type","multispell") 173 b:SetAttribute("type","multispell")
172 b:SetAttribute("action", baseActionID + (currentPage - 1)*slotsPerPage + totemID) 174 b:SetAttribute("action", baseActionID + (currentPage - 1)*slotsPerPage + totemID)
173 b:SetAttribute("spell", spells[page]) 175 b:SetAttribute("spell", spell)
174 b:Show() 176 b:Show()
175 lastButton = b 177 lastButton = b
176 lastPage = page 178 lastPage = page
177 end 179 end
178 end 180 end