Skip to content

Commit

Permalink
reset combat time when we reset bars, add upvalues, simples event -> …
Browse files Browse the repository at this point in the history
…Display
  • Loading branch information
Zariel committed Jul 20, 2009
1 parent 44d4324 commit e33b116
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 39 deletions.
64 changes: 25 additions & 39 deletions core.lua
Expand Up @@ -2,6 +2,12 @@ local addon = CreateFrame("Frame")
addon:SetScript("OnEvent", function(self, event, ...) return self[event](self, ...) end)
addon:RegisterEvent("ADDON_LOADED")

local UnitAffectingCombat = UnitAffectingCombat
local UnitInVehicle = UnitInVehicle
local UnitExists = UnitExists
local UnitGUID = UnitGUID
local UnitName = UnitName

local timer = 0
local OnUpdate = function(self, elapsed)
timer = timer + elapsed
Expand Down Expand Up @@ -35,28 +41,17 @@ local ldb
local band = bit.band
local filter = COMBATLOG_OBJECT_AFFILIATION_RAID + COMBATLOG_OBJECT_AFFILIATION_PARTY + COMBATLOG_OBJECT_AFFILIATION_MINE

local combatStart = {}
local combatEnd = {}

local events = {
["SWING_DAMAGE"] = 1,
["RANGE_DAMAGE"] = 2,
["SPELL_DAMAGE"] = 4,
["SPELL_PERIODIC_DAMAGE"] = 8,
["SPELL_HEAL"] = 16,
["SPELL_PERIDOIC_HEAL"] = 32,
["SPELL_SUMMON"] = 64,
}
["SWING_DAMAGE"] = "Damage",
["RANGE_DAMAGE"] = "Damage",
["SPELL_DAMAGE"] = "Damage",
["SPELL_PERIODIC_DAMAGE"] = "Damage",

local displays = {
[15] = "damage",
[48] = "healing",
}
["SPELL_HEAL"] = "Healing",
["SPELL_PERIDOIC_HEAL"] = "Healing",

local UnitInVehicle = UnitInVehicle
local UnitExists = UnitExists
local UnitGUID = UnitGUID
local UnitName = UnitName
["SPELL_SUMMON"] = true,
}

function addon:ADDON_LOADED(name)
if name ~= "Fiend" then return end
Expand All @@ -83,7 +78,11 @@ function addon:ADDON_LOADED(name)
if IsModifiedClick("ALT") and button == "LeftButton" then
self:StartMoving()
elseif button == "RightButton" then
ToggleDropDownMenu(1, nil, addon.dropDown, self)
if IsModifiedClick("SHIFT") then
self.currentDisplay:RemoveAllBars()
else
ToggleDropDownMenu(1, nil, addon.dropDown, self)
end
end
end)

Expand Down Expand Up @@ -159,27 +158,14 @@ function addon:COMBAT_LOG_EVENT_UNFILTERED(timeStamp, event, sourceGUID, sourceN
local damage = ammount - (over + resist)

if damage > 0 then
local display
if events[event] > 8 then
display = self.displays.Healing

--[[
if UnitAffectingCombat(sourceName) then
combatStart[sourceName] = combatStart[sourceName] or GetTime()
elseif combatStart[sourceName] then
combatEnd[sourceName] = GetTime()
end
]]
else
display = self.displays.Damage
end
local display = self.displays[events[event]]
if display then

local pet = self:IsPet(sourceGUID)
if pet then
sourceGUID = pet
end
local pet = self:IsPet(sourceGUID)
if pet then
sourceGUID = pet
end

if display then
display:Update(sourceGUID, damage)
end
end
Expand Down
4 changes: 4 additions & 0 deletions display.lua
Expand Up @@ -192,6 +192,9 @@ function Display:RemoveAllBars()

self.guids[bar.guid] = nil

fiend.inCombat[bar.guid] = nil
fiend.combatTime[bar.guid] = 0

table.insert(pool, bar)
end

Expand Down Expand Up @@ -264,6 +267,7 @@ function Display:Output(count, where, player)
end

output("Fiend " .. self.title)

for i = 1, count or #self.bars do
if not self.bars[i] then break end
output(i .. ". " .. self.bars[i].name .. "" .. self.bars[i].total)
Expand Down

0 comments on commit e33b116

Please sign in to comment.