local addon = CreateFrame("Button", "gPeen", LynStats) |
addon.text = gPeen:CreateFontString(nil, "OVERLAY") |
|
local bit_bor = bit.bor |
local COMBATLOG_FILTER_ME = COMBATLOG_FILTER_ME |
|
local hit, crit = 0, 0 |
local lastHit, lastCrit = 0, 0 |
local spellHit, spellCrit |
|
local font = "Fonts\\skurri.ttf" |
local size = 16 |
local channel = "GUILD" |
local color = { r = 0, g = 0.8, b = 1 } |
|
local default = { |
normal = 0, |
critical = 0, |
} |
|
local function getHighest() |
local db = gPeenDB |
local hit, crit = 0, 0 |
local lastHit, lastCrit = 0, 0 |
local spellHit, spellCrit |
for spell in pairs(db) do |
if db[spell].normal > lastHit then |
hit = db[spell].normal |
lastHit = hit |
spellHit = spell |
end |
|
if db[spell].critical > lastCrit then |
crit = db[spell].critical |
lastCrit = crit |
spellCrit = spell |
end |
end |
return hit, crit, spellHit, spellCrit |
end |
|
local function 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))) |
|
local db = gPeenDB |
|
if not db[spellName] then |
db[spellName] = default |
end |
|
if critical then |
if amount > db[spellName].critical then |
db[spellName].critical = amount |
--gPeen:AddMessage(spellName.." : "..amount.." (CRIT)", 1, 1, 1, 1, 2) |
if MikSBT and not MikSBT.IsModDisabled() then |
MikSBT.DisplayMessage(spellName.." : "..amount.." (CRIT)", MikSBT.DISPLAYTYPE_NOTIFICATION, true, 255, 255, 255, 38, nil, nil, nil) |
elseif ( SCT ) then |
SCT:DisplayMessage(spellName.." : "..amount.." (CRIT)", addon.color) |
elseif ( COMBAT_TEXT_SCROLL_FUNCTION ) then |
CombatText_AddMessage(spellName.." : "..amount.." (CRIT)", COMBAT_TEXT_SCROLL_FUNCTION, 1, 1, 1, "crit", nil) |
end |
end |
else |
if amount > db[spellName].normal then |
db[spellName].normal = amount |
--gPeen:AddMessage(spellName.." : "..amount, 1, 1, 1, 1, 2) |
if MikSBT and not MikSBT.IsModDisabled() then |
MikSBT.DisplayMessage(spellName.." : "..amount, MikSBT.DISPLAYTYPE_NOTIFICATION, true, 255, 255, 255, 38, nil, nil, nil) |
elseif ( SCT ) then |
SCT:DisplayMessage(spellName.." : "..amount, addon.color) |
elseif ( COMBAT_TEXT_SCROLL_FUNCTION ) then |
CombatText_AddMessage(spellName.." : "..amount, COMBAT_TEXT_SCROLL_FUNCTION, 1, 1, 1, nil, nil) |
end |
end |
end |
|
gPeenDB = db |
hit, crit = getHighest() |
addon.text:SetText("|cffffffff"..hit.."|r/|cffffffff"..crit.."|r") |
addon:SetWidth(addon.text:GetStringWidth()) |
end |
|
local function onEnter(self) |
GameTooltip:SetOwner(self, "ANCHOR_NONE") |
GameTooltip:SetPoint("BOTTOM", self, "TOP", 0, 20) |
GameTooltip:AddDoubleLine("Spell Name", "Normal / Critical", 0, .8, 1, 0, .8, 1) |
GameTooltip:AddLine(" ") |
local db = gPeenDB |
for spell in pairs(db) do |
GameTooltip:AddDoubleLine(spell, db[spell].normal.." / "..db[spell].critical, 1, 1, 1, 1, 1, 1) |
end |
GameTooltip:AddLine("----------------------------------------------------------------------------------", 1, 1, 1) |
GameTooltip:AddLine("ALT + Right-click to reset database", 0, .8, 1) |
GameTooltip:AddLine("SHIFT + Left-click to announce highest records to "..string.lower(channel), 0, .8, 1) |
GameTooltip:Show() |
end |
|
local function onClick(self, button) |
if ( IsAltKeyDown() and button == "RightButton" ) then |
gPeenDB = {} |
addon.text:SetText("|cffffffff0|r/|cffffffff0|r") |
addon:SetWidth(addon.text:GetStringWidth()) |
elseif ( IsShiftKeyDown() and button == "LeftButton" ) then |
hit, crit, spellHit, spellCrit = getHighest() |
SendChatMessage("gPeen: Highest Damage/Healing Records", channel) |
SendChatMessage("-----------------------------------------------", channel) |
SendChatMessage("(Normal) "..spellHit..": "..hit, channel) |
SendChatMessage("(Critical) "..spellCrit..": "..crit, channel) |
end |
end |
|
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() |
addon.text:SetText("|cffffffff"..hit.."|r/|cffffffff"..crit.."|r") |
addon:SetWidth(addon.text:GetStringWidth()) |
return |
end |
|
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) |
end |
end |
end |
end |
|
gPeenDB = {} |
|
addon.text:SetFont(font, size, "OUTLINE") |
addon.text:ClearAllPoints() |
addon.text:SetPoint"CENTER" |
addon.text:SetTextColor(color.r, color.g, color.b) |
addon.text:Show() |
|
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:SetScript("OnEvent", onEvent) |
addon:RegisterForClicks("AnyUp") |
addon:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
addon:RegisterEvent("PLAYER_LOGIN") |
|
|