|
--]] |
|
local milling, prospecting = GetSpellInfo(51005), GetSpellInfo(31252) |
if(not GetSpellInfo(milling) and not GetSpellInfo(31252)) then return end |
|
local button = CreateFrame('Button', 'Molinari', UIParent, 'SecureActionButtonTemplate, AutoCastShineTemplate') |
|
local strings = { |
[ITEM_MILLABLE] = { name = milling, r = 0.5, g = 1, b = 0.5 }, |
[ITEM_PROSPECTABLE] = { name = prospecting, r = 1, g = 0.5, b = 0.5 }, |
[ITEM_MILLABLE] = GetSpellInfo(51005), |
[ITEM_PROSPECTABLE] = GetSpellInfo(31252), |
} |
|
local function clickArgs() |
return (not IsAddOnLoaded('Blizzard_AuctionUI') or AuctionFrame and not AuctionFrame:IsShown()) and not TradeFrame:IsShown() and not BankFrame:IsShown() and not MailFrame:IsShown() and not InCombatLockdown() and IsAltKeyDown() |
end |
|
local function hookScript(self) |
if(self:GetItem() and clickArgs()) then |
local spell = strings[GameTooltipTextLeft2:GetText()] |
if(self:GetItem() and IsAltKeyDown() and not InCombatLockdown()) then |
local text = GameTooltipTextLeft2:GetText() |
local spell = strings[text] |
|
if(spell) then |
local mouse = GetMouseFocus() |
|
button:SetAttribute('macrotext', string.format('/cast %s\n/use %s %s', spell.name, mouse:GetParent():GetID(), mouse:GetID())) |
button:SetAttribute('macrotext', string.format('/cast %s\n/use %s %s', spell, mouse:GetParent():GetID(), mouse:GetID())) |
button:ClearAllPoints() |
button:SetAllPoints(mouse) |
button:SetParent(mouse) |
button:Show() |
|
AutoCastShine_AutoCastStart(button, spell.r, spell.g, spell.b) |
if(text == ITEM_MILLABLE) then |
AutoCastShine_AutoCastStart(button, 0.5, 1, 0.5) |
else |
AutoCastShine_AutoCastStart(button, 1, 0.5, 0.5) |
end |
end |
end |
end |