comparison KeyButton.lua @ 91:5005aecc2dc8 v8.0.1b

more 8.0.1 fire spotting
author Nenue
date Tue, 17 Jul 2018 20:47:59 -0400
parents 283dacee2850
children f9df7cd7bfd6
comparison
equal deleted inserted replaced
90:73810564e4b8 91:5005aecc2dc8
200 200
201 201
202 local name, icon, _, macroName, macroText 202 local name, icon, _, macroName, macroText
203 local pickupID, pickupBook 203 local pickupID, pickupBook
204 204
205 if actionType == 'spell' then 205 if actionType == 'spell' then
206 local realName = GetSpellInfo(subData) 206 local realName = GetSpellInfo(subData)
207 name, _, icon, _, _, _, actionID = GetSpellInfo(subData) 207 name, _, icon, _, _, _, actionID = GetSpellInfo(subData)
208 208
209 if TALENT_SPELLS[actionID] then 209 if TALENT_SPELLS[actionID] then
210 name = TALENT_SPELLS[actionID].actionName 210 name = TALENT_SPELLS[actionID].actionName
211 actionID = TALENT_SPELLS[actionID].actionID 211 actionID = TALENT_SPELLS[actionID].actionID
212 icon = TALENT_SPELLS[actionID].icon 212 icon = TALENT_SPELLS[actionID].icon
213 elseif actionType == 'macro' then 213 elseif actionType == 'macro' then
214 name, icon, macroText = GetMacroInfo(actionID) 214 name, icon, macroText = GetMacroInfo(actionID)
215 macroName = name 215 macroName = name
216 elseif actionType == 'petaction' then 216 elseif actionType == 'petaction' then
217 if CURSOR_SPELLSLOT and CURSOR_BOOKTYPE then 217 if CURSOR_SPELLSLOT and CURSOR_BOOKTYPE then
218 218
219 local spellType, spellID = GetSpellBookItemInfo(CURSOR_SPELLSLOT, CURSOR_BOOKTYPE) 219 local spellType, spellID = GetSpellBookItemInfo(CURSOR_SPELLSLOT, CURSOR_BOOKTYPE)
220 local spellName, spellText = GetSpellBookItemName(CURSOR_SPELLSLOT, CURSOR_BOOKTYPE) 220 local spellName, spellText = GetSpellBookItemName(CURSOR_SPELLSLOT, CURSOR_BOOKTYPE)
221 if spellType == 'PETACTION' then 221 if spellType == 'PETACTION' then
222 name = spellName 222 name = spellName
223 actionID = spellText 223 actionID = spellText
224 icon = CURSOR_TEXTURE 224 icon = CURSOR_TEXTURE
225 else
226 name, _, icon = GetSpellInfo(spellID)
227 actionID = spellID
228 end
229
230 pickupID = CURSOR_SPELLSLOT
231 pickupBook = CURSOR_BOOKTYPE
225 else 232 else
226 name, _, icon = GetSpellInfo(spellID) 233
227 actionID = spellID 234
228 end 235 end
229 236
230 pickupID = CURSOR_SPELLSLOT 237 elseif actionType == 'mount' then
231 pickupBook = CURSOR_BOOKTYPE 238 if subType == 0 then
239 name, _, icon = GetSpellInfo(SUMMON_RANDOM_FAVORITE_MOUNT_SPELL)
240 actionID = 0
241 else
242 name, _, icon = GetMountInfoByID(actionID)
243 end
244 elseif actionType == 'item' then
245 name = GetItemInfo(actionID)
246 icon = GetItemIcon(actionID)
247 elseif actionType == 'battlepet' then
248
249 local speciesID, customName, level, xp, maxXp, displayID, isFavorite, petName, petIcon, petType, creatureID = GetPetInfoByPetID(actionID)
250 name = customName or petName
251 icon = petIcon
252
253 end
254 local _, macroBody, command = kb.RegisterAction(actionType, actionID, name)
255 local slotInfo = {
256 command = command,
257 actionName = name,
258 iconPath = icon,
259 actionType = actionType,
260 actionID = actionID,
261 macroName = macroName,
262 macroText = macroText or macroBody,
263 spellbookSlot = pickupID,
264 spellbookType = pickupBook,
265 assignedKeys = {GetBindingKey(command)}
266 }
267
268 local isAssigned, isBound, assignedBy, boundBy = kb.IsCommandBound(self, command)
269 if isAssigned then
270 local popup = StaticPopupDialogs["SKELETONKEY_CONFIRM_ASSIGN_SLOT"]
271 popup.slot = self
272 popup.text = "Currently assigned in |cFFFFFF00"..tostring(kb.configHeaders[assignedBy]).."|r. Are you sure?"
273 popup.oldProfile = assignedBy
274 popup.args = {slotInfo}
275 SkeletonKey:SetScript('OnMouseWheel', nil) -- disable scrolling
276 StaticPopup_Show('SKELETONKEY_CONFIRM_ASSIGN_SLOT')
232 else 277 else
233 278 kb.currentProfile.buttons[self:GetID()] = slotInfo
234 279 kb.LoadBinding(slotInfo)
235 end 280 self:SetSlot(slotInfo)
236 281 self:UpdateSlot()
237 elseif actionType == 'mount' then 282 self.active = nil
238 if subType == 0 then 283 ClearCursor()
239 name, _, icon = GetSpellInfo(SUMMON_RANDOM_FAVORITE_MOUNT_SPELL) 284 ResetCursor()
240 actionID = 0 285 end
241 else 286 end
242 name, _, icon = GetMountInfoByID(actionID) 287 end
243 end 288 end
244 elseif actionType == 'item' then 289
245 name = GetItemInfo(actionID)
246 icon = GetItemIcon(actionID)
247 elseif actionType == 'battlepet' then
248
249 local speciesID, customName, level, xp, maxXp, displayID, isFavorite, petName, petIcon, petType, creatureID = GetPetInfoByPetID(actionID)
250 name = customName or petName
251 icon = petIcon
252
253 end
254 local _, macroBody, command = kb.RegisterAction(actionType, actionID, name)
255 local slotInfo = {
256 command = command,
257 actionName = name,
258 iconPath = icon,
259 actionType = actionType,
260 actionID = actionID,
261 macroName = macroName,
262 macroText = macroText or macroBody,
263 spellbookSlot = pickupID,
264 spellbookType = pickupBook,
265 assignedKeys = {GetBindingKey(command)}
266 }
267
268 local isAssigned, isBound, assignedBy, boundBy = kb.IsCommandBound(self, command)
269 if isAssigned then
270 local popup = StaticPopupDialogs["SKELETONKEY_CONFIRM_ASSIGN_SLOT"]
271 popup.slot = self
272 popup.text = "Currently assigned in |cFFFFFF00"..tostring(kb.configHeaders[assignedBy]).."|r. Are you sure?"
273 popup.oldProfile = assignedBy
274 popup.args = {slotInfo}
275 SkeletonKey:SetScript('OnMouseWheel', nil) -- disable scrolling
276 StaticPopup_Show('SKELETONKEY_CONFIRM_ASSIGN_SLOT')
277 else
278 kb.currentProfile.buttons[self:GetID()] = slotInfo
279 kb.LoadBinding(slotInfo)
280 self:SetSlot(slotInfo)
281 self:UpdateSlot()
282 self.active = nil
283 ClearCursor()
284 ResetCursor()
285 end
286 end
287 end
288 290
289 291
290 do 292 do
291 local PickupAction = { 293 local PickupAction = {
292 spell = _G.PickupSpell, 294 spell = _G.PickupSpell,