vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1  
2 assert(BigWigs, "BigWigs not found!")
3  
4  
5 ------------------------------
6 -- Are you local? --
7 ------------------------------
8  
9 local throt, times = {}, {}
10  
11  
12 ----------------------------------
13 -- Module Declaration --
14 ----------------------------------
15  
16 BigWigsComm = BigWigs:NewModule("Comm")
17  
18  
19 ------------------------------
20 -- Initialization --
21 ------------------------------
22  
23 function BigWigsComm:OnEnable()
24 self:RegisterEvent("CHAT_MSG_ADDON")
25 self:RegisterEvent("BigWigs_SendSync")
26 self:RegisterEvent("BigWigs_ThrottleSync")
27 end
28  
29  
30 ------------------------------
31 -- Event Handlers --
32 ------------------------------
33  
34 function BigWigsComm:CHAT_MSG_ADDON(prefix, message, type, sender)
35 if (prefix ~= "BigWigs" or type ~= "RAID") then return end
36  
37 local _, _, sync, rest = string.find(message, "(%S+)%s*(.*)$")
38 if not sync then return end
39  
40 if not throt[sync] or not times[sync] or (times[sync] + throt[sync]) <= GetTime() then
41 self:TriggerEvent("BigWigs_RecvSync", sync, rest, sender)
42 times[sync] = GetTime()
43 end
44 end
45  
46  
47 function BigWigsComm:BigWigs_SendSync(msg)
48 SendAddonMessage("BigWigs", msg, "RAID")
49 self:CHAT_MSG_ADDON("BigWigs", msg, "RAID", UnitName("player"))
50 end
51  
52  
53 function BigWigsComm:BigWigs_ThrottleSync(msg, time)
54 assert(msg, "No message passed")
55 throt[msg] = time
56 end