Originally Posted by Levisaxos
Thank you all for your help guys!
Now all I have to find out is how to filter the kills to only kills made by people in my group (Could use party_kills for that, but that doesn't get raid kills!) and people in my raid!
So i'm guessing I will have to check the sourceName or sourceGUID to my raidmembers.
If anyone wishes to help me with that they are welcome to do so
[...]
However, how can I register if a mob is killed by a raid member?
UNIT_DIED does not give a valid sourceGUID of the person that killed him?
|
You would maybe have to check for the
overkill parameter
Here is a quick example (borrowing the code from Nibelheim
)
Code:
local Char, PlayerID, Realm
local KillCountDefaults = {
totalkills = 0,
characters = {},
}
local playerName = UnitName("player")
local damageEvent = {
["SWING_DAMAGE"] = true,
["RANGE_DAMAGE"] = true,
["SPELL_DAMAGE"] = true,
["SPELL_PERIODIC_DAMAGE"] = true,
}
local frame = CreateFrame("FRAME", "KillCountFrame");
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
frame:RegisterEvent("PLAYER_LOGIN");
local function eventHandler(self, event, ...)
if event == "PLAYER_LOGIN" then
Char = UnitName("player")
Realm = GetRealmName()
PlayerID = UnitGUID("player")
local CharID = Char .. " - " .. Realm
if not KillCountDB then
KillCountDB = KillCountDefaults
end
if not KillCountDB.characters[CharID] then
KillCountDB.characters[CharID] = 0,
end
else
local timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = ...
local amount, overkill
if damageEvent[subevent] then
if subevent == "SWING_DAMAGE" then
amount, overkill = select(12, ...)
else
amount, overkill = select(15, ...)
end
if overkill > 1 and (UnitInRaid(sourceName) or UnitInParty(sourceName) or sourceName == playerName) then
--print(sourceName.." killed "..destName.." for "..amount.." damage!")
KillCountDB.characters[sourceName] = (KillCountDB.characters[sourceName] or 0) + 1,
end
end
end
end
frame:SetScript("OnEvent", eventHandler);
There might be a problem with multiple timed overkill events for the same unit, so you maybe have to add in a throttle for each individual player, or it would all get counted as a kill