Reply
Thread Tools Display Modes
Unread 12-04-12, 11:05 AM   #21
gmarco
Premium Member
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 97
Code:
local HOSTILE_PLAYER = bit_bor(COMBAT_LOG_REACTION_HOSTILE, COMBATLOG_OBJECT_CONTROL_PLAYER)

if bit_band(sourceFlags, HOSTILE_PLAYER) ~= 0 then
    -- source is a hostile player
end
You can find a complete list of combat log bitmasks here:
http://wow.go-hero.net/framexml/16309/Constants.lua#374
Hi Phanx,
I get error if i try to use this code.
I am not very confident in the COMBAT_LOG_REACTION_HOSTILE var name global.

I have added:

local bit_bor = bit.bor
local COMBAT_LOG_REACTION_HOSTILE = COMBAT_LOG_REACTION_HOSTILE

to my addon code but I always get an error like:

Lua Code:
  1. bad argument #1 to "bit_bor" (number expected, got nil)

Again, thanks really very much to you and to every reader and poster :-)
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
gmarco is offline   Reply With Quote
Unread 12-04-12, 11:33 AM   #22
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 565
I think someone misread or typo'd it

COMBAT_LOG_REACTION_HOSTILE -> COMBATLOG_OBJECT_REACTION_HOSTILE
Ketho is offline   Reply With Quote
Unread 12-06-12, 02:20 AM   #23
gmarco
Premium Member
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 97
Thanks for the reply.

I fix the code and try but also with these modifications it sometime identified the bosses like players.

I paste a debug from an error of buggrabber.


Code:
7x Remgank-0.5\core.lua:149: bad argument #6 to "string_format" (string expected, got nil)
<in C code>
Remgank-0.5\core.lua:149: in function <Remgank\core.lua:116>

Locals:
self = remgankframe_cleu {
 0 = <userdata>
}
event = "COMBAT_LOG_EVENT_UNFILTERED"
HOSTILE_PLAYER = 320
timeStamp = 1354742499.932
event = "SWING_DAMAGE"
hideCaster = false
sourceGUID = "0xF550EC4B0012073A"
sourceName = "Sha della Rabbia"
sourceFlags = 68168
sourceRaidFlags = 0
destGUID = "0x05000000049A36BF"
destName = "Axilea"
destFlags = 1297
destRaidFlags = 0
prefixParam1 = 493671
prefixParam2 = 212274
dummyparam = 1
suffixParam1 = nil
suffixParam2 = nil
(*temporary) = <func> @FrameXML\RestrictedInfrastructure.lua:116
bit_bor = <func> =[C]:-1
COMBATLOG_OBJECT_REACTION_HOSTILE = 64
COMBATLOG_OBJECT_CONTROL_PLAYER = 256
playerGUID = "0x05000000049A36BF"
bit_band = <func> =[C]:-1
string_format = <func> =[C]:-1
prgname = "|cffffd200remgank|r"
RemGank_Add_Player = <func> @Remgank\core.lua:28

Here is the part of code interested ...

Lua Code:
  1. local HOSTILE_PLAYER = bit_bor(COMBATLOG_OBJECT_REACTION_HOSTILE, COMBATLOG_OBJECT_CONTROL_PLAYER)
  2.     local timeStamp, event, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, prefixParam1, prefixParam2, dummyparam, suffixParam1, suffixParam2 = ...
  3.    
  4.     -- proceed with CLEU handling
  5.     if not playerGUID then
  6.         playerGUID = UnitGUID("player")
  7.     end
  8.  
  9.     -- Since these first two conditions apply no matter which event is
  10.     -- firing, check them first.
  11.     if destGUID == playerGUID and bit_band(sourceFlags, HOSTILE_PLAYER) ~= 0 then
  12.         if event == "SWING_DAMAGE" then
  13.             -- Nest checks inside each other instead of using and, so
  14.             -- that if any check matches (eg. it is this event, but not
  15.             -- the right prefix) the code doesn't keep checking other
  16.             -- things that obviously can never match.
  17.             if prefixParam2 > 0 then
  18.  
  19.                                 --- LINE 149 the one that printed the error above
  20.                 print(string_format("%s: [%s] killed [%s] with %s Melee overkill %s", prgname, sourceName, destName, prefixParam1, suffixParam2))  
  21.  
  22.                 if RemGankDB[sourceName:lower()] == nil then
  23.                     RemGank_Add_Player(sourceName)
  24.                 else   
  25.                     print(string_format("%s: [%s] already present. skipped", prgname, sourceName))
  26.                 end
  27.             end
  28.         elseif event == "SPELL_DAMAGE" or event == "SPELL_PERIODIC_DAMAGE" or event == "RANGE_DAMAGE" then
  29.             if suffixParam2 > 0 then
  30.                 print(string_format("%s: [%s] killed [%s] with %s damage of %s overkill %s", prgname, sourceName, destName, suffixParam1, GetSpellLink(prefixParam1), suffixParam2))
  31.                 if RemGankDB[sourceName:lower()] == nil then
  32.                     RemGank_Add_Player(sourceName)
  33.                 else   
  34.                     print(string_format("%s: [%s] already present. skipped", prgname, sourceName))
  35.                 end
  36.             end
  37.         end
  38.     end

It was a fight with SHA of Anger and I was killed probably by a melee ability.
The addon identified the boss as enemy player :-)

A couple of questions:
1) The error above is due the fact the suffixParam2 is null and this is probably a typo.
Should it be prefixParam2 (prefixParam1 = damage = 493671 prefixParam2 = overkill = 212274) ?

2) The second question. Why addon never mistakes when I am killed by normal mob, but fails on bosses ? It should not be the same check ?
Once identified as enemy player also this http://www.wowhead.com/spell=125311

Thanks again for time and patience in reading this long and boring thread :-)
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.

Last edited by gmarco : 12-06-12 at 02:35 AM.
gmarco is offline   Reply With Quote
Unread 12-06-12, 03:52 AM   #24
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,259
1) Yes, it should be prefixParam2, not suffixParam2.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Reply

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