if(select(2, UnitClass'player') ~= 'ROGUE') then return end |
local addon = CreateFrame('Button', 'pRogue', TradeFrame, 'SecureActionButtonTemplate, UIPanelButtonTemplate') |
|
local addon = CreateFrame('Frame') |
local function GetChannel() |
local channel = GetNumRaidMembers() > 0 and 'RAID' or GetNumPartyMembers() > 0 and 'PARTY' or 'SAY' |
return channel |
end |
|
function addon.PLAYER_LOGIN() |
local button = CreateFrame('Button', 'pRogueUnlockButton', TradeFrame, 'SecureActionButtonTemplate, UIPanelButtonTemplate') |
button:SetHeight(22) |
button:SetWidth(85) |
button:RegisterForClicks('AnyUp') |
button:SetAttribute('type', 'spell') |
button:SetAttribute('spell', 'Pick Lock') |
button:SetPoint('RIGHT', TradeFrameTradeButton, 'LEFT', -2, 1) |
button:SetText('Unlock') |
local function InBattleGround() |
for i = 1, MAX_BATTLEFIELD_QUEUES do |
if(GetBattlefieldStatus(i) == 'active') then |
return true |
end |
end |
return false |
end |
|
function addon.COMBAT_LOG_EVENT_UNFILTERED(stamp, event, sGUID, sName, sFlags, dGUID, dName, dFlags, spellId) |
if(event == 'SPELL_CAST_SUCCESS') then |
if(sGUID == UnitGUID('player')) then |
if(spellId == 11297) then |
SendChatMessage(format("- %s is now sapped -", dName), (GetNumRaidMembers() > 0) and 'RAID' or (GetNumPartyMembers() > 0) and 'PARTY' or 'SAY') |
elseif(spellId == 2094) then |
SendChatMessage(format("- %s is now blinded -", dName), (GetNumRaidMembers() > 0) and 'RAID' or (GetNumPartyMembers() > 0) and 'PARTY' or 'SAY') |
function addon.PLAYER_LOGIN(self) |
self:SetHeight(22) |
self:SetWidth(85) |
self:RegisterForClicks('AnyUp') |
self:SetAttribute('type', 'spell') |
self:SetAttribute('spell', 'Pick Lock') |
self:SetPoint('RIGHT', TradeFrameTradeButton, 'LEFT', -2, 1) |
self:SetText('Unlock') |
end |
|
function addon.COMBAT_LOG_EVENT_UNFILTERED(self, stamp, event, sGUID, sName, sFlags, dGUID, dName, dFlags, spellId) |
if(not InBattleGround()) then |
if(event == 'SPELL_CAST_SUCCESS') then |
if(sGUID == UnitGUID('player')) then |
if(spellId == 11297) then |
SendChatMessage(format("- %s is now sapped -", dName), GetChannel()) |
elseif(spellId == 2094) then |
SendChatMessage(format("- %s is now blinded -", dName), GetChannel()) |
end |
end |
end |
end |
end |
|
addon:SetScript('OnEvent', function(self, event, ...) self[event](...) end) |
addon:SetScript('OnEvent', function(self, event, ...) self[event](self, ...) end) |
addon:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED') |
addon:RegisterEvent('PLAYER_LOGIN') |