local _, class = UnitClass('player'); if(class ~= 'ROGUE') then return end |
local addon = CreateFrame('Button', 'pRogue', TradeFrame, 'SecureActionButtonTemplate, UIPanelButtonTemplate') |
|
local function GetChannel() |
local channel = GetNumRaidMembers() > 0 and 'RAID' or GetNumPartyMembers() > 0 and 'PARTY' |
return channel |
end |
|
local function InBattleGround() |
for i = 1, MAX_BATTLEFIELD_QUEUES do |
if(GetBattlefieldStatus(i) == 'active') then |
return true |
end |
end |
return false |
end |
|
function addon:PLAYER_LOGIN() |
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') |
|
self:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED') |
end |
|
function addon:COMBAT_LOG_EVENT_UNFILTERED(stamp, event, sGUID, sName, sFlags, dGUID, dName, dFlags, spellId) |
if(not InBattleGround() and (GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0)) 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](self, ...) end) |
addon:RegisterEvent('PLAYER_LOGIN') |