Thread Tools Display Modes
Prev Previous Post   Next Post Next
Unread 11-25-12, 06:06 PM   #1
gmarco
Premium Member
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 97
Best way to determine who killed me

Hi all,
I'd like to improve my ganklist addon to offer the possibility to show a frame with the name of the char that killed you to easily add to the db.

So I begin to study a little bit the combat log.

The best way I found to determine who killed me is something like this pseudo sample code:


Lua Code:
  1. --- other code above
  2. local playerName = UnitName("player");
  3. local type = ""
  4. local typeMask = 0x00F
  5.  
  6. local function eventHandler_cleu(self, event, ...)
  7.     local timeStamp, event, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, prefixParam1, prefixParam2, dummyparam, suffixParam1, suffixParam2 = ...
  8.        
  9.         -- bit.band(tonumber(sourceGUID:sub(1,5)),typeMask) = 0 Player, 3-4 NPC
  10.  
  11.         if destName == playerName and bit.band(tonumber(sourceGUID:sub(1,5)),typeMask) == 0 and (event == "SPELL_DAMAGE" or event == "SPELL_PERIODIC_DAMAGE" or event == "RANGE_DAMAGE") and suffixParam2 > 0  then
  12.             print(type .. " ["..sourceName.."] killed ["..destName.."] with "..suffixParam1.." damage of ".. GetSpellLink(prefixParam1) .. " overkill " .. suffixParam2)   
  13.         elseif destName == playerName and bit.band(tonumber(sourceGUID:sub(1,5)),typeMask) == 0 and event == "SWING_DAMAGE" and prefixParam2 > 0 then
  14.             print(type .." ["..sourceName.."] killed ["..destName.."] with "..prefixParam1.." Melee, overkill " .. suffixParam2 )
  15.         end        
  16.        
  17.         -- a sample line when an enemy player killed me
  18.         -- [name] killed [me] with 65762 damage of [Combustione dell'Ombra] overkill 48472
  19.     end
  20.  
  21.  
  22. local frame_cleu = CreateFrame("FRAME", "remgankframe_cleu")
  23. frame_cleu:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  24. frame_cleu:SetScript("OnEvent", eventHandler_cleu)
  25.  
  26. --- other code not show...


Some questions now:

1) As noted in another thread the UNIT_DIED subevent not contain all the information about the src of the damage so I think I can't use it. So is this the best way ( check the overkill ) ?

2) May I use the CLE not CLEU ? I have not understand so much the differences but if in the first there are only events related to me probably is more efficent than the second and for what I need is the same.

3) I am a little bit scared about the so many conditions to parsing of the die event ... if it is my name related (destName), if I am not in a bg/arena, if the srcName is a Player, if this player is an Enemy (this could be omitted I think), if the there is an overkill so I am died by spell or it was a melee ... etc :-) . But I think I can't summarize them all :-)

Thanks all for attention.
gmarco is offline   Reply With Quote
 

Go BackWoWInterface » Developer Discussions » Lua/XML Help » Best way to determine who killed me

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off