LibParser-4.0
From WowAce Wiki
LibParser-4.0 is a mixin that can parser combat events.
Example
MyAddon = Rock:NewAddon("MyAddon", "LibParser-4.0")
function MyAddon:MyHandler(t)
assert(t.sourceID == "player")
end
MyAddon:AddParserListener({
eventType = "Damage",
sourceID = "player",
}, "MyHandler")
API Documentation
:AddParserListener(filter, func or "method", ...)
Adds a listener for a given combat event filter.
Args
- filter
- #Filters
- func
- function to call
- "method"
- method to call
- ...
- any arguments for the function to call
:RemoveParserListener(filter)
Removes a given filter from the registry.
Args
- filter
- #Filters
:RemoveAllParserListeners()
Removes all parser listeners.
Remarks
This is called automatically on OnDisable
Example
MyAddon:RemoveAllParserListeners()
:HasParserListener(filter)
Returns whether a given filter is registered.
Args
- filter
- #Filters
Example
local exists = MyAddon:HasParserListener(myFilter)
Filters
Filters are tables that look like result tables. Result tables will correspond to the filter if everything in the filter matches the result table.
An empty table can technically be a filter, which means to receive all events.
The field eventType is no longer required. It is still recommended that you specify it, since most filters are eventType-specific.
Note: do not put recipientName = UnitName("player") or sourceName = UnitName("player"). It can cause duplication issues and is less optimized than setting recipientID or sourceID.
Other note: to check if someone is in your group, the best way is to set sourceID_not = false, since if they have an ID, they are in your group.
There are a variety of specialized comparisons
No comparison given
This does a straight equality check
{
eventType = "Damage",
sourceID = "player",
}
gets all damage that came from the player.
_not
Negates the selection.
{
eventType = "Damage",
sourceID_not = "player",
}
gets all damage that doesn't come from the player.
_lt
Performs a less-than comparison
{
eventType = "Damage",
amount_lt = 10,
}
gets all damage that produced less than 10 damage
_le
Performs a less-than-or-equal comparison
{
eventType = "Damage",
amount_le = 10,
}
gets all damage that produced less than or equal to 10 damage
_gt
Performs a greater-than comparison
{
eventType = "Damage",
amount_gt = 10,
}
gets all damage that produced greater than 10 damage
_ge
Performs a greater-than-or-equal comparison
{
eventType = "Damage",
amount_ge = 10,
}
gets all damage that produced greater than or equal to 10 damage
_start
Checks to see if a string starts with the given value - note: Case-sensitive
{
eventType = "Damage",
sourceName_start = "Monkey",
}
gets all damage that comes from "Monkey", "Monkeyman", "Monkeywoman", etc.
_end
Checks to see if a string ends with the given value - note: Case-sensitive
{
eventType = "Damage",
sourceName_end = "face",
}
gets all damage that comes from "Pooface", "Monkeyface", etc.
_match
Checks to see if a string matches (with string.find) with the given pattern.
{
eventType = "Damage",
sourceName_match = "^Monk.*face$",
}
gets all damage that comes from "Monkface", "Monkeyface", etc.
_notstart
Checks to see if a string doesn't start with the given value - note: Case-sensitive
{
eventType = "Damage",
sourceName_notstart = "Monkey",
}
gets all damage that doesn't come from "Monkey", "Monkeyman", "Monkeywoman", etc.
_notend
Checks to see if a string doesn't end with the given value - note: Case-sensitive
{
eventType = "Damage",
sourceName_notend = "face",
}
gets all damage that doesn't come from "Pooface", "Monkeyface", etc.
_notmatch
Checks to see if a string doesn't match (with string.find) with the given pattern.
{
eventType = "Damage",
sourceName_notmatch = "^Monk.*face$",
}
gets all damage that doesn't come from "Monkface", "Monkeyface", etc.
_in
Checks to see if the result is a key in the given table.
{
eventType = "Damage",
sourceName_in = {
Monkey = true,
Jordash = true,
},
}
Alternatively,
{
eventType = "Damage",
sourceName_in = {
"Monkey",
"Jordash",
},
}
gets all damage that comes from "Jordash" or "Monkey".
_notin
Checks to see if the result is not a key in the given table.
{
eventType = "Damage",
sourceName_notin = {
Monkey = true,
Jordash = true,
},
}
Alternatively,
{
eventType = "Damage",
sourceName_notin = {
"Monkey",
"Jordash",
},
}
gets all damage that doesn't come from "Jordash" or "Monkey".
Event types
Aura
This occurs when someone gains a buff or debuff
{
eventType = "Aura", -- in English
eventTypeLocal = "Aura", -- in the current locale
recipientName = "Someguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
abilityName = "Some spell", -- the aura name.
applications = 2, -- or some other number. [1, inf)
isBuff = false, -- or true
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Cast
This occurs when someone starts to cast a spell or perform an action.
{
eventType = "Cast", -- in English
eventTypeLocal = "Cast", -- in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
recipientName = "Someguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
abilityName = false, -- or "Skill which was casted by Someguy"
isBegin = false, -- or true
isPerform = false, -- or true
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Create
This occurs when someone creates or loots an item.
{
eventType = "Create", -- in English
eventTypeLocal = "Create", -- in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
itemLink = "|cffffffff|Hitem:6948:0:0:0:0:0:0:0|h[Hearthstone]|h|r", -- or some other item.
itemID = "item:6948:0:0:0:0:0:0:0", -- or some other item.
itemName = "Hearthstone", -- or some other item.
itemRarity = 1, -- or some other rarity.
isCreated = false, -- whether the item was created or looted.
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Damage
This occurs when someone causes damage to somebody.
{
eventType = "Damage", -- in English
eventTypeLocal = "Damage", -- in the current locale
damageType = "Physical", -- or "Holy", "Fire", "Frost", "Nature", "Shadow", "Arcane", or "Unknown" - in English
damageTypeLocal = "Physical", -- or "Holy", "Fire", "Frost", "Nature", "Shadow", "Arcane", or "Unknown" - in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
recipientName = "Someguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
amount = 5, -- number [0, inf)
abilityName = "Spell Used", -- or false if it's a simple attack
isCrit = false, -- or true
isDoT = false, -- or true
isSplit = false, -- or true - this happens if damage is split between yourself and your pet.
isGlancing = false, -- or true
isCrushing = false, -- or true
absorbAmount = 0, -- number [0, inf)
blockAmount = 0, -- number [0, inf)
resistAmount = 0, -- number [0, inf)
vulnerableAmount = 0, -- number [0, inf)
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Death
This occurs when someone kills someone else.
{
eventType = "Death", -- in English
eventTypeLocal = "Death", -- in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
recipientName = "Someguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
abilityName = false, -- or "Skill which killed Someguy"
isItem = false, -- or true
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Dispel
This occurs when a debuff is forcefully dispelled.
{
eventType = "Dispel", -- in English
eventTypeLocal = "Dispel", -- in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
recipientName = "Someotherguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
sourceAbilityName = "Skill", -- or "Skill which was cast by Someguy"
recipientAbilityName = "Skill", -- or "Dispelled spell previously on Someotherguy"
isFailed = false, -- or true
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Drain
This occurs when an attribute is drained from somebody.
{
eventType = "Drain", -- in English
eventTypeLocal = "Drain", -- in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
recipientName = "Someguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
abilityName = false, -- or "Skill which was casted by Someguy"
amount = 123, -- or some other number [0, inf)
attribute = "Mana", -- or "Energy", "Focus", "Rage", "Health", or "Unknown" - in English
attributeLocal = "Mana", -- or "Energy", "Focus", "Rage", "Health", or "Unknown" - in the current locale
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Durability
This occurs when someone's items become damaged.
{
eventType = "Durability", -- in English
eventTypeLocal = "Durability", -- in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
recipientName = "Someguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
abilityName = false, -- or "Skill which was cast by Someguy"
item = "Fists of Awesomeness", -- or some other item, or false if all items are affected.
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Enchant
This occurs when someone's items become enchanted.
{
eventType = "Enchant", -- in English
eventTypeLocal = "Enchant", -- in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
recipientName = "Someotherguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
abilityName = "Skill", -- or "Skill which was cast by Someguy"
item = "Gloves of Awesomeness", -- or "Some other item"
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Environmental
This occurs when the environment hurts somebody.
{
eventType = "Environmental", -- in English
eventTypeLocal = "Environmental", -- in the current locale
recipientName = "Someguy",
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
hazardType = "Drowning", -- or "Falling", "Fatigue", "Fire", "Lava", or "Slime" - in English
hazardTypeLocal = "Drowning", -- or "Falling", "Fatigue", "Fire", "Lava", or "Slime" - in the current locale
damageType = "Physical", -- or "Holy", "Fire", "Frost", "Nature", "Shadow", "Arcane", or "Unknown" - in English
damageTypeLocal = "Physical", -- or "Holy", "Fire", "Frost", "Nature", "Shadow", "Arcane", or "Unknown" - in the current locale
amount = 5, -- number [0, inf)
isGlancing = false, -- or true
isCrushing = false, -- or true
absorbAmount = 0, -- number [0, inf)
blockAmount = 0, -- number [0, inf)
resistAmount = 0, -- number [0, inf)
vulnerableAmount = 0, -- number [0, inf)
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Experience
This occurs when somebody (the player) gains experience by killing something.
{
eventType = "Experience", -- in English
eventTypeLocal = "Experience", -- in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
recipientName = "Someguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
amount = 123, -- or some other number it changed by. [1, inf)
bonusAmount = 123, -- or some other number it changed by. [0, inf)
bonusType = "Group", -- or some other bonus type.
penaltyAmount = 123, -- or some number. [0, inf)
penaltyType = "Group", -- or some other penalty type.
amountRaidPenalty = 123, -- or some other number. [0, inf)
amountGroupBonus = 123, -- or some other number. [0, inf)
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Extra Attack
This occurs when somebody gains an extra attack, e.g. 2+ swings at once.
{
eventType = "Extra Attack", -- in English
eventTypeLocal = "Extra Attack", -- in the current locale
recipientName = "Someguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
abilityName = false, -- or "Skill which was cast by Someguy"
amount = 1, -- or some other number, [1, inf)
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Fade
This occurs when a buff or debuff fades from someone peacefully.
{
eventType = "Fade", -- in English
eventTypeLocal = "Fade", -- in the current locale
recipientName = "Someguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
abilityName = "Some aura", -- the aura which was canceled or faded.
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Fail
This occurs when a cast or perform action fails.
{
eventType = "Fail", -- in English
eventTypeLocal = "Fail", -- in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
abilityName = "Skill", -- or "Skill which was cast by Someguy"
reason = "Whatever reason", -- or "Some other reason"
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Feed Pet
{
eventType = "Feed Pet", -- in English
eventTypeLocal = "Feed Pet", -- in the current locale
recipientName = "Someguy", -- or false if unknown. Note: this is actually the owner's name, not the pet's
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
item = "Porkchops", -- or some other item.
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Gain
This occurs when somebody gains an amount of some attribute.
{
eventType = "Gain", -- in English
eventTypeLocal = "Gain", -- in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
recipientName = "Someguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
abilityName = "Some spell", -- the spell cast by sourceName to create the gain.
amount = 123, -- or some other number [1, inf)
attribute = "Mana", -- or "Energy", "Focus", "Rage", "Health", or "Unknown" - in English
attributeLocal = "Mana", -- or "Energy", "Focus", "Rage", "Health", or "Unknown" - in the current locale
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Heal
This occurs when somebody is healed by someone else.
{
eventType = "Heal", -- in English
eventTypeLocal = "Heal", -- in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
recipientName = "Someguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
amount = 5, -- number [0, inf)
abilityName = "Spell Used",
isCrit = false, -- or true
isDoT = false, -- or true
overhealAmount = 0, -- number [0, inf)
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Honor
This occurs when somebody (the player) gains or loses honor.
{
eventType = "Honor", -- in English
eventTypeLocal = "Honor", -- in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
sourceRank = "Someguy's Rank", -- the rank of Someguy
amount = 123, -- or some other number it changed by, or 0 (which means a DK). [0, inf)
isHonorable = true, -- or false, which means a DK.
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Interrupt
This occurs when somebody's cast or perform action is interrupted.
{
eventType = "Interrupt", -- in English
eventTypeLocal = "Interrupt", -- in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
recipientName = "Someotherguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
abilityName = "Skill", -- or "Skill which was cast by Someguy"
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Leech
This occurs when somebody's attribute is leeched from them and given to someone else, potentially in lieu of a third party.
{
eventType = "Leech", -- in English
eventTypeLocal = "Leech", -- in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
recipientName = "Someotherguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
sourceGainedName = "Someguy", -- or false if unknown. - this is the unit that receives the leech benefits
sourceGainedID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourceGainedPvP = false, -- or true
abilityName = "Skill", -- or "Skill which was cast by Someguy"
amount = 123, -- or any other number [1, inf)
amountGained = 123, -- or any other number [1, inf)
attribute = "Mana", -- or "Energy", "Focus", "Rage", "Health", or "Unknown" - in English
attributeLocal = "Mana", -- or "Energy", "Focus", "Rage", "Health", or "Unknown" - in the current locale
attributeGained = "Mana", -- or "Energy", "Focus", "Rage", "Health", or "Unknown"
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Miss
This occurs when somebody misses an attack on someone else.
{
eventType = "Miss", -- in English
eventTypeLocal = "Miss", -- in the current locale
sourceName = "Someguy", -- or false if unknown.
sourceID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
sourcePvP = false, -- or true
recipientName = "Someguy", -- or false if unknown.
recipientID = "player", -- or "pet", "partyN", "partypetN", "raidN", "raidpetN", or false if unknown
recipientPvP = false, -- or true
missType = "Miss", -- or "Parry", "Dodge", "Reflect", "Resist", "Absorb", "Block", "Evade", or "Immune"
abilityName = "Spell Used", -- or false if it's a simple attack
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Reputation
This occurs when somebody gains or loses reputation.
{
eventType = "Reputation", -- in English
eventTypeLocal = "Reputation", -- in the current locale
faction = "Some faction",
amount = 123, -- or some other number it changed by. (-inf, inf)
rank = false, -- or "Some rank"
globalString = "GLOBALSTRING", -- whatever global string was parsed.
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}
Unknown
This occurs when an unknown event occurs, which is likely a bug.
{
eventType = "Unknown", -- in English
eventTypeLocal = "Unknown", -- in the current locale
message = "Text message", -- whatever literal message was received.
event = "EVENT_NAME", -- whatever Blizzard event is associated.
}

