WoWInterface SVN ItemRackStun

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk/ItemRackStun/libs/LibPlayerControl-1.0
    from Rev 38 to Rev 41
    Reverse comparison

Rev 38 → Rev 41

LibPlayerControl-1.0.toc
2,7 → 2,7
## Title: Lib: PlayerControl-1.0
## Notes: A library to provide tools for detecting adverse effects on players.
## Author: Draake
## Dependencies: LibStub, CallbackHandler-1.0
 
LibStub\LibStub.lua
CallbackHandler-1.0\CallbackHandler-1.0.lua
lib.xml
CallbackHandler-1.0/CallbackHandler-1.0.lua New file
0,0 → 1,239
--[[ $Id$ ]]
local MAJOR, MINOR = "CallbackHandler-1.0", 5
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
 
if not CallbackHandler then return end -- No upgrade needed
 
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
 
local type = type
local pcall = pcall
local pairs = pairs
local assert = assert
local concat = table.concat
local loadstring = loadstring
local next = next
local select = select
local type = type
local xpcall = xpcall
 
local function errorhandler(err)
return geterrorhandler()(err)
end
 
local function CreateDispatcher(argCount)
local code = [[
local next, xpcall, eh = ...
 
local method, ARGS
local function call() method(ARGS) end
 
local function dispatch(handlers, ...)
local index
index, method = next(handlers)
if not method then return end
local OLD_ARGS = ARGS
ARGS = ...
repeat
xpcall(call, eh)
index, method = next(handlers, index)
until not method
ARGS = OLD_ARGS
end
 
return dispatch
]]
 
local ARGS, OLD_ARGS = {}, {}
for i = 1, argCount do ARGS[i], OLD_ARGS[i] = "arg"..i, "old_arg"..i end
code = code:gsub("OLD_ARGS", concat(OLD_ARGS, ", ")):gsub("ARGS", concat(ARGS, ", "))
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler)
end
 
local Dispatchers = setmetatable({}, {__index=function(self, argCount)
local dispatcher = CreateDispatcher(argCount)
rawset(self, argCount, dispatcher)
return dispatcher
end})
 
--------------------------------------------------------------------------
-- CallbackHandler:New
--
-- target - target object to embed public APIs in
-- RegisterName - name of the callback registration API, default "RegisterCallback"
-- UnregisterName - name of the callback unregistration API, default "UnregisterCallback"
-- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API.
 
function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName, OnUsed, OnUnused)
-- TODO: Remove this after beta has gone out
assert(not OnUsed and not OnUnused, "ACE-80: OnUsed/OnUnused are deprecated. Callbacks are now done to registry.OnUsed and registry.OnUnused")
 
RegisterName = RegisterName or "RegisterCallback"
UnregisterName = UnregisterName or "UnregisterCallback"
if UnregisterAllName==nil then -- false is used to indicate "don't want this method"
UnregisterAllName = "UnregisterAllCallbacks"
end
 
-- we declare all objects and exported APIs inside this closure to quickly gain access
-- to e.g. function names, the "target" parameter, etc
 
 
-- Create the registry object
local events = setmetatable({}, meta)
local registry = { recurse=0, events=events }
 
-- registry:Fire() - fires the given event/message into the registry
function registry:Fire(eventname, ...)
if not rawget(events, eventname) or not next(events[eventname]) then return end
local oldrecurse = registry.recurse
registry.recurse = oldrecurse + 1
 
Dispatchers[select('#', ...) + 1](events[eventname], eventname, ...)
 
registry.recurse = oldrecurse
 
if registry.insertQueue and oldrecurse==0 then
-- Something in one of our callbacks wanted to register more callbacks; they got queued
for eventname,callbacks in pairs(registry.insertQueue) do
local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten.
for self,func in pairs(callbacks) do
events[eventname][self] = func
-- fire OnUsed callback?
if first and registry.OnUsed then
registry.OnUsed(registry, target, eventname)
first = nil
end
end
end
registry.insertQueue = nil
end
end
 
-- Registration of a callback, handles:
-- self["method"], leads to self["method"](self, ...)
-- self with function ref, leads to functionref(...)
-- "addonId" (instead of self) with function ref, leads to functionref(...)
-- all with an optional arg, which, if present, gets passed as first argument (after self if present)
target[RegisterName] = function(self, eventname, method, ... --[[actually just a single arg]])
if type(eventname) ~= "string" then
error("Usage: "..RegisterName.."(eventname, method[, arg]): 'eventname' - string expected.", 2)
end
 
method = method or eventname
 
local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten.
 
if type(method) ~= "string" and type(method) ~= "function" then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - string or function expected.", 2)
end
 
local regfunc
 
if type(method) == "string" then
-- self["method"] calling style
if type(self) ~= "table" then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): self was not a table?", 2)
elseif self==target then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): do not use Library:"..RegisterName.."(), use your own 'self'", 2)
elseif type(self[method]) ~= "function" then
error("Usage: "..RegisterName.."(\"eventname\", \"methodname\"): 'methodname' - method '"..tostring(method).."' not found on self.", 2)
end
 
if select("#",...)>=1 then -- this is not the same as testing for arg==nil!
local arg=select(1,...)
regfunc = function(...) self[method](self,arg,...) end
else
regfunc = function(...) self[method](self,...) end
end
else
-- function ref with self=object or self="addonId"
if type(self)~="table" and type(self)~="string" then
error("Usage: "..RegisterName.."(self or \"addonId\", eventname, method): 'self or addonId': table or string expected.", 2)
end
 
if select("#",...)>=1 then -- this is not the same as testing for arg==nil!
local arg=select(1,...)
regfunc = function(...) method(arg,...) end
else
regfunc = method
end
end
 
 
if events[eventname][self] or registry.recurse<1 then
-- if registry.recurse<1 then
-- we're overwriting an existing entry, or not currently recursing. just set it.
events[eventname][self] = regfunc
-- fire OnUsed callback?
if registry.OnUsed and first then
registry.OnUsed(registry, target, eventname)
end
else
-- we're currently processing a callback in this registry, so delay the registration of this new entry!
-- yes, we're a bit wasteful on garbage, but this is a fringe case, so we're picking low implementation overhead over garbage efficiency
registry.insertQueue = registry.insertQueue or setmetatable({},meta)
registry.insertQueue[eventname][self] = regfunc
end
end
 
-- Unregister a callback
target[UnregisterName] = function(self, eventname)
if not self or self==target then
error("Usage: "..UnregisterName.."(eventname): bad 'self'", 2)
end
if type(eventname) ~= "string" then
error("Usage: "..UnregisterName.."(eventname): 'eventname' - string expected.", 2)
end
if rawget(events, eventname) and events[eventname][self] then
events[eventname][self] = nil
-- Fire OnUnused callback?
if registry.OnUnused and not next(events[eventname]) then
registry.OnUnused(registry, target, eventname)
end
end
if registry.insertQueue and rawget(registry.insertQueue, eventname) and registry.insertQueue[eventname][self] then
registry.insertQueue[eventname][self] = nil
end
end
 
-- OPTIONAL: Unregister all callbacks for given selfs/addonIds
if UnregisterAllName then
target[UnregisterAllName] = function(...)
if select("#",...)<1 then
error("Usage: "..UnregisterAllName.."([whatFor]): missing 'self' or \"addonId\" to unregister events for.", 2)
end
if select("#",...)==1 and ...==target then
error("Usage: "..UnregisterAllName.."([whatFor]): supply a meaningful 'self' or \"addonId\"", 2)
end
 
 
for i=1,select("#",...) do
local self = select(i,...)
if registry.insertQueue then
for eventname, callbacks in pairs(registry.insertQueue) do
if callbacks[self] then
callbacks[self] = nil
end
end
end
for eventname, callbacks in pairs(events) do
if callbacks[self] then
callbacks[self] = nil
-- Fire OnUnused callback?
if registry.OnUnused and not next(callbacks) then
registry.OnUnused(registry, target, eventname)
end
end
end
end
end
end
 
return registry
end
 
 
-- CallbackHandler purposefully does NOT do explicit embedding. Nor does it
-- try to upgrade old implicit embeds since the system is selfcontained and
-- relies on closures to work.
 
Property changes : Added: svn:mime-type + text/plain Added: svn:keywords + Revision Date Id Added: svn:eol-style + native
CallbackHandler-1.0/CallbackHandler-1.0.xml New file
0,0 → 1,4
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="CallbackHandler-1.0.lua"/>
</Ui>
\ No newline at end of file Property changes : Added: svn:mime-type + text/xml Added: svn:eol-style + native
CallbackHandler-1.0 Property changes : Added: tsvn:autoprops + *.png = svn:mime-type=image/png *.jpg = svn:mime-type=image/jpeg *.tga = svn:mime-type=image/tga README = svn:mime-type=text/plain;svn:eol-style=native *.cmd = svn:mime-type=text/plain;svn:eol-style=CRLF *.bat = svn:mime-type=text/plain;svn:eol-style=CRLF *.lua = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Revision Date Id *.sh = svn:mime-type=text/plain;svn:eol-style=LF;svn:executable *.toc = svn:mime-type=text/plain;svn:eol-style=native;svn:keywords=Revision Date Id *.txt = svn:mime-type=text/plain;svn:eol-style=native *.xml = svn:mime-type=text/xml;svn:eol-style=native
LibPlayerControl-1.0.lua
6,7 → 6,7
------------------------------------------------------------------------------------------------]]
 
local MAJOR_VERSION = "LibPlayerControl-1.0"
local MINOR_VERSION = 10000 + tonumber(("$Rev$"):match("(%d+)"))
local MINOR_VERSION = 90000 + tonumber(("$Rev$"):match("(%d+)"))
 
-- Namespace delcaration
if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end
19,7 → 19,7
"RegisterEvent", "UnregisterEvent", "UnregisterAllEvents")
end
 
--~ lib.debug = true
lib.debug = true
 
--------------------------------------------------------------------------------------------------
-- Local Variables
31,38 → 31,41
local CONTROL_AURA_TABLE = {{36877,45195,24713,41356,33422,21066,42380,42636,46987,29896,51722,21898,30216,48267,64903,30600,15398,22666,37262,49675,18763,62344,31368,46604,59017,59145,31688,15878,65807,51467,11879,67855,52491,40590,44813,40846,61577,41358,41486,12551,62601,29321,55051,43150,47373,63881,51724,21835,30153,35856,64649,9032,65033,40591,49037,32913,33041,49549,54028,38032,54540,9576,58891,9672,64010,39568,9992,40976,61579,33042,37265,5205,45839,10472,33810,38033,17165,17293,14823,65813,10856,10888,35474,44432,26379,48783,33043,57741,30986,22924,15655,58893,731,19469,51343,19597,19725,64140,48144,44177,48400,45201,20685,6213,12520,785,38035,42386,59150,59278,29963,64141,6533,30283,64781,6581,37012,837,30923,6789,851,853,50577,13704,6869,31755,31819,64654,52497,3547,24333,36629,49170,45203,24717,45587,3635,33686,3651,67868,58768,29516,59280,29964,17743,30092,26061,64655,52498,11113,7621,40597,33047,33175,61968,41621,54290,15656,23310,59153,55314,39062,23694,35351,39574,8037,16104,44565,32588,36887,57490,24718,61969,37527,12521,1062,50836,12809,39063,29837,25806,52244,30413,60946,22415,22479,49173,32921,45334,30989,31117,23055,19408,39064,43415,67619,48278,24335,48918,28622,32922,24719,67620,67876,38169,1330,42648,10730,10794,43416,10890,25999,30414,61076,36634,37018,61716,22800,33563,15593,5782,23312,38554,39194,27983,32334,32654,40858,61461,24720,16914,42394,6358,34716,8715,29903,55959,30095,40219,36252,22289,6614,13322,61590,37276,6726,67114,27088,68394,34973,35101,51609,6982,23953,68139,64918,52761,36509,1786,41116,20882,62487,68140,42396,62999,25425,29904,25937,10955,10987,39965,64663,40221,36254,44572,36510,7670,26641,15530,22994,54426,23186,50715,55066,15850,38942,47772,48156,8150,53019,44957,24594,57626,4167,20819,58138,37919,8492,34080,2140,17172,21331,12747,38815,8716,17492,30225,13099,26258,22291,36512,22419,53148,13323,61594,41247,41631,9484,67890,39584,64538,28434,40864,16469,5159,16597,25043,38049,38177,47007,38945,35234,66613,64155,43936,11020,26195,5543,52766,22356,36642,2812,61596,49439,5703,11436,58269,31250,46240,54814,59037,23444,51103,38946,11820,35107,64156,16075,24020,48288,48416,16470,24724,6215,16790,3132,38051,54687,17174,12748,39331,30035,21909,3260,26196,52640,48673,22357,26580,33061,45602,9485,50721,59039,59679,31955,24213,10093,48674,7127,10253,37029,3604,20822,3636,54561,34214,7399,39077,43428,47779,30100,26069,26197,68157,40357,15244,36518,44836,22678,30932,15532,15660,34087,11725,42917,51491,68159,4060,4068,8151,44837,32724,37031,16600,4168,12461,8398,25046,12557,58530,42790,29717,34984,29909,21847,13005,26070,40103,18328,30741,37160,31125,9454,67650,50597,23447,38952,65859,47526,32021,27990,67651,28310,28374,52773,32725,61475,10318,37289,37417,24919,67652,58532,42280,42408,17177,25495,10734,43432,43560,21848,26071,52390,36138,22424,61476,45352,22744,37546,37930,27223,34347,59045,11726,38826,43049,39210,43433,16045,32150,43945,67655,36139,40490,24408,44841,6136,24600,41130,53543,49704,45737,12494,16922,58534,25304,21401,25,6408,35244,43562,51880,30103,30231,40363,40491,30615,40875,6664,53544,6728,33709,33965,58663,38316,46762,55080,19482,13902,32023,14030,10159,7144,53545,25049,67660,58664,62887,17307,29848,17691,30104,30168,67661,61224,18395,53546,41389,15534,62248,67662,33967,38318,50731,15822,38830,59433,65871,43309,43437,27993,8040,8056,36399,8152,36911,53547,20699,4169,45741,54059,50732,17244,17308,47021,63529,39087,35120,63913,12943,60074,13007,52524,56747,52908,22427,36784,13327,57515,49453,50093,31257,38064,34097,34353,42671,27610,19676,52141,28314,48558,52781,10160,57388,53421,41392,20828,2637,10576,62891,25371,42672,46895,59564,47407,35250,43568,21916,21980,30298,36402,44848,36786,15407,15471,49711,37554,50095,42161,34099,58797,51503,19677,43569,35507,52271,28315,44465,20253,48816,36659,24732,33332,16798,12528,33844,58798,34356,46769,42930,6409,25756,43442,64173,35892,36148,26332,6601,48817,13360,6713,13488,62382,58799,34357,42803,42931,43315,19678,64046,52657,10161,56,3589,24733,41396,49842,16799,29148,16927,7321,58672,25501,10737,17503,47411,25821,35382,64175,15056,48179,36022,36278,40885,45108,32951,22686,30940,62000,33463,45876,54706,23454,7961,31964,64048,8041,36279,28445,12241,20511,8242,8338,50100,50228,42166,50484,17312,64049,43702,30109,48053,67681,18144,40503,30621,61362,57395,49333,57779,31069,9458,33849,42167,50613,38456,38712,23775,19872,52149,40248,56756,24415,40760,32826,24671,24735,41528,54453,21152,34490,17313,42936,14897,10834,43448,56117,26079,26143,64819,30494,36922,53558,30942,18977,31390,23456,47032,63540,19681,11922,28127,40122,48696,12242,24736,6266,12562,34108,29407,17250,34620,38843,101,21793,6538,26272,36924,22689,6714,6730,46010,58551,1715,23457,13810,27808,19682,51897,43963,67691,20066,7082,40380,44603,40636,1787,32830,24737,113,16803,25057,33854,7322,62775,38461,50874,47035,39229,30112,35774,60472,64695,26273,65079,48827,30688,30752,53562,15474,11443,23010,27553,51131,59577,59705,19683,16050,52027,35775,32416,8122,40510,65208,36671,32832,41150,2070,61881,41534,2094,12531,62649,50876,55099,34752,25698,47805,64697,26274,44606,13235,53052,53308,22691,54460,23331,13747,19364,13907,19684,47678,4955,32417,28450,44863,36801,49342,53565,5195,5211,16805,16869,5259,25187,55101,29666,5403,10836,39489,15091,26211,44352,48703,15283,18469,53438,22692,11412,22884,15571,54462,34243,42945,47168,35011,59709,31970,43585,20005,28323,32674,53439,24740,45889,41922,50368,29539,29667,17446,47425,35268,64189,30115,205,40259,18278,44994,45122,53568,31075,62526,50497,42435,42691,3446,6907,34885,47298,19686,66683,14100,3542,28516,3574,53313,24741,66940,228,21030,25189,58816,29540,34630,10805,43332,21990,48323,30500,61376,22566,53442,53570,37830,246,42949,55490,47428,51779,39622,35783,40262,40774,49092,53571,260,8406,12565,63169,51012,42950,55491,43590,52292,40135,22247,30501,13237,22567,53572,31013,58179,9462,50245,58563,23207,58947,42695,19496,43207,27814,52165,32421,36297,10134,36809,24615,45255,5164,5196,58180,37833,5260,5276,42696,29670,339,29926,29990,5484,52550,44872,11286,45256,45384,5708,58181,46024,62532,42185,46408,11638,27559,31718,19753,43977,44233,24360,45257,53575,33356,8407,50760,29607,34764,63685,29991,6524,8983,56775,13238,36940,65930,49481,6716,31015,46026,62662,58823,19306,31719,43083,65931,27880,52169,14102,40268,28456,40652,14326,24937,67468,21098,46411,7372,34510,14870,14902,56777,40525,40653,22570,41421,18795,27177,50379,50635,69006,34639,11831,32040,32104,56138,12023,8124,16310,512,49356,8312,8408,21099,42702,51020,38863,39119,66193,35280,51788,568,44622,30633,30761,30889,62026,46158,62794,23275,59211,47310,32105,32361,40400,28522,5101,14327,24619,37073,5165,24811,5213,54093,54477,42320,25387,29546,25515,34770,14871,676,15063,52174,40017,692,64971,30506,700,53070,61388,710,37330,720,31274,46288,46416,34259,58957,31914,51663,19821,12024,56910,44881,8281,20717,8377,45905,3143,38099,25260,29419,58958,800,12824,804,25772,21869,56143,3263,3271,6605,61390,6669,37204,37332,18798,54224,58447,38100,31467,65947,47442,59855,47698,9913,48082,3551,49106,37205,33238,20910,29164,29292,54609,38357,29484,34518,63311,29676,55505,43348,55889,67229,26157,48467,60880,18223,7645,36950,37206,22766,26989,11481,50259,38102,31404,11641,27565,55250,19503,55506,66207,19695,47700,23918,24110,32364,48596,1022,65488,8218,24686,8346,24942,25006,62417,38103,21167,55251,12825,35032,25774,55891,56147,67745,22127,65105,36824,22639,22703,33241,37592,33625,23023,38104,23279,54996,31661,59347,27758,55636,23919,32173,56404,32365,53077,5134,24687,49750,10458,5246,38105,50518,38617,39001,55509,5422,21808,21936,52182,30254,68005,44504,36570,26607,32859,57685,57941,5726,15609,42201,38234,19185,42841,34779,23600,5918,39258,24048,44121,28271,28335,16249,36699,36827,53463,61781,8379,70049,69681,38235,40727,38491,42714,42842,29679,12826,68587,12890,6462,46299,38837,13018,68507,68506,68442,68326,48601,68312,52713,9179,68306,68158,18546,68141,66474,13466,18802,68044,68043,6798,23153,57488,68004,68003,67867,6894,67857,23601,6942,63830,31983,67856,9915,67810,39900,67806,28272,67791,1776,59513,1784,67780,63124,67677,67656,24753,41436,67654,33502,67618,29168,67576,17011,50522,46555,67575,42716,34654,42972,67366,63985,43356,17651,43612,39645,67232,67047,32053,40157,18099,11131,67035,40669,66862,66845,41053,30832,66830,6749,66804,54196,59362,66689,58457,42205,38238,66656,66552,66547,36527,27633,7950,66533,43357,59865,53261,66514,11538,66407,8078,24178,66346,37103,8142,36575,66290,32752,32864,41182,66070,4159,38850,66044,62297,35492,58458,34016,7964,29425,58970,50979,51220,52807,65985,62091,62420,51676,35424,65960,13019,65935,8988,65929,65918,65877,65857,65820,65815,65809,19820,22643,37216,41439,62042,43650,58203,65792,31281,34017,31409,31473,31537,42719,65578,27634,23603,59611,19636,9852,59995,65545,52061,32241,7357,65543,65542,65451,36449,65444,65400,51162,54997,28786,65122,65078,24883,5215,38065,64970,64942,64919,64877,64804,29490,64803,17333,33937,16340,14907,64669,21748,30002,64668,64647,20683,52318,55041,18101,5567,64478,5599,36706,36834,19780,64346,64345,64186,64151,5727,50015,2880,50271,64058,64052,50655,64047,38626,64044,64013,43105,11836,43361,5951,63987,15499,67255,48096,63912,32370,63861,63846,20277,63784,32690,36835,63726,41186,8285,61385,45665,33487,50997,6271,63589,59253,38243,46561,58974,63549,63480,17398,29212,37162,43362,47585,51808,8893,26036,30195,67769,63080,63004,41479,6607,55982,62930,62928,62886,22645,62861,66490,62826,62663,45922,6783,58463,62632,46434,46562,31539,42723,34661,62628,6927,62605,39268,9853,59999,62604,62602,24053,60511,32323,52577,62585,52833,40497,62580,62576,62573,3600,33126,39810,37450,29044,7279,7295,58464,29300,38245,58848,58976,57491,38757,29684,61462,65981,43364,7074,62316,51938,55489,62310,62287,62283,18103,62241,52834,53548,36710,53218,22582,65982,62056,57825,61990,18807,61878,61834,37990,34023,26552,58849,58977,23414,45350,38886,61780,7967,61747,61734,61730,61721,61717,61704,32308,61662,61628,4064,61025,61578,61575,36839,36967,61572,33128,45848,61556,61491,12509,62433,61458,34024,61394,61391,61387,4320,34664,29685,25654,63713,61359,33829,61204,33684,13021,30197,61186,60642,61170,13181,35198,61143,61136,36840,61087,61065,8646,61043,37480,60995,9438,60983,46182,60960,19128,31477,31541,50917,60947,31733,31797,35049,60814,60778,47718,19832,6466,34922,12484,60236,60210,60109,24375,60077,48998,40936,60067,58373,33130,59974,20792,55844,59868,37865,46183,59824,59820,46567,38505,59726,59689,5376,39017,59669,5424,39401,21749,47847,30850,59604,67781,24453,59370,59369,52838,55947,48999,18425,5648,30838,59367,39346,66758,59330,59322,59292,46184,42217,20668,31478,17314,38634,55142,59365,63588,24261,19641,59217,19769,59165,33173,39914,33499,20019,59047,68551,50519,58975,53095,36843,52883,49384,58806,16508,58693,20229,22935,41962,58606,6304,46441,58540,58537,25464,58535,17402,39019,6432,58526,29943,60006,58351,58283,58154,44138,20716,6576,57886,6608,40370,30647,57799,57794,19679,57668,57665,57629,57546,13534,62438,31287,68042,54632,57477,6864,23417,38764,27640,63590,57383,9823,55784,57095,27615,57050,56935,14309,52457,8511,36333,8510,7136,56632,56485,7184,56448,45419,56427,41580,55699,56287,56115,56095,46315,25273,62951,38509,55964,55958,59368,63591,32904,35182,59880,39533,39661,55807,55802,56425,52151,52586,40429,55635,30584,30648,55633,55536,41197,55508,55507,45676,55492,62312,55488,46188,46316,55467,31480,38510,55424,55334,27641,55284,35055,55266,55240,55224,55126,16094,8064,64616,52459,26034,40430,55021,65256,36719,53227,41070,24698,54914,37359,54888,37615,54805,37871,22856,23103,25274,50541,54735,17276,38767,34800,54683,35056,54644,54565,54526,54514,26042,54506,44142,40175,36208,52716,36464,54451,54440,54399,54340,22651,54339,13439,66770,18812,54193,54166,54159,13020,38256,38384,9632,53542,31673,38896,54047,31865,54029,35313,54022,23931,19685,50839,46102,53574,53573,53567,53566,52973,53564,53561,28730,20604,28858,53560,53559,62187,54125,53540,53538,53537,53534,53500,53472,17277,53437,29690,53359,53325,53322,66517,53239,35570,53219,53211,35954,53116,40305,6537,53103,53069,53045,11264,5649,53017,52989,15487,33395,52939,27067,52938,31290,52889,38258,58861,16568,31610,52656,52844,52837,66007,52744,31994,55918,52721,52696,52207,35955,12096,68311,52719,52847,46239,40818,6145,8225,66008,20669,52592,52584,13496,33652,20989,3145,25212,42354,52443,52436,52402,38771,52287,52185,51440,55663,35316,48376,52087,26044,26108,16566,51959,40307,51878,40563,61166,51756,51752,51750,51693,51681,41097,25656,22909,37748,33781,51514,38132,19134,51413,38516,38644,51372,38900,41168,47346,47340,35317,49011,39668,39796,45995,35957,51240,52593,28412,20909,65262,32699,20478,57456,66012,3609,53745,37493,50812,50762,50733,13138,50642,50544,54769,58992,38645,50459,50437,50436,25725,50435,41062,47731,47859,50411,50396,50378,50304,50295,44532,50269,48883,30652,18431,11297,50234,50101,30972,7761,49978,49935,27133,38006,34039,38262,46580,31548,44320,27581,49915,51315,49913,31932,49838,49820,47860,16096,49803,49802,49735,49721,48628,49616,49352,16352,49316,49288,49236,41334,49235,41590,49215,25022,49172,22746,29309,12252,49025,12705,12737,32984,49012,51316,59634,27087,39415,30013,30077,12540,1121,8994,48826,56691,30461,21330,40695,40823,40951,41274,66018,17716,32109,33401,22911,54132,23039,33913,408,19136,46035,48620,59123,59251,31741,34937,48342,38995,63986,45342,4962,31086,48155,38631,40184,30981,3409,28478,31406,5106,38595,32890,47995,20672,37369,41592,47923,29711,33786,38009,27760,27792,25809,6984,59124,47854,47846,9005,20276,26078,43512,1785,24690,52086,27795,8399,37786,56693,47534,40569,40409,13808,38441,22592,38106,47466,27868,32015,67046,37754,33787,31294,31358,31422,11650,47415,55030,46968,38660,51319,47307,36700,28785,47736,39674,16097,24723,35963,1513,36970,16727,28479,15548,16353,6146,61557,6814,41338,24832,28991,31344,31408,9080,23412,46745,41281,12674,8611,8643,46631,7992,34940,59638,47481,29951,15621,26259,4065,4069,46681,20310,18327,8208,52856,18647,36732,46383,18498,39837,12542,31249,14621,6754,27072,33789,31295,29266,17272,68586,8672,46295,27584,12798,43131,46283,31935,47610,17624,46280,835,28160,35965,24193,52601,1777,42325,10179,53113,46180,36989,4538,53625,41468,16707,49914,45947,20663,62583,1833,45740,68588,3109,9552,42398,17145,4067,45476,39293,35326,55929,17401,26049,45433,25685,7586,6945,22274,25815,41940,36734,36862,36990,41213,61816,45270,22519,22914,45029,15618,31296,58617,44937,12543,42621,13608,7922,34815,39038,40417,15970,35327,35252,8034,32192,19971,12734,8817,44765,33637,26102,24450,61305,44614,16452,12355,26198,13119,16708,49916,34782,33792,4243,12611,28725,12675,29505,31843,59258,38911,10326,44415,5810,15753,44217,21369,19386,35840,25655,44286,44031,44542,2974,745,30657,16046,10017,30849,45438,66546,36646,22915,16350,26679,24664,23171,58747,46590,31553,47521,63354,38912,4307,31622,51581,43519,32065,17500,24003,19972,19263,60667,24259,3242,37823,10180,43489,43426,40358,10308,61819,20740,16709,5219,33666,15535,21060,29314,21188,6770,18972,29570,59260,25603,43130,41981,35202,29954,43648,15043,17405,17925,60540,31261,40321,48639,30530,35178,18373,36866,42944,37122,45440,1090,11428,39219,62332,27139,31298,38146,28504,20540,23364,63228,59261,41384,3618,19133,11876,35331,42690,16451,16099,19973,24132,44289,42520,24324,40578,28547,6131,42220,20549,24708,865,57854,47591,6243,16838,12548,33924,33390,62845,62973,25852,17286,15744,41426,17311,6435,41397,39427,30019,8901,43906,17926,26180,31864,18118,29849,9827,41382,40835,8058,41345,12098,11444,48680,40620,27012,41272,41229,35247,122,41220,41218,34437,3442,10451,47106,51329,66043,51585,43523,43651,41086,3514,19974,24133,41084,14180,44547,10835,7139,14308,32774,10851,24709,57728,41476,20806,33542,29124,12946,41083,50434,15089,50690,24710,38661,34694,34801,27068,23102,26115,43524,40520,25989,26053,48131,43310,7587,26141,65023,30532,35263,40398,5116,18503,41221,12323,30980,34322,18657,15588,7267,15652,23174,31428,54786,38534,2647,19137,8629,43141,19393,40082,10852,47748,39686,36817,19975,39594,89,18658,4066,8147,27006,7803,31292,24646,20615,19970,12421,37511,12485,1098,27010,38023,12613,10181,32700,59010,38663,38791,47109,39035,22561,39002,29957,14515,8902,60290,17928,27071,25056,38913,35614,61058,57091,1604,38697,32905,24225,6580,45574,42805,22919,37768,42869,38024,31365,11285,3355,38536,34569,38338,15859,39048,39176,38154,47476,19784,32133,64386,24002,38101,36474,10230,24327,10278,19369,32709,8391,24647,24711,37939,116,37850,54021,118,62467,38025,58628,15252,5589,29703,120,14821,11430,39049,37118,66309,43528,51846,24004,52102,29923,24452,64771,44424,56837,5588,20614,36741,32779,30790,66054,6253,23269,31046,33547,23365,18953,31302,31366,27619,27747,10855,34571,46984,59397,29303,9256,25161,35334,66823,25029,33919,40447,40511,27620,12134,52743,20297,7093,40842,65544,16458,24712,7373,34190,8359,12486,10473,62469,62597,13579,33572,54791,29511,59142,38795,38923,65801,16497,24648,43530,17738,29158,31589,12888,64645,52488,13158,44554,40647,9159,30756,45066,65802,24394,32908,30094,24778,58119,20812,23115,23113,31367,17134,29512,29544,33933,30504,51209,39052,15752,29673,22667,30217,30857,20654,26661,19680,64774,20170,15497,15531,61191,32651},{0x0008,0x0080,0x4000,0x0008,0x0008,0x0080,0x0001,0x0010,0x0080,0x0008,0x0100,0x0004,0x0008,0x0008,0x0020,0x0800,0x0008,0x0040,0x0080,0x0008,0x0008,0x0080,0x0020,0x0008,0x0080,0x0008,0x0080,0x0008,0x0080,0x0004,0x0100,0x0080,0x0020,0x0020,0x0020,0x0008,0x0800,0x0008,0x0080,0x0080,0x0080,0x0004,0x0010,0x0020,0x0080,0x0004,0x2000,0x0002,0x0008,0x0008,0x0008,0x0008,0x0080,0x0008,0x0080,0x0050,0x0081,0x0080,0x0008,0x0080,0x0080,0x0020,0x0050,0x0080,0x0008,0x0008,0x0001,0x0080,0x0020,0x0081,0x0080,0x0050,0x0050,0x0080,0x0070,0x0020,0x0080,0x0008,0x0008,0x0040,0x0008,0x0004,0x0004,0x0008,0x0080,0x0080,0x0081,0x0008,0x0008,0x0020,0x0008,0x0050,0x0008,0x0002,0x0004,0x0002,0x0004,0x0040,0x0004,0x0020,0x0008,0x0008,0x0008,0x0004,0x0020,0x0002,0x0020,0x0008,0x0020,0x0080,0x0001,0x0008,0x0020,0x0008,0x0008,0x0080,0x0008,0x0080,0x0002,0x0004,0x4000,0x0008,0x0004,0x0004,0x0008,0x0008,0x0008,0x0081,0x0008,0x0080,0x0008,0x0004,0x0008,0x0008,0x4000,0x0008,0x0008,0x0040,0x0060,0x0008,0x0020,0x0008,0x0080,0x0001,0x0020,0x0080,0x0008,0x0080,0x0080,0x0080,0x0002,0x0008,0x0080,0x0100,0x0008,0x0050,0x0080,0x0080,0x0008,0x0020,0x0040,0x0080,0x0020,0x0080,0x0008,0x0080,0x0008,0x0050,0x0008,0x0140,0x0140,0x4000,0x0008,0x0008,0x0020,0x0020,0x0080,0x0008,0x0020,0x0080,0x0002,0x0002,0x0008,0x0080,0x0020,0x0080,0x0100,0x0080,0x0020,0x0080,0x0040,0x0008,0x0004,0x0080,0x0400,0x0080,0x0008,0x0000,0x0008,0x0008,0x0080,0x4000,0x0080,0x0080,0x0008,0x0040,0x0008,0x0010,0x0028,0x0008,0x0004,0x0020,0x0008,0x0080,0x0008,0x0001,0x4000,0x0020,0x0008,0x0008,0x0004,0x0008,0x0008,0x0020,0x0008,0x0080,0x0008,0x0008,0x0080,0x4000,0x0080,0x0020,0x0008,0x0008,0x0004,0x0008,0x0008,0x0080,0x0020,0x0020,0x0008,0x0004,0x0080,0x0080,0x0080,0x0040,0x0008,0x0020,0x0008,0x0400,0x0080,0x0040,0x0008,0x0080,0x0004,0x0008,0x0020,0x0008,0x0080,0x0080,0x0002,0x0008,0x0004,0x0080,0x0008,0x0008,0x0040,0x0008,0x0000,0x0080,0x0020,0x0040,0x0004,0x0008,0x0008,0x0100,0x0008,0x0004,0x0080,0x0020,0x0008,0x0008,0x0080,0x0080,0x0080,0x0080,0x0008,0x0080,0x0008,0x0020,0x0040,0x0008,0x0008,0x0020,0x0080,0x0100,0x0008,0x0080,0x0020,0x0080,0x4000,0x0020,0x0020,0x0080,0x0080,0x0008,0x0040,0x0020,0x0002,0x0008,0x0020,0x0100,0x0020,0x4000,0x0080,0x0040,0x0080,0x0000,0x0008,0x0020,0x0008,0x0080,0x0008,0x0020,0x0080,0x0080,0x0008,0x0008,0x0050,0x0008,0x0004,0x0020,0x0008,0x0008,0x0008,0x0008,0x0002,0x0004,0x0080,0x0080,0x0008,0x0008,0x0020,0x0060,0x0008,0x0080,0x0008,0x0020,0x0080,0x0080,0x0008,0x0008,0x0080,0x0004,0x0020,0x0020,0x0080,0x0008,0x0008,0x0008,0x0020,0x0050,0x4000,0x0004,0x0008,0x0080,0x0020,0x0080,0x0080,0x0020,0x0050,0x0080,0x0020,0x0008,0x0008,0x0008,0x0080,0x0008,0x0004,0x0080,0x0050,0x0000,0x0080,0x0008,0x0020,0x0100,0x0008,0x00C0,0x0080,0x0080,0x4000,0x0008,0x0080,0x0080,0x0000,0x0008,0x0080,0x0004,0x0008,0x0080,0x0040,0x0002,0x0040,0x0002,0x0040,0x0020,0x0080,0x0080,0x0008,0x0004,0x0080,0x0020,0x0008,0x0040,0x0002,0x0020,0x0008,0x0040,0x4000,0x0008,0x0008,0x0020,0x0000,0x0040,0x0008,0x0020,0x0008,0x0080,0x0040,0x0080,0x0050,0x0002,0x0080,0x0200,0x0002,0x0008,0x0008,0x0004,0x0080,0x0080,0x0004,0x0040,0x0080,0x0008,0x0008,0x0008,0x0008,0x0080,0x8000,0x0080,0x0008,0x0004,0x0008,0x0080,0x0008,0x0080,0x0000,0x0008,0x0008,0x0081,0x0008,0x0008,0x0008,0x0080,0x0020,0x0008,0x0010,0x0008,0x0080,0x0004,0x0080,0x0008,0x0020,0x0002,0x0008,0x0800,0x0008,0x0000,0x0020,0x8000,0x0080,0x0004,0x0080,0x0080,0x0002,0x0080,0x0020,0x0004,0x0001,0x8000,0x0008,0x0080,0x0008,0x0100,0x0008,0x0008,0x0020,0x0080,0x0008,0x0008,0x0100,0x0020,0x0080,0x0020,0x0008,0x0008,0x0080,0x0080,0x0008,0x0080,0x0080,0x0080,0x0008,0x0002,0x8000,0x0020,0x0001,0x0004,0x0020,0x0008,0x0020,0x0008,0x0008,0x0008,0x0008,0x0020,0x0008,0x0020,0x0008,0x0008,0x0008,0x0020,0x0080,0x0008,0x0020,0x0080,0x0008,0x0008,0x0020,0x0008,0x4000,0x0008,0x0002,0x0008,0x0008,0x0008,0x0008,0x0020,0x0008,0x4000,0x0008,0x0008,0x0080,0x0050,0x0008,0x0000,0x0008,0x0088,0x0010,0x4000,0x0008,0x0080,0x0000,0x0080,0x0080,0x0080,0x0400,0x0020,0x0020,0x0020,0x0080,0x0100,0x0080,0x0002,0x0008,0x0020,0x0040,0x0080,0x0002,0x0080,0x0040,0x0008,0x0010,0x1000,0x0008,0x0008,0x0008,0x0080,0x0800,0x0000,0x0020,0x0008,0x0080,0x0800,0x0100,0x0080,0x0040,0x0004,0x0002,0x0008,0x0008,0x1000,0x0008,0x0080,0x0010,0x0008,0x0100,0x0080,0x0000,0x0040,0x0008,0x0008,0x0008,0x0008,0x0008,0x0020,0x0081,0x0080,0x0020,0x0008,0x0020,0x0000,0x0050,0x0080,0x0080,0x0060,0x0020,0x0080,0x0020,0x0080,0x0100,0x0080,0x0002,0x0002,0x0080,0x0080,0x0008,0x0004,0x0050,0x0008,0x0008,0x0080,0x4000,0x0008,0x0000,0x0040,0x0020,0x0080,0x0080,0x0020,0x0080,0x0008,0x0008,0x0070,0x0008,0x0040,0x0080,0x0008,0x0080,0x0008,0x0008,0x0100,0x0005,0x0008,0x0080,0x0008,0x0080,0x0080,0x0080,0x0002,0x0050,0x0080,0x0080,0x0008,0x0040,0x4000,0x0000,0x0008,0x0080,0x0000,0x0080,0x0080,0x0008,0x0080,0x0008,0x0080,0x0020,0x0008,0x0008,0x0008,0x0020,0x0020,0x0040,0x0080,0x0020,0x0008,0x0020,0x0004,0x8000,0x0004,0x0008,0x0008,0x0020,0x0008,0x0008,0x0008,0x0050,0x0040,0x0080,0x0008,0x0020,0x0008,0x0008,0x0008,0x0008,0x0080,0x0008,0x0080,0x0080,0x0050,0x0002,0x0080,0x0080,0x0001,0x0008,0x0008,0x0008,0x0800,0x0008,0x0008,0x0080,0x0040,0x000C,0x0010,0x0008,0x0040,0x8000,0x0080,0x0008,0x0008,0x0008,0x0080,0x0008,0x0080,0x0008,0x4000,0x0008,0x4000,0x0008,0x0020,0x0008,0x0040,0x0080,0x0080,0x0080,0x0020,0x0400,0x0050,0x0002,0x0080,0x0008,0x0080,0x0004,0x0008,0x0080,0x0080,0x0008,0x0008,0x0080,0x0008,0x0002,0x0020,0x0008,0x0010,0x0004,0x0020,0x4000,0x0008,0x0008,0x0008,0x0080,0x0008,0x0008,0x0080,0x0008,0x0080,0x0020,0x4000,0x0008,0x0080,0x0020,0x0008,0x0008,0x0050,0x0080,0x0008,0x0080,0x0008,0x0002,0x0140,0x0080,0x0050,0x0800,0x0008,0x0008,0x0050,0x0004,0x0080,0x0002,0x4000,0x0020,0x0008,0x0100,0x0020,0x0080,0x0080,0x0008,0x0008,0x0008,0x0008,0x0008,0x0000,0x0080,0x0020,0x4000,0x0080,0x0080,0x0008,0x0004,0x0008,0x0020,0x0080,0x0050,0x0008,0x0040,0x0080,0x0008,0x0002,0x0080,0x0080,0x0000,0x0008,0x0004,0x0008,0x0008,0x0008,0x0008,0x0004,0x2000,0x0008,0x0008,0x1000,0x0080,0x8000,0x0008,0x0008,0x0008,0x0008,0x0080,0x0040,0x4000,0x0080,0x0008,0x0008,0x0020,0x0100,0x0008,0x0080,0x0080,0x0008,0x0008,0x0002,0x0000,0x0080,0x0080,0x0008,0x0004,0x0020,0x0008,0x0008,0x0020,0x0008,0x0001,0x0008,0x0100,0x0080,0x0008,0x0080,0x0020,0x0020,0x0100,0x0800,0x0080,0x0008,0x0008,0x0008,0x0040,0x0200,0x0008,0x00D0,0x0004,0x0080,0x0080,0x0008,0x0080,0x0020,0x0008,0x0008,0x0004,0x0020,0x0080,0x0008,0x0080,0x0001,0x4000,0x000C,0x0080,0x0004,0x0080,0x0080,0x0050,0x0080,0x0030,0x0040,0x0008,0x0080,0x0004,0x0040,0x0008,0x0008,0x0008,0x0001,0x0020,0x0004,0x0008,0x0010,0x0008,0x0080,0x0008,0x0080,0x0002,0x0008,0x0004,0x0020,0x0040,0x0080,0x0020,0x4000,0x0008,0x4000,0x0080,0x0008,0x0080,0x0080,0x0002,0x0020,0x0080,0x0008,0x0008,0x0004,0x0020,0x4000,0x0020,0x0400,0x0080,0x0080,0x0081,0x0080,0x0008,0x0080,0x8000,0x0008,0x0008,0x0008,0x0020,0x0080,0x0002,0x0080,0x0008,0x0080,0x0080,0x0081,0x0080,0x0004,0x0080,0x0000,0x0080,0x4000,0x0008,0x0080,0x0080,0x0004,0x0080,0x0080,0x0020,0x0008,0x0040,0x0008,0x0008,0x0080,0x0020,0x0040,0x0008,0x0001,0x0040,0x0001,0x0008,0x0080,0x0020,0x0008,0x0020,0x0080,0x0008,0x0008,0x0008,0x0100,0x0008,0x0020,0x0080,0x0080,0x0004,0x0008,0x0008,0x0008,0x0001,0x0010,0x0008,0x0080,0x0008,0x0050,0x0002,0x0020,0x0080,0x0040,0x0008,0x0008,0x0020,0x0008,0x0000,0x0010,0x0080,0x0020,0x0080,0x0008,0x0080,0x0010,0x0020,0x0020,0x0008,0x0008,0x0080,0x0008,0x0050,0x0004,0x0008,0x0020,0x0050,0x0008,0x0080,0x0008,0x0020,0x0080,0x0080,0x0008,0x0008,0x0008,0x0008,0x0050,0x0008,0x0080,0x0004,0x0010,0x0008,0x0080,0x0008,0x0080,0x0008,0x0008,0x0008,0x0040,0x0020,0x0080,0x0008,0x0008,0x0020,0x0008,0x0080,0x0020,0x0008,0x4000,0x0020,0x0004,0x0008,0x0080,0x0020,0x0004,0x0008,0x0020,0x0008,0x0020,0x0080,0x0008,0x0080,0x0008,0x0800,0x0004,0x0080,0x0002,0x00D0,0x0080,0x0080,0x0080,0x0008,0x0008,0x0010,0x0080,0x0008,0x0004,0x0080,0x0100,0x0008,0x0008,0x4000,0x0008,0x0008,0x0004,0x0040,0x0008,0x0008,0x0008,0x0080,0x0040,0x0008,0x0001,0x0080,0x0002,0x0008,0x0008,0x0008,0x0100,0x0020,0x0008,0x0080,0x0008,0x0008,0x4000,0x0000,0x0040,0x0080,0x8000,0x0080,0x0008,0x0008,0x0008,0x0008,0x0004,0x0008,0x0080,0x0008,0x0040,0x0020,0x0008,0x0002,0x0040,0x0080,0x0020,0x0020,0x0008,0x0008,0x0004,0x0004,0x0004,0x0008,0x4000,0x0020,0x0002,0x0004,0x0080,0x0008,0x0008,0x0084,0x0080,0x0004,0x0008,0x0080,0x0008,0x0008,0x0020,0x0008,0x0080,0x0080,0x0001,0x0080,0x0020,0x0080,0x0008,0x0008,0x0004,0x0008,0x0080,0x0020,0x0080,0x0080,0x0080,0x0008,0x0008,0x0010,0x0080,0x0008,0x0020,0x0008,0x0080,0x0002,0x4000,0x0080,0x0008,0x0080,0x0002,0x0004,0x0008,0x0080,0x0020,0x0008,0x0080,0x0008,0x0004,0x4000,0x8000,0x0080,0x0001,0x0020,0x0080,0x0030,0x0008,0x0040,0x0060,0x0080,0x0008,0x0010,0x0080,0x0080,0x0008,0x0020,0x0080,0x0020,0x0008,0x0008,0x0008,0x0008,0x4000,0x0080,0x0008,0x0008,0x0080,0x0008,0x0020,0x0008,0x0008,0x0080,0x0008,0x0008,0x0008,0x0080,0x0001,0x0008,0x0020,0x0080,0x0081,0x0020,0x0008,0x0008,0x0008,0x0020,0x0004,0x0020,0x0020,0x0004,0x0040,0x0004,0x0080,0x0004,0x0008,0x0008,0x0080,0x0080,0x0020,0x0080,0x0008,0x0008,0x0028,0x0008,0x0080,0x0080,0x0002,0x0080,0x0020,0x0008,0x0080,0x0008,0x0020,0x0040,0x0080,0x0020,0x0080,0x0020,0x0080,0x0008,0x0020,0x0008,0x0080,0x4000,0x0008,0x0080,0x0080,0x0020,0x0028,0x4000,0x0100,0x0020,0x0008,0x0008,0x0020,0x0040,0x0400,0x0080,0x0000,0x4000,0x0008,0x0008,0x0010,0x0080,0x0080,0x0080,0x0010,0x0010,0x0008,0x0084,0x0020,0x0800,0x0020,0x0008,0x0008,0x0040,0x0020,0x0004,0x0020,0x0001,0x0080,0x0080,0x0080,0x0008,0x0080,0x0008,0x0080,0x0080,0x0008,0x0008,0x0080,0x0001,0x0040,0x0004,0x0020,0x0080,0x0020,0x0008,0x0080,0x0008,0x4000,0x0008,0x0008,0x0008,0x0080,0x0008,0x0008,0x0004,0x0008,0x0050,0x0004,0x0008,0x0002,0x0080,0x0004,0x0008,0x0008,0x0080,0x0020,0x0008,0x0020,0x0001,0x1000,0x0008,0x0008,0x0008,0x0008,0x0008,0x0030,0x0020,0x0080,0x0040,0x0080,0x0080,0x0080,0x0080,0x0004,0x0001,0x0008,0x0100,0x0008,0x0008,0x0008,0x0020,0x002C,0x0080,0x0008,0x0080,0x0040,0x0080,0x0000,0x0004,0x0008,0x0400,0x0080,0x0020,0x0008,0x0080,0x0008,0x0008,0x0008,0x0080,0x0008,0x0080,0x0002,0x0080,0x0008,0x0020,0x0008,0x0000,0x0008,0x0008,0x0008,0x0020,0x0008,0x0140,0x0800,0x0008,0x0008,0x0020,0x0008,0x0008,0x0008,0x0800,0x0004,0x0010,0x0080,0x0070,0x0008,0x0008,0x0080,0x0008,0x1000,0x0080,0x0100,0x0040,0x0008,0x0008,0x0000,0x0020,0x0004,0x0080,0x0004,0x0080,0x0080,0x0002,0x0080,0x0008,0x0080,0x0090,0x0020,0x0080,0x0020,0x0020,0x0080,0x0008,0x0080,0x0008,0x0080,0x4000,0x0008,0x0020,0x0020,0x0020,0x0200,0x0004,0x0004,0x0080,0x0004,0x0040,0x0010,0x0008,0x0020,0x0008,0x0008,0x0020,0x0050,0x4000,0x0008,0x0008,0x0080,0x0004,0x0020,0x0008,0x0080,0x0020,0x0020,0x0008,0x0020,0x0020,0x0008,0x0080,0x0020,0x0008,0x0008,0x0004,0x0020,0x0081,0x0008,0x0008,0x0400,0x0080,0x0020,0x0008,0x0010,0x0080,0x0001,0x0008,0x0100,0x0008,0x0080,0x0008,0x0008,0x0020,0x0008,0x0080,0x0100,0x0050,0x0080,0x0050,0x0002,0x0200,0x0008,0x0001,0x0008,0x0002,0x0008,0x0008,0x0080,0x0080,0x0080,0x0020,0x0080,0x0020,0x0008,0x0008,0x0080,0x0040,0x0008,0x0010,0x0000,0x0008,0x0020,0x00D0,0x0008,0x0020,0x0008,0x0080,0x0020,0x0080,0x0004,0x0008,0x0080,0x0008,0x0008,0x0080,0x0002,0x0020,0x0050,0x0080,0x0008,0x0080,0x0008,0x0008,0x0008,0x0080,0x0008,0x0008,0x0008,0x0020,0x0008,0x0020,0x0020,0x0020,0x0070,0x0040,0x0080,0x0008,0x0080,0x0080,0x0080,0x0080,0x0080,0x0008,0x0008,0x0008,0x0004,0x0008,0x0020,0x0020,0x0020,0x0080,0x0080,0x0080,0x4000,0x0008,0x0008,0x0008,0x0004,0x0008,0x0008,0x0080,0x0080,0x0020,0x0080,0x0100,0x0050,0x0070,0x4000,0x0080,0x0020,0x0020,0x0008,0x4000,0x0008,0x0100,0x0080,0x0008,0x0008,0x0020,0x0008,0x0080,0x0040,0x0008,0x0080,0x0080,0x0008,0x0080,0x0020,0x0008,0x0008,0x0008,0x0020,0x0080,0x0020,0x0080,0x0008,0x0008,0x0080,0x0008,0x0080,0x0008,0x4000,0x0000,0x0008,0x0008,0x0000,0x0008,0x0020,0x0000,0x0000,0x4000,0x0000,0x0080,0x4000,0x0080,0x4000,0x4000,0x0080,0x0008,0x8000,0x0008,0x0008,0x4000,0x0080,0x0080,0x0080,0x0010,0x0080,0x0008,0x0008,0x0020,0x0008,0x0020,0x0010,0x0080,0x0008,0x0080,0x0080,0x0080,0x0040,0x0020,0x0004,0x0008,0x0002,0x0080,0x0004,0x0008,0x0002,0x0080,0x0008,0x0080,0x0008,0x0008,0x0002,0x0004,0x0008,0x0008,0x4000,0x0080,0x0008,0x0008,0x0020,0x0020,0x0008,0x0010,0x0004,0x0040,0x0008,0x0008,0x0080,0x0000,0x0008,0x0080,0x0008,0x8000,0x0001,0x0080,0x0050,0x0008,0x0080,0x0008,0x0040,0x0080,0x8000,0x0400,0x0008,0x0008,0x0008,0x0020,0x0008,0x0008,0x0020,0x0200,0x0080,0x0080,0x0050,0x0080,0x0080,0x0008,0x0080,0x0008,0x0008,0x8000,0x0008,0x0008,0x0100,0x0008,0x0004,0x0020,0x0010,0x0008,0x0008,0x0008,0x0080,0x0080,0x0080,0x0080,0x0080,0x0008,0x0008,0x0020,0x0040,0x0008,0x4000,0x0080,0x0030,0x0008,0x0008,0x0080,0x0008,0x0008,0x0008,0x0002,0x0080,0x0080,0x0040,0x0008,0x1000,0x0080,0x0002,0x0008,0x0080,0x0008,0x0000,0x4000,0x0004,0x0040,0x0001,0x0008,0x0080,0x0008,0x0080,0x0040,0x0080,0x0020,0x0010,0x0020,0x0004,0x0080,0x0080,0x0020,0x0008,0x0080,0x0008,0x0008,0x0008,0x4000,0x0080,0x0080,0x0080,0x0002,0x0008,0x0050,0x0040,0x0080,0x0008,0x0001,0x0008,0x0008,0x0080,0x0004,0x0008,0x0100,0x0030,0x0002,0x0080,0x0008,0x0002,0x0020,0x0080,0x0020,0x0000,0x0100,0x0020,0x0020,0x0080,0x0080,0x0080,0x0080,0x0040,0x0008,0x0080,0x0080,0x0080,0x0008,0x0080,0x0020,0x0008,0x0020,0x0008,0x0400,0x0008,0x0008,0x0000,0x0008,0x0020,0x0020,0x0008,0x0008,0x0008,0x0008,0x0008,0x0020,0x0080,0x0080,0x0020,0x0080,0x0008,0x0008,0x0004,0x0008,0x0008,0x0008,0x0080,0x0080,0x0010,0x8000,0x0010,0x0080,0x0004,0x0080,0x0080,0x0020,0x0050,0x0080,0x0080,0x0080,0x0004,0x0002,0x0020,0x0020,0x0008,0x0020,0x0020,0x0008,0x0080,0x0020,0x0080,0x0008,0x0004,0x0008,0x0008,0x0000,0x0008,0x0040,0x0004,0x0020,0x0100,0x0080,0x0008,0x0008,0x0008,0x0080,0x0008,0x0040,0x0008,0x0080,0x0080,0x0040,0x0008,0x0008,0x0080,0x0004,0x0800,0x0080,0x0080,0x0008,0x0080,0x0080,0x0008,0x0008,0x0008,0x0008,0x0100,0x0008,0x0008,0x0080,0x0080,0x0004,0x0080,0x0080,0x4000,0x0008,0x0080,0x0004,0x0008,0x0004,0x0008,0x0100,0x0004,0x0080,0x0080,0x0008,0x0080,0x0080,0x0008,0x0080,0x0080,0x0008,0x0008,0x0080,0x0050,0x0100,0x0080,0x0080,0x0080,0x0020,0x0100,0x0020,0x4000,0x0020,0x0008,0x0008,0x0008,0x0050,0x0080,0x0002,0x0008,0x0020,0x0080,0x0080,0x0008,0x0008,0x0020,0x0008,0x0008,0x0040,0x0002,0x0020,0x0008,0x0008,0x0020,0x0008,0x0100,0x0100,0x0100,0x0020,0x0008,0x0088,0x0800,0x0008,0x0008,0x0100,0x4000,0x0020,0x0030,0x0020,0x0008,0x0080,0x0008,0x0004,0x0008,0x0008,0x0008,0x0002,0x0020,0x0000,0x0020,0x0008,0x0008,0x0008,0x0040,0x0020,0x0008,0x0020,0x0080,0x0020,0x0080,0x0004,0x0008,0x0080,0x0008,0x0008,0x0008,0x0008,0x0008,0x0080,0x0008,0x0008,0x0000,0x0008,0x0008,0x0080,0x0004,0x4000,0x0008,0x0008,0x0008,0x0080,0x0020,0x0004,0x0800,0x0000,0x0080,0x0008,0x0080,0x0008,0x0000,0x0080,0x0080,0x0070,0x0080,0x0080,0x0008,0x0080,0x0008,0x0020,0x0020,0x0040,0x0080,0x0080,0x0008,0x0004,0x1000,0x0020,0x0020,0x0008,0x0080,0x0008,0x0080,0x0008,0x0008,0x0008,0x0080,0x0080,0x0080,0x0040,0x0080,0x0050,0x0008,0x4000,0x0020,0x0004,0x0001,0x0080,0x0080,0x0080,0x0020,0x0040,0x0080,0x0008,0x0080,0x0000,0x0008,0x0008,0x0008,0x0008,0x0004,0x0008,0x0004,0x0020,0x0080,0x0080,0x0030,0x0080,0x0008,0x0008,0x0008,0x0008,0x0008,0x0020,0x0001,0x0020,0x0008,0x0008,0x0080,0x0040,0x0080,0x0080,0x0050,0x0080,0x0008,0x0080,0x0100,0x4000,0x0004,0x0080,0x0001,0x0080,0x0080,0x0080,0x0008,0x0080,0x0100,0x0002,0x0004,0x2000,0x0008,0x0020,0x0008,0x0020,0x0020,0x4000,0x0080,0x0008,0x0000,0x0080,0x0080,0x0008,0x0008,0x0100,0x0040,0x0080,0x0040,0x0008,0x0008,0x0008,0x0004,0x0008,0x0008,0x0008,0x0058,0x0040,0x0008,0x0008,0x0010,0x0080,0x0080,0x0050,0x0080,0x4000,0x0080,0x0400,0x0008,0x0080,0x0040,0x0080,0x0008,0x0020,0x0008,0x0080,0x0080,0x0080,0x0000,0x0140,0x4000,0x0080,0x0004,0x0100,0x4000,0x0800,0x0008,0x8000,0x0080,0x0008,0x0008,0x0004,0x0008,0x0040,0x0008,0x0008,0x0040,0x0080,0x0008,0x0020,0x0008,0x0008,0x0800,0x0040,0x0008,0x0008,0x0080,0x0008,0x0008,0x0080,0x0080,0x0008,0x0008,0x0080,0x0008,0x0001,0x0020,0x0080,0x0080,0x0080,0x0008,0x0080,0x0080,0x0080,0x0080,0x0008,0x0004,0x0008,0x0008,0x0004,0x0008,0x0008,0x0008,0x0008,0x8000,0x8000,0x4000,0x0020,0x0080,0x0080,0x0028,0x0008,0x0008,0x0008,0x0008,0x0080,0x0080,0x0080,0x0008,0x0020,0x0010,0x0000,0x0080,0x0020,0x0024,0x0020,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0020,0x0008,0x0080,0x0008,0x0080,0x0080,0x0004,0x0008,0x0008,0x0008,0x0020,0x0008,0x0004,0x0008,0x0080,0x4000,0x0080,0x0008,0x0008,0x4000,0x4000,0x0020,0x0004,0x0080,0x0008,0x0080,0x0080,0x0080,0x0080,0x0008,0x0080,0x0008,0x0100,0x0020,0x0040,0x0008,0x0080,0x0080,0x0080,0x0080,0x0020,0x0008,0x0008,0x0050,0x0080,0x0800,0x0080,0x0008,0x0080,0x0008,0x0002,0x0008,0x0008,0x0001,0x0008,0x0040,0x0008,0x0008,0x8000,0x0008,0x0008,0x0040,0x0008,0x0004,0x0008,0x4000,0x0008,0x0080,0x0004,0x0080,0x0008,0x0008,0x0008,0x0008,0x4000,0x0080,0x0008,0x0080,0x0004,0x0080,0x0080,0x0008,0x4000,0x0008,0x0008,0x0080,0x0008,0x0008,0x0008,0x0008,0x0080,0x0080,0x0080,0x0020,0x0008,0x0008,0x0008,0x4000,0x0040,0x0008,0x0000,0x0080,0x0008,0x0080,0x0008,0x0008,0x0040,0x0040,0x0800,0x0008,0x0008,0x0001,0x0008,0x0008,0x0080,0x0004,0x0010,0x0008,0x0020,0x0008,0x4000,0x0004,0x0080,0x0020,0x0800,0x0080,0x0008,0x4000,0x0008,0x0008,0x0080,0x0008,0x0008,0x0080,0x0080,0x0080,0x0008,0x0008,0x0020,0x0008,0x0008,0x0080,0x0080,0x0000,0x0020,0x0080,0x0080,0x0020,0x0020,0x0008,0x000C,0x8000,0x0008,0x0008,0x0080,0x4000,0x0080,0x0008,0x0008,0x0002,0x0020,0x4000,0x0040,0x0080,0x0008,0x0040,0x0080,0x0008,0x0080,0x0040,0x0008,0x0080,0x0008,0x0000,0x0008,0x0080,0x0008,0x0020,0x0080,0x0000,0x0001,0x0100,0x0080,0x0008,0x0008,0x0080,0x0020,0x0008,0x0800,0x0020,0x0040,0x0008,0x0008,0x0080,0x0008,0x0008,0x0080,0x0008,0x0008,0x0008,0x0008,0x0080,0x0020,0x0008,0x0020,0x0080,0x0080,0x0008,0x0008,0x0080,0x0008,0x0080,0x0020,0x0010,0x0080,0x0040,0x0008,0x0020,0x0080,0x0070,0x0020,0x0008,0x0008,0x4000,0x0002,0x4000,0x0020,0x0080,0x0008,0x0001,0x4000,0x0008,0x2000,0x0080,0x0080,0x0020,0x0080,0x0020,0x0020,0x0008,0x0080,0x0008,0x0080,0x0002,0x0004,0x0080,0x0020,0x0008,0x0080,0x0004,0x0080,0x0020,0x0002,0x0080,0x0002,0x0010,0x0000,0x0008,0x0002,0x0008,0x0008,0x0008,0x0040,0x0000,0x0080,0x0008,0x0008,0x0080,0x0080,0x0008,0x0080,0x0008,0x0080,0x0004,0x8000,0x0080,0x0020,0x0000,0x0080,0x0008,0x0008,0x8000,0x0080,0x0020,0x0001,0x0008,0x4000,0x0020,0x0008,0x0008,0x0004,0x0040,0x0080,0x0004,0x0040,0x0080,0x0008,0x0008,0x0008,0x0800,0x0001,0x0080,0x0008,0x0001,0x0004,0x0002,0x0000,0x0050,0x0004,0x0008,0x0008,0x0080,0x0020,0x0008,0x0080,0x0008,0x0080,0x0002,0x0000,0x0008,0x0008,0x0008,0x0080,0x0008,0x0080,0x0020,0x0020,0x0008,0x0008,0x0004,0x0002,0x0008,0x0080,0x0008,0x4000,0x0080,0x0040,0x0008,0x0020,0x0080,0x0020,0x0000,0x0040,0x0100,0x0008,0x0020,0x0008,0x0400,0x0080,0x0100,0x4000,0x0008,0x0020,0x0080,0x0008,0x0004,0x0040,0x0008,0x0080,0x0080,0x0020,0x4000,0x0020,0x0001,0x0000,0x0000,0x0080,0x0020,0x0080,0x0080,0x0080,0x0040,0x0008,0x0080,0x0020,0x0080,0x0080,0x0020,0x0080,0x0008,0x0080,0x4000,0x0008,0x0080,0x0800,0x0004,0x0000,0x0080,0x0008,0x0008,0x0002,0x0008,0x0008,0x0080,0x0008,0x0080,0x0008,0x0008,0x0040,0x0020,0x0020,0x0008,0x0080,0x0008,0x0020,0x0008,0x0080,0x0000,0x0008,0x0080,0x0008,0x0008,0x0000,0x0080,0x0008,0x0020,0x0008,0x0008,0x0080,0x0002,0x0020,0x0008,0x0004,0x0080,0x0080,0x0040,0x0080,0x8000,0x0008,0x0020,0x0008,0x0008,0x0080,0x0002,0x0000,0x0800,0x0004,0x0080,0x0008,0x0040,0x0008,0x0400,0x0080,0x0080,0x0080,0x0008,0x0080,0x0008,0x0008,0x1000,0x0080,0x0008,0x0004,0x0008,0x0004,0x0008,0x0400,0x0080,0x0020,0x0020,0x0002,0x0004,0x0004,0x0004,0x0040,0x0008,0x0080,0x0004,0x0080,0x0008,0x0008,0x0020,0x0002,0x0010,0x0001,0x0004,0x0008,0x0008,0x4000,0x0004,0x0080,0x0008,0x0080,0x4000,0x0008,0x0008,0x0008,0x0008,0x0008,0x0080,0x0080,0x0008,0x0008,0x0080,0x0008,0x0080,0x8000,0x0004,0x0000,0x0008,0x0080,0x0080,0x0080,0x0001,0x0080,0x0008,0x0008,0x0080,0x0800,0x0008,0x4000,0x0008,0x0008,0x0008,0x0004,0x0100,0x0020,0x0008,0x0020,0x0008,0x0010,0x0080,0x0080,0x0080,0x0080,0x0080,0x0008,0x00C0,0x0040,0x0080,0x0080,0x0008,0x0008,0x0008,0x0040,0x0008,0x0800,0x0080,0x0004,0x0080,0x0050,0x0080,0x4000,0x0080,0x0040,0x0050,0x0080,0x0080,0x0020,0x0020,0x0800,0x0080,0x0080,0x0008,0x0008,0x0080,0x0080,0x4000,0x0008,0x0020,0x0080,0x4000,0x0080,0x0080,0x0002,0x0080,0x0002,0x0001,0x0050,0x0008,0x0000,0x0050,0x0008,0x0008,0x0008,0x0080,0x0020,0x0008,0x0008,0x0080,0x0080,0x0800,0x0020,0x0080,0x0040,0x0004,0x0080,0x4000,0x0400,0x0040,0x0100,0x0080,0x0002,0x0008,0x0008,0x0020,0x0004,0x0002,0x0008,0x0008,0x0080,0x0020,0x0002,0x0080}}
local MOD_BIT_FLAG = {CONFUSE=0x00001,CHARM=0x00002,FEAR=0x00004,STUN=0x00008,HORRIFY=0x00200,FREEZE=0x00400,INCAPACITATE=0x00800,DISORIENT=0x01000,SAP=0x02000,POLYMORPH=0x04000,BANISH=0x08000,SLEEP=0x10000,SHACKLE=0x20000,TURN=0x40000,PACIFY=0x00010,ROOT=0x00020,SILENCE=0x00040,SNARE=0x00080,DISARM=0x00100,NOCONTROL=0x7FE0F}
 
local PLAYER_AURA_TABLE, PLAYER_BIT_STATE = {}, 0
local AURA_TYPE = { BUFF = "HELPFUL", DEBUFF = "HARMFUL" }
local PLAYER_AURA, PLAYER_AURA_STATE = { BUFF = {}, DEBUFF = {} }, 0
 
if lib.debug then
CONTROL_AURA_TABLE[1][ #CONTROL_AURA_TABLE[1] + 1 ],CONTROL_AURA_TABLE[2][ #CONTROL_AURA_TABLE[2] + 1 ] = 18499, MOD_BIT_FLAG.STUN -- Berserker Rage effect
CONTROL_AURA_TABLE[1][ #CONTROL_AURA_TABLE[1] + 1 ],CONTROL_AURA_TABLE[2][ #CONTROL_AURA_TABLE[2] + 1 ] = 29131, MOD_BIT_FLAG.FEAR -- Bloodrage effect
local TT = CONTROL_AURA_TABLE
local AddDebugSpell = function(index, flag)
TT[1][ #TT[1] + 1 ], TT[2][ #TT[2] + 1 ] = index, flag
end
AddDebugSpell(18499, MOD_BIT_FLAG.STUN) -- Berserker Rage effect
AddDebugSpell(29131, MOD_BIT_FLAG.FEAR) -- Bloodrage effect
AddDebugSpell(47436, MOD_BIT_FLAG.FEAR)
end
 
lib.events = {}
 
--------------------------------------------------------------------------------------------------
-- Bitwise Functions
-- Utility Functions
--------------------------------------------------------------------------------------------------
 
local TriggerEvent, PlayerAuraApplied, PlayerAuraRemoved, PlayerAuraEvent
local BitBandBool, RefreshPlayerBitState, PlayerHasAuraBitFlag, GetControlAuraBitFlag
local BitBandBool, SelectOne
 
function BitBandBool(...)
return bit.band(...) ~= 0
end
 
function RefreshPlayerBitState()
PLAYER_BIT_STATE = 0
for _, v in pairs(PLAYER_AURA_TABLE) do
PLAYER_BIT_STATE = bit.bor(PLAYER_BIT_STATE, v)
end
return PLAYER_BIT_STATE
function SelectOne(n, ...)
local v = select(n, ...); return v
end
 
function PlayerHasAuraBitFlag(...)
return BitBandBool(PLAYER_BIT_STATE, ...)
end
--------------------------------------------------------------------------------------------------
-- Bitwise Functions
--------------------------------------------------------------------------------------------------
 
local GetControlAuraBitFlag, GetUnitAuraBitState, UnitHasAuraBitFlag
 
function GetControlAuraBitFlag(index)
for i, v in ipairs(CONTROL_AURA_TABLE[1]) do
if v == index then
71,62 → 74,88
end
end
 
function GetUnitAuraBitState(unit)
local state = 0
for kind, filter in pairs(AURA_TYPE) do
local j = 1
repeat
local index = SelectOne(11, UnitAura(unit, j, filter))
if index then
state = bit.bor(state, GetControlAuraBitFlag(index) or 0)
end
j = j + 1
until ( not index )
end
return state
end
 
function UnitHasAuraBitFlag(unit, ...)
return BitBandBool( GetUnitAuraBitState(unit), ... )
end
 
--------------------------------------------------------------------------------------------------
-- Aura/Aura Events
--------------------------------------------------------------------------------------------------
 
function lib.events.UNIT_AURA(...)
print(...)
end
local PlayerAuraEvent, PlayerStateEvent, TriggerEvent
 
function PlayerAuraApplied(index, name, kind)
-- Some spells (like channeled spells) apply the same debuff to the caster, except in a hidden state. So
-- in order to prevent false positives we need confirm that the player actually has the de/buff.
if ( kind == "BUFF" and UnitBuff("player", name) ) or ( kind == "DEBUFF" and UnitDebuff("player", name) ) then
local newFlag = GetControlAuraBitFlag(index)
if ( newFlag ) and ( not PLAYER_AURA_TABLE[index] ) then
PLAYER_AURA_TABLE[index] = newFlag
PlayerAuraEvent("GAIN", index, name, newFlag, bit.band(PLAYER_BIT_STATE, RefreshPlayerBitState()))
end
function PlayerAuraEvent()
for i, filter in pairs(AURA_TYPE) do
local j = 1
repeat
local newIndex = SelectOne(11, UnitAura("player", j, filter))
local oldIndex = PLAYER_AURA[i][j]
if newIndex == oldIndex then
j = j + 1
elseif newIndex and ( not oldIndex ) then
PlayerStateEvent("GAIN", newIndex)
PLAYER_AURA[i][j] = newIndex
j = j + 1
else
PlayerStateEvent("LOST", oldIndex)
table.remove(PLAYER_AURA[i], j)
end
until ( not newIndex ) and ( not oldIndex )
end
end
 
function PlayerAuraRemoved(index, name, kind)
-- If multiple versions of a single spell index are applied, the event of losing the first index would also
-- clear the second (which is still active). So in order to prevent false positives we need confirm that the
-- player actually lost the de/buff.
if ( kind == "BUFF" and not UnitBuff("player", name) ) or ( kind == "DEBUFF" and not UnitDebuff("player", name) ) then
local newFlag = GetControlAuraBitFlag(index)
if ( newFlag ) and ( PLAYER_AURA_TABLE[index] ) then
PLAYER_AURA_TABLE[index] = nil
PlayerAuraEvent("LOST", index, name, newFlag, bit.band(PLAYER_BIT_STATE, RefreshPlayerBitState()))
end
function lib.events.UNIT_AURA(unit)
if unit == "player" then
PlayerAuraEvent()
end
end
 
function PlayerAuraEvent(state, index, name, flag, diff)
lib.events.PLAYER_LOGIN = PlayerAuraEvent
 
function PlayerStateEvent(kind, index)
local flag = GetControlAuraBitFlag(index); if ( not flag ) then
return
end
local oldState, newState = PLAYER_AURA_STATE, GetUnitAuraBitState("player")
-- Set the new player aura state
PLAYER_AURA_STATE = newState
-- Check for effect changes
for modName, modFlag in pairs(MOD_BIT_FLAG) do
if ( modName ~= "NOCONTROL" ) and BitBandBool(flag, modFlag) then
-- Event that triggers on any aura gain/loss, with arg1 being the aura type, and arg2
-- being the aura's spellID.
TriggerEvent("LPC_PLAYER_"..state.."_AURA", modName, index, name)
TriggerEvent("LPC_PLAYER_"..kind.."_AURA", modName, index)
-- Event that triggers when the player gains/loses a specific aura type.
TriggerEvent("LPC_PLAYER_"..state.."_AURA_"..modName, index, name)
if ( not BitBandBool(modFlag, diff) ) then
TriggerEvent("LPC_PLAYER_"..kind.."_AURA_"..modName, index)
if ( not BitBandBool(modFlag, oldState, newState) ) then
-- Event that triggers on any mod gain/loss, with arg1 being the mod type.
TriggerEvent("LPC_PLAYER_"..state.."_MOD", modName)
TriggerEvent("LPC_PLAYER_"..kind.."_MOD", modName)
-- Event that triggers when the player gains/loses a specific mod type.
TriggerEvent("LPC_PLAYER_"..state.."_MOD_" .. modName)
TriggerEvent("LPC_PLAYER_"..kind.."_MOD_" .. modName)
end
end
end
-- PLAYER_GAIN_CONTROL is the last event that should be fired after an adverse effect is gained/lost.
if ( not BitBandBool(MOD_BIT_FLAG.NOCONTROL, diff) ) then
-- The last event that should be fired after an adverse effect is gained/lost.
if ( not BitBandBool(MOD_BIT_FLAG.NOCONTROL, oldState, newState) ) then
-- When the player gains a mod, they're losing control, and vice versa...
if ( state == "GAIN" ) then
if ( kind == "GAIN" ) then
TriggerEvent("LPC_PLAYER_LOST_CONTROL")
elseif ( state == "LOST" ) then
elseif ( kind == "LOST" ) then
TriggerEvent("LPC_PLAYER_GAIN_CONTROL")
end
end
138,46 → 167,6
end
 
--------------------------------------------------------------------------------------------------
-- CombatLog Event Filtering
--------------------------------------------------------------------------------------------------
 
local COMBAT_EVENT_PREFIX, COMBAT_EVENT_SUFFIX = { "SWING","RANGE","SPELL_BUILDING","SPELL_PERIODIC","SPELL","ENVIRONMENTAL"}, {"DAMAGE","MISSED","HEAL","ENERGIZE","DRAIN","LEECH","INTERRUPT","DISPEL_FAILED","DISPEL","STOLEN","EXTRA_ATTACKS","AURA_APPLIED","AURA_REMOVED","AURA_APPLIED_DOSE","AURA_REMOVED_DOSE","AURA_REFRESH","AURA_BROKEN","AURA_BROKEN_SPELL","CAST_START","CAST_SUCCESS","CAST_FAILED","INSTAKILL","DURABILITY_DAMAGE_ALL","DURABILITY_DAMAGE","CREATE","SUMMON","RESURRECT"}
 
local GetEventType = function(event)
local prefix, suffix
for i, v in ipairs(COMBAT_EVENT_PREFIX) do
if string.match(event, ("^%s_"):format(v)) then
prefix = v; break
end
end
for i, v in ipairs(COMBAT_EVENT_SUFFIX) do
if string.match(event, ("_%s$"):format(v)) then
suffix = v; break
end
end
return prefix, suffix
end
 
function lib.events.COMBAT_LOG_EVENT_UNFILTERED(...)
 
local timestamp, eventType, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags = select(1, ...)
local arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11 = select(9, ...)
 
if ( bit.band(dstFlags, COMBATLOG_FILTER_ME) ~= COMBATLOG_FILTER_ME ) then return end
 
local prefix, suffix = GetEventType(eventType)
 
if suffix == "AURA_APPLIED" then
PlayerAuraApplied(arg1, arg2, arg4)
elseif suffix == "AURA_REMOVED" or suffix == "AURA_BROKEN" then
PlayerAuraRemoved(arg1, arg2, arg4)
elseif suffix == "DISPEL" or suffix == "STOLEN" or suffix == "AURA_BROKEN_SPELL" then
PlayerAuraRemoved(arg1, arg2, arg7)
end
 
end
 
--------------------------------------------------------------------------------------------------
-- Event Handling
--------------------------------------------------------------------------------------------------
 
197,10 → 186,11
--[[----------------------------------------------------------------------------------------------
-- Lib Info/State Functions
 
Func: PlayerHasEffect
Func: UnitHasEffect
Usage: Returns whether the player is afflicted with the the queried effect.
Returns: Boolean
Args:
unit - unitID
effect - Must be one of the following strings: BANISH, CHARM, CONFUSE, DISORIENT, FEAR,
FREEZE, HORRIFY, INCAPACITATE, POLYMORPH, SAP, SHACKLE, SLEEP, STUN, TURN, DISARM,
PACIFY, ROOT, SILENCE, SNARE
214,7 → 204,7
*: Banished/Charmed/Confused/Disoriented/Feared/Frozen/Horrified/Incapacitated/Polymorphed/
Sapped/Shackled/Asleep/Stunned/Turned/Disarmed/Pacified/Rooted/Silenced/Ensnared
Usage: Returns whether the player is currently *. Exists only for convenience sake as it
acts the same as PlayerHasEffect(*).
acts the same as UnitHasEffect("player", *).
Returns: Boolean
Args: none
 
231,34 → 221,38
return b
end
 
function lib:PlayerHasEffect(...)
return PlayerHasAuraBitFlag( self:GetEffectBitFlag(...) )
function lib:UnitHasEffect(unit, ...)
return UnitHasAuraBitFlag( unit, self:GetEffectBitFlag(...) )
end
 
function lib:UnitHasControl(unit)
return ( not self:UnitHasEffect(unit, "NOCONTROL") )
end
 
function lib:PlayerHasControl()
return ( not self:PlayerHasEffect("NOCONTROL") )
return self:UnitHasControl("player")
end
 
function lib:PlayerIsBanished() return self:PlayerHasEffect("BANISH"); end
function lib:PlayerIsCharmed() return self:PlayerHasEffect("CHARM"); end
function lib:PlayerIsConfused() return self:PlayerHasEffect("CONFUSE"); end
function lib:PlayerIsDisoriented() return self:PlayerHasEffect("DISORIENT"); end
function lib:PlayerIsFeared() return self:PlayerHasEffect("FEAR"); end
function lib:PlayerIsFrozen() return self:PlayerHasEffect("FREEZE"); end
function lib:PlayerIsHorrified() return self:PlayerHasEffect("HORRIFY"); end
function lib:PlayerIsIncapacitated() return self:PlayerHasEffect("INCAPACITATE"); end
function lib:PlayerIsPolymorphed() return self:PlayerHasEffect("POLYMORPH"); end
function lib:PlayerIsSapped() return self:PlayerHasEffect("SAP"); end
function lib:PlayerIsShackled() return self:PlayerHasEffect("SHACKLE"); end
function lib:PlayerIsAsleep() return self:PlayerHasEffect("SLEEP"); end
function lib:PlayerIsStunned() return self:PlayerHasEffect("STUN"); end
function lib:PlayerIsTurned() return self:PlayerHasEffect("TURN"); end
function lib:PlayerIsBanished() return self:UnitHasEffect("player", "BANISH"); end
function lib:PlayerIsCharmed() return self:UnitHasEffect("player", "CHARM"); end
function lib:PlayerIsConfused() return self:UnitHasEffect("player", "CONFUSE"); end
function lib:PlayerIsDisoriented() return self:UnitHasEffect("player", "DISORIENT"); end
function lib:PlayerIsFeared() return self:UnitHasEffect("player", "FEAR"); end
function lib:PlayerIsFrozen() return self:UnitHasEffect("player", "FREEZE"); end
function lib:PlayerIsHorrified() return self:UnitHasEffect("player", "HORRIFY"); end
function lib:PlayerIsIncapacitated() return self:UnitHasEffect("player", "INCAPACITATE"); end
function lib:PlayerIsPolymorphed() return self:UnitHasEffect("player", "POLYMORPH"); end
function lib:PlayerIsSapped() return self:UnitHasEffect("player", "SAP"); end
function lib:PlayerIsShackled() return self:UnitHasEffect("player", "SHACKLE"); end
function lib:PlayerIsAsleep() return self:UnitHasEffect("player", "SLEEP"); end
function lib:PlayerIsStunned() return self:UnitHasEffect("player", "STUN"); end
function lib:PlayerIsTurned() return self:UnitHasEffect("player", "TURN"); end
 
function lib:PlayerIsDisarmed() return self:PlayerHasEffect("DISARM"); end
function lib:PlayerIsPacified() return self:PlayerHasEffect("PACIFY"); end
function lib:PlayerIsRooted() return self:PlayerHasEffect("ROOT"); end
function lib:PlayerIsSilenced() return self:PlayerHasEffect("SILENCE"); end
function lib:PlayerIsEnsnared() return self:PlayerHasEffect("SNARE"); end
function lib:PlayerIsDisarmed() return self:UnitHasEffect("player", "DISARM"); end
function lib:PlayerIsPacified() return self:UnitHasEffect("player", "PACIFY"); end
function lib:PlayerIsRooted() return self:UnitHasEffect("player", "ROOT"); end
function lib:PlayerIsSilenced() return self:UnitHasEffect("player", "SILENCE"); end
function lib:PlayerIsEnsnared() return self:UnitHasEffect("player", "SNARE"); end
 
--------------------------------------------------------------------------------------------------
-- Global Functions