vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | SpellAlert (modified again) |
||
3 | Author:______Sent |
||
4 | Thanks:______Awen_(Original_Author) |
||
5 | _____________Mithryn_(versions_up_to_1.65) |
||
6 | ]] |
||
7 | |||
8 | local fullString; |
||
9 | local currentTarget; |
||
10 | local partyNum = 0; |
||
11 | local raidNum = 0; |
||
12 | local membersList = {}; |
||
13 | |||
14 | local cType = 0; -- 0=damage, 1=heal, 2=buff-gain, 3=buff-gone, 4=totem, 5=emote, 6=periodic, 7=istant, 8=CC, 9=Misc |
||
15 | |||
16 | -- --------------- -- |
||
17 | -- Event functions -- |
||
18 | -- --------------- -- |
||
19 | |||
20 | function SA_BeginsToCast(mob, spell) |
||
21 | if (SA_TBL_HEALS[spell]) then cType = 1; end |
||
22 | if (SA_TBL_CC[spell]) then cType = 8; end |
||
23 | if ((not SAVars[cType].on) or membersList[mob] or (SAVars[cType].to and (currentTarget ~= mob)) or SA_IGNORE[cType][spell]) then |
||
24 | return; |
||
25 | end |
||
26 | AlertFrame_Show(SAVars[cType].alert, fullString, mob, spell); |
||
27 | end |
||
28 | |||
29 | function SA_BeginsToPerform(mob, spell) |
||
30 | if ((not SAVars[cType].on) or membersList[mob] or (SAVars[cType].to and (currentTarget ~= mob)) or SA_IGNORE[cType][spell]) then |
||
31 | return; |
||
32 | end |
||
33 | AlertFrame_Show(SAVars[cType].alert, fullString, mob, spell); |
||
34 | end |
||
35 | |||
36 | function SA_CastsOn(mob, spell, mob2) |
||
37 | if ((not SAVars[cType].on) or membersList[mob] or (SAVars[cType].to and (currentTarget ~= mob)) or SA_IGNORE[cType][spell]) then |
||
38 | return; |
||
39 | end |
||
40 | AlertFrame_Show(SAVars[cType].alert, fullString, mob, spell); |
||
41 | end |
||
42 | |||
43 | function SA_GainsFrom(mob, num, power, mob2, spell) |
||
44 | if ((not SAVars[cType].on) or membersList[mob2] or (SAVars[cType].to and (currentTarget ~= mob)) or SA_IGNORE[cType][spell]) then |
||
45 | return; |
||
46 | end |
||
47 | AlertFrame_Show(SAVars[cType].alert, fullString, mob, num.." "..power); |
||
48 | end |
||
49 | |||
50 | function SA_GainsX(mob, spell, num) |
||
51 | if ((not SAVars[cType].on) or membersList[mob] or (SAVars[cType].to and (currentTarget ~= mob)) or SA_IGNORE[cType][spell]) then |
||
52 | return; |
||
53 | end |
||
54 | AlertFrame_Show(SAVars[cType].alert, fullString, mob, spell.." ("..num..")"); |
||
55 | end |
||
56 | |||
57 | function SA_Gains(mob, spell) |
||
58 | if ((not SAVars[cType].on) or membersList[mob] or (SAVars[cType].to and (currentTarget ~= mob)) or SA_IGNORE[cType][spell]) then |
||
59 | return; |
||
60 | end |
||
61 | AlertFrame_Show(SAVars[cType].alert, fullString, mob, spell); |
||
62 | end |
||
63 | |||
64 | function SA_FadesFrom(spell, mob) |
||
65 | if ((not SAVars[cType].on) or membersList[mob] or (SAVars[cType].to and (currentTarget ~= mob)) or SA_IGNORE[cType][spell]) then |
||
66 | return; |
||
67 | end |
||
68 | AlertFrame_Show(SAVars[cType].alert, fullString, mob, spell); |
||
69 | end |
||
70 | |||
71 | function SA_OnEvent(event, arg1, arg2) |
||
72 | fullString = arg1; |
||
73 | |||
74 | if (event == "PLAYER_ENTERING_WORLD") then |
||
75 | SA_SMF_Adjust(1); |
||
76 | SA_SMF_Adjust(2); |
||
77 | SA_SMF_Adjust(3); |
||
78 | SA_SMF_UpdateLook(1); |
||
79 | SA_SMF_UpdateLook(2); |
||
80 | SA_SMF_UpdateLook(3); |
||
81 | |||
82 | elseif (event == "VARIABLES_LOADED") then |
||
83 | SA_SAVarsIntegrityCheck(); |
||
84 | |||
85 | elseif (event == "PARTY_MEMBERS_CHANGED") then |
||
86 | local num = GetNumPartyMembers(); |
||
87 | if ((num ~= partyNum) and (GetNumRaidMembers() == 0)) then |
||
88 | partyNum = num; |
||
89 | SA_BuildMembersList(false); |
||
90 | end |
||
91 | |||
92 | elseif (event == "RAID_ROSTER_UPDATE") then |
||
93 | local num = GetNumRaidMembers(); |
||
94 | if (num ~= raidNum) then |
||
95 | raidNum = num; |
||
96 | SA_BuildMembersList(true); |
||
97 | end |
||
98 | |||
99 | elseif (event == "PLAYER_TARGET_CHANGED") then |
||
100 | currentTarget = UnitName("target"); |
||
101 | |||
102 | elseif (not SAVars.on) then return; |
||
103 | elseif (SAVars.offonrest and IsResting()) then return; |
||
104 | |||
105 | elseif (event == "CHAT_MSG_SPELL_CREATURE_VS_CREATURE_DAMAGE") then |
||
106 | cType = 0; |
||
107 | MarsMessageParser_ParseMessage("SpellAlert", arg1); |
||
108 | |||
109 | elseif (event == "CHAT_MSG_SPELL_CREATURE_VS_CREATURE_BUFF") then |
||
110 | cType = 2; |
||
111 | MarsMessageParser_ParseMessage("SpellAlert", arg1); |
||
112 | |||
113 | elseif (event == "CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_BUFFS") then |
||
114 | cType = 6; |
||
115 | MarsMessageParser_ParseMessage("SpellAlert", arg1); |
||
116 | |||
117 | elseif (event == "CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE") then |
||
118 | cType = 0; |
||
119 | MarsMessageParser_ParseMessage("SpellAlert", arg1); |
||
120 | |||
121 | elseif (event == "CHAT_MSG_SPELL_HOSTILEPLAYER_BUFF") then |
||
122 | cType = 2; |
||
123 | MarsMessageParser_ParseMessage("SpellAlert", arg1); |
||
124 | |||
125 | elseif (event == "CHAT_MSG_SPELL_PERIODIC_CREATURE_BUFFS") then |
||
126 | cType = 6; |
||
127 | MarsMessageParser_ParseMessage("SpellAlert", arg1); |
||
128 | |||
129 | elseif (event == "CHAT_MSG_SPELL_AURA_GONE_OTHER") then |
||
130 | cType = 3; |
||
131 | MarsMessageParser_ParseMessage("SpellAlert", arg1); |
||
132 | |||
133 | elseif (event == "CHAT_MSG_MONSTER_EMOTE") then |
||
134 | cType = 5; |
||
135 | if ((not SAVars[cType].on) or (SAVars[cType].to and (currentTarget ~= arg2)) or SA_IGNORE[cType][arg1]) then |
||
136 | return; |
||
137 | end |
||
138 | AlertFrame_Show(SAVars[cType].alert, arg2.." "..arg1, arg2, arg1); |
||
139 | |||
140 | end |
||
141 | end |
||
142 | |||
143 | function SA_BuildMembersList(isRaid) |
||
144 | local max, g, name; |
||
145 | if (isRaid) then |
||
146 | max = 40; |
||
147 | g = "raid"; |
||
148 | else |
||
149 | max = 4; |
||
150 | g = "party"; |
||
151 | end |
||
152 | for i = 1, max do |
||
153 | name = UnitName(g..i); |
||
154 | if (name) then |
||
155 | membersList[name] = true; |
||
156 | end |
||
157 | name = UnitName(g.."pet"..i); |
||
158 | if (name) then |
||
159 | membersList[name] = true; |
||
160 | end |
||
161 | end |
||
162 | end |
||
163 | |||
164 | |||
165 | --==QUESTA NON DOVREBBE STARE QUI==-- |
||
166 | function AlertFrame_Show(num, fullStr, mob, spell) |
||
167 | if (SAVars[cType].short) then |
||
168 | getglobal("SA_SMF"..num):AddMessage(string.gsub(string.gsub(SAVars[cType].shortstr, "$m", mob), "$s", spell), SAVars[cType].r, SAVars[cType].g, SAVars[cType].b); |
||
169 | else |
||
170 | getglobal("SA_SMF"..num):AddMessage(fullStr, SAVars[cType].r, SAVars[cType].g, SAVars[cType].b); |
||
171 | end |
||
172 | end |