/trunk
if ( not LynStats ) then return end |
if ( not LynStats.plugins ) then |
LynStats.plugins = {} |
end |
local addon = CreateFrame("Button", "gPeen", LynStats) |
addon.text = gPeen:CreateFontString(nil, "OVERLAY") |
critical = 0, |
} |
local function getHighest() |
function addon:getHighest() |
local db = gPeenDB |
local hit, crit = 0, 0 |
local lastHit, lastCrit = 0, 0 |
return hit, crit, spellHit, spellCrit |
end |
local function BuffPeen(spellName, amount, critical) |
function addon:BuffPeen(spellName, amount, critical) |
assert(type(spellName) == "string", format("bad argument #1 to 'BuffPeen' (string expected, got %s)", type(spellName))) |
assert(type(amount) == "number", format("bad argument #2 to 'BuffPeen' (number expected, got %s)", type(amount))) |
end |
gPeenDB = db |
hit, crit = getHighest() |
hit, crit = self:getHighest() |
addon.text:SetText("|cffffffff"..hit.."|r/|cffffffff"..crit.."|r") |
addon:SetWidth(addon.text:GetStringWidth()) |
end |
addon.text:SetText("|cffffffff0|r/|cffffffff0|r") |
addon:SetWidth(addon.text:GetStringWidth()) |
elseif ( IsShiftKeyDown() and button == "LeftButton" ) then |
hit, crit, spellHit, spellCrit = getHighest() |
hit, crit, spellHit, spellCrit = self:getHighest() |
SendChatMessage("gPeen: Highest Damage/Healing Records", channel) |
SendChatMessage("-----------------------------------------------", channel) |
SendChatMessage("(Normal) "..spellHit..": "..hit, channel) |
local function onEvent(self, event, time, eventType, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, spellID, spellName, spellSchool, amount, school, resisted, blocked, absorbed, critical) |
if ( not addon.text:GetText() ) then |
hit, crit = getHighest() |
hit, crit = self:getHighest() |
addon.text:SetText("|cffffffff"..hit.."|r/|cffffffff"..crit.."|r") |
addon:SetWidth(addon.text:GetStringWidth()) |
return |
if ( eventType == "SPELL_DAMAGE" or eventType == "SPELL_PERIODIC_DAMAGE" or eventType == "SPELL_HEAL" or eventType == "SPELL_PERIODIC_HEAL" ) then |
if ( bit_bor(srcFlags, COMBATLOG_FILTER_ME) == COMBATLOG_FILTER_ME ) then |
if ( not (resisted and blocked and absorbed) ) then |
BuffPeen(spellName, amount, critical) |
self:BuffPeen(spellName, amount, critical) |
end |
end |
end |
addon:SetWidth(addon.text:GetStringWidth()) |
addon:SetHeight(15) |
addon:SetScale(GetCVar("UIScale")) |
addon:SetPoint("RIGHT", LynStats, "LEFT", -20, 0) |
addon:SetScript("OnEnter", onEnter) |
addon:SetScript("OnLeave", function() GameTooltip:Hide() end) |
addon:SetScript("OnClick", onClick) |
addon:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
addon:RegisterEvent("PLAYER_LOGIN") |
tinsert(LynStats.plugins, addon) |
addon:SetPoint("RIGHT", LynStats, "LEFT", -(#LynStats.plugins * 20), 0) |