vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 -- ChatCast 1.41
2 CHATCAST_VERSION = 1.41
3 ChatCast = {{}}
4 ChatCast_SpellLibrary = {{{{}}}}
5  
6 ChatCast_AddMessage1_Original = nil
7 ChatCast_AddMessage2_Original = nil
8 ChatCast_AddMessage3_Original = nil
9 ChatCast_AddMessage4_Original = nil
10 ChatCast_AddMessage5_Original = nil
11 ChatCast_AddMessage6_Original = nil
12 ChatCast_AddMessage7_Original = nil
13 ChatCast_SetItemRef_Original = nil
14  
15 if CCClass == "PRIEST" then
16 ChatCast_SpellLibrary = {
17 PRIEST = {
18 {
19 spell = CCLocale.PRIEST.Prayer_of_Fortitude,
20 trigger = CCLocale.PRIEST.Prayer_of_Fortitude_trigger,
21 level = 48,
22 rank = { 48, 60 }
23 },
24 {
25 spell = CCLocale.PRIEST.Power_Word_Fortitude,
26 trigger = CCLocale.PRIEST.Power_Word_Fortitude_trigger,
27 level = 1,
28 rank = { 1, 12, 24, 36, 48, 60 }
29 },
30 {
31 spell = CCLocale.PRIEST.Shadow_Protection,
32 trigger = CCLocale.PRIEST.Shadow_Protection_trigger,
33 level = 30,
34 rank = { 30, 42, 56 }
35 },
36 {
37 spell = CCLocale.PRIEST.Power_Word_Shield,
38 trigger = CCLocale.PRIEST.Power_Word_Shield_trigger,
39 level = 6,
40 rank = { 6, 12, 18, 24, 30, 36, 42, 48, 54, 60 }
41 },
42 {
43 spell = CCLocale.PRIEST.Dispel_Magic,
44 trigger = CCLocale.PRIEST.Dispel_Magic_trigger,
45 gains = CCLocale.PRIEST.Dispel_Magic_gains,
46 afflicted = CCLocale.PRIEST.Dispel_Magic_afflicted,
47 level = 18
48 },
49 {
50 spell = CCLocale.PRIEST.Abolish_Disease,
51 trigger = CCLocale.PRIEST.Abolish_Disease_trigger,
52 afflicted = CCLocale.PRIEST.Abolish_Disease_afflicted,
53 level = 24
54 },
55 {
56 spell = CCLocale.PRIEST.Resurrection,
57 trigger = CCLocale.PRIEST.Resurrection_trigger,
58 level = 10,
59 },
60 {
61 spell = CCLocale.PRIEST.Heal,
62 trigger = CCLocale.PRIEST.Heal_trigger,
63 level = 20
64 }
65 }
66 }
67 if CCRace == "Dwarf" then
68 table.insert(ChatCast_SpellLibrary["PRIEST"],
69 {
70 spell = CCLocale.PRIEST.Fear_Ward,
71 trigger = CCLocale.PRIEST.Fear_Ward_trigger,
72 level = 20,
73 })
74 end
75 local _, _, _, _, currentRank = GetTalentInfo(1, 13)
76 if currentRank == 1 then
77 table.insert(ChatCast_SpellLibrary["PRIEST"],
78 {
79 spell = CCLocale.PRIEST.Prayer_of_Spirit,
80 trigger = CCLocale.PRIEST.Prayer_of_Spirit_trigger,
81 level = 60,
82 })
83 table.insert(ChatCast_SpellLibrary["PRIEST"],
84 {
85 spell = CCLocale.PRIEST.Divine_Spirit,
86 trigger = CCLocale.PRIEST.Divine_Spirit_trigger,
87 level = 40,
88 rank = { 40, 42, 54 }
89 })
90 end
91 local _, _, _, _, currentRank = GetTalentInfo(3, 12)
92 if currentRank == 1 then
93 table.insert(ChatCast_SpellLibrary["PRIEST"],
94 {
95 spell = CCLocale.PRIEST.Silence,
96 casting = CCLocale.PRIEST.Silence_casting,
97 level = 30,
98 })
99 end
100  
101 elseif CCClass == "MAGE" then
102 ChatCast_SpellLibrary = {
103 MAGE = {
104 {
105 spell = CCLocale.MAGE.Arcane_Brilliance,
106 trigger = CCLocale.MAGE.Arcane_Brilliance_trigger,
107 level = 56,
108 rank = { 56 }
109 },
110 {
111 spell = CCLocale.MAGE.Arcane_Intellect,
112 trigger = CCLocale.MAGE.Arcane_Intellect_trigger,
113 level = 1,
114 rank = { 1, 14, 28, 42, 56 }
115 },
116 {
117 spell = CCLocale.MAGE.Dampen_Magic,
118 trigger = CCLocale.MAGE.Dampen_Magic_trigger,
119 level = 12,
120 rank = { 12, 24, 36, 48, 60 }
121 },
122 {
123 spell = CCLocale.MAGE.Amplify_Magic,
124 trigger = CCLocale.MAGE.Amplify_Magic_trigger,
125 level = 18,
126 rank = { 18, 30, 42, 54 }
127 },
128 {
129 spell = CCLocale.MAGE.Remove_Lesser_Curse,
130 trigger = CCLocale.MAGE.Remove_Lesser_Curse_trigger,
131 afflicted = CCLocale.MAGE.Remove_Lesser_Curse_afflicted,
132 level = 16
133 },
134 {
135 macro = CCLocale.MAGE.Conjure_Water,
136 trigger = CCLocale.MAGE.Conjure_Water_trigger,
137 level = 4,
138 rank = { 4, 10, 20, 30, 40, 50, 60 },
139 rankitem = CCLocale.MAGE.Conjure_Water_rankitem,
140 spellname = CCLocale.MAGE.Conjure_Water_spellname
141 },
142 {
143 macro = CCLocale.MAGE.Conjure_Food,
144 trigger = CCLocale.MAGE.Conjure_Food_trigger,
145 level = 6,
146 rank = { 6, 12, 22, 32, 42, 52 },
147 rankitem = CCLocale.MAGE.Conjure_Food_rankitem,
148 spellname = CCLocale.MAGE.Conjure_Food_spellname
149 },
150 {
151 spell = CCLocale.MAGE.Counterspell,
152 casting = CCLocale.MAGE.Counterspell_casting,
153 level = 24
154 }
155 }
156 }
157 elseif CCClass == "DRUID" then
158 ChatCast_SpellLibrary = {
159 DRUID = {
160 {
161 spell = CCLocale.DRUID.Gift_of_the_Wild,
162 trigger = CCLocale.DRUID.Gift_of_the_Wild_trigger,
163 level = 50,
164 rank = { 50, 60 }
165 },
166 {
167 spell = CCLocale.DRUID.Mark_of_the_Wild,
168 trigger = CCLocale.DRUID.Mark_of_the_Wild_trigger,
169 level = 1,
170 rank = { 1, 10, 20, 30, 40, 50, 60 }
171 },
172 {
173 spell = CCLocale.DRUID.Thorns,
174 trigger = CCLocale.DRUID.Thorns_trigger,
175 level = 6,
176 rank = { 6, 14, 24, 34, 44, 54 }
177 },
178 {
179 spell = CCLocale.DRUID.Remove_Curse,
180 trigger = CCLocale.DRUID.Remove_Curse_trigger,
181 afflicted = CCLocale.DRUID.Remove_Curse_afflicted,
182 level = 24
183 },
184 {
185 spell = CCLocale.DRUID.Abolish_Poison,
186 trigger = CCLocale.DRUID.Abolish_Poison_trigger,
187 afflicted = CCLocale.DRUID.Abolish_Poison_afflicted,
188 level = 26
189 },
190 {
191 spell = CCLocale.DRUID.Rebirth,
192 trigger = CCLocale.DRUID.Rebirth_trigger,
193 level = 20,
194 },
195 {
196 spell = CCLocale.DRUID.Heal,
197 trigger = CCLocale.DRUID.Heal_trigger,
198 level = 12
199 },
200 {
201 spell = CCLocale.DRUID.Hibernate,
202 gains = CCLocale.DRUID.Hibernate_gains,
203 level = 18,
204 rank = { 18, 38, 58 }
205 }
206 }
207 }
208  
209 local _, _, _, _, currentRank = GetTalentInfo(3, 15)
210 if currentRank == 1 then
211 table.insert(ChatCast_SpellLibrary["DRUID"],
212 {
213 spell = CCLocale.DRUID.Innervate,
214 trigger = CCLocale.DRUID.Innervate_trigger,
215 level = 40
216 })
217 end
218  
219 elseif CCClass == "PALADIN" then
220 ChatCast_SpellLibrary = {
221 PALADIN = {
222 {
223 spell = CCLocale.PALADIN.Blessing_of_Might,
224 trigger = CCLocale.PALADIN.Blessing_of_Might_trigger,
225 level = 4,
226 rank = { 4, 12, 22, 32, 42, 52 }
227 },
228 {
229 spell = CCLocale.PALADIN.Blessing_of_Wisdom,
230 trigger = CCLocale.PALADIN.Blessing_of_Wisdom_trigger,
231 level = 14,
232 rank = { 14, 24, 34, 44, 54 }
233 },
234 {
235 spell = CCLocale.PALADIN.Blessing_of_Freedom,
236 trigger = CCLocale.PALADIN.Blessing_of_Freedom_trigger,
237 afflicted = CCLocale.PALADIN.Blessing_of_Freedom_afflicted,
238 level = 18
239 },
240 {
241 spell = CCLocale.PALADIN.Blessing_of_Light,
242 trigger = CCLocale.PALADIN.Blessing_of_Light_trigger,
243 level = 40,
244 rank = { 40, 50, 60 }
245 },
246 {
247 spell = CCLocale.PALADIN.Blessing_of_Sacrifice,
248 trigger = CCLocale.PALADIN.Blessing_of_Sacrifice_trigger,
249 level = 46,
250 rank = { 46, 54 }
251 },
252 {
253 spell = CCLocale.PALADIN.Blessing_of_Salvation,
254 trigger = CCLocale.PALADIN.Blessing_of_Salvation_trigger,
255 level = 26
256 },
257 {
258 spell = CCLocale.PALADIN.Cleanse,
259 trigger = CCLocale.PALADIN.Cleanse_trigger,
260 afflicted = CCLocale.PALADIN.Cleanse_afflicted,
261 level = 32
262 },
263 {
264 spell = CCLocale.PALADIN.Purify,
265 trigger = CCLocale.PALADIN.Purify_trigger,
266 afflicted = CCLocale.PALADIN.Purify_afflicted,
267 level = 18
268 },
269 {
270 spell = CCLocale.PALADIN.Redemption,
271 trigger = CCLocale.PALADIN.Redemption_trigger,
272 level = 12,
273 },
274 {
275 spell = CCLocale.PALADIN.Heal,
276 trigger = CCLocale.PALADIN.Heal_trigger,
277 level = 20
278 },
279 {
280 spell = CCLocale.PALADIN.Greater_Blessing_of_Might,
281 trigger = CCLocale.PALADIN.Greater_Blessing_of_Might_trigger,
282 level = 52,
283 },
284 {
285 spell = CCLocale.PALADIN.Greater_Blessing_of_Wisdom,
286 trigger = CCLocale.PALADIN.Greater_Blessing_of_Wisdom_trigger,
287 level = 54,
288 },
289 {
290 spell = CCLocale.PALADIN.Greater_Blessing_of_Light,
291 trigger = CCLocale.PALADIN.Greater_Blessing_of_Light_trigger,
292 level = 60,
293 },
294 {
295 spell = CCLocale.PALADIN.Greater_Blessing_of_Salvation,
296 trigger = CCLocale.PALADIN.Greater_Blessing_of_Salvation_trigger,
297 level = 60,
298 },
299 }
300 }
301 local _, _, _, _, currentRank = GetTalentInfo(2,6)
302 if currentRank == 1 then
303 table.insert(ChatCast_SpellLibrary["PALADIN"],
304 {
305 spell = CCLocale.PALADIN.Blessing_of_Kings,
306 trigger = CCLocale.PALADIN.Blessing_of_Kings_trigger,
307 level = 40
308 })
309 table.insert(ChatCast_SpellLibrary["PALADIN"],
310 {
311 spell = CCLocale.PALADIN.Greater_Blessing_of_Kings,
312 trigger = CCLocale.PALADIN.Greater_Blessing_of_Kings_trigger,
313 level = 60,
314 })
315 end
316 local _, _, _, _, currentRank = GetTalentInfo(2,12)
317 if currentRank == 1 then
318 table.insert(ChatCast_SpellLibrary["PALADIN"],
319 {
320 spell = CCLocale.PALADIN.Blessing_of_Sanctuary,
321 trigger = CCLocale.PALADIN.Blessing_of_Sanctuary_trigger,
322 level = 20,
323 rank = { 20, 30, 40, 50, 60 }
324 })
325 table.insert(ChatCast_SpellLibrary["PALADIN"],
326 {
327 spell = CCLocale.PALADIN.Greater_Blessing_of_Sanctuary,
328 trigger = CCLocale.PALADIN.Greater_Blessing_of_Sanctuary_trigger,
329 level = 60,
330 })
331 end
332 elseif CCClass == "SHAMAN" then
333 ChatCast_SpellLibrary = {
334 SHAMAN = {
335 {
336 spell = CCLocale.SHAMAN.Cure_Poison,
337 trigger = CCLocale.SHAMAN.Cure_Poison_trigger,
338 afflicted = CCLocale.SHAMAN.Cure_Poison_afflicted,
339 level = 16
340 },
341 {
342 spell = CCLocale.SHAMAN.Cure_Disease,
343 trigger = CCLocale.SHAMAN.Cure_Disease_trigger,
344 afflicted = CCLocale.SHAMAN.Cure_Disease_afflicted,
345 level = 22
346 },
347 {
348 spell = CCLocale.SHAMAN.Water_Breathing,
349 trigger = CCLocale.SHAMAN.Water_Breathing_trigger,
350 level = 22
351 },
352 {
353 spell = CCLocale.SHAMAN.Ancestral_Spirit,
354 trigger = CCLocale.SHAMAN.Ancestral_Spirit_trigger,
355 level = 12,
356 },
357 {
358 spell = CCLocale.SHAMAN.Heal,
359 trigger = CCLocale.SHAMAN.Heal_trigger,
360 level = 20
361 },
362 {
363 spell = CCLocale.SHAMAN.Water_Walking,
364 trigger = CCLocale.SHAMAN.Water_Walking_trigger,
365 level = 28
366 },
367 {
368 spell = CCLocale.SHAMAN.Purge,
369 gains = CCLocale.SHAMAN.Purge_gains,
370 level = 12
371 },
372 {
373 spell = CCLocale.SHAMAN.Earth_Shock,
374 casting = CCLocale.SHAMAN.Earth_Shock_casting,
375 level = 4
376 }
377 }
378 }
379 local _, _, _, _, currentRank = GetTalentInfo(3, 14)
380 if currentRank == 1 then
381 table.insert(ChatCast_SpellLibrary["SHAMAN"],
382 {
383 spell = CCLocale.SHAMAN.Mana_Tide,
384 trigger = CCLocale.SHAMAN.Mana_Tide.trigger,
385 level = 40,
386 rank = { 40, 48, 58 }
387 })
388 end
389  
390 elseif CCClass == "WARLOCK" then
391 ChatCast_SpellLibrary = {
392 WARLOCK = {
393 {
394 spell = CCLocale.WARLOCK.Unending_Breath,
395 trigger = CCLocale.WARLOCK.Unending_Breath_trigger,
396 level = 16
397 },
398 {
399 spell = CCLocale.WARLOCK.Detect_Greater_Invisibility,
400 trigger = CCLocale.WARLOCK.Detect_Greater_Invisibility_trigger,
401 level = 50
402 },
403 {
404 spell = CCLocale.WARLOCK.Ritual_of_Summoning,
405 trigger = CCLocale.WARLOCK.Ritual_of_Summoning_trigger,
406 level = 20,
407 leavetargeted = true
408 },
409 {
410 macro = CCLocale.WARLOCK.Healthstone,
411 trigger = CCLocale.WARLOCK.Healthstone_trigger,
412 rank = { 10, 22, 34, 46, 58 },
413 rankitem = CCLocale.WARLOCK.Healthstone_rankitem,
414 spellname = CCLocale.WARLOCK.Healthstone_spellname
415 },
416 {
417 macro = CCLocale.WARLOCK.Soulstone,
418 trigger = CCLocale.WARLOCK.Soulstone_trigger,
419 rank = { 18, 30, 40, 50, 60 },
420 rankitem = CCLocale.WARLOCK.Soulstone_rankitem,
421 spellname = CCLocale.WARLOCK.Soulstone_spellname
422 }
423 }
424 }
425 end
426 table.insert(ChatCast_SpellLibrary, "GENERAL")
427 ChatCast_SpellLibrary["GENERAL"] = {
428 --invite entries have to be the first 5 entries for toggle invites to work
429 {
430 macro = CCLocale.GENERAL.AskInvite,
431 trigger = CCLocale.GENERAL.AskInvite_trigger
432 },
433 {
434 macro = CCLocale.GENERAL.Invite_Target,
435 trigger = CCLocale.GENERAL.Invite_Target_trigger
436 },
437 {
438 macro = CCLocale.GENERAL.Invite,
439 trigger = CCLocale.GENERAL.Invite_trigger
440 },
441 {
442 macro = CCLocale.GENERAL.PST,
443 trigger = CCLocale.GENERAL.PST_trigger
444 },
445 {
446 macro = CCLocale.GENERAL.LFM,
447 macro_alt = CCLocale.GENERAL.LFM_alt,
448 trigger = CCLocale.GENERAL.LFM_trigger
449 },
450 {
451 macro = CCLocale.GENERAL.ChatCast,
452 trigger = CCLocale.GENERAL.ChatCast_trigger
453 }
454 }
455  
456  
457 function ChatCast_OnEvent()
458 if (event == "VARIABLES_LOADED") then
459 ChatCast_Startup();
460 elseif (event == "UI_ERROR_MESSAGE" or event == "SPELLCAST_INTERRUPT") then
461 ChatCast_SpellError();
462 elseif (event == "PLAYER_ENTER_COMBAT") then
463 CC_WasAttacking = true
464 elseif (event == "PLAYER_LEAVE_COMBAT") then
465 CC_WasAttacking = nil
466 if CC_AttackTimer and CC_AttackTimer > 0 then ChatCastFrame:Show() end
467 end
468  
469 if (ChatCast.Trading) or ChatCastFrame:IsShown() then
470 ChatCast_Trade_OnEvent()
471 end
472 end
473  
474 function ChatCast_OnLoad()
475 this:RegisterEvent("VARIABLES_LOADED");
476 this:RegisterEvent("UI_ERROR_MESSAGE");
477 this:RegisterEvent("PLAYER_ENTER_COMBAT");
478 this:RegisterEvent("PLAYER_LEAVE_COMBAT");
479 if (CCClass == "WARLOCK" or CCClass == "MAGE") then ChatCast_Trade_OnLoad() end
480 end
481  
482 function ChatCast_AddMessage1(t, s, ...)
483 s = ChatCast_Decompose (s)
484 ChatCast_AddMessage1_Original (t, s, unpack (arg))
485 end
486  
487 function ChatCast_AddMessage2(t, s, ...)
488 s = ChatCast_Decompose (s)
489 ChatCast_AddMessage2_Original (t, s, unpack (arg))
490 end
491  
492 function ChatCast_AddMessage3(t, s, ...)
493 s = ChatCast_Decompose (s)
494 ChatCast_AddMessage3_Original (t, s, unpack (arg))
495 end
496  
497 function ChatCast_AddMessage4(t, s, ...)
498 s = ChatCast_Decompose (s)
499 ChatCast_AddMessage4_Original (t, s, unpack (arg))
500 end
501  
502 function ChatCast_AddMessage5(t, s, ...)
503 s = ChatCast_Decompose (s)
504 ChatCast_AddMessage5_Original (t, s, unpack (arg))
505 end
506  
507 function ChatCast_AddMessage6(t, s, ...)
508 s = ChatCast_Decompose (s)
509 ChatCast_AddMessage6_Original (t, s, unpack (arg))
510 end
511  
512 function ChatCast_AddMessage7(t, s, ...)
513 s = ChatCast_Decompose (s)
514 ChatCast_AddMessage7_Original (t, s, unpack (arg))
515 end
516  
517 function ChatCast_FC_IncomingMessage(Name, Text)
518 Text = ChatCast_BuffSub(Text,Name)
519 ChatCast_FC_IncomingMessage_Original(Name, Text)
520 end
521  
522 function ChatCast_HM_Output_Multiwindow(OriginatingUnit, TargetUnit, SpecialAttack, VerboseMessage, Option, Message, Crit, ChatMessage, ChatEvent)
523 if SpecialAttack then SpecialAttack = ChatCast_HM_Process(OriginatingUnit, SpecialAttack, VerboseMessage, ChatEvent) end
524 ChatCast_HM_Output_Multiwindow_Original(OriginatingUnit, TargetUnit, SpecialAttack, VerboseMessage, Option, Message, Crit, ChatMessage, ChatEvent)
525 end
526  
527 function ChatCast_Startup()
528 if DEFAULT_CHAT_FRAME.AddMessage ~= ChatCast_AddMessage1 then
529 ChatCast_AddMessage1_Original = DEFAULT_CHAT_FRAME.AddMessage
530 DEFAULT_CHAT_FRAME.AddMessage = ChatCast_AddMessage1
531 end
532 if ChatFrame2 and ChatFrame2.AddMessage ~= ChatCast_AddMessage2 then
533 ChatCast_AddMessage2_Original = ChatFrame2.AddMessage
534 ChatFrame2.AddMessage = ChatCast_AddMessage2
535 end
536 if ChatFrame3 and ChatFrame3.AddMessage ~= ChatCast_AddMessage3 then
537 ChatCast_AddMessage3_Original = ChatFrame3.AddMessage
538 ChatFrame3.AddMessage = ChatCast_AddMessage3
539 end
540 if ChatFrame4 and ChatFrame4.AddMessage ~= ChatCast_AddMessage4 then
541 ChatCast_AddMessage4_Original = ChatFrame4.AddMessage
542 ChatFrame4.AddMessage = ChatCast_AddMessage4
543 end
544 if ChatFrame5 and ChatFrame5.AddMessage ~= ChatCast_AddMessage5 then
545 ChatCast_AddMessage5_Original = ChatFrame5.AddMessage
546 ChatFrame5.AddMessage = ChatCast_AddMessage5
547 end
548 if ChatFrame6 and ChatFrame6.AddMessage ~= ChatCast_AddMessage6 then
549 ChatCast_AddMessage6_Original = ChatFrame6.AddMessage
550 ChatFrame6.AddMessage = ChatCast_AddMessage6
551 end
552 if ChatFrame7 and ChatFrame7.AddMessage ~= ChatCast_AddMessage7 then
553 ChatCast_AddMessage7_Original = ChatFrame7.AddMessage
554 ChatFrame7.AddMessage = ChatCast_AddMessage7
555 end
556 if FC_IncomingMessage and FC_IncomingMessage ~= ChatCast_FC_IncomingMessage then
557 ChatCast_FC_IncomingMessage_Original = FC_IncomingMessage
558 FC_IncomingMessage = ChatCast_FC_IncomingMessage
559 end
560 if HM_Output_Multiwindow and HM_Output_Multiwindow ~= ChatCast_HM_Output_Multiwindow then
561 ChatCast_HM_Output_Multiwindow_Original = HM_Output_Multiwindow
562 HM_Output_Multiwindow = ChatCast_HM_Output_Multiwindow
563 end
564  
565 ChatCast_SetItemRef_Original = SetItemRef
566 SetItemRef = ChatCast_SetItemRef
567  
568 SlashCmdList["CHATCASTOPTIONS"] = ChatCast_Options;
569 SLASH_CHATCASTOPTIONS1 = "/cc";
570 SLASH_CHATCASTOPTIONS2 = "/chatcast";
571  
572 if ChatCast.Brackets == nil then
573 ChatCast.Brackets = false
574 end
575 if ChatCast.Color == nil or ChatCast.Color.rgb == nil then
576 ChatCast.Color = { rgb = "FFEE20" }
577 end
578 if ChatCast.Invites == nil then
579 ChatCast.Invites = true
580 end
581 if ChatCast.Feedback == nil then
582 ChatCast.Feedback = false
583 end
584 if ChatCast.Sound == nil then
585 ChatCast.Sound = true
586 end
587 if ChatCast.LFM == nil then
588 ChatCast.LFM = CCLocale.UI.text.LFM_default
589 end
590 if ChatCast.LFMAlt == nil then
591 ChatCast.LFMAlt = false
592 end
593 if ChatCast.LastLink == nil then
594 ChatCast.LastLink = true
595 end
596 if ChatCast.HitsMode == nil then
597 ChatCast.HitsMode = true
598 end
599  
600 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.loaded, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL") .. " " .. CHATCAST_VERSION))
601 end
602  
603 function ChatCast_Decompose (chatstring)
604 if chatstring ~= nil then
605 local _, premsg, name, postname, msg
606 if not (string.find(chatstring, CCLocale.UI.text.trade_channel) or string.find(chatstring, CCLocale.UI.text.tell_prefix)) then
607 if string.find(chatstring, "player:%a+") then
608 _, _, premsg, name, postname, msg = string.find(chatstring, "(.*player:)(%a+)(.- )(.+)")
609 elseif string.find(chatstring, CCLocale.emote_heal) or string.find(chatstring, CCLocale.emote_mana) then
610 _, _, name = string.find(chatstring, "^(%a+)")
611 end
612 if name then
613 if premsg then
614 chatstring = premsg..name..postname..ChatCast_BuffSub(msg, name)
615 else
616 chatstring = ChatCast_BuffSub(chatstring, name)
617 end
618 end
619 end
620 end
621 return chatstring
622 end
623  
624 function ChatCast_BuffSub(msg, name, mode)
625 local posA,posB,ccvar,trigger_set, trim
626 if not mode then mode = "CHAT" end
627 if string.sub(msg, 1, 1) ~= " " then msg = " "..msg; trim = 1 end
628 if name and (CCtest == nil and name ~= UnitName("player") or CCtest == 1)then
629 local lower_msg = string.lower(msg)
630 for _, section in { "GENERAL", ChatCast_SpellLibrary[CCClass] and CCClass } do
631 for i, entry in ChatCast_SpellLibrary[section] do
632  
633 -- if mode ~= "CHAT" and section == "GENERAL" then break end
634 if mode == "CHAT" and entry.trigger then trigger_set = entry.trigger
635 elseif mode == "FADES" and entry.spell then trigger_set = { string.lower(entry.spell) }
636 elseif mode == "GAINS" and entry.gains then trigger_set = entry.gains
637 elseif mode == "AFFLICTED" and entry.afflicted then trigger_set = entry.afflicted
638 elseif mode == "CASTING" and entry.casting then trigger_set = entry.casting
639 else trigger_set = { "" } end
640 for j, trigger in trigger_set do
641 if trigger_set[1] == "" then break end
642 if (ChatCast.Invites == false and section == "GENERAL" and i < 6) then break
643 elseif (entry.level and UnitLevel("player") < entry.level) then break else
644 trigger = string.gsub(trigger, "%$w", "(%%a+)")
645 --Scan for triggers in the middle of a line
646 --Check the end of line for trigger
647 posA,posB,ccvar = string.find(lower_msg, "[%s%p]"..trigger.."%s*$")
648 if posA ~= nil then
649 local _,linkopen = string.gsub(msg, "|H", "|H")
650 local _,linkclose = string.gsub(msg, "|h", "|h")
651 if linkopen * 2 == linkclose and not string.find(string.sub(msg,posA+1),"|H") then
652 if not ccvar then
653 msg = string.sub(msg, 1, posA) .. ChatCast_CreateLink(i,string.sub(msg,posA+1),name,section,mode)
654 lower_msg = string.lower(msg)
655 elseif string.len(ccvar) > 3 and not string.find(CCLocale.DoNotAllow, ccvar..",") then
656 msg = string.sub(msg, 1, posA) .. ChatCast_CreateLink(i,string.sub(msg,posA+1),name .."#"..string.gsub(ccvar, "^%a", string.upper),section,mode)
657 lower_msg = string.lower(msg)
658 end
659 end
660 end
661 for posB = 1, 255, 1 do
662 posA,posB,ccvar = string.find(lower_msg, "[^%a%d%[|\"']"..trigger.."[^%a%d%]|]", posB)
663 if posA ~= nil then
664 local _,linkopen = string.gsub(string.sub(msg,1,posA+1), "|H", "|H")
665 local _,linkclose = string.gsub(string.sub(msg,1,posA+1), "|h", "|h")
666 if linkopen * 2 == linkclose and not string.find(string.sub(msg,posA+1,posB-1), "|H") then
667 if not ccvar then
668 local templink = ChatCast_CreateLink(i,string.sub(msg,posA+1,posB-1),name,section,mode)
669 msg = string.sub(msg, 1, posA) .. templink .. string.sub(msg,posB)
670 lower_msg = string.lower(msg)
671 posB = posB + string.len(templink) - string.len(trigger) - 1
672 elseif string.len(ccvar) > 3 and not string.find(CCLocale.DoNotAllow, ccvar..",") then
673 local templink = ChatCast_CreateLink(i,string.sub(msg,posA+1,posB-1),name .."#"..string.gsub(ccvar, "^%a", string.upper),section,mode)
674 msg = string.sub(msg, 1, posA) .. templink .. string.sub(msg,posB)
675 lower_msg = string.lower(msg)
676 posB = posB + string.len(templink) - string.len(trigger..ccvar) - 1
677 else
678 posB = posB + string.len(trigger) - 1
679 end
680 else
681 posB = posB + string.len(trigger) - 1
682 end
683 else break
684 end
685 end
686 end
687 end
688 end
689 end
690 end
691 if trim then msg = string.sub(msg, 2) end
692 return msg
693 end
694  
695 function ChatCast_CreateLink(buff,link,name,section,mode)
696 if not mode then mode = "CHAT" end
697 section = (section == "GENERAL" and "macro" or "buff")
698 link = (mode == "CHAT" and "|CFF" .. ChatCast.Color.rgb or "" ) .. "|H" .. section .. buff .. ":" .. name .. "|h" .. (ChatCast.Brackets and "[" .. link .. "]|h|r" or link .. "|h|r")
699 if (section == "buff") or (section == "macro" and buff ~= 1 and buff ~= 4 and buff ~= 5) then
700 lastlink = section .. buff..":"..name
701 end
702 if section == "buff" and mode == "CHAT" then
703 lastbuff = lastlink
704 end
705 return link
706 end
707  
708 function ChatCast_FindUnit(realname)
709 realname = string.lower(realname)
710 if realname == "you" or realname == string.lower(UnitName("player")) then
711 return "player"
712 end
713 for i, trialUnit in { "party1", "party2", "party3", "party4" } do
714 if ( UnitName(trialUnit) and realname == string.lower(UnitName(trialUnit))) then
715 return trialUnit
716 end
717 end
718 for i=1,40,1 do
719 local trialUnit = "raid"..i;
720 if ( UnitName(trialUnit) and realname == string.lower(UnitName(trialUnit))) then
721 return trialUnit
722 end
723 end
724 return false
725 end
726  
727 function ChatCast_Target(realname)
728 if not realname then return false
729 else
730 realname = string.lower(realname)
731 if UnitExists("target") and realname == string.lower(UnitName("target")) then return true end
732 end
733 local targetid = ChatCast_FindUnit(realname)
734 if targetid then
735 TargetUnit(targetid)
736 return true
737 end
738 TargetByName(realname);
739 if ( UnitName("target") and realname == string.lower(UnitName("target"))) then
740 return true
741 end
742 return false
743 end
744  
745 function ChatCast_SpellError()
746 CCSpellError = arg1
747 end
748  
749 function ChatCast_FindSpell(target_spell,target_rank)
750 local i, spell_name, spell_rank, tempid = 1
751 target_rank = string.format(CCLocale.UI.rank, target_rank)
752 while true do
753 spell_name, spell_rank = GetSpellName(i, 1)
754 if not spell_name then
755 break
756 elseif spell_name == target_spell then
757 if "("..spell_rank..")" == target_rank then
758 return i, spell_rank
759 else
760 tempid = i
761 temprank = spell_rank
762 end
763 end
764 i = i + 1
765 end
766 return tempid, temprank
767 end
768  
769 function ChatCast_Cast(buffnumber, realname, targetname)
770 local oldtarget, targetisenemy, target_rank, spell_name, spell_rank, unitID
771 if targetname then realname = targetname end
772 if (ChatCast_SpellLibrary[CCClass][buffnumber].gains and UnitCanAttack("player", "target")) or (UnitIsFriend("player", "target") and string.lower(UnitName("target")) ~= string.lower(realname)) then
773 else
774 unitID = ChatCast_FindUnit(realname)
775 end
776 oldtarget = UnitName("target")
777 if (unitID or ChatCast_Target(realname)) then
778 CCSpellError = nil
779 if (ChatCast_SpellLibrary[CCClass][buffnumber].rank) and UnitLevel("player") - 10 > UnitLevel(unitID or "target") then
780 for x=1, table.getn(ChatCast_SpellLibrary[CCClass][buffnumber].rank), 1 do
781 if (UnitLevel(unitID or "target") >= (ChatCast_SpellLibrary[CCClass][buffnumber].rank[x]-10)) then
782 target_rank = x;
783 end
784 end
785 local tempid = ChatCast_FindSpell(ChatCast_SpellLibrary[CCClass][buffnumber].spell, target_rank)
786 if tempid then
787 CastSpell(tempid, 1)
788 --CastSpellByName(ChatCast_SpellLibrary[CCClass][buffnumber].spell .. "("..temprank..")")
789 elseif ChatCast.Feedback then DEFAULT_CHAT_FRAME:AddMessage(CCLocale.UI.fb_unknownspell) end
790 else
791 CastSpellByName(ChatCast_SpellLibrary[CCClass][buffnumber].spell);
792 end
793 if ChatCast.Feedback == true then
794 if CCSpellError then
795 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.fb_castfail, ChatCast_SpellLibrary[CCClass][buffnumber].spell, realname, CCSpellError))
796 else
797 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.fb_casting, ChatCast_SpellLibrary[CCClass][buffnumber].spell, realname))
798 end
799 end
800 elseif ChatCast.Feedback then DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.fb_targetfail, realname))
801 end;
802 if SpellIsTargeting() then
803 if unitID then SpellTargetUnit(unitID) else SpellStopTargeting() end;
804 end
805 if not ChatCast_SpellLibrary[CCClass][buffnumber].leavetargeted and UnitName("target") ~= oldtarget then
806 if oldtarget then TargetLastTarget(); if CC_WasAttacking then CC_AttackTimer = 0.5 end
807 else ClearTarget() end;
808 end
809 end
810  
811 function ChatCast_LastLink()
812 if lastlink then
813 if ChatCast.LastLink then
814 ChatCast_SetItemRef(lastbuff)
815 else
816 ChatCast_SetItemRef(lastlink)
817 end
818 end
819 end
820  
821 function ChatCast_SetItemRef(link, text, button)
822 local entry = nil
823 if ( strsub(link, 1, 4) == "buff" ) then
824 entry = CCClass
825 elseif (strsub(link,1,5) == "macro") then
826 entry = "GENERAL"
827 end
828 if entry then
829 local entrynumber, realname, targetname, macro
830 if string.find(link,"#") then _,_,entrynumber,realname,targetname = string.find(link,"(%d+):([%a%s]+)#([%a%s]+)")
831 else _,_,entrynumber,realname = string.find(link,"(%d+):([%a%s]+)");end
832 entrynumber = tonumber(entrynumber)
833 if(ChatCast.Sound) then PlaySound("igMainMenuOption");end
834 if ChatCast_SpellLibrary[entry][entrynumber].spell then
835 ChatCast_Cast(entrynumber,realname,targetname)
836 elseif ChatCast_SpellLibrary[entry][entrynumber].macro then
837 if (ChatCast_SpellLibrary[entry][entrynumber].macro_alt and ChatCast.LFMAlt) then
838 macro = tostring(ChatCast_SpellLibrary[entry][entrynumber].macro_alt)
839 else
840 macro = tostring(ChatCast_SpellLibrary[entry][entrynumber].macro)
841 end
842 macro = gsub(macro, "$p", realname)
843 if targetname then macro = gsub(macro, "$w", targetname) end
844 RunScript(macro)
845 end
846 return;
847 end
848 ChatCast_SetItemRef_Original(link, text, button);
849 end
850 -- Color functions
851 function ChatCast_ColorPicker()
852 if (ColorPickerFrame:IsShown()) then
853 ChatCast_ColorPicker_Cancelled(ColorPickerFrame.previousValues)
854 ColorPickerFrame:Hide()
855 else
856 ChatCast.Color.Changed = false
857 local r,g,b = string.sub(ChatCast.Color.rgb,1,2), string.sub(ChatCast.Color.rgb,3,4), string.sub(ChatCast.Color.rgb,5,6)
858 r = tonumber(r, 16)/255
859 g = tonumber(g,16)/255
860 b = tonumber(b,16)/255
861 ColorPickerFrame.previousValues = {r, g, b};
862 ColorPickerFrame.hasOpacity = false;
863 ColorPickerFrame:SetColorRGB(r, g, b);
864 ColorPickerFrame.cancelFunc = ChatCast_ColorPicker_Cancelled;
865 ColorPickerFrame.func = ChatCast_ColorPicker_ColorChanged;
866 ColorPickerFrame:Show();
867 end
868 end
869  
870 function ChatCast_ColorPicker_Cancelled(color)
871 ChatCast_MakeColor(color[1],color[2],color[3])
872 end
873  
874 function ChatCast_ColorPicker_ColorChanged()
875 local r, g, b = ColorPickerFrame:GetColorRGB()
876 if (not ColorPickerFrame:IsShown() and ChatCast.Color.Changed == true) then
877 ChatCast.Color.Changed = nil
878 ChatCast_MakeColor(r,g,b)
879 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.color_changed, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL"), "|CFF" .. ChatCast.Color.rgb .. "" .. ChatCast.Color.rgb))
880 else ChatCast.Color.Changed = true
881 end
882 end
883  
884 function ChatCast_round(n)
885 return (ceil(n) - n <= n - floor(n)) and ceil(n) or floor(n)
886 end
887  
888 function ChatCast_MakeColor(r,g,b)
889 r,g,b = ChatCast_round(r*255),ChatCast_round(g*255),ChatCast_round(b*255)
890 r = string.format("%X",r)
891 g = string.format("%X",g)
892 b = string.format("%X",b)
893 if string.len(r) == 1 then r = "0"..r;end
894 if string.len(g) == 1 then g = "0"..g;end
895 if string.len(b) == 1 then b = "0"..b;end
896 ChatCast.Color.rgb = r..g..b
897 end
898  
899 -- Options functions
900 function ChatCast_Options(arg1)
901 if (arg1 == "" or arg1 == nil) then
902 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.options_list, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL") .. " " .. CHATCAST_VERSION))
903 DEFAULT_CHAT_FRAME:AddMessage(CCLocale.UI.text.options_color)
904 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.options_brackets, (ChatCast.Brackets and CCLocale.UI.text.options_on or CCLocale.UI.text.options_off)))
905 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.options_sound, (ChatCast.Sound and CCLocale.UI.text.options_on or CCLocale.UI.text.options_off)))
906 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.options_feedback, (ChatCast.Feedback and CCLocale.UI.text.options_on or CCLocale.UI.text.options_off)))
907 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.options_invites, (ChatCast.Invites and CCLocale.UI.text.options_on or CCLocale.UI.text.options_off)))
908 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.options_autosend, (ChatCast.LFMAlt and CCLocale.UI.text.options_off or CCLocale.UI.text.options_on)))
909 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.options_LFM, ChatCast.LFM))
910 DEFAULT_CHAT_FRAME:AddMessage(CCLocale.UI.text.options_lastlink)
911 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.options_hitsmode, (ChatCast.HitsMode and CCLocale.UI.text.options_on or CCLocale.UI.text.options_off)))
912 elseif string.find(string.lower(arg1),CCLocale.UI.text.slash_color) then
913 ChatCast_ToggleColor(ChatCast_OpArg(arg1))
914 elseif string.find(string.lower(arg1),CCLocale.UI.text.slash_brackets) then
915 ChatCast_ToggleBrackets(ChatCast_OpArg(arg1))
916 elseif string.find(string.lower(arg1),CCLocale.UI.text.slash_invites) then
917 ChatCast_ToggleInvites(ChatCast_OpArg(arg1))
918 elseif string.find(string.lower(arg1),CCLocale.UI.text.slash_feedback) then
919 ChatCast_ToggleFeedback(ChatCast_OpArg(arg1))
920 elseif string.find(string.lower(arg1),CCLocale.UI.text.slash_sound) then
921 ChatCast_ToggleSound(ChatCast_OpArg(arg1))
922 elseif string.find(string.lower(arg1),CCLocale.UI.text.slash_lfmtext) then
923 ChatCast_SetLFM(ChatCast_OpArg(arg1))
924 elseif string.find(string.lower(arg1),CCLocale.UI.text.slash_lfm) then
925 ChatCast_ToggleLFM(ChatCast_OpArg(arg1))
926 elseif string.find(string.lower(arg1),CCLocale.UI.text.slash_lastlink) then
927 ChatCast_ToggleLastLink(ChatCast_OpArg(arg1))
928 elseif string.find(string.lower(arg1),CCLocale.UI.text.slash_hitsmode) then
929 ChatCast_ToggleHitsMode(ChatCast_OpArg(arg1))
930 end
931 end
932  
933 function ChatCast_OpArg(arg1)
934 local posA,posB=string.find(arg1, "%s");
935 if posB then return string.sub(arg1,posB+1);end
936 return nil
937 end
938  
939 function ChatCast_SetLFM(arg)
940 if arg == nil or arg == "" then ChatCast.LFM = ""
941 elseif arg == "reset" or arg == "default" then ChatCast.LFM = CCLocale.UI.text.LFM_default
942 else ChatCast.LFM = arg
943 end
944 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.LFM_set, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL"), ChatCast.LFM))
945 end
946  
947 function ChatCast_ToggleLFM(arg)
948 if arg == nil or arg == "" then arg = ChatCast.LFMAlt end
949 if (type(arg) == "string" and string.lower(arg) == CCLocale.UI.text.slash_arg_on) or arg == false then
950 ChatCast.LFMAlt = true
951 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.LFMalt_on, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL")))
952 elseif (type(arg) == "string" and string.lower(arg) == CCLocale.UI.text.slash_arg_off) or arg == true then
953 ChatCast.LFMAlt = false
954 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.LFMalt_off, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL")))
955 end
956 end
957  
958 function ChatCast_ToggleInvites(arg)
959 if arg == nil or arg == "" then arg = ChatCast.Invites end
960 if (type(arg) == "string" and string.lower(arg) == CCLocale.UI.text.slash_arg_on) or arg == false then
961 ChatCast.Invites = true
962 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.invites_on, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL")))
963 elseif (type(arg) == "string" and string.lower(arg) == CCLocale.UI.text.slash_arg_off) or arg == true then
964 ChatCast.Invites = false
965 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.invites_off, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL")))
966 end
967 end
968  
969 function ChatCast_ToggleHitsMode(arg)
970 if arg == nil or arg == "" then arg = ChatCast.HitsMode end
971 if (type(arg) == "string" and string.lower(arg) == CCLocale.UI.text.slash_arg_on) or arg == false then
972 ChatCast.HitsMode = true
973 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.hitsmode_on, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL")))
974 elseif (type(arg) == "string" and string.lower(arg) == CCLocale.UI.text.slash_arg_off) or arg == true then
975 ChatCast.HitsMode = false
976 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.hitsmode_off, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL")))
977 end
978 end
979  
980 function ChatCast_ToggleLastLink(arg)
981 if arg == nil or arg == "" then arg = ChatCast.LastLink end
982 if (type(arg) == "string" and string.lower(arg) == CCLocale.UI.text.slash_arg_on) or arg == false then
983 ChatCast.LastLink = true
984 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.lastlink_on, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL")))
985 elseif (type(arg) == "string" and string.lower(arg) == CCLocale.UI.text.slash_arg_off) or arg == true then
986 ChatCast.LastLink = false
987 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.lastlink_off, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL")))
988 end
989 end
990  
991 function ChatCast_ToggleFeedback(arg)
992 if arg == nil or arg == "" then arg = ChatCast.Feedback end
993 if (type(arg) == "string" and string.lower(arg) == CCLocale.UI.text.slash_arg_on) or arg == false then
994 ChatCast.Feedback = true
995 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.feedback_on, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL")))
996 elseif (type(arg) == "string" and string.lower(arg) == CCLocale.UI.text.slash_arg_off) or arg == true then
997 ChatCast.Feedback = false
998 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.feedback_off, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL")))
999 end
1000 end
1001  
1002 function ChatCast_ToggleSound(arg)
1003 if arg == nil or arg == "" then arg = ChatCast.Sound end
1004 if (type(arg) == "string" and string.lower(arg) == CCLocale.UI.text.slash_arg_on) or arg == false then
1005 ChatCast.Sound = true
1006 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.sound_on, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL")))
1007 elseif (type(arg) == "string" and string.lower(arg) == CCLocale.UI.text.slash_arg_off) or arg == true then
1008 ChatCast.Sound = false
1009 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.sound_off, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL")))
1010 end
1011 end
1012  
1013 function ChatCast_ToggleBrackets(arg)
1014 if arg == nil or arg == "" then arg = ChatCast.Brackets end
1015 if (type(arg) == "string" and string.lower(arg) == CCLocale.UI.text.slash_arg_on) or arg == false then
1016 ChatCast.Brackets = true
1017 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.brackets_on, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL")))
1018 elseif (type(arg) == "string" and string.lower(arg) == CCLocale.UI.text.slash_arg_off) or arg == true then
1019 ChatCast.Brackets = false
1020 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.brackets_off, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL")))
1021 end
1022 end
1023  
1024 function ChatCast_ToggleColor(arg)
1025 if (arg == nil or arg == "") then
1026 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.color_current, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL"), "|CFF" .. ChatCast.Color.rgb .. "" .. ChatCast.Color.rgb))
1027 ChatCast_ColorPicker()
1028 elseif (string.lower(arg) == CCLocale.UI.text.slash_arg_reset or string.lower(arg) == CCLocale.UI.text.slash_arg_reset2) then
1029 ChatCast.Color = { rgb = "FFEE20" }
1030 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.color_reset, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL"), "|CFF" .. ChatCast.Color.rgb .. "" .. ChatCast.Color.rgb))
1031 else
1032 if string.find(arg, "%x%x%x%x%x%x") then
1033 ChatCast.Color.rgb = arg
1034 DEFAULT_CHAT_FRAME:AddMessage(string.format(CCLocale.UI.text.color_changed, ChatCast_CreateLink(6,"ChatCast","ChatCast","GENERAL"), "|CFF" .. ChatCast.Color.rgb .. "" .. ChatCast.Color.rgb))
1035 end
1036 end
1037 end
1038  
1039 --HitsMode stuff
1040 function ChatCast_HM_Process(realname, spell, VerboseMessage, event)
1041 if ChatCast.HitsMode == true then
1042 if (VerboseMessage == "FADES" and not string.find(event, "HOSTILE"))
1043 or VerboseMessage == "GAINS" or VerboseMessage == "AFFLICTED"
1044 or (VerboseMessage == "CASTING" and realname ~= "You") then
1045 spell = ChatCast_BuffSub(spell, realname, VerboseMessage)
1046 end
1047 end
1048 return spell
1049 end