Originally Posted by Katae
This should get you going
Code:
{ width=50, height=50,
OnLoad=function(self)
self:RegisterEvent'PLAYER_REGEN_ENABLED'
self:RegisterEvent'PLAYER_REGEN_DISABLED'
self:Hide()
end,
OnEvent=function(self) ToggleFrame(self) end
}
You'll probably need to make a custom function to check if the character is a healer and not a deeps, probably by checking where they put their talent points.
|
Yay, that code worked, although i had to work with it a bit to make it fit with my layout
Anyhow, that wasn't how i meant really. I meant if you could make it ONLY show it when u do damage to something, in compilation with the hide/show in combat. So when you dont do damage in combat, it stays hidden
EDIT: Hmm, now i notice something weird... The frame like is like flashing shown/hidden all the time o.O Seems to happen when i just do something, like moving the mouse or typing something o.O Can provide u with the code, see if u can find the problem
Code:
-- DPS Frame
{ name = "DPS", anchor_to = "BOTTOM", y_off = "175",
text = {
string = function(self)
self = self:GetParent()
self.dps = self.active and format("%.1f", self.damage / (GetTime() - self.starttime)) or self.dps or "0.0"
return self.dps.." dps" -- "5433.4 dps"
end, update = 0.5, color = {1,1,1}, size = 15, shadow=2, font = "Fonts\\FRIZQT__.TTF",
},
OnLoad = function(self)
self:RegisterEvent("UNIT_PET")
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
self:RegisterEvent("PLAYER_REGEN_DISABLED")
self.events = "SWING_DAMAGE RANGE_DAMAGE SPELL_DAMAGE SPELL_PERIODIC_DAMAGE DAMAGE_SHIELD DAMAGE_SPLIT"
self.player, self.pet, self.damage, self.active = UnitGUID'player', UnitGUID'pet' or '0x0', 0, false
self:RegisterEvent'PLAYER_REGEN_ENABLED'
self:RegisterEvent'PLAYER_REGEN_DISABLED'
self:Hide()
end,
OnEvent = function(self, event, ...) ToggleFrame(self)
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
local _,spellevent,unit,_,_,_,_,_,type,_,_,damage = ...
if not strmatch(self.events,spellevent) then return end
if unit == self.player or unit == self.pet then
if spellevent == "SWING_DAMAGE" then damage = type end
self.damage = self.damage + damage
end
end
if event == "UNIT_PET" then self.pet = UnitGUID'pet' or '0x0' end
if event == "PLAYER_REGEN_ENABLED" then self.active = false end
if event == "PLAYER_REGEN_DISABLED" then
self.starttime, self.damage, self.active = GetTime(), 0, true
end
end,
OnClick = function(self, button)
if button == "RightButton" then
self.starttime, self.damage, self.dps = GetTime(), 0, '0.0'
self.text:SetText("0.0 dps")
end
end
},