vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 ---------------------------------------------------------------------------
2 -- You MUST update the major version whenever you make an incompatible
3 -- change
4 ---------------------------------------------------------------------------
5 -- You MUST update the minor version whenever you make a compatible
6 -- change (And check LibActivate is still valid!)
7 ---------------------------------------------------------------------------
8 -- Set usedebug = true if you want to see output
9 -- ** THIS ONLY APPLIES TO THIS INSTANCE OF THE LIBRARY **
10 ---------------------------------------------------------------------------
11  
12 local vmajor, vminor = "1.1", 15 -- Set your version numbers here
13 local stubvarname = "TekLibStub" -- Change this to your library stub's global name
14 local libvarname = "ParserLib" -- Change this to your library's global name
15  
16  
17  
18  
19 -- ************************************* --
20 -- ** This embed requires CompostLib! ** --
21 -- ************************************* --
22 if not CompostLib then ChatFrame1:AddMessage("<ParserLib> CompostLib is not installed!", 1, 0, 0) return end
23 compost = CompostLib:GetInstance("compost-1")
24  
25  
26  
27 ---------------------------------------------------------------------------
28 -- **************************************************************
29 -- **** YOU DON'T NEED TO EDIT ANYTHING BELOW UNTIL LINE 146 ****
30 -- **************************************************************
31 ---------------------------------------------------------------------------
32  
33 -- Check to see if an update is needed
34 -- if not then just return out now before we do anything
35 local libobj = getglobal(libvarname)
36 if libobj and not libobj:NeedsUpgraded(vmajor, vminor) then return end
37  
38  
39 ---------------------------------------------------------------------------
40 -- Embedded Library Registration Stub
41 -- Written by Iriel <iriel@vigilance-committee.org>
42 -- Version 0.1 - 2006-03-05
43 -- Modified by Tekkub <tekkub@gmail.com>
44 ---------------------------------------------------------------------------
45  
46 local stubobj = getglobal(stubvarname)
47 if not stubobj then
48 stubobj = {}
49 setglobal(stubvarname, stubobj)
50  
51  
52 -- Instance replacement method, replace contents of old with that of new
53 function stubobj:ReplaceInstance(old, new)
54 for k,v in pairs(old) do old[k]=nil end
55 for k,v in pairs(new) do old[k]=v end
56 end
57  
58  
59 -- Get a new copy of the stub
60 function stubobj:NewStub(name)
61 local newStub = {}
62 self:ReplaceInstance(newStub, self)
63 newStub.libName = name
64 newStub.lastVersion = ''
65 newStub.versions = {}
66 return newStub
67 end
68  
69  
70 -- Get instance version
71 function stubobj:NeedsUpgraded(vmajor, vminor)
72 local versionData = self.versions[vmajor]
73 if not versionData or versionData.minor < vminor then return true end
74 end
75  
76  
77 -- Get instance version
78 function stubobj:GetInstance(version)
79 if not version then version = self.lastVersion end
80 local versionData = self.versions[version]
81 if not versionData then print(string.format("<%s> Cannot find library version: %s", self.libName, version or "")) return end
82 return versionData.instance
83 end
84  
85  
86 -- Register new instance
87 function stubobj:Register(newInstance)
88 local version,minor = newInstance:GetLibraryVersion()
89 self.lastVersion = version
90 local versionData = self.versions[version]
91 if not versionData then
92 -- This one is new!
93 versionData = {
94 instance = newInstance,
95 minor = minor,
96 old = {},
97 }
98 self.versions[version] = versionData
99 newInstance:LibActivate(self)
100 return newInstance
101 end
102 -- This is an update
103 local oldInstance = versionData.instance
104 local oldList = versionData.old
105 versionData.instance = newInstance
106 versionData.minor = minor
107 local skipCopy = newInstance:LibActivate(self, oldInstance, oldList)
108 table.insert(oldList, oldInstance)
109 if not skipCopy then
110 for i, old in ipairs(oldList) do self:ReplaceInstance(old, newInstance) end
111 end
112 return newInstance
113 end
114 end
115  
116  
117 if not libobj then
118 libobj = stubobj:NewStub(libvarname)
119 setglobal(libvarname, libobj)
120 end
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149 local lib = {}
150  
151  
152 -- Return the library's current version
153 function lib:GetLibraryVersion()
154 return vmajor, vminor
155 end
156  
157  
158 -- Activate a new instance of this library
159 function lib:LibActivate(stub, oldLib, oldList)
160 local maj, min = self:GetLibraryVersion()
161  
162 if oldLib then
163 local omaj, omin = oldLib:GetLibraryVersion()
164 ----------------------------------------------------
165 -- ********************************************** --
166 -- **** Copy over any old data you need here **** --
167 -- ********************************************** --
168 ----------------------------------------------------
169 self.frame = oldLib.frame
170 self:OnLoad()
171  
172 if omin < 11 and oldLib.clients then
173 for event in oldLib.clients do
174 for i in oldLib.clients[event] do
175 if type(oldLib.clients[event][i]["func"]) == "string" then
176 oldLib.clients[event][i]["func"] = getglobal(oldLib.clients[event][i]["func"])
177 end
178 end
179 end
180 end
181 self.clients = oldLib.clients
182  
183  
184 else
185 ---------------------------------------------------
186 -- ********************************************* --
187 -- **** Do any initialization you need here **** --
188 -- ********************************************* --
189 ---------------------------------------------------
190 self:OnLoad()
191 end
192 -- nil return makes stub do object copy
193 end
194  
195  
196 -------------------------------------
197 -- ******************************* --
198 -- **** Add your methods here **** --
199 -- ******************************* --
200 -------------------------------------
201  
202  
203  
204 -- Constants
205 ParserLib_SELF = 103
206 ParserLib_MELEE = 112
207 ParserLib_DAMAGESHIELD = 113
208  
209  
210 -- Public Methods
211  
212 function lib:RegisterEvent(addonID, event, handler)
213  
214 local eventExist
215 for i, v in self.supportedEvents do
216 if v == event then
217 eventExist = true
218 break
219 end
220 end
221  
222 if not eventExist then
223 self:Print( string.format("Event %s is not supported. (AddOnID %s)", event, addonID), 1, 0, 0 )
224 return
225 end
226  
227  
228 self:Debug(string.format("Registering %s for addon %s.", event, addonID) );
229  
230 if type(handler) == "string" then handler = getglobal(handler) end
231  
232 if not handler then self:Print("nil handler from " .. addonID, 1, 0, 0) return end
233  
234  
235 if self.clients[event] == nil then
236 self.clients[event] = {};
237 end
238  
239 table.insert(self.clients[event], { ["id"]=addonID, ["func"]=handler } );
240 self.frame:RegisterEvent(event);
241  
242 end
243  
244 function lib:IsEventRegistered(addonID, event)
245 if self.clients[event] then
246 for i, v in self.clients[event] do
247 if v.id == addonID then return true end
248 end
249 end
250 end
251  
252 function lib:UnregisterEvent(addonID, event)
253 local empty = true
254  
255  
256 if not self.clients[event] then return end
257  
258 for i, v in self.clients[event] do
259 if v.id == addonID then
260 self:Debug( format("Removing %s from %s", v.id, event) )
261 table.remove(self.clients[event], i)
262 else
263 empty = false
264 end
265 end
266  
267 if empty then
268 self:Debug("Unregistering event " .. event)
269 self.frame:UnregisterEvent(event)
270 self.clients[event] = nil
271 end
272 end
273  
274 function lib:UnregisterAllEvents(addonID)
275 local event, index, empty;
276  
277 for event in self.clients do
278 empty = true;
279  
280 for i, v in self.clients[event] do
281 if v.id == addonID then
282 self:Debug( format("Removing %s for %s", v.id, event) )
283 table.remove(self.clients[event], i)
284 -- self.clients[event][index] = nil;
285 else
286 empty = false;
287 end
288 end
289  
290 if empty then
291 self:Debug("Unregistering event " .. event)
292 self.frame:UnregisterEvent(event);
293 self.clients[event] = nil;
294 end
295  
296 end
297  
298 end
299  
300  
301 function lib:Deformat(text, pattern)
302 if not self.customPatterns then self.customPatterns = {} end
303 if not self.customPatterns[pattern] then
304 self.customPatterns[pattern] = self:Curry(pattern)
305 end
306 return self.customPatterns[pattern](text)
307 end
308  
309  
310 -- Convert "%s hits %s for %d." to "(.+) hits (.+) for (%d+)."
311 -- Will additionaly return the sequence of tokens, for example:
312 -- "%2$s reflects %3$d %4$s damage to %1$s." will return:
313 -- "(.-) reflects (%+) (.-) damage to (.-)%.", 4 1 2 3.
314 -- ( [1]=2,[2]=3,[3]=4,[4]=1 Reverting indexes and become [1]=4, [2]=[1],[3]=2,[4]=3. )
315 function lib:ConvertPattern(pattern, anchor)
316  
317 local seq
318  
319 -- Add % to escape all magic characters used in LUA pattern matching, except $ and %
320 pattern = string.gsub(pattern,"([%^%(%)%.%[%]%*%+%-%?])","%%%1");
321  
322 -- Do these AFTER escaping the magic characters.
323 pattern = string.gsub(pattern,"%%s","(.-)"); -- %s to (.-)
324 pattern = string.gsub(pattern,"%%d","(%%d+)"); -- %d to (%d+)
325  
326 if string.find(pattern,"%$") then
327 seq = {}; -- fills with ordered list of $s as they appear
328 local idx = 1; -- incremental index into field[]
329  
330 local tmpSeq = {}
331 for i in string.gfind(pattern,"%%(%d)%$.") do
332 tmpSeq[idx] = tonumber(i);
333 idx = idx + 1
334 end
335 for i, j in ipairs(tmpSeq) do
336 seq[j] = i
337 end
338 table.setn(seq, table.getn(tmpSeq))
339 pattern = string.gsub(pattern,"%%%d%$s","(.-)"); -- %1$s to (.-)
340 pattern = string.gsub(pattern,"%%%d%$d","(%%d+)"); -- %1$d to (%d+)
341 end
342  
343 -- Escape $ now.
344 pattern = string.gsub(pattern,"%$","%%$");
345  
346 -- Anchor tag can improve string.find() performance by 100%.
347 if anchor then pattern = "^"..pattern end
348  
349 -- If the pattern ends with (.-), replace it with (.+), or the capsule will be lost.
350 if string.sub(pattern, -4) == "(.-)" then
351 pattern = string.sub(pattern, 0, -5) .. "(.+)";
352 end
353  
354 if not seq then return pattern end
355  
356 return pattern, seq[1], seq[2], seq[3], seq[4], seq[5], seq[6], seq[7], seq[8], seq[9], seq[10]
357 end
358  
359 lib.debug = nil
360 local function ParserOnEvent() lib:OnEvent() end
361  
362  
363 -- Currently supported event list.
364 lib.supportedEvents = {
365  
366 "CHAT_MSG_COMBAT_CREATURE_VS_CREATURE_HITS",
367 "CHAT_MSG_COMBAT_CREATURE_VS_CREATURE_MISSES",
368 "CHAT_MSG_COMBAT_CREATURE_VS_PARTY_HITS",
369 "CHAT_MSG_COMBAT_CREATURE_VS_PARTY_MISSES",
370 "CHAT_MSG_COMBAT_CREATURE_VS_SELF_HITS",
371 "CHAT_MSG_COMBAT_CREATURE_VS_SELF_MISSES",
372 "CHAT_MSG_COMBAT_FACTION_CHANGE",
373 "CHAT_MSG_COMBAT_FRIENDLYPLAYER_HITS",
374 "CHAT_MSG_COMBAT_FRIENDLYPLAYER_MISSES",
375 "CHAT_MSG_COMBAT_FRIENDLY_DEATH",
376 "CHAT_MSG_COMBAT_HONOR_GAIN",
377 "CHAT_MSG_COMBAT_HOSTILEPLAYER_HITS",
378 "CHAT_MSG_COMBAT_HOSTILEPLAYER_MISSES",
379 "CHAT_MSG_COMBAT_HOSTILE_DEATH",
380 "CHAT_MSG_COMBAT_PARTY_HITS",
381 "CHAT_MSG_COMBAT_PARTY_MISSES",
382 "CHAT_MSG_COMBAT_PET_HITS",
383 "CHAT_MSG_COMBAT_PET_MISSES",
384 "CHAT_MSG_COMBAT_SELF_HITS",
385 "CHAT_MSG_COMBAT_SELF_MISSES",
386 "CHAT_MSG_COMBAT_XP_GAIN",
387 "CHAT_MSG_SPELL_AURA_GONE_OTHER",
388 "CHAT_MSG_SPELL_AURA_GONE_SELF",
389 "CHAT_MSG_SPELL_AURA_GONE_PARTY",
390 "CHAT_MSG_SPELL_BREAK_AURA",
391 "CHAT_MSG_SPELL_CREATURE_VS_CREATURE_BUFF",
392 "CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE",
393 "CHAT_MSG_SPELL_CREATURE_VS_PARTY_BUFF",
394 "CHAT_MSG_SPELL_CREATURE_VS_PARTY_DAMAGE",
395 "CHAT_MSG_SPELL_CREATURE_VS_SELF_BUFF",
396 "CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE",
397 "CHAT_MSG_SPELL_DAMAGESHIELDS_ON_OTHERS",
398 "CHAT_MSG_SPELL_DAMAGESHIELDS_ON_SELF",
399 "CHAT_MSG_SPELL_FAILED_LOCALPLAYER",
400 "CHAT_MSG_SPELL_FRIENDLYPLAYER_BUFF",
401 "CHAT_MSG_SPELL_FRIENDLYPLAYER_DAMAGE",
402 "CHAT_MSG_SPELL_HOSTILEPLAYER_BUFF",
403 "CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE",
404 "CHAT_MSG_SPELL_ITEM_ENCHANTMENTS",
405 "CHAT_MSG_SPELL_PARTY_BUFF",
406 "CHAT_MSG_SPELL_PARTY_DAMAGE",
407 "CHAT_MSG_SPELL_PERIODIC_CREATURE_BUFFS",
408 "CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE",
409 "CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_BUFFS",
410 "CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_DAMAGE",
411 "CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_BUFFS",
412 "CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE",
413 "CHAT_MSG_SPELL_PERIODIC_PARTY_BUFFS",
414 "CHAT_MSG_SPELL_PERIODIC_PARTY_DAMAGE",
415 "CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS",
416 "CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE",
417 "CHAT_MSG_SPELL_PET_BUFF",
418 "CHAT_MSG_SPELL_PET_DAMAGE",
419 "CHAT_MSG_SPELL_SELF_BUFF",
420 "CHAT_MSG_SPELL_SELF_DAMAGE",
421 "CHAT_MSG_SPELL_TRADESKILLS",
422  
423 }
424  
425 -- Sort the pattern so that they can be parsed in a correct sequence, will only do once for each registered event.
426 local function PatternCompare(a, b)
427  
428 local pa = getglobal(a)
429 local pb = getglobal(b)
430  
431 if not pa then ChatFrame1:AddMessage("|cffff0000Nil pattern: ".. a.."|r") end
432 if not pb then ChatFrame1:AddMessage("|cffff0000Nil pattern: ".. b.."|r") end
433  
434 local ca=0
435 for _ in string.gfind(pa, "%%%d?%$?[sd]") do ca=ca+1 end
436 local cb=0
437 for _ in string.gfind(pb, "%%%d?%$?[sd]") do cb=cb+1 end
438  
439 pa = string.gsub(pa, "%%%d?%$?[sd]", "")
440 pb = string.gsub(pb, "%%%d?%$?[sd]", "")
441  
442 if string.len(pa) == string.len(pb) then
443 return ca < cb;
444 else
445 return string.len(pa) > string.len(pb)
446 end
447  
448 end
449  
450  
451 -- local timing = true -- timer
452  
453  
454 function lib:OnLoad()
455  
456 -- Both table starts out empty, and load the data only when required.
457 self.eventTable = {}
458 self.patternTable = {}
459  
460  
461 if timing then
462 ctimer = {
463 acquire = 0,
464 recycle = 0,
465 reclaim = 0,
466 }
467  
468 self.time = {
469 find = 0,
470 list = 0,
471 parse = 0,
472 trailer = 0,
473 notify = 0,
474 LoadPatternInfo = 0
475 }
476 end
477  
478 if not self.clients then self.clients = {} end
479  
480 if not self.frame then
481 self.frame = CreateFrame("FRAME", "ParserLibFrame")
482 self.frame:SetScript("OnEvent", ParserOnEvent );
483 end
484  
485  
486 end
487  
488  
489 function lib:OnEvent(e, a1)
490 local info, infoBackup, func;
491  
492 if not e then e = event end
493 if not a1 then a1 = arg1 end
494  
495  
496 self:Debug("Event: |cff3333ff"..e.."|r")
497  
498 -- local timer = GetTime() -- timer
499 info = compost:Acquire()
500 -- ctimer.acquire = GetTime() - timer + ctimer.acquire -- timer
501  
502 if self:ParseMessage(a1, e, info) then
503  
504 -- currTime = GetTime() -- timer
505 self:NotifyClients(e, info)
506 -- self.time.notify = self.time.notify + GetTime() - currTime -- timer
507  
508 end
509  
510 -- local timer = GetTime() -- timer
511 compost:Reclaim(info)
512 -- ctimer.reclaim = GetTime() - timer + ctimer.reclaim -- timer
513  
514 end
515  
516 function lib:NotifyClients(event, info)
517  
518 -- local timer = GetTime() -- timer
519 local infoBackup = compost:Acquire()
520 -- ctimer.acquire = GetTime() - timer + ctimer.acquire -- timer
521  
522 -- Backup info, because clients may modify it.
523 for i in info do
524 infoBackup[i] = info[i]
525 end
526  
527  
528 if not self.clients[event] then
529 self:Debug(event .. " has no client to notify.")
530 return
531 end
532  
533 for i in self.clients[event] do
534  
535 self:Debug(event .. ",Calling " .. self.clients[event][i].id)
536 local func = self.clients[event][i].func
537  
538 func(event, info)
539  
540 -- -- local timer = GetTime() -- timer
541 info = compost:Recycle(info)
542 -- ctimer.recycle = GetTime() - timer + ctimer.recycle -- timer
543  
544 -- Copy back old info
545 for j in infoBackup do
546 info[j] = infoBackup[j]
547 end
548  
549  
550 end
551  
552 -- timer = GetTime() -- timer
553 compost:Reclaim(infoBackup)
554 -- ctimer.reclaim = GetTime() - timer + ctimer.reclaim -- timer
555  
556 end
557  
558  
559 function lib:Print(msg, r, g, b)
560 ChatFrame1:AddMessage(string.format("<%s-%s-%s> %s", libvarname, vmajor, vminor, msg), r, g, b)
561 end
562  
563 function lib:Debug(msg, r, g, b)
564 if self.debug then
565 ChatFrame1:AddMessage(string.format("<%s-%s-%s>(Debug) %s", libvarname, vmajor, vminor, msg), r, g, b)
566 end
567 end
568  
569  
570 -- message : the arg1 in the event
571 -- event : name says it all.
572 -- info : the table which will store the passed result, so THIS IS THE OUTPUT.
573 -- return : true if pattern found and parsed, nil otherwise.
574 function lib:ParseMessage(message, event, info)
575  
576 local currTime
577  
578 -- currTime = GetTime() -- timer
579 if not self.eventTable[event] then self.eventTable[event] = self:LoadPatternList(event) end
580 local list = self.eventTable[event] --:LoadPatternList(event)
581 -- self.time.list = self.time.list + GetTime() - currTime -- timer
582  
583 if not list then return end
584  
585 -- currTime = GetTime() -- timer
586 local pattern = self:FindPattern(message, list, info)
587 -- self.time.find = GetTime() - currTime + self.time.find -- timer
588  
589  
590 if not pattern then
591 self:Print(message .. " -> not found in event " .. event, 1, 0.3, 0.3)
592 return false
593 end
594  
595 -- currTime = GetTime() -- timer
596 self:ParseInformation(pattern, info)
597 -- self.time.parse = GetTime() - currTime + self.time.parse -- timer
598  
599  
600 -- currTime = GetTime() -- timer
601 if info.type == "hit" or info.type == "environment" then
602 self:ParseTrailers(message, info)
603 end
604 -- self.time.trailer = GetTime() - currTime + self.time.trailer -- timer
605  
606 self:ConvertTypes(info)
607  
608 return true
609  
610  
611 end
612  
613 -- Search for pattern in 'patternList' which matches 'message', parsed tokens will be stored in 'info'
614 function lib:FindPattern(message, patternList, info)
615  
616 local pattern, patternName, found, n
617  
618 local n = table.getn(patternList)
619 for i=1, n do
620  
621 patternName = patternList[i]
622  
623 -- timer = GetTime() -- timer
624 if not self.patternTable[patternName] then self.patternTable[patternName] = self:LoadPatternInfo(patternName) end
625 -- self.time.LoadPatternInfo = GetTime() - timer + self.time.LoadPatternInfo -- timer
626  
627 if not self.patternTable[patternName] then
628 self:Print(patternName .. " cannot be found in the pattern table.", 1, 0, 0)
629 return
630 end
631  
632 -- timer = GetTime() -- timer
633 info = compost:Recycle(info)
634 -- ctimer.recycle = GetTime() - timer + ctimer.recycle -- timer
635  
636 pattern = self.patternTable[patternName].pattern
637 n = self.patternTable[patternName].tc
638 found = false
639 if self:OptimizerCheck(message, patternName) then
640 if n == 0 then
641 found = string.find(message, pattern)
642 elseif n == 1 then
643 found, _, info[1] = string.find(message, pattern)
644 elseif n == 2 then
645 found, _, info[1], info[2] = string.find(message, pattern)
646 elseif n == 3 then
647 found, _, info[1], info[2], info[3]= string.find(message, pattern)
648 elseif n == 4 then
649 found, _, info[1], info[2], info[3], info[4] = string.find(message, pattern)
650 elseif n == 5 then
651 found, _, info[1], info[2], info[3], info[4], info[5] = string.find(message, pattern)
652 elseif n == 6 then
653 found, _, info[1], info[2], info[3], info[4], info[5], info[6] = string.find(message, pattern)
654 elseif n == 7 then
655 found, _, info[1], info[2], info[3], info[4], info[5], info[6], info[7] = string.find(message, pattern)
656 elseif n == 8 then
657 found, _, info[1], info[2], info[3], info[4], info[5], info[6], info[7], info[8] = string.find(message, pattern)
658 elseif n == 9 then
659 found, _, info[1], info[2], info[3], info[4], info[5], info[6], info[7], info[8], info[9] = string.find(message, pattern)
660 end
661  
662  
663 -- found, _, info[1], info[2], info[3], info[4], info[5], info[6], info[7], info[8] = string.find(message, pattern)
664 end
665 if found then
666 self:Debug(message.." -> |cff3333ff" .. self.patternTable[patternName].pattern .. "|r")
667 return patternName
668 end
669 end
670 end
671  
672  
673 -- Parses for trailors.
674 function lib:ParseTrailers(message, info)
675 local found, amount
676  
677  
678 if not self.trailers then
679 self.trailers = {
680 CRUSHING_TRAILER = self:ConvertPattern(CRUSHING_TRAILER),
681 GLANCING_TRAILER = self:ConvertPattern(GLANCING_TRAILER),
682 ABSORB_TRAILER = self:ConvertPattern(ABSORB_TRAILER),
683 BLOCK_TRAILER = self:ConvertPattern(BLOCK_TRAILER),
684 RESIST_TRAILER = self:ConvertPattern(RESIST_TRAILER),
685 VULNERABLE_TRAILER = self:ConvertPattern(VULNERABLE_TRAILER),
686 }
687 end
688  
689 found = string.find(message, self.trailers.CRUSHING_TRAILER)
690 if found then
691 info.isCrushing = true
692 end
693 found = string.find(message, self.trailers.GLANCING_TRAILER)
694 if found then
695 info.isGlancing = true
696 end
697 found, _, amount = string.find(message, self.trailers.ABSORB_TRAILER)
698 if found then
699 info.amountAbsorb = amount
700 end
701 found, _, amount = string.find(message, self.trailers.BLOCK_TRAILER)
702 if found then
703 info.amountBlock = amount
704 end
705 found, _, amount = string.find(message, self.trailers.RESIST_TRAILER)
706 if found then
707 info.amountResist = amount
708 end
709 found, _, amount = string.find(message, self.trailers.VULNERABLE_TRAILER)
710 if found then
711 info.amountVulnerable = amount
712 end
713  
714 end
715  
716  
717  
718 function lib:ParseInformation(patternName, info)
719  
720 -- Create an info table from pattern table, copies everything except the pattern string.
721 for i, v in self.patternTable[patternName] do
722 if i ~= "pattern" and i ~= 'tc' then
723 if type(v) == "number" and v < 100 then
724 info[i] = info[v]
725 else
726 info[i] = v
727 end
728 end
729 end
730  
731  
732 for i in ipairs(info) do
733 info[i] = nil
734 end
735  
736 end
737  
738 function lib:ConvertTypes(info)
739 for i in info do
740 if string.find(i, "^amount") then info[i] = tonumber(info[i]) end
741 end
742 end
743  
744 function lib:OptimizerCheck(message, patternName)
745  
746 if not ParserLibOptimizer then return true end
747  
748 if not ParserLibOptimizer[patternName] then return true end
749  
750 if string.find(message, ParserLibOptimizer[patternName], 1, true) then return true end
751  
752 return false
753 end
754  
755  
756 -- Most of the parts were learnt from BabbleLib by chknight, so credits goes to him.
757 function lib:Curry(pattern)
758 local cp, tt, n, f, o
759 local DoNothing = function(tok) return tok end
760  
761 tt = {}
762 for tk in string.gfind(pattern, "%%%d?%$?([sd])") do
763 table.insert(tt, tk)
764 end
765  
766 cp = { self:ConvertPattern(pattern, true) }
767 cp.p = cp[1]
768  
769 n = table.getn(cp)
770 for i=1,n-1 do
771 cp[i] = cp[i+1]
772 end
773 table.remove(cp, n)
774  
775 f = {}
776 o = {}
777 n = table.getn(tt)
778 for i=1, n do
779 if tt[i] == "s" then
780 f[i] = DoNothing
781 else
782 f[i] = tonumber
783 end
784 end
785  
786 if not cp[1] then
787 if n == 0 then
788 return function() end
789 elseif n == 1 then
790 return function(text)
791 _, _, o[1] = string.find(text, cp.p)
792 if o[1] then
793 return f[1](o[1])
794 end
795 end
796 elseif n == 2 then
797 return function(text)
798 _, _, o[1], o[2]= string.find(text, cp.p)
799 if o[1] then
800 return f[1](o[1]), f[2](o[2])
801 end
802 end
803 elseif n == 3 then
804 return function(text)
805 _, _, o[1], o[2], o[3] = string.find(text, cp.p)
806 if o[1] then
807 return f[1](o[1]), f[2](o[2]), f[3](o[3])
808 end
809 end
810 elseif n == 4 then
811 return function(text)
812 _, _, o[1], o[2], o[3], o[4] = string.find(text, cp.p)
813 if o[1] then
814 return f[1](o[1]), f[2](o[2]), f[3](o[3]), f[4](o[4])
815 end
816 end
817 elseif n == 5 then
818 return function(text)
819 _, _, o[1], o[2], o[3], o[4], o[5] = string.find(text, cp.p)
820 if o[1] then
821 return f[1](o[1]), f[2](o[2]), f[3](o[3]), f[4](o[4]), f[5](o[5])
822 end
823 end
824 elseif n == 6 then
825 return function(text)
826 _, _, o[1], o[2], o[3], o[4], o[5], o[6] = string.find(text, cp.p)
827 if o[1] then
828 return f[1](o[1]), f[2](o[2]), f[3](o[3]), f[4](o[4]), f[5](o[5]), f[6](o[6])
829 end
830 end
831 elseif n == 7 then
832 return function(text)
833 _, _, o[1], o[2], o[3], o[4], o[5], o[6], o[7] = string.find(text, cp.p)
834 if o[1] then
835 return f[1](o[1]), f[2](o[2]), f[3](o[3]), f[4](o[4]), f[5](o[5]), f[6](o[6]), f[7](o[7])
836 end
837 end
838 elseif n == 8 then
839 return function(text)
840 _, _, o[1], o[2], o[3], o[4], o[5], o[6], o[7], o[8] = string.find(text, cp.p)
841 if o[1] then
842 return f[1](o[1]), f[2](o[2]), f[3](o[3]), f[4](o[4]), f[5](o[5]), f[6](o[6]), f[7](o[7]), f[8](o[8])
843 end
844 end
845 elseif n == 9 then
846 return function(text)
847 _, _, o[1], o[2], o[3], o[4], o[5], o[6], o[7], o[8], o[9] = string.find(text, cp.p)
848 if o[1] then
849 return f[1](o[1]), f[2](o[2]), f[3](o[3]), f[4](o[4]), f[5](o[5]), f[6](o[6]), f[7](o[7]), f[8](o[8]), f[9](o[9])
850 end
851 end
852 end
853 else
854 if n == 0 then
855 return function() end
856 elseif n == 1 then
857 return function(text)
858 _, _, o[1] = string.find(text, cp.p)
859 if o[1] then
860 return f[cp[1]](o[cp[1]])
861 end
862 end elseif n == 2 then
863 return function(text)
864 _, _, o[1], o[2] = string.find(text, cp.p)
865 if o[1] then
866 return f[cp[1]](o[cp[1]]), f[cp[2]](o[cp[2]])
867 end
868 end elseif n == 3 then
869 return function(text)
870 _, _, o[1], o[2], o[3] = string.find(text, cp.p)
871 if o[1] then
872 return f[cp[1]](o[cp[1]]), f[cp[2]](o[cp[2]]), f[cp[3]](o[cp[3]])
873 end
874 end
875 elseif n == 4 then
876 return function(text)
877 _, _, o[1], o[2], o[3], o[4] = string.find(text, cp.p)
878 if o[1] then
879 return f[cp[1]](o[cp[1]]), f[cp[2]](o[cp[2]]), f[cp[3]](o[cp[3]]), f[cp[4]](o[cp[4]])
880 end
881 end elseif n == 5 then
882 return function(text)
883 _, _, o[1], o[2], o[3], o[4], o[5] = string.find(text, cp.p)
884 if o[1] then
885 return f[cp[1]](o[cp[1]]), f[cp[2]](o[cp[2]]), f[cp[3]](o[cp[3]]), f[cp[4]](o[cp[4]]), f[cp[5]](o[cp[5]])
886 end
887 end elseif n == 6 then
888 return function(text)
889 _, _, o[1], o[2], o[3], o[4], o[5], o[6] = string.find(text, cp.p)
890 if o[1] then
891 return f[cp[1]](o[cp[1]]), f[cp[2]](o[cp[2]]), f[cp[3]](o[cp[3]]), f[cp[4]](o[cp[4]]), f[cp[5]](o[cp[5]]), f[cp[6]](o[cp[6]])
892 end
893 end elseif n == 7 then
894 return function(text)
895 _, _, o[1], o[2], o[3], o[4], o[5], o[6], o[7] = string.find(text, cp.p)
896 if o[1] then
897 return f[cp[1]](o[cp[1]]), f[cp[2]](o[cp[2]]), f[cp[3]](o[cp[3]]), f[cp[4]](o[cp[4]]), f[cp[5]](o[cp[5]]), f[cp[6]](o[cp[6]]), f[cp[7]](o[cp[7]])
898 end
899 end elseif n == 8 then
900 return function(text)
901 _, _, o[1], o[2], o[3], o[4], o[5], o[6], o[7], o[8] = string.find(text, cp.p)
902 if o[1] then
903 return f[cp[1]](o[cp[1]]), f[cp[2]](o[cp[2]]), f[cp[3]](o[cp[3]]), f[cp[4]](o[cp[4]]), f[cp[5]](o[cp[5]]), f[cp[6]](o[cp[6]]), f[cp[7]](o[cp[7]]), f[cp[8]](o[cp[8]])
904 end
905 end elseif n == 9 then
906 return function(text)
907 _, _, o[1], o[2], o[3], o[4], o[5], o[6], o[7], o[8], o[9] = string.find(text, cp.p)
908 if o[1] then
909 return f[cp[1]](o[cp[1]]), f[cp[2]](o[cp[2]]), f[cp[3]](o[cp[3]]), f[cp[4]](o[cp[4]]), f[cp[5]](o[cp[5]]), f[cp[6]](o[cp[6]]), f[cp[7]](o[cp[7]]), f[cp[8]](o[cp[8]]), f[cp[9]](o[cp[9]])
910 end
911 end
912 end
913 end
914 end
915  
916  
917 -- Used to test the correcteness of ParserLib on different languages.
918 function lib:TestPatterns(sendToClients)
919  
920 self:LoadEverything()
921  
922  
923 -- Check for valid variable types.
924 local pattern
925 local cnt = 1
926 for i, v in self.patternTable do
927 pattern = getglobal(i)
928 cnt = 1
929 for tok in string.gfind(pattern, "%%%d?%$?([sd])") do
930 for j, w in v do
931 if j ~= "tc"
932 and w == cnt
933 and ( ( string.find(j, "^amount") and tok ~= "d" )
934 or ( not string.find(j, "^amount") and tok == "d") )then
935 self:Print(pattern..","..j..","..cnt..","..tok)
936 end
937 end
938 cnt = cnt+1
939 end
940 end
941  
942  
943  
944  
945  
946 -- Creating the combat messages.
947 local messages = compost:Acquire();
948 for patternName in self.patternTable do
949 messages[patternName] = getglobal(patternName)
950 end
951  
952 local testString = "<s>";
953 local testNumber = "123";
954  
955 for i in messages do
956 messages[i] = string.gsub(messages[i], "%%%d?%$?s", testString);
957 messages[i] = string.gsub(messages[i], "%%%d?%$?d", testNumber);
958 end
959  
960  
961  
962 -- Begin the test.
963  
964 testNumber = tonumber(testNumber)
965 -- local timer = GetTime() -- timer
966 local info = compost:Acquire()
967 -- ctimer.acquire = GetTime() - timer + ctimer.acquire -- timer
968  
969 local startTime = GetTime()
970 local startMem = gcinfo()
971  
972 for _, event in self.supportedEvents do
973  
974 for _, pattern in self:LoadPatternList(event) do
975  
976 local msg = messages[pattern]
977  
978 if sendToClients then self:OnEvent(event, msg) end
979  
980 if self:ParseMessage(msg, event, info) then
981  
982 for i, v in info do
983  
984 if type(i) ~= "number" then
985 if type(v) == "number" and ( v == ParserLib_SELF or v == ParserLib_MELEE or v == ParserLib_DAMAGESHIELD ) then
986 v = testString
987 end
988  
989 if i == "type" or i == "missType" or i == "damageType" then v = testString end
990  
991 if ( type(v) == "string" and v ~= testString )
992 or ( type(v) == "number" and v ~= testNumber )
993 then
994 self:Print(string.format("E[%s],M[%s],[%s]=[%s]", event, msg, i, v), 1, 0.3, 0)
995 end
996 end
997 end
998 end
999  
1000 info = compost:Recycle(info)
1001  
1002 end
1003 end
1004  
1005  
1006 self:Print( string.format("Test completed in %.4fs, memory cost %.2fKB.", GetTime() - startTime, gcinfo() - startMem) )
1007  
1008 -- Cleaning up.
1009 compost:Reclaim(info)
1010 compost:Reclaim(messages)
1011  
1012 end
1013  
1014 -- Not working.
1015 function lib:TestDeformat()
1016  
1017 self:LoadEverything()
1018  
1019  
1020 -- Creating the combat messages.
1021  
1022 local messages = compost:Acquire();
1023 for patternName in self.patternTable do
1024 messages[patternName] = getglobal(patternName)
1025 end
1026  
1027 local testString = "<s>";
1028 local testNumber = "123";
1029  
1030 for i in messages do
1031 messages[i] = string.gsub(messages[i], "%%%d?%$?s", testString);
1032 messages[i] = string.gsub(messages[i], "%%%d?%$?d", testNumber);
1033 end
1034  
1035  
1036  
1037 -- Begin the test.
1038 local o = compost:Acquire()
1039 local tt = compost:Acquire()
1040  
1041 testNumber = tonumber(testNumber)
1042  
1043 local startTime = GetTime()
1044 local startMem = gcinfo()
1045  
1046 for _, event in self.supportedEvents do
1047  
1048 for _, pattern in self:LoadPatternList(event) do
1049  
1050  
1051 for i, v in self.patternTable[pattern] do
1052 if i ~= 'pattern' and i ~= 'tc' then
1053 if string.find(i, "^amount") then
1054 tt[v] = "number"
1055 else
1056 tt[v] = "string"
1057 end
1058 end
1059 end
1060  
1061 local msg = messages[pattern]
1062  
1063 o[1], o[2], o[3], o[4], o[5], o[6], o[7], o[8], o[9] = self:Deformat(msg, getglobal(pattern))
1064 for i=1, self.patternTable[pattern].tc do
1065 if type(o[i]) ~= tt[i]
1066 or ( type(o[i]) == "string" and not o[i] == testString)
1067 or ( type(o[i]) == "number" and not o[i] == testNumber) then
1068 self:Print(string.format("E[%s],M[%s],[%s]=%s (%s)", event, msg, o[i], type(o[i]), tt[i]), 1, 0.3, 0)
1069 PrintTable(o)
1070 PrintTable(tt)
1071 print(pattern)
1072 PrintTable(self.patternTable[pattern])
1073 end
1074 end
1075 compost:Recycle(o)
1076 compost:Recycle(tt)
1077  
1078 end
1079 end
1080  
1081  
1082 self:Print( string.format("Test completed in %.4fs, memory cost %.2fKB.", GetTime() - startTime, gcinfo() - startMem) )
1083  
1084 -- Cleaning up.
1085 -- compost:Reclaim(info)
1086 compost:Reclaim(messages)
1087  
1088 end
1089  
1090 function lib:LoadEverything()
1091  
1092 -- Load all patterns and events.
1093 for _, v in self.supportedEvents do
1094 for _, w in self:LoadPatternList(v) do
1095 if not self.patternTable[w] then
1096 self.patternTable[w] = self:LoadPatternInfo(w)
1097 end
1098 end
1099 end
1100  
1101 end
1102  
1103  
1104  
1105 -- Used to load patternTable elements on demand.
1106 function lib:LoadPatternInfo(patternName)
1107  
1108 local patternInfo
1109  
1110 -- DebuffOther
1111 if patternName == "AURAADDEDOTHERHARMFUL" then patternInfo = { -- %s is afflicted by %s."; -- Combat log text for aura even
1112 type = "debuff",
1113 victim = 1,
1114 skill = 2
1115 }
1116 elseif patternName == "AURAAPPLICATIONADDEDOTHERHARMFUL" then patternInfo = { -- %s is afflicted by %s (%d).
1117 type = "debuff",
1118 victim = 1,
1119 skill = 2,
1120 amountRank = 3,
1121 }
1122  
1123  
1124 -- DebuffSelf
1125 elseif patternName == "AURAADDEDSELFHARMFUL" then patternInfo = { -- You are afflicted by %s."; -- Combat log text for aura even
1126 type = "debuff",
1127 victim = ParserLib_SELF,
1128 skill = 1,
1129 }
1130 elseif patternName == "AURAAPPLICATIONADDEDSELFHARMFUL" then patternInfo = { -- You are afflicted by %s (%d).
1131 type = "debuff",
1132 victim = ParserLib_SELF,
1133 skill = 1,
1134 amountRank = 2,
1135 }
1136  
1137 -- BuffOther
1138 elseif patternName == "AURAADDEDOTHERHELPFUL" then patternInfo = { -- %s gains %s."; -- Combat log text for aura even
1139 type = "buff",
1140 victim = 1,
1141 skill = 2,
1142 }
1143 elseif patternName == "AURAAPPLICATIONADDEDOTHERHELPFUL" then patternInfo = { -- %s gains %s (%d).
1144 type = "buff",
1145 victim = 1,
1146 skill = 2,
1147 amountRank = 3,
1148 }
1149  
1150 -- BuffSelf
1151 elseif patternName == "AURAADDEDSELFHELPFUL" then patternInfo = { -- You gain %s."; -- Combat log text for aura even
1152 type = "buff",
1153 victim = ParserLib_SELF,
1154 skill = 1,
1155 }
1156 elseif patternName == "AURAAPPLICATIONADDEDSELFHELPFUL" then patternInfo = { -- You gain %s (%d).
1157 type = "buff",
1158 victim = ParserLib_SELF,
1159 skill = 1,
1160 amountRank = 2,
1161 }
1162  
1163 -- AuraDispell
1164 elseif patternName == "AURADISPELOTHER" then patternInfo = { -- %s's %s is removed.
1165 type = "dispel",
1166 victim = 1,
1167 skill = 2,
1168 }
1169 elseif patternName == "AURADISPELSELF" then patternInfo = { -- Your %s is removed.
1170 type = "dispel",
1171 victim = ParserLib_SELF,
1172 skill = 1,
1173 }
1174  
1175 -- Fade
1176 elseif patternName == "AURAREMOVEDOTHER" then patternInfo = { -- %s fades from %s."; -- Combat log text for aura even
1177 type = "fade",
1178 victim = 2,
1179 skill = 1,
1180 }
1181 elseif patternName == "AURAREMOVEDSELF" then patternInfo = { -- %s fades from you."; -- Combat log text for aura even
1182 type = "fade",
1183 victim = ParserLib_SELF,
1184 skill = 1,
1185 }
1186  
1187  
1188 -- HitOther
1189 elseif patternName == "COMBATHITCRITOTHEROTHER" then patternInfo = { -- %s crits %s for %d.
1190 type = "hit",
1191 source = 1,
1192 victim = 2,
1193 skill = ParserLib_MELEE,
1194 amount = 3,
1195 isCrit = true,
1196 }
1197 elseif patternName == "COMBATHITCRITOTHERSELF" then patternInfo = { -- %s crits you for %d.
1198 type = "hit",
1199 source = 1,
1200 victim = ParserLib_SELF,
1201 skill = ParserLib_MELEE,
1202 amount = 2,
1203 isCrit = true,
1204 }
1205 elseif patternName == "COMBATHITCRITSCHOOLOTHEROTHER" then patternInfo = { -- %s crits %s for %d %s damage.
1206 type = "hit",
1207 source = 1,
1208 victim = 2,
1209 skill = ParserLib_MELEE,
1210 amount = 3,
1211 element = 4,
1212 isCrit = true
1213 }
1214 elseif patternName == "COMBATHITCRITSCHOOLOTHERSELF" then patternInfo = { -- %s crits you for %d %s damage.
1215 type = "hit",
1216 source = 1,
1217 victim = ParserLib_SELF,
1218 skill = ParserLib_MELEE,
1219 amount = 2,
1220 element = 3,
1221 isCrit = true
1222 }
1223 elseif patternName == "COMBATHITOTHEROTHER" then patternInfo = { -- %s hits %s for %d.
1224 type = "hit",
1225 source = 1,
1226 victim = 2,
1227 skill = ParserLib_MELEE,
1228 amount = 3,
1229 }
1230 elseif patternName == "COMBATHITOTHERSELF" then patternInfo = { -- %s hits you for %d.
1231 type = "hit",
1232 source = 1,
1233 victim = ParserLib_SELF,
1234 skill = ParserLib_MELEE,
1235 amount = 2,
1236 }
1237 elseif patternName == "COMBATHITSCHOOLOTHEROTHER" then patternInfo = { -- %s hits %s for %d %s damage.
1238 type = "hit",
1239 source = 1,
1240 victim = 2,
1241 skill = ParserLib_MELEE,
1242 amount = 3,
1243 element = 4
1244 }
1245 elseif patternName == "COMBATHITSCHOOLOTHERSELF" then patternInfo = { -- %s hits you for %d %s damage.
1246 type = "hit",
1247 source = 1,
1248 victim = ParserLib_SELF,
1249 skill = ParserLib_MELEE,
1250 amount = 2,
1251 element = 3
1252 }
1253  
1254 -- HitSelf
1255 elseif patternName == "COMBATHITSCHOOLSELFOTHER" then patternInfo = { -- You hit %s for %d %s damage.
1256 type = "hit",
1257 source = ParserLib_SELF,
1258 victim = 1,
1259 skill = ParserLib_MELEE,
1260 amount = 2,
1261 element = 3
1262 }
1263 elseif patternName == "COMBATHITSELFOTHER" then patternInfo = { -- You hit %s for %d.
1264 type = "hit",
1265 source = ParserLib_SELF,
1266 victim = 1,
1267 skill = ParserLib_MELEE,
1268 amount = 2,
1269 }
1270 elseif patternName == "COMBATHITCRITSCHOOLSELFOTHER" then patternInfo = { -- You crit %s for %d %s damage.
1271 type = "hit",
1272 source = ParserLib_SELF,
1273 victim = 1,
1274 skill = ParserLib_MELEE,
1275 amount = 2,
1276 element = 3,
1277 isCrit = true
1278 }
1279 elseif patternName == "COMBATHITCRITSELFOTHER" then patternInfo = { -- You crit %s for %d.
1280 type = "hit",
1281 source = ParserLib_SELF,
1282 victim = 1,
1283 skill = ParserLib_MELEE,
1284 amount = 2,
1285 isCrit = true,
1286 }
1287  
1288 -- Honor
1289 elseif patternName == "COMBATLOG_DISHONORGAIN" then patternInfo = { -- %s dies, dishonorable kill.
1290 type = "honor",
1291 source = 1,
1292 isDishonor = true
1293 }
1294 elseif patternName == "COMBATLOG_HONORAWARD" then patternInfo = { -- You have been awarded %d honor points.
1295 type = "honor",
1296 amount = 1,
1297 }
1298 elseif patternName == "COMBATLOG_HONORGAIN" then patternInfo = { -- "%s dies, honorable kill Rank: %s (Estimated Honor Points: %d)";
1299 type = "honor",
1300 source = 1,
1301 sourceRank = 2,
1302 amount = 3,
1303  
1304 }
1305 elseif patternName == "COMBATLOG_XPGAIN" then patternInfo = { -- %s gains %d experience.
1306 type = "experience",
1307 amount = 2,
1308 victim = 1,
1309 }
1310  
1311  
1312 -- Exp
1313 elseif patternName == "COMBATLOG_XPGAIN_EXHAUSTION1" then patternInfo = { -- %s dies, you gain %d experience. (%s exp %s bonus)
1314 type = "experience",
1315 amount = 2,
1316 source = 1,
1317 bonusAmount = 3,
1318 bonusType = 4,
1319 }
1320 elseif patternName == "COMBATLOG_XPGAIN_EXHAUSTION1_GROUP" then patternInfo = { -- %s dies, you gain %d experience. (%s exp %s bonus, +%d group bonus)
1321 type = "experience",
1322 amount = 2,
1323 source = 1,
1324 bonusAmount = 3,
1325 bonusType = 4,
1326 amountGroupBonus = 5
1327 }
1328 elseif patternName == "COMBATLOG_XPGAIN_EXHAUSTION1_RAID" then patternInfo = { -- %s dies, you gain %d experience. (%s exp %s bonus, -%d raid penalty)
1329 type = "experience",
1330 amount = 2,
1331 source = 1,
1332 bonusAmount = 3,
1333 bonusType = 4,
1334 amountRaidPenalty = 5
1335 }
1336 elseif patternName == "COMBATLOG_XPGAIN_EXHAUSTION2" then patternInfo = { -- %s dies, you gain %d experience. (%s exp %s bonus)
1337 type = "experience",
1338 amount = 2,
1339 source = 1,
1340 bonusAmount = 3,
1341 bonusType = 4,
1342 }
1343 elseif patternName == "COMBATLOG_XPGAIN_EXHAUSTION2_GROUP" then patternInfo = { -- %s dies, you gain %d experience. (%s exp %s bonus, +%d group bonus)
1344 type = "experience",
1345 amount = 2,
1346 source = 1,
1347 bonusAmount = 3,
1348 bonusType = 4,
1349 amountGroupBonus = 5
1350 }
1351 elseif patternName == "COMBATLOG_XPGAIN_EXHAUSTION2_RAID" then patternInfo = { -- %s dies, you gain %d experience. (%s exp %s bonus, -%d raid penalty)
1352 type = "experience",
1353 amount = 2,
1354 source = 1,
1355 bonusAmount = 3,
1356 bonusType = 4,
1357 amountRaidPenalty = 5
1358 }
1359 elseif patternName == "COMBATLOG_XPGAIN_EXHAUSTION4" then patternInfo = { -- %s dies, you gain %d experience. (%s exp %s penalty)
1360 type = "experience",
1361 amount = 2,
1362 source = 1,
1363 penaltyAmount = 3,
1364 penaltyType = 4,
1365 }
1366 elseif patternName == "COMBATLOG_XPGAIN_EXHAUSTION4_GROUP" then patternInfo = { -- %s dies, you gain %d experience. (%s exp %s penalty, +%d group bonus)
1367 type = "experience",
1368 amount = 2,
1369 source = 1,
1370 penaltyAmount = 3,
1371 penaltyType = 4,
1372 amountGroupBonus = 5
1373 }
1374 elseif patternName == "COMBATLOG_XPGAIN_EXHAUSTION4_RAID" then patternInfo = { -- %s dies, you gain %d experience. (%s exp %s penalty, -%d raid penalty)
1375 type = "experience",
1376 amount = 2,
1377 source = 1,
1378 penaltyAmount = 3,
1379 penaltyType = 4,
1380 amountGroupBonus = 5
1381 }
1382 elseif patternName == "COMBATLOG_XPGAIN_EXHAUSTION5" then patternInfo = { -- %s dies, you gain %d experience. (%s exp %s penalty)
1383 type = "experience",
1384 amount = 2,
1385 source = 1,
1386 penaltyAmount = 3,
1387 penaltyType = 4,
1388 }
1389 elseif patternName == "COMBATLOG_XPGAIN_EXHAUSTION5_GROUP" then patternInfo = { -- %s dies, you gain %d experience. (%s exp %s penalty, +%d group bonus)
1390 type = "experience",
1391 amount = 2,
1392 source = 1,
1393 penaltyAmount = 3,
1394 penaltyType = 4,
1395 amountGroupBonus = 5
1396 }
1397 elseif patternName == "COMBATLOG_XPGAIN_EXHAUSTION5_RAID" then patternInfo = { -- %s dies, you gain %d experience. (%s exp %s penalty, -%d raid penalty)
1398 type = "experience",
1399 amount = 2,
1400 source = 1,
1401 penaltyAmount = 3,
1402 penaltyType = 4,
1403 amountRaidPenalty = 5
1404 }
1405 elseif patternName == "COMBATLOG_XPGAIN_FIRSTPERSON" then patternInfo = { -- %s dies, you gain %d experience.
1406 type = "experience",
1407 amount = 2,
1408 source = 1,
1409 }
1410 elseif patternName == "COMBATLOG_XPGAIN_FIRSTPERSON_GROUP" then patternInfo = { -- %s dies, you gain %d experience. (+%d group bonus)
1411 type = "experience",
1412 amount = 2,
1413 source = 1,
1414 amountGroupBonus = 3
1415 }
1416 elseif patternName == "COMBATLOG_XPGAIN_FIRSTPERSON_RAID" then patternInfo = { -- %s dies, you gain %d experience. (-%d raid penalty)
1417 type = "experience",
1418 amount = 2,
1419 source = 1,
1420 amountRaidPenalty = 3
1421 }
1422 elseif patternName == "COMBATLOG_XPGAIN_FIRSTPERSON_UNNAMED" then patternInfo = { -- You gain %d experience.
1423 type = "experience",
1424 amount = 1,
1425 }
1426 elseif patternName == "COMBATLOG_XPGAIN_FIRSTPERSON_UNNAMED_GROUP" then patternInfo = { -- You gain %d experience. (+%d group bonus)
1427 type = "experience",
1428 amount = 1,
1429 amountGroupBonus = 2
1430 }
1431 elseif patternName == "COMBATLOG_XPGAIN_FIRSTPERSON_UNNAMED_RAID" then patternInfo = { -- You gain %d experience. (-%d raid penalty)
1432 type = "experience",
1433 amount = 1,
1434 amountRaidPenalty = 2
1435 }
1436 elseif patternName == "COMBATLOG_XPLOSS_FIRSTPERSON_UNNAMED" then patternInfo = { -- You lose %d experience.
1437 type = "experience",
1438 amount = 1,
1439 isNegative = true
1440 }
1441  
1442  
1443 -- DmgShieldOther
1444 elseif patternName == "DAMAGESHIELDOTHEROTHER" then patternInfo = { -- %s reflects %d %s damage to %s.
1445 type = "hit",
1446 source = 1,
1447 victim = 4,
1448 skill = ParserLib_DAMAGESHIELD,
1449 amount = 2,
1450 element = 3,
1451 }
1452 elseif patternName == "DAMAGESHIELDOTHERSELF" then patternInfo = { -- %s reflects %d %s damage to you.
1453 type = "hit",
1454 source = 1,
1455 victim = ParserLib_SELF,
1456 skill = ParserLib_DAMAGESHIELD,
1457 amount = 2,
1458 element = 3,
1459 }
1460  
1461 -- DmgShieldSelf
1462 elseif patternName == "DAMAGESHIELDSELFOTHER" then patternInfo = { -- You reflect %d %s damage to %s.
1463 type = "hit",
1464 source = ParserLib_SELF,
1465 victim = 3,
1466 skill = ParserLib_DAMAGESHIELD,
1467 amount = 1,
1468 element = 2,
1469 }
1470  
1471 -- DispellFailOther
1472 elseif patternName == "DISPELFAILEDOTHEROTHER" then patternInfo = { -- %s fails to dispel %s's %s.
1473 type = "dispel",
1474 source = 1,
1475 victim = 2,
1476 skill = 3,
1477 isFailed = true
1478 }
1479 elseif patternName == "DISPELFAILEDOTHERSELF" then patternInfo = { -- %s fails to dispel your %s.
1480 type = "dispel",
1481 source = 1,
1482 victim = ParserLib_SELF,
1483 skill = 2,
1484 isFailed = true
1485 }
1486  
1487 -- DispellFailSelf
1488 elseif patternName == "DISPELFAILEDSELFOTHER" then patternInfo = { -- You fail to dispel %s's %s.
1489 type = "dispel",
1490 source = ParserLib_SELF,
1491 victim = 1,
1492 skill = 2,
1493 isFailed = true
1494 }
1495  
1496 -- WoW 1.11 new pattern.
1497 elseif patternName == "DISPELFAILEDSELFSELF" then patternInfo = { -- You fail to dispel your %s.
1498 type = "dispel",
1499 source = ParserLib_SELF,
1500 victim = ParserLb_SELF,
1501 skill = 1,
1502 isFailed = true
1503 }
1504  
1505 --[[ Seems no longer used
1506 elseif patternName == "DISPELLEDOTHEROTHER" then patternInfo = { -- %s casts %s on %s.
1507 type = "dispel",
1508 source = 1,
1509 victim = 3,
1510 skill = 2
1511 }
1512 elseif patternName == "DISPELLEDOTHERSELF" then patternInfo = { -- %s casts %s on you.
1513 type = "dispel",
1514 source = 1,
1515 victim = ParserLib_SELF,
1516 skill = 2
1517 }
1518 elseif patternName == "DISPELLEDSELFOTHER" then patternInfo = { -- You cast %s on %s.
1519 type = "dispel",
1520 source = ParserLib_SELF,
1521 victim = 2,
1522 skill = 1
1523 }
1524 elseif patternName == "DISPELLEDSELFSELF" then patternInfo = { -- You cast %s.
1525 type = "dispel",
1526 source = ParserLib_SELF,
1527 victim = ParserLib_SELF,
1528 skill = 1
1529 }
1530 ]]
1531  
1532 -- Rep
1533 elseif patternName == "FACTION_STANDING_CHANGED" then patternInfo = { -- You are now %s with %s.
1534 type = "reputation",
1535 rank = 1,
1536 faction = 2
1537 }
1538  
1539 -- These will be removed in WoW 1.11.
1540 elseif patternName == "FACTION_STANDING_DECREASED2" then patternInfo = { -- Your reputation with %s has slightly decreased. (%d reputation lost)
1541 type = "reputation",
1542 faction = 1,
1543 amount = 2,
1544 isNegative = true
1545 }
1546 elseif patternName == "FACTION_STANDING_DECREASED4" then patternInfo = { -- Your reputation with %s has greatly decreased. (%d reputation lost)
1547 type = "reputation",
1548 faction = 1,
1549 amount = 2,
1550 isNegative = true,
1551 }
1552 elseif patternName == "FACTION_STANDING_DECREASED3" then patternInfo = { -- Your reputation with %s has decreased. (%d reputation lost)
1553 type = "reputation",
1554 faction = 1,
1555 amount = 2,
1556 isNegative = true,
1557 }
1558 elseif patternName == "FACTION_STANDING_DECREASED1" then patternInfo = { -- Your reputation with %s has very slightly decreased. (%d reputation lost)
1559 type = "reputation",
1560 faction = 1,
1561 amount = 2,
1562 isNegative = true,
1563 }
1564 elseif patternName == "FACTION_STANDING_INCREASED1" then patternInfo = { -- Your reputation with %s has very slightly increased. (%d reputation gained)
1565 type = "reputation",
1566 faction = 1,
1567 amount = 2,
1568 }
1569 elseif patternName == "FACTION_STANDING_INCREASED2" then patternInfo = { -- Your reputation with %s has slightly increased. (%d reputation gained)
1570 type = "reputation",
1571 faction = 1,
1572 amount = 2,
1573 }
1574 elseif patternName == "FACTION_STANDING_INCREASED3" then patternInfo = { -- Your reputation with %s has increased. (%d reputation gained)
1575 type = "reputation",
1576 faction = 1,
1577 amount = 2,
1578 }
1579 elseif patternName == "FACTION_STANDING_INCREASED4" then patternInfo = { -- Your reputation with %s has greatly increased. (%d reputation gained)
1580 type = "reputation",
1581 faction = 1,
1582 amount = 2,
1583 }
1584  
1585 -- These 2 are WoW 1.11 new patterns.
1586 elseif patternName == "FACTION_STANDING_DECREASED" then patternInfo = { -- "Your %s reputation has decreased by %d.";
1587 type = "reputation",
1588 faction = 1,
1589 amount = 2,
1590 isNegative = true,
1591 }
1592 elseif patternName == "FACTION_STANDING_INCREASED" then patternInfo = { -- "Your %s reputation has increased by %d.";
1593 type = "reputation",
1594 faction = 1,
1595 amount = 2,
1596 }
1597  
1598  
1599 elseif patternName == "FEEDPET_LOG_FIRSTPERSON" then patternInfo = { -- Your pet begins eating the %s.
1600 type = "feedpet",
1601 victim = ParserLib_SELF,
1602 item = 1
1603 }
1604 elseif patternName == "FEEDPET_LOG_THIRDPERSON" then patternInfo = { -- %s's pet begins eating a %s."
1605 type = "feedpet",
1606 victim = 1,
1607 item = 2
1608 }
1609  
1610 -- HealOther
1611 elseif patternName == "HEALEDCRITOTHEROTHER" then patternInfo = { -- %s's %s critically heals %s for %d.
1612 type = "heal",
1613 source = 1,
1614 victim = 3,
1615 skill = 2,
1616 amount = 4,
1617 isCrit = true,
1618 }
1619 elseif patternName == "HEALEDCRITOTHERSELF" then patternInfo = { -- %s's %s critically heals you for %d.
1620 type = "heal",
1621 source = 1,
1622 victim = ParserLib_SELF,
1623 skill = 2,
1624 amount = 3,
1625 isCrit = true,
1626 }
1627 elseif patternName == "HEALEDOTHEROTHER" then patternInfo = { -- %s's %s heals %s for %d.
1628 type = "heal",
1629 source = 1,
1630 victim = 3,
1631 skill = 2,
1632 amount = 4,
1633 }
1634 elseif patternName == "HEALEDOTHERSELF" then patternInfo = { -- %s's %s heals you for %d.
1635 type = "heal",
1636 source = 1,
1637 victim = ParserLib_SELF,
1638 skill = 2,
1639 amount = 3,
1640 }
1641  
1642 -- HealSelf
1643 elseif patternName == "HEALEDCRITSELFOTHER" then patternInfo = { -- Your %s critically heals %s for %d.
1644 type = "heal",
1645 source = ParserLib_SELF,
1646 victim = 2,
1647 skill = 1,
1648 amount = 3,
1649 isCrit = true,
1650 }
1651 elseif patternName == "HEALEDCRITSELFSELF" then patternInfo = { -- Your %s critically heals you for %d.
1652 type = "heal",
1653 source = ParserLib_SELF,
1654 victim = ParserLib_SELF,
1655 skill = 1,
1656 amount = 2,
1657 isCrit = true,
1658 }
1659 elseif patternName == "HEALEDSELFOTHER" then patternInfo = { -- Your %s heals %s for %d.
1660 type = "heal",
1661 source = ParserLib_SELF,
1662 victim = 2,
1663 skill = 1,
1664 amount = 3,
1665 }
1666 elseif patternName == "HEALEDSELFSELF" then patternInfo = { -- Your %s heals you for %d.
1667 type = "heal",
1668 source = ParserLib_SELF,
1669 victim = ParserLib_SELF,
1670 skill = 1,
1671 amount = 2,
1672 }
1673  
1674 --[[
1675 elseif patternName == "IMMUNEDAMAGECLASSOTHEROTHER" then patternInfo = { -- %s is immune to %s's %s damage.
1676 type = "miss",
1677 source = 2,
1678 victim = 1,
1679 skill = ParserLib_MELEE,
1680 missType = "immune",
1681 element = 3
1682 }
1683 elseif patternName == "IMMUNEDAMAGECLASSOTHERSELF" then patternInfo = { -- You are immune to %s's %s damage.
1684 type = "miss",
1685 source = 1,
1686 victim = ParserLib_SELF,
1687 skill = ParserLib_MELEE,
1688 missType = "immune",
1689 element = 2
1690 }
1691 elseif patternName == "IMMUNEDAMAGECLASSSELFOTHER" then patternInfo = { -- %s is immune to your %s damage.
1692 type = "miss",
1693 source = ParserLib_SELF,
1694 victim = 1,
1695 skill = ParserLib_MELEE,
1696 missType = "immune",
1697 element = 2
1698 }
1699 elseif patternName == "IMMUNEOTHEROTHER" then patternInfo = { -- %s hits %s, who is immune.
1700 type = "miss",
1701 source = 1,
1702 victim = 2,
1703 skill = ParserLib_MELEE,
1704 missType = "immune",
1705 }
1706 elseif patternName == "IMMUNEOTHERSELF" then patternInfo = { -- %s hits you, but you are immune.
1707 type = "miss",
1708 source = 1,
1709 victim = ParserLib_SELF,
1710 skill = ParserLib_MELEE,
1711 missType = "immune",
1712 }
1713 elseif patternName == "IMMUNESELFOTHER" then patternInfo = { -- You hit %s, who is immune.
1714 type = "miss",
1715 source = ParserLib_SELF,
1716 victim = 1,
1717 skill = ParserLib_MELEE,
1718 missType = "immune",
1719 }
1720 elseif patternName == "IMMUNESELFSELF" then patternInfo = { -- You hit yourself, but you are immune.
1721 type = "miss",
1722 source = ParserLib_SELF,
1723 victim = ParserLib_SELF,
1724 skill = ParserLib_MELEE,
1725 missType = "immune",
1726 }
1727 ]]
1728  
1729  
1730  
1731  
1732 -- EnchantOther
1733 elseif patternName == "ITEMENCHANTMENTADDOTHEROTHER" then patternInfo = { -- %s casts %s on %s's %s.
1734 type = "enchant",
1735 source = 1,
1736 victim = 3,
1737 skill = 2,
1738 item = 4
1739 }
1740 elseif patternName == "ITEMENCHANTMENTADDOTHERSELF" then patternInfo = { -- %s casts %s on your %s.
1741 type = "enchant",
1742 source = 1,
1743 victim = ParserLib_SELF,
1744 skill = 2,
1745 item = 3
1746 }
1747  
1748 -- EnchantSelf
1749 elseif patternName == "ITEMENCHANTMENTADDSELFOTHER" then patternInfo = { -- You cast %s on %s's %s.
1750 type = "enchant",
1751 source = ParserLib_SELF,
1752 victim = 2,
1753 skill = 1,
1754 item = 3
1755 }
1756 elseif patternName == "ITEMENCHANTMENTADDSELFSELF" then patternInfo = { -- You cast %s on your %s.
1757 type = "enchant",
1758 source = ParserLib_SELF,
1759 victim = ParserLib_SELF,
1760 skill = 1,
1761 item = 2
1762 }
1763 --[[
1764 elseif patternName == "ITEMENCHANTMENTREMOVEOTHER" then patternInfo = { -- %s has faded from %s's %s.
1765 type = "enchant",
1766 victim = 2,
1767 skill = 1,
1768 item = 3,
1769 isFade = true
1770 }
1771 elseif patternName == "ITEMENCHANTMENTREMOVESELF" then patternInfo = { -- %s has faded from your %s.
1772 type = "enchant",
1773 victim = ParserLib_SELF,
1774 skill = 1,
1775 item = 2,
1776 isFade = true
1777 }
1778 ]]
1779  
1780  
1781  
1782 elseif patternName == "PARTYKILLOTHER" then patternInfo = { -- %s is slain by %s!
1783 type = "death",
1784 source = 2,
1785 victim = 1,
1786 }
1787  
1788 -- WoW 1.11 Pattern.
1789 elseif patternName == "SELFKILLOTHER" then patternInfo = { -- "You have slain %s!";
1790 type = "death",
1791 source = ParserLib_SELF,
1792 victim = 1,
1793 }
1794  
1795 -- DotOther
1796 elseif patternName == "PERIODICAURADAMAGEOTHEROTHER" then patternInfo = { -- %s suffers %d %s damage from %s's %s.
1797 type = "hit",
1798 source = 4,
1799 victim = 1,
1800 skill = 5,
1801 amount = 2,
1802 element = 3,
1803 isDOT = true,
1804 }
1805 elseif patternName == "PERIODICAURADAMAGEOTHERSELF" then patternInfo = { -- You suffer %d %s damage from %s's %s.
1806 type = "hit",
1807 source = 3,
1808 victim = ParserLib_SELF,
1809 skill = 4,
1810 amount = 1,
1811 element = 2,
1812 isDOT = true,
1813 }
1814  
1815 -- DotSelf
1816 elseif patternName == "PERIODICAURADAMAGESELFOTHER" then patternInfo = { -- %s suffers %d %s damage from your %s.
1817 type = "hit",
1818 source = ParserLib_SELF,
1819 victim = 1,
1820 skill = 4,
1821 amount = 2,
1822 element = 3,
1823 isDOT = true,
1824 }
1825 elseif patternName == "PERIODICAURADAMAGESELFSELF" then patternInfo = { -- You suffer %d %s damage from your %s.
1826 type = "hit",
1827 source = ParserLib_SELF,
1828 victim = ParserLib_SELF,
1829 skill = 3,
1830 amount = 1,
1831 element = 2,
1832 isDOT = true,
1833 }
1834  
1835 -- HotOther
1836 elseif patternName == "PERIODICAURAHEALOTHEROTHER" then patternInfo = { -- %s gains %d health from %s's %s.
1837 type = "heal",
1838 source = 3,
1839 victim = 1,
1840 skill = 4,
1841 amount = 2,
1842 isDOT = true,
1843 }
1844 elseif patternName == "PERIODICAURAHEALOTHERSELF" then patternInfo = { -- You gain %d health from %s's %s.
1845 type = "heal",
1846 source = 2,
1847 victim = ParserLib_SELF,
1848 skill = 3,
1849 amount = 1,
1850 isDOT = true,
1851 }
1852 -- HotSelf
1853 elseif patternName == "PERIODICAURAHEALSELFOTHER" then patternInfo = { -- %s gains %d health from your %s.
1854 type = "heal",
1855 source = ParserLib_SELF,
1856 victim = 1,
1857 skill = 3,
1858 amount = 2,
1859 isDOT = true,
1860 }
1861 elseif patternName == "PERIODICAURAHEALSELFSELF" then patternInfo = { -- You gain %d health from %s.
1862 type = "heal",
1863 source = ParserLib_SELF,
1864 victim = ParserLib_SELF,
1865 skill = 2,
1866 amount = 1,
1867 isDOT = true,
1868 }
1869  
1870  
1871 -- PowerGainOther
1872 elseif patternName == "POWERGAINOTHEROTHER" then patternInfo = { -- %s gains %d %s from %s's %s.
1873 type = "gain",
1874 source = 4,
1875 victim = 1,
1876 skill = 5,
1877 amount = 2,
1878 attribute = 3,
1879 }
1880 elseif patternName == "POWERGAINOTHERSELF" then patternInfo = { -- You gain %d %s from %s's %s.
1881 type = "gain",
1882 source = 3,
1883 victim = ParserLib_SELF,
1884 skill = 4,
1885 amount = 1,
1886 attribute = 2,
1887 }
1888  
1889 -- PowerGainSelf
1890 elseif patternName == "POWERGAINSELFOTHER" then patternInfo = { -- %s gains %d %s from %s.
1891 type = "gain",
1892 source = ParserLib_SELF,
1893 victim = 1,
1894 skill = 4,
1895 amount = 2,
1896 attribute = 3,
1897 }
1898 elseif patternName == "POWERGAINSELFSELF" then patternInfo = { -- You gain %d %s from %s.
1899 type = "gain",
1900 source = ParserLib_SELF,
1901 victim = ParserLib_SELF,
1902 skill = 3,
1903 amount = 1,
1904 attribute = 2,
1905 }
1906  
1907 -- ProcResistOther
1908 elseif patternName == "PROCRESISTOTHEROTHER" then patternInfo = { -- %s resists %s's %s.
1909 type = "miss",
1910 source = 2,
1911 victim = 1,
1912 skill = 3,
1913 missType = "resist",
1914 isProc = true,
1915 }
1916 elseif patternName == "PROCRESISTOTHERSELF" then patternInfo = { -- You resist %s's %s.
1917 type = "miss",
1918 source = 1,
1919 victim = ParserLib_SELF,
1920 skill = 2,
1921 missType = "resist",
1922 isProc = true,
1923 }
1924  
1925 -- ProcResistSelf
1926 elseif patternName == "PROCRESISTSELFOTHER" then patternInfo = { -- %s resists your %s.
1927 type = "miss",
1928 source = ParserLib_SELF,
1929 victim = 1,
1930 skill = 2,
1931 missType = "resist",
1932 isProc = true,
1933 }
1934 elseif patternName == "PROCRESISTSELFSELF" then patternInfo = { -- You resist your %s.
1935 type = "miss",
1936 source = ParserLib_SELF,
1937 victim = ParserLib_SELF,
1938 skill = 1,
1939 missType = "resist",
1940 isProc = true,
1941 }
1942  
1943  
1944  
1945 --[[
1946 elseif patternName == "SPELLDISMISSPETOTHER" then patternInfo = { -- %s's %s is dismissed.
1947 }
1948 elseif patternName == "SPELLDISMISSPETSELF" then patternInfo = { -- Your %s is dismissed.
1949 }
1950 ]]
1951  
1952 --[[
1953 elseif patternName == "SPELLCASTGOOTHER" then patternInfo = { -- %s casts %s.
1954 type = "cast",
1955 source = 1,
1956 skill = 2
1957 }
1958 elseif patternName == "SPELLCASTGOOTHERTARGETTED" then patternInfo = { -- %s casts %s on %s.
1959 type = "cast",
1960 source = 1,
1961 victim = 3,
1962 skill = 2
1963 }
1964  
1965 elseif patternName == "SPELLCASTGOSELF" then patternInfo = { -- You cast %s.
1966 type = "cast",
1967 source = ParserLib_SELF,
1968 skill = 1
1969 }
1970 elseif patternName == "SPELLCASTGOSELFTARGETTED" then patternInfo = { -- You cast %s on %s.
1971 type = "cast",
1972 source = ParserLib_SELF,
1973 victim = 2,
1974 skill = 1
1975 }
1976 ]]
1977 -- SpellMissSelf
1978 elseif patternName == "IMMUNESPELLSELFOTHER" then patternInfo = { -- %s is immune to your %s.
1979 type = "miss",
1980 source = ParserLib_SELF,
1981 victim = 1,
1982 skill = 2,
1983 missType = "immune",
1984 }
1985 elseif patternName == "IMMUNESPELLSELFSELF" then patternInfo = { -- You are immune to your %s.
1986 type = "miss",
1987 source = ParserLib_SELF,
1988 victim = ParserLib_SELF,
1989 skill = 1,
1990 missType = "immune",
1991 }
1992 elseif patternName == "SPELLBLOCKEDSELFOTHER" then patternInfo = { -- Your %s was blocked by %s."
1993 type = "miss",
1994 source = ParserLib_SELF,
1995 victim = 2,
1996 skill = 1,
1997 missType = "block",
1998 }
1999 elseif patternName == "SPELLDEFLECTEDSELFOTHER" then patternInfo = { -- "Your %s was deflected by %s.";
2000 type = "miss",
2001 source = ParserLib_SELF,
2002 victim = 2,
2003 skill = 1,
2004 missType = "deflect"
2005 }
2006 elseif patternName == "SPELLDEFLECTEDSELFSELF" then patternInfo = { -- "You deflected your %s.";
2007 type = "miss",
2008 source = ParserLib_SELF,
2009 victim = ParserLib_SELF,
2010 skill = 1,
2011 missType = "deflect"
2012 }
2013 elseif patternName == "SPELLDODGEDSELFOTHER" then patternInfo = { -- Your %s was dodged by %s.
2014 type = "miss",
2015 source = ParserLib_SELF,
2016 victim = 2,
2017 skill = 1,
2018 missType = "dodge",
2019 }
2020 elseif patternName == "SPELLDODGEDSELFSELF" then patternInfo = { -- "You dodged your %s.
2021 type = "miss",
2022 source = ParserLib_SELF,
2023 victim = ParserLib_SELF,
2024 skill = 1,
2025 missType = "dodge",
2026 }
2027 elseif patternName == "SPELLEVADEDSELFOTHER" then patternInfo = { -- Your %s was evaded by %s.
2028 type = "miss",
2029 source = ParserLib_SELF,
2030 victim = 2,
2031 skill = 1,
2032 missType = "evade",
2033 }
2034 elseif patternName == "SPELLEVADEDSELFSELF" then patternInfo = { -- You evaded your %s.
2035 type = "miss",
2036 source = ParserLib_SELF,
2037 victim = ParserLib_SELF,
2038 skill = 1,
2039 missType = "evade",
2040 }
2041 elseif patternName == "SPELLIMMUNESELFOTHER" then patternInfo = { -- Your %s failed. %s is immune.
2042 type = "miss",
2043 source = ParserLib_SELF,
2044 victim = 2,
2045 skill = 1,
2046 missType = "immune",
2047 }
2048 elseif patternName == "SPELLIMMUNESELFSELF" then patternInfo = { -- Your %s failed. You are immune.
2049 type = "miss",
2050 source = ParserLib_SELF,
2051 victim = ParserLib_SELF,
2052 skill = 1,
2053 missType = "immune",
2054 }
2055 elseif patternName == "SPELLLOGABSORBSELFOTHER" then patternInfo = { -- Your %s is absorbed by %s.
2056 type = "miss",
2057 source = ParserLib_SELF,
2058 victim = 2,
2059 skill = 1,
2060 missType = "absorb",
2061 }
2062 elseif patternName == "SPELLLOGABSORBSELFSELF" then patternInfo = { -- You absorb your %s.
2063 type = "miss",
2064 source = ParserLib_SELF,
2065 victim = ParserLib_SELF,
2066 skill = 1,
2067 missType = "absorb",
2068 }
2069 elseif patternName == "SPELLMISSSELFOTHER" then patternInfo = { -- Your %s missed %s.
2070 type = "miss",
2071 source = ParserLib_SELF,
2072 victim = 2,
2073 skill = 1,
2074 missType = "miss",
2075 }
2076 elseif patternName == "SPELLMISSSELFSELF" then patternInfo = { -- Your %s misses you.
2077 type = "miss",
2078 source = ParserLib_SELF,
2079 victim = ParserLib_SELF,
2080 skill = 1,
2081 missType = "miss",
2082 }
2083 elseif patternName == "SPELLPARRIEDSELFOTHER" then patternInfo = { -- Your %s is parried by %s.
2084 type = "miss",
2085 source = ParserLib_SELF,
2086 victim = 2,
2087 skill = 1,
2088 missType = "parry",
2089 }
2090 elseif patternName == "SPELLPARRIEDSELFSELF" then patternInfo = { -- You parried your %s.
2091 type = "miss",
2092 source = ParserLib_SELF,
2093 victim = ParserLib_SELF,
2094 skill = 1,
2095 missType = "parry",
2096 }
2097 elseif patternName == "SPELLREFLECTSELFOTHER" then patternInfo = { -- Your %s is reflected back by %s.
2098 type = "miss",
2099 source = 1,
2100 skill = 2,
2101 victim = ParserLib_SELF,
2102 missType = "reflect"
2103 }
2104 elseif patternName == "SPELLREFLECTSELFSELF" then patternInfo = { -- You reflected your %s.
2105 type = "miss",
2106 source = ParserLib_SELF,
2107 skill = 1,
2108 victim = ParserLib_SELF,
2109 missType = "reflect"
2110 }
2111 elseif patternName == "SPELLRESISTSELFOTHER" then patternInfo = { -- Your %s was resisted by %s.
2112 type = "miss",
2113 source = ParserLib_SELF,
2114 victim = 2,
2115 skill = 1,
2116 missType = "resist",
2117 }
2118 elseif patternName == "SPELLRESISTSELFSELF" then patternInfo = { -- You resisted your %s.
2119 type = "miss",
2120 source = ParserLib_SELF,
2121 victim = ParserLib_SELF,
2122 skill = 1,
2123 missType = "resist",
2124 }
2125  
2126  
2127  
2128 elseif patternName == "SPELLCASTOTHERSTART" then patternInfo = { -- %s begins to cast %s.
2129 type = "cast",
2130 source = 1,
2131 skill = 2,
2132 isBegin = true
2133 }
2134 elseif patternName == "SPELLCASTSELFSTART" then patternInfo = { -- You begin to cast %s.
2135 type = "cast",
2136 source = ParserLib_SELF,
2137 skill = 1,
2138 isBegin = true
2139 }
2140  
2141  
2142  
2143 elseif patternName == "SPELLDURABILITYDAMAGEALLOTHEROTHER" then patternInfo = { -- "%s casts %s on %s: all items damaged.
2144 type = 'durability',
2145 source = 1,
2146 skill = 2,
2147 victim = 3,
2148 isAllItems = true
2149 }
2150 elseif patternName == "SPELLDURABILITYDAMAGEALLOTHERSELF" then patternInfo = { -- "%s casts %s on you: all items damaged.
2151 type = 'durability',
2152 source = 1,
2153 skill = 2,
2154 victim = ParserLib_SELF,
2155 isAllItems = true
2156 }
2157 elseif patternName == "SPELLDURABILITYDAMAGEALLSELFOTHER" then patternInfo = { -- "You cast %s on %s: all items damaged.
2158 type = 'durability',
2159 source = ParserLib_SELF,
2160 skill = 1,
2161 victim = 2,
2162 isAllItems = true
2163 }
2164 elseif patternName == "SPELLDURABILITYDAMAGEOTHEROTHER" then patternInfo = { -- "%s casts %s on %s: %s damaged.
2165 type = 'durability',
2166 source = 1,
2167 skill = 2,
2168 victim = 3,
2169 item = 4,
2170 }
2171 elseif patternName == "SPELLDURABILITYDAMAGEOTHERSELF" then patternInfo = { -- "%s casts %s on you: %s damaged.
2172 type = 'durability',
2173 source = 1,
2174 skill = 2,
2175 victim = ParserLib_SELF,
2176 item = 3,
2177 }
2178 elseif patternName == "SPELLDURABILITYDAMAGESELFOTHER" then patternInfo = { -- "You cast %s on %s: %s damaged."; -- Example: You cast Destruction on Fred: helmet damage
2179 type = 'durability',
2180 source = ParserLib_SELF,
2181 skill = 1,
2182 victim = 2,
2183 item = 3,
2184 }
2185  
2186  
2187 -- SpellMissOther
2188 elseif patternName == "IMMUNESPELLOTHEROTHER" then patternInfo = { -- %s is immune to %s's %s.
2189 type = "miss",
2190 source = 2,
2191 victim = 1,
2192 skill = 3,
2193 missType = "immune",
2194 }
2195 elseif patternName == "IMMUNESPELLOTHERSELF" then patternInfo = { -- You are immune to %s's %s.
2196 type = "miss",
2197 source = 1,
2198 victim = ParserLib_SELF,
2199 skill = 2,
2200 missType = "immune",
2201 }
2202 elseif patternName == "SPELLBLOCKEDOTHEROTHER" then patternInfo = { -- %s's %s was blocked by %s.
2203 type = "miss",
2204 source = 1,
2205 victim = 3,
2206 skill = 2,
2207 missType = "block",
2208 }
2209 elseif patternName == "SPELLBLOCKEDOTHERSELF" then patternInfo = { -- %s's %s was blocked.
2210 type = "miss",
2211 source = 1,
2212 victim = ParserLib_SELF,
2213 skill = 2,
2214 missType = "block",
2215 }
2216 elseif patternName == "SPELLDODGEDOTHEROTHER" then patternInfo = { -- %s's %s was dodged by %s.
2217 type = "miss",
2218 source = 1,
2219 victim = 3,
2220 skill = 2,
2221 missType = "dodge",
2222 }
2223 elseif patternName == "SPELLDODGEDOTHERSELF" then patternInfo = { -- %s's %s was dodged.
2224 type = "miss",
2225 source = 1,
2226 victim = ParserLib_SELF,
2227 skill = 2,
2228 missType = "dodge",
2229 }
2230 elseif patternName == "SPELLDEFLECTEDOTHEROTHER" then patternInfo = { -- "%s's %s was deflected by %s.";
2231 type = "miss",
2232 source = 1,
2233 victim = 3,
2234 skill = 2,
2235 missType = "deflect"
2236 }
2237 elseif patternName == "SPELLDEFLECTEDOTHERSELF" then patternInfo = { -- "%s's %s was deflected.";
2238 type = "miss",
2239 source = 1,
2240 victim = ParserLib_SELF,
2241 skill = 2,
2242 missType = "deflect"
2243 }
2244 elseif patternName == "SPELLEVADEDOTHEROTHER" then patternInfo = { -- %s's %s was evaded by %s.
2245 type = "miss",
2246 source = 1,
2247 victim = 3,
2248 skill = 2,
2249 missType = "evade",
2250 }
2251 elseif patternName == "SPELLEVADEDOTHERSELF" then patternInfo = { -- %s's %s was evaded.
2252 type = "miss",
2253 source = 1,
2254 victim = ParserLib_SELF,
2255 skill = 2,
2256 missType = "evade",
2257 }
2258 elseif patternName == "SPELLIMMUNEOTHEROTHER" then patternInfo = { -- %s's %s fails. %s is immune.
2259 type = "miss",
2260 source = 1,
2261 victim = 3,
2262 skill = 2,
2263 missType = "immune",
2264 }
2265 elseif patternName == "SPELLIMMUNEOTHERSELF" then patternInfo = { -- %s's %s failed. You are immune.
2266 type = "miss",
2267 source = 1,
2268 victim = ParserLib_SELF,
2269 skill = 2,
2270 missType = "immune",
2271 }
2272 elseif patternName == "SPELLLOGABSORBOTHEROTHER" then patternInfo = { -- %s's %s is absorbed by %s.
2273 type = "miss",
2274 source = 1,
2275 victim = 3,
2276 skill = 2,
2277 missType = "absorb",
2278 }
2279 elseif patternName == "SPELLLOGABSORBOTHERSELF" then patternInfo = { -- You absorb %s's %s.
2280 type = "miss",
2281 source = 1,
2282 victim = ParserLib_SELF,
2283 skill = 2,
2284 missType = "absorb",
2285 }
2286 elseif patternName == "SPELLMISSOTHEROTHER" then patternInfo = { -- %s's %s missed %s.
2287 type = "miss",
2288 source = 1,
2289 victim = 3,
2290 skill = 2,
2291 missType = "miss",
2292 }
2293 elseif patternName == "SPELLMISSOTHERSELF" then patternInfo = { -- %s's %s misses you.
2294 type = "miss",
2295 source = 1,
2296 victim = ParserLib_SELF,
2297 skill = 2,
2298 missType = "miss",
2299 }
2300 elseif patternName == "SPELLPARRIEDOTHEROTHER" then patternInfo = { -- %s's %s was parried by %s.
2301 type = "miss",
2302 source = 1,
2303 victim = 3,
2304 skill = 2,
2305 missType = "parry",
2306 }
2307 elseif patternName == "SPELLPARRIEDOTHERSELF" then patternInfo = { -- %s's %s was parried.
2308 type = "miss",
2309 source = 1,
2310 victim = ParserLib_SELF,
2311 skill = 2,
2312 missType = "parry",
2313 }
2314 elseif patternName == "SPELLREFLECTOTHEROTHER" then patternInfo = { -- %s's %s is reflected back by %s.
2315 type = "miss",
2316 source = 1,
2317 skill = 2,
2318 victim = 3,
2319 missType = "reflect"
2320 }
2321 elseif patternName == "SPELLREFLECTOTHERSELF" then patternInfo = { -- You reflect %s's %s.
2322 type = "miss",
2323 source = 1,
2324 skill = 2,
2325 victim = ParserLib_SELF,
2326 missType = "reflect"
2327 }
2328 elseif patternName == "SPELLRESISTOTHEROTHER" then patternInfo = { -- %s's %s was resisted by %s.
2329 type = "miss",
2330 source = 1,
2331 victim = 3,
2332 skill = 2,
2333 missType = "resist",
2334 }
2335 elseif patternName == "SPELLRESISTOTHERSELF" then patternInfo = { -- %s's %s was resisted.
2336 type = "miss",
2337 source = 1,
2338 victim = ParserLib_SELF,
2339 skill = 2,
2340 missType = "resist",
2341 }
2342  
2343  
2344  
2345 -- ExtraAttackOther
2346 elseif patternName == "SPELLEXTRAATTACKSOTHER" then patternInfo = { -- %s gains %d extra attacks through %s."; -- Victim gains 3 extra attacks through Thras
2347 type = "extraattack",
2348 victim = 1,
2349 skill = 3,
2350 amount = 2
2351 }
2352 elseif patternName == "SPELLEXTRAATTACKSOTHER_SINGULAR" then patternInfo = { -- %s gains %d extra attack through %s.
2353 type = "extraattack",
2354 victim = 1,
2355 skill = 3,
2356 amount = 2
2357 }
2358  
2359 -- ExtraAttackSelf
2360 elseif patternName == "SPELLEXTRAATTACKSSELF" then patternInfo = { -- You gain %d extra attacks through %s."; -- You gain 3 extra attacks through Thras
2361 type = "extraattack",
2362 victim = ParserLib_SELF,
2363 skill = 2,
2364 amount = 1
2365 }
2366 elseif patternName == "SPELLEXTRAATTACKSSELF_SINGULAR" then patternInfo = { -- You gain %d extra attack through %s.
2367 type = "extraattack",
2368 victim = ParserLib_SELF,
2369 skill = 2,
2370 amount = 1
2371 }
2372  
2373  
2374 elseif patternName == "SPELLFAILCASTOTHER" then patternInfo = { -- %s fails to cast %s: %s.
2375 type = "fail",
2376 source = 1,
2377 skill = 2,
2378 reason = 3,
2379 }
2380 elseif patternName == "SPELLFAILCASTSELF" then patternInfo = { -- You fail to cast %s: %s.
2381 type = "fail",
2382 source = ParserLib_SELF,
2383 skill = 1,
2384 reason = 2,
2385 }
2386  
2387 elseif patternName == "SPELLFAILPERFORMOTHER" then patternInfo = { -- %s fails to perform %s: %s.
2388 type = "fail",
2389 source = 1,
2390 skill = 2,
2391 reason = 3,
2392 isPerform = true,
2393 }
2394 elseif patternName == "SPELLFAILPERFORMSELF" then patternInfo = { -- You fail to perform %s: %s.
2395 type = "fail",
2396 source = ParserLib_SELF,
2397 skill = 1,
2398 reason = 2,
2399 isPerform = true
2400 }
2401  
2402 elseif patternName == "SPELLHAPPINESSDRAINOTHER" then patternInfo = { -- %s's %s loses %d happiness.
2403 }
2404 elseif patternName == "SPELLHAPPINESSDRAINSELF" then patternInfo = { -- Your %s loses %d happiness.
2405 }
2406  
2407 elseif patternName == "SPELLINTERRUPTOTHEROTHER" then patternInfo = { -- %s interrupts %s's %s.
2408 type = "interrupt",
2409 source = 1,
2410 victim = 2,
2411 skill = 3
2412 }
2413 elseif patternName == "SPELLINTERRUPTOTHERSELF" then patternInfo = { -- %s interrupts your %s.
2414 type = "interrupt",
2415 source = 1,
2416 victim = ParserLib_SELF,
2417 skill = 2
2418 }
2419 elseif patternName == "SPELLINTERRUPTSELFOTHER" then patternInfo = { -- You interrupt %s's %s.
2420 type = "interrupt",
2421 source = ParserLib_SELF,
2422 victim = 1,
2423 skill = 2
2424 }
2425  
2426 -- SpellHitOther
2427 elseif patternName == "SPELLLOGCRITOTHEROTHER" then patternInfo = { -- %s's %s crits %s for %d.
2428 type = "hit",
2429 source = 1,
2430 victim = 3,
2431 skill = 2,
2432 amount = 4,
2433 isCrit = true,
2434 }
2435 elseif patternName == "SPELLLOGCRITOTHERSELF" then patternInfo = { -- %s's %s crits you for %d.
2436 type = "hit",
2437 source = 1,
2438 victim = ParserLib_SELF,
2439 skill = 2,
2440 amount = 3,
2441 isCrit = true,
2442 }
2443 elseif patternName == "SPELLLOGCRITSCHOOLOTHEROTHER" then patternInfo = { -- %s's %s crits %s for %d %s damage.
2444 type = "hit",
2445 source = 1,
2446 victim = 3,
2447 skill = 2,
2448 amount = 4,
2449 element = 5,
2450 isCrit = true,
2451 }
2452 elseif patternName == "SPELLLOGCRITSCHOOLOTHERSELF" then patternInfo = { -- %s's %s crits you for %d %s damage.
2453 type = "hit",
2454 source = 1,
2455 victim = ParserLib_SELF,
2456 skill = 2,
2457 amount = 3,
2458 element = 4,
2459 isCrit = true,
2460 }
2461 elseif patternName == "SPELLLOGOTHEROTHER" then patternInfo = { -- %s's %s hits %s for %d.
2462 type = "hit",
2463 source = 1,
2464 victim = 3,
2465 skill = 2,
2466 amount = 4,
2467 }
2468 elseif patternName == "SPELLLOGOTHERSELF" then patternInfo = { -- %s's %s hits you for %d.
2469 type = "hit",
2470 source = 1,
2471 victim = ParserLib_SELF,
2472 skill = 2,
2473 amount = 3,
2474 }
2475 elseif patternName == "SPELLLOGSCHOOLOTHEROTHER" then patternInfo = { -- %s's %s hits %s for %d %s damage.
2476 type = "hit",
2477 source = 1,
2478 victim = 3,
2479 skill = 2,
2480 amount = 4,
2481 element = 5,
2482 }
2483 elseif patternName == "SPELLLOGSCHOOLOTHERSELF" then patternInfo = { -- %s's %s hits you for %d %s damage.
2484 type = "hit",
2485 source = 1,
2486 victim = ParserLib_SELF,
2487 skill = 2,
2488 amount = 3,
2489 element = 4,
2490 }
2491  
2492  
2493  
2494 -- SpellHitSelf
2495 elseif patternName == "SPELLLOGCRITSCHOOLSELFOTHER" then patternInfo = { -- Your %s crits %s for %d %s damage.
2496 type = "hit",
2497 source = ParserLib_SELF,
2498 victim = 2,
2499 skill = 1,
2500 amount = 3,
2501 element = 4,
2502 isCrit = true,
2503 }
2504 elseif patternName == "SPELLLOGCRITSCHOOLSELFSELF" then patternInfo = { -- Your %s crits you for %d %s damage.
2505 type = "hit",
2506 source = ParserLib_SELF,
2507 victim = ParserLib_SELF,
2508 skill = 1,
2509 amount = 2,
2510 element = 3,
2511 isCrit = true,
2512 }
2513 elseif patternName == "SPELLLOGCRITSELFOTHER" then patternInfo = { -- Your %s crits %s for %d.
2514 type = "hit",
2515 source = ParserLib_SELF,
2516 victim = 2,
2517 skill = 1,
2518 amount = 3,
2519 isCrit = true,
2520 }
2521 elseif patternName == "SPELLLOGCRITSELFSELF" then patternInfo = { -- Your %s crits you for %d.
2522 type = "hit",
2523 source = ParserLib_SELF,
2524 victim = ParserLib_SELF,
2525 skill = 1,
2526 amount = 2,
2527 isCrit = true,
2528 }
2529 elseif patternName == "SPELLLOGSCHOOLSELFOTHER" then patternInfo = { -- Your %s hits %s for %d %s damage.
2530 type = "hit",
2531 source = ParserLib_SELF,
2532 victim = 2,
2533 skill = 1,
2534 amount = 3,
2535 element = 4,
2536 }
2537 elseif patternName == "SPELLLOGSCHOOLSELFSELF" then patternInfo = { -- Your %s hits you for %d %s damage.
2538 type = "hit",
2539 source = ParserLib_SELF,
2540 victim = ParserLib_SELF,
2541 skill = 1,
2542 amount = 2,
2543 element = 3,
2544 }
2545 elseif patternName == "SPELLLOGSELFOTHER" then patternInfo = { -- Your %s hits %s for %d.
2546 type = "hit",
2547 source = ParserLib_SELF,
2548 victim = 2,
2549 skill = 1,
2550 amount = 3,
2551 }
2552 elseif patternName == "SPELLLOGSELFSELF" then patternInfo = { -- Your %s hits you for %d.
2553 type = "hit",
2554 source = ParserLib_SELF,
2555 victim = ParserLib_SELF,
2556 skill = 1,
2557 amount = 2,
2558 }
2559  
2560  
2561 --[[
2562 elseif patternName == "SPELLPERFORMGOOTHER" then patternInfo = { -- %s performs %s.
2563  
2564 }
2565 elseif patternName == "SPELLPERFORMGOOTHERTARGETTED" then patternInfo = { -- %s performs %s on %s.
2566 }
2567 elseif patternName == "SPELLPERFORMGOSELF" then patternInfo = { -- You perform %s.
2568 }
2569 elseif patternName == "SPELLPERFORMGOSELFTARGETTED" then patternInfo = { -- You perform %s on %s.
2570 }
2571 ]]
2572 elseif patternName == "SPELLPERFORMOTHERSTART" then patternInfo = { -- %s begins to perform %s.
2573 type = "cast",
2574 source = 1,
2575 skill = 2,
2576 isBegin = true,
2577 isPerform = true
2578 }
2579 elseif patternName == "SPELLPERFORMSELFSTART" then patternInfo = { -- You begin to perform %s.
2580 type = "cast",
2581 source = ParserLib_SELF,
2582 skill = 1,
2583 isBegin = true,
2584 isPerform = true
2585 }
2586  
2587  
2588 -- DrainOther
2589 elseif patternName == "SPELLPOWERDRAINOTHEROTHER" then patternInfo = { -- %s's %s drains %d %s from %s.
2590 type = "drain",
2591 source = 1,
2592 victim = 5,
2593 skill = 2,
2594 amount = 3,
2595 attribute = 4
2596 }
2597 elseif patternName == "SPELLPOWERDRAINOTHERSELF" then patternInfo = { -- %s's %s drains %d %s from you.
2598 type = "drain",
2599 source = 1,
2600 victim = ParserLib_SELF,
2601 skill = 2,
2602 amount = 3,
2603 attribute = 4
2604 }
2605 elseif patternName == "SPELLPOWERLEECHOTHEROTHER" then patternInfo = { -- %s's %s drains %d %s from %s. %s gains %d %s.
2606 type = "leech",
2607 source = 1,
2608 skill = 2,
2609 amount = 3,
2610 attribute = 4,
2611 victim = 5,
2612 sourceGained = 6,
2613 amountGained = 7,
2614 attributeGained = 8
2615 }
2616 elseif patternName == "SPELLPOWERLEECHOTHERSELF" then patternInfo = { -- %s's %s drains %d %s from you. %s gains %d %s.
2617 type = "leech",
2618 source = 1,
2619 skill = 2,
2620 amount = 3,
2621 attribute = 4,
2622 victim = ParserLib_SELF,
2623 sourceGained = 5,
2624 amountGained = 6,
2625 attributeGained = 7
2626 }
2627  
2628 -- DrainSelf
2629 elseif patternName == "SPELLPOWERDRAINSELFOTHER" then patternInfo = { -- Your %s drains %d %s from %s.
2630 type = "drain",
2631 source = ParserLib_SELF,
2632 victim = 4,
2633 skill = 1,
2634 amount = 2,
2635 attribute = 3
2636 }
2637 elseif patternName == "SPELLPOWERLEECHSELFOTHER" then patternInfo = { -- Your %s drains %d %s from %s. You gain %d %s.
2638 type = "leech",
2639 source = ParserLib_SELF,
2640 skill = 1,
2641 amount = 2,
2642 attribute = 3,
2643 victim = 4,
2644 sourceGained = ParserLib_SELF,
2645 amountGained = 5,
2646 attributeGained = 6
2647 }
2648  
2649 -- SplitDamage
2650 elseif patternName == "SPELLSPLITDAMAGEOTHEROTHER" then patternInfo = { -- %s's %s causes %s %d damage.
2651 type = "hit",
2652 source = 1,
2653 victim = 3,
2654 skill = 2,
2655 amount = 4,
2656 isSplit = true,
2657 }
2658 elseif patternName == "SPELLSPLITDAMAGEOTHERSELF" then patternInfo = { -- %s's %s causes you %d damage.
2659 type = "hit",
2660 source = 1,
2661 victim = ParserLib_SELF,
2662 skill = 2,
2663 amount = 3,
2664 isSplit = true,
2665 }
2666 elseif patternName == "SPELLSPLITDAMAGESELFOTHER" then patternInfo = { -- Your %s causes %s %d damage.
2667 type = "hit",
2668 source = ParserLib_SELF,
2669 victim = 2,
2670 skill = 1,
2671 amount = 3,
2672 isSplit = true,
2673 }
2674  
2675  
2676  
2677 elseif patternName == "TRADESKILL_LOG_FIRSTPERSON" then patternInfo = { -- You create %s.
2678 type = "create",
2679 source = ParserLib_SELF,
2680 item = 1
2681 }
2682 elseif patternName == "TRADESKILL_LOG_THIRDPERSON" then patternInfo = { -- %s creates %s.
2683 type = "create",
2684 source = 1,
2685 item = 2
2686 }
2687  
2688 elseif patternName == "UNITDESTROYEDOTHER" then patternInfo = { -- %s is destroyed.
2689 type = "death",
2690 victim = 1,
2691 isItem = true
2692 }
2693 elseif patternName == "UNITDIESOTHER" then patternInfo = { -- %s dies.
2694 type = "death",
2695 victim = 1,
2696 }
2697 elseif patternName == "UNITDIESSELF" then patternInfo = { -- You die.
2698 type = "death",
2699 victim = ParserLib_SELF
2700 }
2701  
2702  
2703 -- MissSelf
2704 elseif patternName == "MISSEDSELFOTHER" then patternInfo = { -- You miss %s.
2705 type = "miss",
2706 source = ParserLib_SELF,
2707 victim = 1,
2708 skill = ParserLib_MELEE,
2709 missType = "miss",
2710 }
2711 elseif patternName == "VSABSORBSELFOTHER" then patternInfo = { -- You attack. %s absorbs all the damage.
2712 type = "miss",
2713 source = ParserLib_SELF,
2714 victim = 1,
2715 skill = ParserLib_MELEE,
2716 missType = "absorb",
2717 }
2718 elseif patternName == "VSBLOCKSELFOTHER" then patternInfo = { -- You attack. %s blocks.
2719 type = "miss",
2720 source = ParserLib_SELF,
2721 victim = 1,
2722 skill = ParserLib_MELEE,
2723 missType = "block",
2724 }
2725 elseif patternName == "VSDEFLECTSELFOTHER" then patternInfo = { -- You attack. %s deflects.
2726 type = "miss",
2727 source = ParserLib_SELF,
2728 victim = 1,
2729 skill = ParserLib_MELEE,
2730 missType = "deflect",
2731 }
2732 elseif patternName == "VSDODGESELFOTHER" then patternInfo = { -- You attack. %s dodges.
2733 type = "miss",
2734 source = ParserLib_SELF,
2735 victim = 1,
2736 skill = ParserLib_MELEE,
2737 missType = "dodge",
2738 }
2739 elseif patternName == "VSEVADESELFOTHER" then patternInfo = { -- You attack. %s evades.
2740 type = "miss",
2741 source = ParserLib_SELF,
2742 victim = 1,
2743 skill = ParserLib_MELEE,
2744 missType = "evade",
2745 }
2746 elseif patternName == "VSIMMUNESELFOTHER" then patternInfo = { -- You attack but %s is immune.
2747 type = "miss",
2748 source = ParserLib_SELF,
2749 victim = 1,
2750 skill = ParserLib_MELEE,
2751 missType = "immune",
2752 }
2753 elseif patternName == "VSPARRYSELFOTHER" then patternInfo = { -- You attack. %s parries.
2754 type = "miss",
2755 source = ParserLib_SELF,
2756 victim = 1,
2757 skill = ParserLib_MELEE,
2758 missType = "parry",
2759 }
2760 elseif patternName == "VSRESISTSELFOTHER" then patternInfo = { -- You attack. %s resists all the damage.
2761 type = "miss",
2762 source = ParserLib_SELF,
2763 victim = 1,
2764 skill = ParserLib_MELEE,
2765 missType = "resist",
2766 }
2767  
2768  
2769 -- MissOther
2770 elseif patternName == "MISSEDOTHEROTHER" then patternInfo = { -- %s misses %s.
2771 type = "miss",
2772 source = 1,
2773 victim = 2,
2774 skill = ParserLib_MELEE,
2775 missType = "miss",
2776 }
2777 elseif patternName == "MISSEDOTHERSELF" then patternInfo = { -- %s misses you.
2778 type = "miss",
2779 source = 1,
2780 victim = ParserLib_SELF,
2781 skill = ParserLib_MELEE,
2782 missType = "miss",
2783 }
2784 elseif patternName == "VSABSORBOTHEROTHER" then patternInfo = { -- %s attacks. %s absorbs all the damage.
2785 type = "miss",
2786 source = 1,
2787 victim = 2,
2788 skill = ParserLib_MELEE,
2789 missType = "absorb",
2790 }
2791 elseif patternName == "VSABSORBOTHERSELF" then patternInfo = { -- %s attacks. You absorb all the damage.
2792 type = "miss",
2793 source = 1,
2794 victim = ParserLib_SELF,
2795 skill = ParserLib_MELEE,
2796 missType = "absorb",
2797 }
2798 elseif patternName == "VSBLOCKOTHEROTHER" then patternInfo = { -- %s attacks. %s blocks.
2799 type = "miss",
2800 source = 1,
2801 victim = 2,
2802 skill = ParserLib_MELEE,
2803 missType = "block",
2804 }
2805 elseif patternName == "VSBLOCKOTHERSELF" then patternInfo = { -- %s attacks. You block.
2806 type = "miss",
2807 source = 1,
2808 victim = ParserLib_SELF,
2809 skill = ParserLib_MELEE,
2810 missType = "block",
2811 }
2812 elseif patternName == "VSDEFLECTOTHEROTHER" then patternInfo = { -- %s attacks. %s deflects.
2813 type = "miss",
2814 source = 1,
2815 victim = 2,
2816 skill = ParserLib_MELEE,
2817 missType = "deflect",
2818 }
2819 elseif patternName == "VSDEFLECTOTHERSELF" then patternInfo = { -- %s attacks. You deflect.
2820 type = "miss",
2821 source = 1,
2822 victim = ParserLib_SELF,
2823 skill = ParserLib_MELEE,
2824 missType = "deflect",
2825 }
2826 elseif patternName == "VSDODGEOTHEROTHER" then patternInfo = { -- %s attacks. %s dodges.
2827 type = "miss",
2828 source = 1,
2829 victim = 2,
2830 skill = ParserLib_MELEE,
2831 missType = "dodge",
2832 }
2833 elseif patternName == "VSDODGEOTHERSELF" then patternInfo = { -- %s attacks. You dodge.
2834 type = "miss",
2835 source = 1,
2836 victim = ParserLib_SELF,
2837 skill = ParserLib_MELEE,
2838 missType = "dodge",
2839 }
2840 elseif patternName == "VSEVADEOTHEROTHER" then patternInfo = { -- %s attacks. %s evades.
2841 type = "miss",
2842 source = 1,
2843 victim = 2,
2844 skill = ParserLib_MELEE,
2845 missType = "evade",
2846 }
2847 elseif patternName == "VSEVADEOTHERSELF" then patternInfo = { -- %s attacks. You evade.
2848 type = "miss",
2849 source = 1,
2850 victim = ParserLib_SELF,
2851 skill = ParserLib_MELEE,
2852 missType = "evade",
2853 }
2854 elseif patternName == "VSIMMUNEOTHEROTHER" then patternInfo = { -- %s attacks but %s is immune.
2855 type = "miss",
2856 source = 1,
2857 victim = 2,
2858 skill = ParserLib_MELEE,
2859 missType = "immune",
2860 }
2861 elseif patternName == "VSIMMUNEOTHERSELF" then patternInfo = { -- %s attacks but you are immune.
2862 type = "miss",
2863 source = 1,
2864 victim = ParserLib_SELF,
2865 skill = ParserLib_MELEE,
2866 missType = "immune",
2867 }
2868 elseif patternName == "VSPARRYOTHEROTHER" then patternInfo = { -- %s attacks. %s parries.
2869 type = "miss",
2870 source = 1,
2871 victim = 2,
2872 skill = ParserLib_MELEE,
2873 missType = "parry",
2874 }
2875 elseif patternName == "VSPARRYOTHERSELF" then patternInfo = { -- %s attacks. You parry.
2876 type = "miss",
2877 source = 1,
2878 victim = ParserLib_SELF,
2879 skill = ParserLib_MELEE,
2880 missType = "parry",
2881 }
2882 elseif patternName == "VSRESISTOTHEROTHER" then patternInfo = { -- %s attacks. %s resists all the damage.
2883 type = "miss",
2884 source = 1,
2885 victim = 2,
2886 skill = ParserLib_MELEE,
2887 missType = "resist",
2888 }
2889 elseif patternName == "VSRESISTOTHERSELF" then patternInfo = { -- %s attacks. You resist all the damage.
2890 type = "miss",
2891 source = 1,
2892 victim = ParserLib_SELF,
2893 skill = ParserLib_MELEE,
2894 missType = "resist",
2895 }
2896  
2897  
2898 -- EnvOther
2899 elseif patternName == "VSENVIRONMENTALDAMAGE_DROWNING_OTHER" then patternInfo = { -- %s is drowning and loses %d health.
2900 type = "environment",
2901 victim = 1,
2902 amount = 2,
2903 damageType = "drown",
2904 }
2905 elseif patternName == "VSENVIRONMENTALDAMAGE_FALLING_OTHER" then patternInfo = { -- %s falls and loses %d health.
2906 type = "environment",
2907 victim = 1,
2908 amount = 2,
2909 damageType = "fall",
2910 }
2911 elseif patternName == "VSENVIRONMENTALDAMAGE_FATIGUE_OTHER" then patternInfo = { -- %s is exhausted and loses %d health.
2912 type = "environment",
2913 victim = 1,
2914 amount = 2,
2915 damageType = "exhaust",
2916 }
2917 elseif patternName == "VSENVIRONMENTALDAMAGE_FIRE_OTHER" then patternInfo = { -- %s suffers %d points of fire damage.
2918 type = "environment",
2919 victim = 1,
2920 amount = 2,
2921 damageType = "fire",
2922 }
2923 elseif patternName == "VSENVIRONMENTALDAMAGE_LAVA_OTHER" then patternInfo = { -- %s loses %d health for swimming in lava.
2924 type = "environment",
2925 victim = 1,
2926 amount = 2,
2927 damageType = "lava",
2928 }
2929 elseif patternName == "VSENVIRONMENTALDAMAGE_SLIME_OTHER" then patternInfo = { -- %s loses %d health for swimming in slime.
2930 type = "environment",
2931 victim = 1,
2932 amount = 2,
2933 damageType = "slime",
2934 }
2935  
2936 -- EnvSelf
2937 elseif patternName == "VSENVIRONMENTALDAMAGE_DROWNING_SELF" then patternInfo = { -- You are drowning and lose %d health.
2938 type = "environment",
2939 victim = ParserLib_SELF,
2940 amount = 1,
2941 damageType = "drown",
2942 }
2943 elseif patternName == "VSENVIRONMENTALDAMAGE_FALLING_SELF" then patternInfo = { -- You fall and lose %d health.
2944 type = "environment",
2945 victim = ParserLib_SELF,
2946 amount = 1,
2947 damageType = "fall",
2948 }
2949 elseif patternName == "VSENVIRONMENTALDAMAGE_FATIGUE_SELF" then patternInfo = { -- You are exhausted and lose %d health.
2950 type = "environment",
2951 victim = ParserLib_SELF,
2952 amount = 1,
2953 damageType = "exhaust",
2954 }
2955 elseif patternName == "VSENVIRONMENTALDAMAGE_FIRE_SELF" then patternInfo = { -- You suffer %d points of fire damage.
2956 type = "environment",
2957 victim = ParserLib_SELF,
2958 amount = 1,
2959 damageType = "fire",
2960 }
2961 elseif patternName == "VSENVIRONMENTALDAMAGE_LAVA_SELF" then patternInfo = { -- You lose %d health for swimming in lava.
2962 type = "environment",
2963 victim = ParserLib_SELF,
2964 amount = 1,
2965 damageType = "lava",
2966 }
2967 elseif patternName == "VSENVIRONMENTALDAMAGE_SLIME_SELF" then patternInfo = { -- You lose %d health for swimming in slime.
2968 type = "environment",
2969 victim = ParserLib_SELF,
2970 amount = 1,
2971 damageType = "slime",
2972 }
2973  
2974  
2975 -- PerformOther
2976 elseif patternName == "OPEN_LOCK_OTHER" then patternInfo = { -- %s performs %s on %s.
2977 type = "cast",
2978 source = 1,
2979 victim = 3,
2980 skill = 2,
2981 isPerform = true
2982 }
2983 elseif patternName == "SIMPLEPERFORMOTHEROTHER" then patternInfo = { -- %s performs %s on %s.
2984 type = "cast",
2985 source = 1,
2986 victim = 3,
2987 skill = 2,
2988 isPerform = true
2989 }
2990 elseif patternName == "SIMPLEPERFORMOTHERSELF" then patternInfo = { -- %s performs %s on you.
2991 type = "cast",
2992 source = 1,
2993 victim = ParserLib_SELF,
2994 skill = 2,
2995 isPerform = true
2996 }
2997 elseif patternName == "SPELLTERSEPERFORM_OTHER" then patternInfo = { -- %s performs %s.
2998 type = "cast",
2999 source = 1,
3000 skill = 2,
3001 isPerform = true
3002 }
3003  
3004  
3005 -- PerformSelf
3006 elseif patternName == "OPEN_LOCK_SELF" then patternInfo = { -- You perform %s on %s.
3007 type = "cast",
3008 source = ParserLib_SELF,
3009 victim = 2,
3010 skill = 1,
3011 isPerform = true
3012 }
3013 elseif patternName == "SIMPLEPERFORMSELFOTHER" then patternInfo = { -- You perform %s on %s.
3014 type = "cast",
3015 source = ParserLib_SELF,
3016 victim = 2,
3017 skill = 1,
3018 isPerform = true
3019 }
3020 elseif patternName == "SIMPLEPERFORMSELFSELF" then patternInfo = { -- You perform %s.
3021 type = "cast",
3022 source = ParserLib_SELF,
3023 victim = ParserLib_SELF,
3024 skill = 1,
3025 isPerform = true
3026 }
3027 elseif patternName == "SPELLTERSEPERFORM_SELF" then patternInfo = { -- You perform %s.
3028 type = "cast",
3029 source = ParserLib_SELF,
3030 skill = 1,
3031 isPerform = true
3032 }
3033  
3034  
3035 -- CastOther
3036 elseif patternName == "SIMPLECASTOTHEROTHER" then patternInfo = { -- %s casts %s on %s.
3037 type = "cast",
3038 source = 1,
3039 victim = 3,
3040 skill = 2
3041 }
3042 elseif patternName == "SIMPLECASTOTHERSELF" then patternInfo = { -- %s casts %s on you.
3043 type = "cast",
3044 source = 1,
3045 victim = 2,
3046 skill = ParserLib_SELF
3047 }
3048 elseif patternName == "SPELLTERSE_OTHER" then patternInfo = { -- %s casts %s.
3049 type = "cast",
3050 source = 1,
3051 skill = 2
3052 }
3053  
3054 -- CastSelf
3055 elseif patternName == "SIMPLECASTSELFOTHER" then patternInfo = { -- You cast %s on %s.
3056 type = "cast",
3057 source = ParserLib_SELF,
3058 victim = 2,
3059 skill = 1
3060 }
3061 elseif patternName == "SIMPLECASTSELFSELF" then patternInfo = { -- "You cast %s.
3062 type = "cast",
3063 source = ParserLib_SELF,
3064 victim = ParserLib_SELF,
3065 skill = 1
3066 }
3067 elseif patternName == "SPELLTERSE_SELF" then patternInfo = { -- You cast %s.
3068 type = "cast",
3069 source = ParserLib_SELF,
3070 skill = 1
3071 }
3072  
3073  
3074  
3075 end
3076  
3077  
3078  
3079 if not patternInfo then
3080 self:Print("LoadPatternInfo(): Cannot find " .. patternName );
3081 return
3082 end
3083  
3084 local pattern = getglobal(patternName); -- Get the pattern from GlobalStrings.lua
3085  
3086 local tc = 0
3087 for _ in string.gfind(pattern, "%%%d?%$?([sd])") do tc = tc + 1 end
3088  
3089 pattern = { self:ConvertPattern(pattern, true) }
3090 local n = table.getn(pattern)
3091 if n > 1 then
3092 for j in patternInfo do
3093 if type(patternInfo[j]) == "number" and patternInfo[j] < 100 then
3094 patternInfo[j] = pattern[patternInfo[j]+1]
3095 end
3096 end
3097 end
3098  
3099 patternInfo.tc = tc
3100 patternInfo.pattern = pattern[1]
3101  
3102  
3103 return patternInfo
3104  
3105 end
3106  
3107  
3108 -- Used to load eventTable elements on demand.
3109 -- 1.1.4 : Now many events share pattern list.
3110 function lib:LoadPatternList(eventName)
3111 local list
3112  
3113 --------------- Melee Hits ----------------
3114  
3115 if eventName == "CHAT_MSG_COMBAT_SELF_HITS" then
3116  
3117 if not self.eventTable["CHAT_MSG_COMBAT_SELF_HITS"] then
3118  
3119 self.eventTable["CHAT_MSG_COMBAT_SELF_HITS"] =
3120 self:LoadPatternCategoryTree(
3121 {
3122 "HitSelf",
3123 "EnvSelf",
3124 }
3125 )
3126  
3127 end
3128  
3129 list = self.eventTable["CHAT_MSG_COMBAT_SELF_HITS"]
3130  
3131 elseif eventName == "CHAT_MSG_COMBAT_CREATURE_VS_CREATURE_HITS"
3132 or eventName == "CHAT_MSG_COMBAT_CREATURE_VS_PARTY_HITS"
3133 or eventName == "CHAT_MSG_COMBAT_CREATURE_VS_SELF_HITS"
3134 or eventName == "CHAT_MSG_COMBAT_FRIENDLYPLAYER_HITS"
3135 or eventName == "CHAT_MSG_COMBAT_PARTY_HITS"
3136 or eventName == "CHAT_MSG_COMBAT_PET_HITS" then
3137  
3138 if not self.eventTable["CHAT_MSG_COMBAT_FRIENDLYPLAYER_HITS"] then
3139 self.eventTable["CHAT_MSG_COMBAT_FRIENDLYPLAYER_HITS"] =
3140 self:LoadPatternCategoryTree( {
3141 "HitOtherOther",
3142 "EnvOther",
3143 } )
3144 end
3145 list = self.eventTable["CHAT_MSG_COMBAT_FRIENDLYPLAYER_HITS"]
3146  
3147  
3148 elseif eventName == "CHAT_MSG_COMBAT_HOSTILEPLAYER_HITS"
3149 or eventName == "CHAT_MSG_COMBAT_CREATURE_VS_SELF_HITS" then
3150  
3151 if not self.eventTable["CHAT_MSG_COMBAT_HOSTILEPLAYER_HITS"] then
3152 self.eventTable["CHAT_MSG_COMBAT_HOSTILEPLAYER_HITS"] =
3153 self:LoadPatternCategoryTree( {
3154 {
3155 "HitOtherOther",
3156 "HitOtherSelf",
3157 },
3158 "EnvOther",
3159 } )
3160 end
3161 list = self.eventTable["CHAT_MSG_COMBAT_HOSTILEPLAYER_HITS"]
3162  
3163  
3164  
3165 --------------- Melee Misses ----------------
3166  
3167  
3168  
3169 elseif eventName == "CHAT_MSG_COMBAT_SELF_MISSES" then
3170 if not self.eventTable["CHAT_MSG_COMBAT_SELF_MISSES"] then
3171 self.eventTable["CHAT_MSG_COMBAT_SELF_MISSES"] =
3172 self:LoadPatternCategoryTree( {
3173 "MissSelf",
3174 } )
3175 end
3176 list = self.eventTable["CHAT_MSG_COMBAT_SELF_MISSES"]
3177  
3178 elseif eventName == "CHAT_MSG_COMBAT_CREATURE_VS_CREATURE_MISSES"
3179 or eventName == "CHAT_MSG_COMBAT_CREATURE_VS_PARTY_MISSES"
3180 or eventName == "CHAT_MSG_COMBAT_FRIENDLYPLAYER_MISSES"
3181 or eventName == "CHAT_MSG_COMBAT_PARTY_MISSES"
3182 or eventName == "CHAT_MSG_COMBAT_PET_MISSES" then
3183  
3184 if not self.eventTable["CHAT_MSG_COMBAT_FRIENDLYPLAYER_MISSES"] then
3185 self.eventTable["CHAT_MSG_COMBAT_FRIENDLYPLAYER_MISSES"] =
3186 self:LoadPatternCategoryTree( {
3187 "MissOtherOther",
3188 } )
3189 end
3190  
3191 list = self.eventTable["CHAT_MSG_COMBAT_FRIENDLYPLAYER_MISSES"]
3192  
3193  
3194 elseif eventName == "CHAT_MSG_COMBAT_CREATURE_VS_SELF_MISSES"
3195 or eventName == "CHAT_MSG_COMBAT_HOSTILEPLAYER_MISSES" then
3196  
3197 if not self.eventTable["CHAT_MSG_COMBAT_HOSTILEPLAYER_MISSES"] then
3198 self.eventTable["CHAT_MSG_COMBAT_HOSTILEPLAYER_MISSES"] =
3199 self:LoadPatternCategoryTree( {
3200 {
3201 "MissOtherOther",
3202 "MissOtherSelf",
3203 }
3204 } )
3205 end
3206  
3207 list = self.eventTable["CHAT_MSG_COMBAT_HOSTILEPLAYER_MISSES"]
3208  
3209 --------------- Spell Buffs ----------------
3210 elseif eventName == "CHAT_MSG_SPELL_SELF_BUFF" then
3211 if not self.eventTable["CHAT_MSG_SPELL_SELF_BUFF"] then
3212 self.eventTable["CHAT_MSG_SPELL_SELF_BUFF"] =
3213 self:LoadPatternCategoryTree(
3214 {
3215 "HealSelf",
3216 "EnchantSelf",
3217 "CastSelf",
3218 "PerformSelf",
3219 "DISPELFAILEDSELFOTHER",
3220 "SPELLCASTSELFSTART",
3221 "SPELLPERFORMSELFSTART",
3222 {
3223 "DrainSelf",
3224 "PowerGainSelf",
3225 "ExtraAttackSelf",
3226 },
3227 "SPELLSPLITDAMAGESELFOTHER",
3228 "ProcResistSelf",
3229 "SpellMissSelf",
3230 }
3231 )
3232 end
3233  
3234 list = self.eventTable["CHAT_MSG_SPELL_SELF_BUFF"]
3235  
3236  
3237 elseif eventName == "CHAT_MSG_SPELL_CREATURE_VS_CREATURE_BUFF"
3238 or eventName == "CHAT_MSG_SPELL_CREATURE_VS_PARTY_BUFF"
3239 or eventName == "CHAT_MSG_SPELL_CREATURE_VS_SELF_BUFF"
3240 or eventName == "CHAT_MSG_SPELL_FRIENDLYPLAYER_BUFF"
3241 or eventName == "CHAT_MSG_SPELL_HOSTILEPLAYER_BUFF"
3242 or eventName == "CHAT_MSG_SPELL_PARTY_BUFF"
3243 or eventName == "CHAT_MSG_SPELL_PET_BUFF" then
3244  
3245 if not self.eventTable["CHAT_MSG_SPELL_HOSTILEPLAYER_BUFF"] then
3246 self.eventTable["CHAT_MSG_SPELL_HOSTILEPLAYER_BUFF"] = self:LoadPatternCategoryTree(
3247 {
3248 {
3249 "HealOther",
3250 "PowerGainOther",
3251 "ExtraAttackOther",
3252 "DrainOther",
3253 },
3254 "SPELLCASTOTHERSTART",
3255 {
3256 "EnchantOther",
3257 "CastOther",
3258 "PerformOther",
3259 },
3260 "SPELLPERFORMOTHERSTART",
3261 "SpellMissOther",
3262 {
3263 "PROCRESISTOTHEROTHER",
3264 "PROCRESISTOTHERSELF",
3265 },
3266 {
3267 "SPELLSPLITDAMAGEOTHEROTHER",
3268 "SPELLSPLITDAMAGEOTHERSELF",
3269 },
3270 "DispellFailOther",
3271 }
3272 )
3273  
3274  
3275 end
3276  
3277 list = self.eventTable["CHAT_MSG_SPELL_HOSTILEPLAYER_BUFF"]
3278  
3279  
3280 --------------- Spell Damages ----------------
3281  
3282 elseif eventName == "CHAT_MSG_SPELL_SELF_DAMAGE" then
3283 if not self.eventTable["CHAT_MSG_SPELL_SELF_DAMAGE"] then
3284 self.eventTable["CHAT_MSG_SPELL_SELF_DAMAGE"] =
3285 self:LoadPatternCategoryTree( {
3286 "SpellHitSelf",
3287 "CastSelf",
3288 "PerformSelf",
3289 "SpellMissSelf",
3290 "SPELLCASTSELFSTART",
3291 "SPELLPERFORMSELFSTART",
3292 "InterruptSelf",
3293 "DISPELFAILEDSELFOTHER",
3294 } )
3295  
3296 end
3297 list = self.eventTable["CHAT_MSG_SPELL_SELF_DAMAGE"]
3298  
3299  
3300 elseif eventName == "CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE"
3301 or eventName == "CHAT_MSG_SPELL_CREATURE_VS_PARTY_DAMAGE"
3302 or eventName == "CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE"
3303 or eventName == "CHAT_MSG_SPELL_FRIENDLYPLAYER_DAMAGE"
3304 or eventName == "CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE"
3305 or eventName == "CHAT_MSG_SPELL_PARTY_DAMAGE"
3306 or eventName == "CHAT_MSG_SPELL_PET_DAMAGE" then
3307  
3308 if not self.eventTable["CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE"] then
3309 self.eventTable["CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE"] =
3310 self:LoadPatternCategoryTree( {
3311 "SpellHitOther",
3312 "SPELLCASTOTHERSTART",
3313 "SPELLPERFORMOTHERSTART",
3314 "DrainOther",
3315 "SpellMissOther",
3316 {
3317 "PROCRESISTOTHEROTHER",
3318 "PROCRESISTOTHERSELF",
3319 },
3320 {
3321 "SPELLSPLITDAMAGEOTHEROTHER",
3322 "SPELLSPLITDAMAGEOTHERSELF",
3323 },
3324 {
3325 "CastOther",
3326 "InterruptOther",
3327 {
3328 "SPELLDURABILITYDAMAGEALLOTHEROTHER",
3329 "SPELLDURABILITYDAMAGEALLOTHERSELF",
3330 "SPELLDURABILITYDAMAGEOTHEROTHER",
3331 "SPELLDURABILITYDAMAGEOTHERSELF",
3332 },
3333 },
3334 "PerformOther",
3335 "ExtraAttackOther",
3336 {
3337 "DISPELFAILEDOTHEROTHER",
3338 "DISPELFAILEDOTHERSELF",
3339 },
3340 })
3341  
3342 end
3343 list = self.eventTable["CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE"]
3344  
3345  
3346 --------------- Periodic Buffs ----------------
3347  
3348 elseif eventName == "CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS" then
3349  
3350 if not self.eventTable["CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS"] then
3351  
3352 self.eventTable["CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS"] =
3353 self:LoadPatternCategoryTree( {
3354 {
3355 "HotOther",
3356 "HotSelf",
3357 },
3358 {
3359 "BuffSelf",
3360 "BuffOther",
3361 "PowerGainSelf",
3362 },
3363 "DrainSelf",
3364 } )
3365 end
3366 list = self.eventTable["CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS"]
3367  
3368  
3369 elseif eventName == "CHAT_MSG_SPELL_PERIODIC_CREATURE_BUFFS"
3370 or eventName == "CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_BUFFS"
3371 or eventName == "CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_BUFFS"
3372 or eventName == "CHAT_MSG_SPELL_PERIODIC_PARTY_BUFFS" then
3373  
3374 if not self.eventTable["CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_BUFFS"] then
3375 self.eventTable["CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_BUFFS"] =
3376 self:LoadPatternCategoryTree( {
3377 {
3378 "HotOther",
3379 -- "DrainOther", -- Dont think this would happen but add it anyway.
3380 },
3381 {
3382 "BuffOther",
3383 "PowerGainOther",
3384 },
3385 "DebuffOther", -- Was fired on older WoW version.
3386 } )
3387 end
3388  
3389 list = self.eventTable["CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_BUFFS"]
3390  
3391  
3392  
3393 --------------- Periodic Damages ----------------
3394  
3395 elseif eventName == "CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE" then
3396 if not self.eventTable["CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE"] then
3397  
3398 self.eventTable["CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE"] =
3399 self:LoadPatternCategoryTree( {
3400 {
3401 "DotSelf",
3402 "DotOther",
3403 },
3404 {
3405 "DebuffSelf",
3406 "DebuffOther",
3407 },
3408 {
3409 "SPELLLOGABSORBOTHEROTHER",
3410 "SPELLLOGABSORBOTHERSELF",
3411 "SPELLLOGABSORBSELFSELF",
3412 "SPELLLOGABSORBSELFOTHER",
3413 },
3414 "DrainSelf",
3415 } )
3416 end
3417 list = self.eventTable["CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE"]
3418  
3419  
3420  
3421 elseif eventName == "CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE"
3422 or eventName == "CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_DAMAGE"
3423 or eventName == "CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE"
3424 or eventName == "CHAT_MSG_SPELL_PERIODIC_PARTY_DAMAGE" then
3425  
3426 if not self.eventTable["CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE"] then
3427 self.eventTable["CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE"] =
3428 self:LoadPatternCategoryTree( {
3429 "DebuffOther",
3430 "DotOther",
3431 {
3432 "SPELLLOGABSORBOTHEROTHER",
3433 "SPELLLOGABSORBSELFOTHER",
3434 },
3435 "DrainOther",
3436 {
3437 "PowerGainOther",
3438 "BuffOther", -- Was fired on older WoW version.
3439 }
3440 } )
3441 end
3442 list = self.eventTable["CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_DAMAGE"]
3443  
3444 --------------- Damage Shields ----------------
3445  
3446  
3447 elseif eventName == "CHAT_MSG_SPELL_DAMAGESHIELDS_ON_SELF" then
3448 if not self.eventTable["CHAT_MSG_SPELL_DAMAGESHIELDS_ON_SELF"] then
3449 self.eventTable["CHAT_MSG_SPELL_DAMAGESHIELDS_ON_SELF"] = {
3450 "SPELLRESISTOTHEROTHER",
3451 "SPELLRESISTSELFOTHER",
3452 "DAMAGESHIELDOTHEROTHER",
3453 "DAMAGESHIELDSELFOTHER",
3454 }
3455 table.sort(self.eventTable["CHAT_MSG_SPELL_DAMAGESHIELDS_ON_SELF"] , PatternCompare)
3456 end
3457 list = self.eventTable["CHAT_MSG_SPELL_DAMAGESHIELDS_ON_SELF"]
3458  
3459 elseif eventName == "CHAT_MSG_SPELL_DAMAGESHIELDS_ON_OTHERS" then
3460 if not self.eventTable["CHAT_MSG_SPELL_DAMAGESHIELDS_ON_OTHERS"] then
3461 self.eventTable["CHAT_MSG_SPELL_DAMAGESHIELDS_ON_OTHERS"] = {
3462 "SPELLRESISTOTHEROTHER",
3463 "SPELLRESISTOTHERSELF",
3464 "DAMAGESHIELDOTHEROTHER",
3465 "DAMAGESHIELDOTHERSELF",
3466 }
3467 table.sort(self.eventTable["CHAT_MSG_SPELL_DAMAGESHIELDS_ON_OTHERS"] , PatternCompare)
3468 end
3469 list = self.eventTable["CHAT_MSG_SPELL_DAMAGESHIELDS_ON_OTHERS"]
3470  
3471  
3472  
3473 --------------- Auras ----------------
3474  
3475 elseif eventName == "CHAT_MSG_SPELL_AURA_GONE_PARTY"
3476 or eventName == "CHAT_MSG_SPELL_AURA_GONE_OTHER"
3477 or eventName == "CHAT_MSG_SPELL_AURA_GONE_SELF" then
3478  
3479 if not self.eventTable["CHAT_MSG_SPELL_AURA_GONE_OTHER"] then
3480 self.eventTable["CHAT_MSG_SPELL_AURA_GONE_OTHER"] = {
3481 "AURAREMOVEDOTHER",
3482 "AURAREMOVEDSELF",
3483 }
3484 table.sort(self.eventTable["CHAT_MSG_SPELL_AURA_GONE_OTHER"] , PatternCompare)
3485 end
3486 list = self.eventTable["CHAT_MSG_SPELL_AURA_GONE_OTHER"]
3487 elseif eventName == "CHAT_MSG_SPELL_BREAK_AURA" then
3488  
3489 if not self.eventTable["CHAT_MSG_SPELL_BREAK_AURA"] then
3490 self.eventTable["CHAT_MSG_SPELL_BREAK_AURA"] = {
3491 "AURADISPELSELF",
3492 "AURADISPELOTHER",
3493 }
3494 table.sort(self.eventTable["CHAT_MSG_SPELL_BREAK_AURA"] , PatternCompare)
3495 end
3496 list = self.eventTable["CHAT_MSG_SPELL_BREAK_AURA"]
3497 elseif string.find(eventName, "ITEM_ENCHANT", 1, true) then
3498  
3499 if not self.eventTable["CHAT_MSG_SPELL_ITEM_ENCHANTMENTS"] then
3500 self.eventTable["CHAT_MSG_SPELL_ITEM_ENCHANTMENTS"] = {
3501 "ITEMENCHANTMENTADDSELFSELF",
3502 "ITEMENCHANTMENTADDSELFOTHER",
3503 "ITEMENCHANTMENTADDOTHEROTHER",
3504 "ITEMENCHANTMENTADDOTHERSELF",
3505 }
3506 table.sort(self.eventTable["CHAT_MSG_SPELL_ITEM_ENCHANTMENTS"] , PatternCompare)
3507 end
3508 list = self.eventTable["CHAT_MSG_SPELL_ITEM_ENCHANTMENTS"]
3509  
3510 --------------- Trade Skills ----------------
3511  
3512  
3513 elseif eventName == "CHAT_MSG_SPELL_TRADESKILLS" then
3514 if not self.eventTable["CHAT_MSG_SPELL_TRADESKILLS"] then
3515 self.eventTable["CHAT_MSG_SPELL_TRADESKILLS"] = {
3516 "TRADESKILL_LOG_FIRSTPERSON",
3517 "TRADESKILL_LOG_THIRDPERSON",
3518 "FEEDPET_LOG_FIRSTPERSON",
3519 "FEEDPET_LOG_THIRDPERSON",
3520 }
3521 table.sort(self.eventTable["CHAT_MSG_SPELL_TRADESKILLS"], PatternCompare )
3522 end
3523 list = self.eventTable["CHAT_MSG_SPELL_TRADESKILLS"]
3524  
3525 elseif eventName == "CHAT_MSG_SPELL_FAILED_LOCALPLAYER" then
3526  
3527 if not self.eventTable["CHAT_MSG_SPELL_FAILED_LOCALPLAYER"] then
3528 self.eventTable["CHAT_MSG_SPELL_FAILED_LOCALPLAYER"] = {
3529 "SPELLFAILPERFORMSELF",
3530 "SPELLFAILCASTSELF",
3531 }
3532 table.sort(self.eventTable["CHAT_MSG_SPELL_FAILED_LOCALPLAYER"], PatternCompare)
3533 end
3534 list = self.eventTable["CHAT_MSG_SPELL_FAILED_LOCALPLAYER"]
3535  
3536  
3537 elseif eventName == "CHAT_MSG_COMBAT_FACTION_CHANGE" then
3538  
3539 if not self.eventTable["CHAT_MSG_COMBAT_FACTION_CHANGE"] then
3540  
3541 if FACTION_STANDING_DECREASED then -- WoW 1.11
3542 self.eventTable["CHAT_MSG_COMBAT_FACTION_CHANGE"] = {
3543 "FACTION_STANDING_DECREASED",
3544 "FACTION_STANDING_INCREASED",
3545 }
3546 else -- WoW 1.10
3547  
3548 self.eventTable["CHAT_MSG_COMBAT_FACTION_CHANGE"] = {
3549 "FACTION_STANDING_CHANGED",
3550 "FACTION_STANDING_INCREASED1",
3551 "FACTION_STANDING_INCREASED2",
3552 "FACTION_STANDING_INCREASED3",
3553 "FACTION_STANDING_INCREASED4",
3554 "FACTION_STANDING_DECREASED1",
3555 "FACTION_STANDING_DECREASED2",
3556 "FACTION_STANDING_DECREASED3",
3557 "FACTION_STANDING_DECREASED4",
3558 }
3559 end
3560 table.sort(self.eventTable["CHAT_MSG_COMBAT_FACTION_CHANGE"] , PatternCompare)
3561 end
3562 list = self.eventTable["CHAT_MSG_COMBAT_FACTION_CHANGE"]
3563  
3564 elseif eventName == "CHAT_MSG_COMBAT_HONOR_GAIN" then
3565  
3566 if not self.eventTable["CHAT_MSG_COMBAT_HONOR_GAIN"] then
3567 self.eventTable["CHAT_MSG_COMBAT_HONOR_GAIN"] = {
3568 "COMBATLOG_HONORAWARD",
3569 "COMBATLOG_HONORGAIN",
3570 "COMBATLOG_DISHONORGAIN",
3571 }
3572 table.sort(self.eventTable["CHAT_MSG_COMBAT_HONOR_GAIN"] , PatternCompare)
3573 end
3574 list = self.eventTable["CHAT_MSG_COMBAT_HONOR_GAIN"]
3575 elseif eventName == "CHAT_MSG_COMBAT_XP_GAIN" then
3576  
3577 if not self.eventTable["CHAT_MSG_COMBAT_XP_GAIN"] then
3578 self.eventTable["CHAT_MSG_COMBAT_XP_GAIN"] = {
3579 "COMBATLOG_XPGAIN",
3580 "COMBATLOG_XPGAIN_EXHAUSTION1",
3581 "COMBATLOG_XPGAIN_EXHAUSTION1_GROUP",
3582 "COMBATLOG_XPGAIN_EXHAUSTION1_RAID",
3583 "COMBATLOG_XPGAIN_EXHAUSTION2",
3584 "COMBATLOG_XPGAIN_EXHAUSTION2_GROUP",
3585 "COMBATLOG_XPGAIN_EXHAUSTION2_RAID",
3586 "COMBATLOG_XPGAIN_EXHAUSTION4",
3587 "COMBATLOG_XPGAIN_EXHAUSTION4_GROUP",
3588 "COMBATLOG_XPGAIN_EXHAUSTION4_RAID",
3589 "COMBATLOG_XPGAIN_EXHAUSTION5",
3590 "COMBATLOG_XPGAIN_EXHAUSTION5_GROUP",
3591 "COMBATLOG_XPGAIN_EXHAUSTION5_RAID",
3592 "COMBATLOG_XPGAIN_FIRSTPERSON",
3593 "COMBATLOG_XPGAIN_FIRSTPERSON_GROUP",
3594 "COMBATLOG_XPGAIN_FIRSTPERSON_RAID",
3595 "COMBATLOG_XPGAIN_FIRSTPERSON_UNNAMED",
3596 "COMBATLOG_XPGAIN_FIRSTPERSON_UNNAMED_GROUP",
3597 "COMBATLOG_XPGAIN_FIRSTPERSON_UNNAMED_RAID",
3598 "COMBATLOG_XPLOSS_FIRSTPERSON_UNNAMED",
3599 }
3600 table.sort(self.eventTable["CHAT_MSG_COMBAT_XP_GAIN"] , PatternCompare)
3601 end
3602 list = self.eventTable["CHAT_MSG_COMBAT_XP_GAIN"]
3603  
3604 elseif eventName == "CHAT_MSG_COMBAT_FRIENDLY_DEATH"
3605 or eventName == "CHAT_MSG_COMBAT_HOSTILE_DEATH" then
3606  
3607 if not self.eventTable["CHAT_MSG_COMBAT_HOSTILE_DEATH"] then
3608 self.eventTable["CHAT_MSG_COMBAT_HOSTILE_DEATH"] = {
3609 "PARTYKILLOTHER",
3610 "UNITDESTROYEDOTHER",
3611 "UNITDIESOTHER",
3612 "UNITDIESSELF",
3613 }
3614  
3615 if SELFKILLOTHER then -- WoW 1.11
3616 table.insert(self.eventTable["CHAT_MSG_COMBAT_HOSTILE_DEATH"], "SELFKILLOTHER")
3617 end
3618  
3619 table.sort(self.eventTable["CHAT_MSG_COMBAT_HOSTILE_DEATH"] , PatternCompare)
3620 end
3621 list = self.eventTable["CHAT_MSG_COMBAT_HOSTILE_DEATH"]
3622  
3623 end
3624  
3625  
3626 if not list then
3627 self:Print("Cannot find event " .. eventName);
3628 end
3629  
3630 return list
3631  
3632 end
3633  
3634  
3635  
3636  
3637  
3638 function lib:LoadPatternCategory(category)
3639  
3640 local list
3641  
3642 if category == "DebuffOther" then
3643 list = {
3644 "AURAADDEDOTHERHARMFUL",
3645 "AURAAPPLICATIONADDEDOTHERHARMFUL",
3646 }
3647 elseif category == "DebuffSelf" then
3648 list = {
3649 "AURAADDEDSELFHARMFUL",
3650 "AURAAPPLICATIONADDEDSELFHARMFUL",
3651 }
3652 elseif category == "BuffOther" then
3653 list = {
3654 "AURAADDEDOTHERHELPFUL",
3655 "AURAAPPLICATIONADDEDOTHERHELPFUL",
3656 }
3657 elseif category == "BuffSelf" then
3658 list = {
3659 "AURAADDEDSELFHELPFUL",
3660 "AURAAPPLICATIONADDEDSELFHELPFUL",
3661 }
3662 elseif category == "ExtraAttackOther" then
3663 list = {
3664 "SPELLEXTRAATTACKSOTHER",
3665 "SPELLEXTRAATTACKSOTHER_SINGULAR",
3666 }
3667  
3668 elseif category == "ExtraAttackSelf" then
3669 list = {
3670 "SPELLEXTRAATTACKSSELF",
3671 "SPELLEXTRAATTACKSSELF_SINGULAR",
3672 }
3673  
3674 elseif category == "AuraChange" then
3675 list = {
3676 "AURACHANGEDOTHER",
3677 "AURACHANGEDSELF",
3678 }
3679 elseif category == "AuraDispell" then
3680 list = {
3681 "AURADISPELOTHER",
3682 "AURADISPELSELF",
3683 }
3684 elseif category == "Fade" then
3685 list = {
3686 "AURAREMOVEDOTHER",
3687 "AURAREMOVEDSELF",
3688 }
3689 elseif category == "HitOtherOther" then
3690 list = {
3691 "COMBATHITCRITOTHEROTHER",
3692 "COMBATHITCRITSCHOOLOTHEROTHER",
3693 "COMBATHITOTHEROTHER",
3694 "COMBATHITSCHOOLOTHEROTHER",
3695 }
3696 elseif category == "HitOtherSelf" then
3697 list = {
3698  
3699 "COMBATHITCRITOTHERSELF",
3700 "COMBATHITCRITSCHOOLOTHERSELF",
3701 "COMBATHITOTHERSELF",
3702 "COMBATHITSCHOOLOTHERSELF",
3703 }
3704  
3705 elseif category == "HitSelf" then
3706 list = {
3707 "COMBATHITSCHOOLSELFOTHER",
3708 "COMBATHITSELFOTHER",
3709 "COMBATHITCRITSCHOOLSELFOTHER",
3710 "COMBATHITCRITSELFOTHER",
3711 }
3712 elseif category == "MissOtherOther" then
3713 list = {
3714 "MISSEDOTHEROTHER",
3715 "VSABSORBOTHEROTHER",
3716 "VSBLOCKOTHEROTHER",
3717 "VSDEFLECTOTHEROTHER",
3718 "VSDODGEOTHEROTHER",
3719 "VSEVADEOTHEROTHER",
3720 "VSIMMUNEOTHEROTHER",
3721 "VSPARRYOTHEROTHER",
3722 "VSRESISTOTHEROTHER",
3723 }
3724 elseif category == "MissOtherSelf" then
3725 list = {
3726 "MISSEDOTHERSELF",
3727 "VSABSORBOTHERSELF",
3728 "VSBLOCKOTHERSELF",
3729 "VSDEFLECTOTHERSELF",
3730 "VSDODGEOTHERSELF",
3731 "VSEVADEOTHERSELF",
3732 "VSIMMUNEOTHERSELF",
3733 "VSPARRYOTHERSELF",
3734 "VSRESISTOTHERSELF",
3735 }
3736  
3737  
3738 elseif category == "MissSelf" then
3739  
3740 list = {
3741 "MISSEDSELFOTHER",
3742 "VSABSORBSELFOTHER",
3743 "VSBLOCKSELFOTHER",
3744 "VSDEFLECTSELFOTHER",
3745 "VSDODGESELFOTHER",
3746 "VSEVADESELFOTHER",
3747 "VSIMMUNESELFOTHER",
3748 "VSPARRYSELFOTHER",
3749 "VSRESISTSELFOTHER",
3750 }
3751  
3752 elseif category == "DispellFailOther" then
3753  
3754 list = {
3755 "DISPELFAILEDOTHEROTHER",
3756 "DISPELFAILEDOTHERSELF",
3757  
3758 }
3759  
3760 elseif category == "DispellFailSelf" then
3761  
3762 list = {
3763 "DISPELFAILEDSELFOTHER",
3764  
3765 }
3766  
3767  
3768  
3769 elseif category == "DmgShieldOther" then
3770 list = {
3771 "DAMAGESHIELDOTHEROTHER",
3772 "DAMAGESHIELDOTHERSELF",
3773 }
3774 elseif category == "DmgShieldSelf" then
3775 list = {
3776 "DAMAGESHIELDSELFOTHER",
3777 }
3778  
3779 elseif category == "DispelFailOther" then
3780 list = {
3781 "DISPELFAILEDOTHEROTHER",
3782 "DISPELFAILEDOTHERSELF",
3783 }
3784  
3785 elseif category == "DispellFailSelf" then
3786 list = {
3787 "DISPELFAILEDSELFOTHER",
3788 }
3789  
3790 elseif category == "HealOther" then
3791 list = {
3792 "HEALEDCRITOTHEROTHER",
3793 "HEALEDCRITOTHERSELF",
3794 "HEALEDOTHEROTHER",
3795 "HEALEDOTHERSELF",
3796 }
3797 elseif category == "HealSelf" then
3798 list = {
3799 "HEALEDCRITSELFOTHER",
3800 "HEALEDCRITSELFSELF",
3801 "HEALEDSELFOTHER",
3802 "HEALEDSELFSELF",
3803 }
3804  
3805 elseif category == "SpellMissOther" then
3806 list = {
3807 "IMMUNESPELLOTHEROTHER",
3808 "IMMUNESPELLOTHERSELF",
3809 "SPELLBLOCKEDOTHEROTHER",
3810 "SPELLBLOCKEDOTHERSELF",
3811 "SPELLDODGEDOTHEROTHER",
3812 "SPELLDODGEDOTHERSELF",
3813 "SPELLDEFLECTEDOTHEROTHER",
3814 "SPELLDEFLECTEDOTHERSELF",
3815 "SPELLEVADEDOTHEROTHER",
3816 "SPELLEVADEDOTHERSELF",
3817 "SPELLIMMUNEOTHEROTHER",
3818 "SPELLIMMUNEOTHERSELF",
3819 "SPELLLOGABSORBOTHEROTHER",
3820 "SPELLLOGABSORBOTHERSELF",
3821 "SPELLMISSOTHEROTHER",
3822 "SPELLMISSOTHERSELF",
3823 "SPELLPARRIEDOTHEROTHER",
3824 "SPELLPARRIEDOTHERSELF",
3825 "SPELLREFLECTOTHEROTHER",
3826 "SPELLREFLECTOTHERSELF",
3827 "SPELLRESISTOTHEROTHER",
3828 "SPELLRESISTOTHERSELF",
3829 }
3830  
3831 elseif category == "SpellMissSelf" then
3832 list = {
3833 "IMMUNESPELLSELFOTHER",
3834 "IMMUNESPELLSELFSELF",
3835 "SPELLBLOCKEDSELFOTHER",
3836 "SPELLDEFLECTEDSELFOTHER",
3837 "SPELLDEFLECTEDSELFSELF",
3838 "SPELLDODGEDSELFOTHER",
3839 "SPELLDODGEDSELFSELF",
3840 "SPELLEVADEDSELFOTHER",
3841 "SPELLEVADEDSELFSELF",
3842 "SPELLIMMUNESELFOTHER",
3843 "SPELLIMMUNESELFSELF",
3844 "SPELLLOGABSORBSELFOTHER",
3845 "SPELLLOGABSORBSELFSELF",
3846 "SPELLMISSSELFOTHER",
3847 "SPELLMISSSELFSELF",
3848 "SPELLPARRIEDSELFOTHER",
3849 "SPELLPARRIEDSELFSELF",
3850 "SPELLREFLECTSELFOTHER",
3851 "SPELLREFLECTSELFSELF",
3852 "SPELLRESISTSELFOTHER",
3853 "SPELLRESISTSELFSELF",
3854 }
3855  
3856 elseif category == "PowerGainOther" then
3857 list = {
3858 "POWERGAINOTHEROTHER",
3859 "POWERGAINOTHERSELF",
3860 }
3861  
3862 elseif category == "EnchantOther" then
3863 list = {
3864 "ITEMENCHANTMENTADDOTHEROTHER",
3865 "ITEMENCHANTMENTADDOTHERSELF",
3866 }
3867  
3868 elseif category == "EnchantSelf" then
3869 list = {
3870 "ITEMENCHANTMENTADDSELFOTHER",
3871 "ITEMENCHANTMENTADDSELFSELF",
3872 }
3873  
3874 elseif category == "CastOther" then
3875  
3876 list = {
3877 "SIMPLECASTOTHEROTHER",
3878 "SIMPLECASTOTHERSELF",
3879 "SPELLTERSE_OTHER",
3880 }
3881  
3882 elseif category == "CastSelf" then
3883  
3884 list = {
3885 "SIMPLECASTSELFOTHER",
3886 "SIMPLECASTSELFSELF",
3887 "SPELLTERSE_SELF",
3888 }
3889  
3890 elseif category == "PerformOther" then
3891  
3892 list = {
3893 "OPEN_LOCK_OTHER",
3894 "SIMPLEPERFORMOTHEROTHER",
3895 "SIMPLEPERFORMOTHERSELF",
3896 "SPELLTERSEPERFORM_OTHER",
3897 }
3898  
3899 elseif category == "PerformSelf" then
3900  
3901 list = {
3902 "OPEN_LOCK_SELF",
3903 "SIMPLEPERFORMSELFOTHER",
3904 "SIMPLEPERFORMSELFSELF",
3905 "SPELLTERSEPERFORM_SELF",
3906 }
3907  
3908  
3909 elseif category == "ProcResistOther" then
3910  
3911 elseif category == "ProcResistSelf" then
3912 list = {
3913 "PROCRESISTSELFOTHER",
3914 "PROCRESISTSELFSELF",
3915 }
3916  
3917  
3918 elseif category == "EnvOther" then
3919  
3920 list = {
3921 "VSENVIRONMENTALDAMAGE_DROWNING_OTHER",
3922 "VSENVIRONMENTALDAMAGE_FALLING_OTHER",
3923 "VSENVIRONMENTALDAMAGE_FATIGUE_OTHER",
3924 "VSENVIRONMENTALDAMAGE_FIRE_OTHER",
3925 "VSENVIRONMENTALDAMAGE_LAVA_OTHER",
3926 "VSENVIRONMENTALDAMAGE_SLIME_OTHER",
3927 }
3928  
3929 elseif category == "EnvSelf" then
3930  
3931 list = {
3932 "VSENVIRONMENTALDAMAGE_DROWNING_SELF",
3933 "VSENVIRONMENTALDAMAGE_FALLING_SELF",
3934 "VSENVIRONMENTALDAMAGE_FATIGUE_SELF",
3935 "VSENVIRONMENTALDAMAGE_FIRE_SELF",
3936 "VSENVIRONMENTALDAMAGE_LAVA_SELF",
3937 "VSENVIRONMENTALDAMAGE_SLIME_SELF",
3938 }
3939  
3940 -- HoT effects on others. (not casted by others)
3941 elseif category == "HotOther" then
3942 list = {
3943 "PERIODICAURAHEALOTHEROTHER",
3944 "PERIODICAURAHEALSELFOTHER",
3945 }
3946  
3947 -- HoT effects on you. (not casted by you)
3948 elseif category == "HotSelf" then
3949 list = {
3950 "PERIODICAURAHEALSELFSELF",
3951 "PERIODICAURAHEALOTHERSELF",
3952 }
3953 elseif category == "PowerGainSelf" then
3954 list = {
3955 "POWERGAINSELFSELF",
3956 "POWERGAINSELFOTHER",
3957 }
3958 elseif category == "BuffOther" then
3959 list = {
3960 "AURAAPPLICATIONADDEDOTHERHELPFUL",
3961 "AURAADDEDOTHERHELPFUL",
3962 }
3963 elseif category == "BuffSelf" then
3964 list = {
3965 "AURAADDEDSELFHELPFUL",
3966 "AURAAPPLICATIONADDEDSELFHELPFUL",
3967 }
3968 elseif category == "DrainSelf" then
3969 list = {
3970 "SPELLPOWERLEECHSELFOTHER",
3971 "SPELLPOWERDRAINSELFOTHER",
3972 }
3973 elseif category == "DrainOther" then
3974 list = {
3975 "SPELLPOWERLEECHOTHEROTHER",
3976 "SPELLPOWERLEECHOTHERSELF",
3977 "SPELLPOWERDRAINOTHEROTHER",
3978 "SPELLPOWERDRAINOTHERSELF",
3979 }
3980  
3981 -- DoT effects on others (not casted by others)
3982 elseif category == "DotOther" then
3983 list = {
3984 "PERIODICAURADAMAGEOTHEROTHER",
3985 "PERIODICAURADAMAGESELFOTHER",
3986 }
3987  
3988 -- DoT effects on you (not casted by you)
3989 elseif category == "DotSelf" then
3990 list = {
3991 "PERIODICAURADAMAGEOTHERSELF",
3992 "PERIODICAURADAMAGESELFSELF",
3993 }
3994 elseif category == "SpellHitOther" then
3995 list = {
3996 "SPELLLOGCRITOTHEROTHER",
3997 "SPELLLOGCRITOTHERSELF",
3998 "SPELLLOGCRITSCHOOLOTHEROTHER",
3999 "SPELLLOGCRITSCHOOLOTHERSELF",
4000 "SPELLLOGOTHEROTHER",
4001 "SPELLLOGOTHERSELF",
4002 "SPELLLOGSCHOOLOTHEROTHER",
4003 "SPELLLOGSCHOOLOTHERSELF",
4004 }
4005  
4006  
4007 elseif category == "SpellHitSelf" then
4008 list = {
4009 "SPELLLOGCRITSELFOTHER",
4010 "SPELLLOGCRITSELFSELF",
4011 "SPELLLOGCRITSCHOOLSELFOTHER",
4012 "SPELLLOGCRITSCHOOLSELFSELF",
4013 "SPELLLOGSELFOTHER",
4014 "SPELLLOGSELFSELF",
4015 "SPELLLOGSCHOOLSELFOTHER",
4016 "SPELLLOGSCHOOLSELFSELF",
4017 }
4018  
4019 elseif category == "InterruptOther" then
4020 list = {
4021 "SPELLINTERRUPTOTHEROTHER",
4022 "SPELLINTERRUPTOTHERSELF",
4023 }
4024 elseif category == "InterruptSelf" then
4025 list = {
4026 "SPELLINTERRUPTSELFOTHER",
4027 }
4028 else
4029  
4030 return { category }
4031  
4032 end
4033  
4034 return list
4035  
4036 end
4037  
4038  
4039 -- Load categories recursively. First layer will not be sorted.
4040 function lib:LoadPatternCategoryTree(catTree, reSort)
4041 if type(catTree) ~= "table" then return end
4042  
4043 local resultList = {}
4044 local list
4045  
4046 for i, v in catTree do
4047  
4048 if type(v) == "table" then
4049 list = self:LoadPatternCategoryTree(v, true)
4050 else -- should be string.
4051 list = self:LoadPatternCategory(v)
4052 table.sort(list, PatternCompare)
4053 end
4054  
4055 for j, w in list do
4056 table.insert(resultList, w)
4057 end
4058  
4059 end
4060  
4061 if reSort then
4062 table.sort(resultList, PatternCompare)
4063 end
4064  
4065 return resultList
4066  
4067  
4068 end
4069  
4070  
4071 --------------------------------
4072 -- Load this bitch! --
4073 --------------------------------
4074 libobj:Register(lib)