Get raid target icon from destGUID
I want to check if a unit (identified through the destGUID parameter) from a COMBAT_LOG_EVENT_UNFILTERED event has been marked with a raid marker.
Is there a better/simpler way of doing it than this? 1) upon receiving the combat log event, go through all unitID's and check if they are raid marked 2) if a raid marked unitID has been found, get its unitGUID 3) compare the destGUID from the combat log event with the unitGUID from step 2. If they match, destGUID is raid marked. |
As there is no api call for IsRaidMarked, I don't think there is a easier way =(
|
Don't use destGUID, use destFlags...
Lua Code:
This will return a number from 1 to 8 corresponding to each mark, or nil if the target doesn't have a mark, see here for more information. However, if you are intent on using destGUID, I suppose you could do the following, assuming the unit you are checking is a player with a valid unitId: Lua Code:
|
Quote:
|
There's a small error: bit.band(flag, COMBATLOG_OBJECT_SPECIAL_MASK) should be bit.band(flags, COMBATLOG_OBJECT_SPECIAL_MASK)
Even after fixing that, the function always returns nil though. Here's the code for review Lua Code:
and Lua Code:
|
Combat log processing has the potential to be executed very frequently so I would suggest changing what you've posted to:
Code:
local bit_and = bit.band |
Thanks for the tip Vrul.
I still can't get this to work though. print(tostring(raidIconIndex)) is nil no matter what code I try. |
I just tested this and it appears you must be in a group or raid before the proper bits are set in sourceFlags and destFlags to indicate a raid icon is present. So get someone to group up with you when you need to test.
Also, in the code I posted above, change: Code:
bit_and(sourceFlags, COMBATLOG_OBJECT_AFFILIATION_MINE) Code:
bit_and(sourceFlags, COMBATLOG_OBJECT_AFFILIATION_MINE) ~= 0 |
Quote:
|
The raid icon is correctly recognized if present, but another problem appeared.
Once recognized, the raid icon is added to the destName string which is then processed into a message to be shown in a variety of ways depending on the user settings. The problem is that I can't find a way to insert the raid icon in a manner that works for both SendChatMessage() and ChatFrame:AddMessage(). Thus the question is: can raid icons be added in a format that works for both types of messages? The following way works for ChatFrame:AddMessage() but results in a LUA error stating Quote:
LUA Code:
While the following way works with SendChatMessage(), it doesn't work with ChatFrame:AddMessage() (the {rt1} will not be replaced by the actual icon texture). LUA Code:
Relevant code for review: LUA Code:
For clarity self.db.profile.customMessage = "Interrupted [target]'s [spell] with [interrupt]" outputChannel is either "SAY" "PARTY" "RAID" or false |
All times are GMT -6. The time now is 05:55 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI