/trunk/Molinari
local spell = strings[text] |
if(spell) then |
local anchor = GetMouseFocus() |
local mouse = GetMouseFocus() |
button:SetAttribute('macrotext', string.format('/cast %s\n/use %s %s', spell, anchor:GetParent():GetID(), anchor:GetID())) |
button:SetAttribute('macrotext', string.format('/cast %s\n/use %s %s', spell, mouse:GetParent():GetID(), mouse:GetID())) |
button:ClearAllPoints() |
button:SetAllPoints(anchor) |
button:SetAllPoints(mouse) |
button:SetParent(mouse) |
button:Show() |
if(text == ITEM_MILLABLE) then |
end |
end |
local function safeStop(self) |
if(InCombatLockdown()) then |
self:RegisterEvent('PLAYER_REGEN_ENABLED') |
else |
self:Hide() |
end |
end |
function button:MODIFIER_STATE_CHANGED(event, key) |
if(self:IsShown() and string.match(key, 'ALT$')) then |
if(InCombatLockdown()) then |
self:RegisterEvent('PLAYER_REGEN_DISABLED') |
else |
self:Hide() |
end |
safeStop(self) |
end |
end |
function button:PLAYER_REGEN_DISABLED(event) |
function button:PLAYER_REGEN_ENABLED(event) |
self:UnregisterEvent(event) |
self:Hide() |
end |
function button:PLAYER_LOGIN() |
self:RegisterForClicks('LeftButtonUp') |
self:RegisterEvent('MODIFIER_STATE_CHANGED') |
self:SetFrameStrata('DIALOG') |
self:SetAttribute('*type*', 'macro') |
self:SetScript('OnLeave', function() self:Hide() end) |
self:SetScript('OnLeave', safeStop) |
GameTooltip:HookScript('OnTooltipSetItem', hookScript) |
end |