· 9 years ago · Jan 12, 2017, 12:06 AM
1local GNOME, ns = ...
2local L = LibStub("AceLocale-3.0"):GetLocale("GS-E")
3
4GSL = L
5
6GSMasterSequences = ns
7GSStaticCastCmds = {}
8GSTRUnfoundSpells = {}
9
10GSModifiedSequences = {} -- [sequenceName] = true if we've already modified this sequence
11
12GSStaticCastCmds = { use = true, cast = true, spell = true, cancelaura = true, startattack = true, cancelform = true }
13
14GSStaticCleanStrings = {}
15GSStaticCleanStrings = {
16 [1] = "/console Sound_EnableSFX 0%;\n",
17 [2] = "/console Sound_EnableSFX 1%;\n",
18 [3] = "/script UIErrorsFrame:Hide%(%)%;\n",
19 [4] = "/run UIErrorsFrame:Clear%(%)%;\n",
20 [5] = "/script UIErrorsFrame:Clear%(%)%;\n",
21 [6] = "/run UIErrorsFrame:Hide%(%)%;\n",
22 [7] = "/console Sound_EnableErrorSpeech 1\n",
23 [8] = "/console Sound_EnableErrorSpeech 0\n",
24
25 [11] = "/console Sound_EnableSFX 0\n",
26 [12] = "/console Sound_EnableSFX 1\n",
27 [13] = "/script UIErrorsFrame:Hide%(%)\n",
28 [14] = "/run UIErrorsFrame:Clear%(%)\n",
29 [15] = "/script UIErrorsFrame:Clear%(%)\n",
30 [16] = "/run UIErrorsFrame:Hide%(%)\n",
31 [17] = "/console Sound_EnableErrorSpeech 1%;\n",
32 [18] = "/console Sound_EnableErrorSpeech 0%;\n",
33
34 [20] = "/stopmacro [@playertarget, noexists]\n",
35
36 [30] = "/use 2\n",
37 [31] = "/use [combat] 11\n",
38 [32] = "/use [combat] 12\n",
39 [33] = "/use [combat] 13\n",
40 [34] = "/use [combat] 14\n",
41 [35] = "/use 11\n",
42 [36] = "/use 12\n",
43 [37] = "/use 13\n",
44 [38] = "/use 14\n",
45 [39] = "/Use [combat] 11\n",
46 [40] = "/Use [combat] 12\n",
47 [41] = "/Use [combat] 13\n",
48 [42] = "/Use [combat] 14\n",
49 [43] = "/use [combat]11\n",
50 [44] = "/use [combat]12\n",
51 [45] = "/use [combat]13\n",
52 [46] = "/use [combat]14\n",
53 [47] = "/use [combat]2\n",
54 [48] = "/use [combat] 2\n",
55 [49] = "/use [combat]5\n",
56 [50] = "/use [combat] 5\n",
57 [51] = "/use [combat]1\n",
58 [52] = "/use [combat] 1\n",
59 [53] = "/use 1\n",
60 [54] = "/use 5\n",
61 [101] = "\n\n",
62}
63
64GSStaticStringRESET = "|r"
65GSStaticCoreLoadedMessage = "GS-CoreLoaded"
66
67-- Sety defaults. THese will be overriden once the addon is marked as loaded.
68GSAddInPacks = {}
69GSUnloadedAddInPacks = {}
70
71
72GSOutput = {}
73GSPrintAvailable = false
74GSSpecIDList = {
75 [0] = "All",
76 [1] = "Warrior",
77 [2] = "Paladin",
78 [3] = "Hunter",
79 [4] = "Rogue",
80 [5] = "Priest",
81 [6] = "Death Knight",
82 [7] = "Shaman",
83 [8] = "Mage",
84 [9] = "Warlock",
85 [10] = "Monk",
86 [11] = "Druid",
87 [12] = "Demon Hunter",
88 [62] = "Arcane",
89 [63] = "Fire",
90 [64] = "Frost - Mage",
91 [65] = "Holy - Paladin",
92 [66] = "Protection - Paladin",
93 [70] = "Retribution",
94 [71] = "Arms",
95 [72] = "Fury",
96 [73] = "Protection - Warrior",
97 [102] = "Balance",
98 [103] = "Feral",
99 [104] = "Guardian",
100 [105] = "Restoration - Druid",
101 [250] = "Blood",
102 [251] = "Frost - DK",
103 [252] = "Unholy",
104 [253] = "Beast Mastery",
105 [254] = "Marksmanship",
106 [255] = "Survival",
107 [256] = "Discipline",
108 [257] = "Holy - Priest",
109 [258] = "Shadow",
110 [259] = "Assassination",
111 [260] = "Outlaw",
112 [261] = "Subtlety",
113 [262] = "Elemental",
114 [263] = "Enhancement",
115 [264] = "Restoration - Shaman",
116 [265] = "Affliction",
117 [266] = "Demonology",
118 [267] = "Destruction",
119 [268] = "Brewmaster",
120 [269] = "Windwalker",
121 [270] = "Mistweaver",
122 [577] = "Havoc",
123 [581] = "Vengeance",
124}
125
126GSSpecIDHashList = {}
127for k,v in pairs(GSSpecIDList) do
128 GSSpecIDHashList[v] = k
129end
130
131--- Compares two sequences and return a boolean if the match. If they do not
132-- match then if will print an element by element comparison. This comparison
133-- ignores version, authorversion, source, helpTxt elements as these are not
134-- needed for the execution of the macro but are more for help and versioning.
135function GSCompareSequence(seq1,seq2)
136 local match = false
137 local steps1 = table.concat(seq1, "")
138 local steps2 = table.concat(seq2, "")
139
140 if seq1.PostMacro == seq2.PostMacro and seq1.PreMacro == seq2.PreMacro and seq1.specID == seq2.specID and seq1.StepFunction == seq2.StepFunction and steps1 == steps2 and seq1.helpTxt == seq2.helpTxt then
141 -- we have a match
142 match = true
143 GSPrintDebugMessage(L["We have a perfect match"], GNOME)
144 else
145 if seq1.specID == seq2.specID then
146 GSPrintDebugMessage(L["Matching specID"], GNOME)
147 else
148 GSPrintDebugMessage(L["Different specID"], GNOME)
149 end
150 if seq1.StepFunction == seq2.StepFunction then
151 GSPrintDebugMessage(L["Matching StepFunction"], GNOME)
152 else
153 GSPrintDebugMessage(L["Different StepFunction"], GNOME)
154 end
155 if seq1.PreMacro == seq2.PreMacro then
156 GSPrintDebugMessage(L["Matching PreMacro"], GNOME)
157 else
158 GSPrintDebugMessage(L["Different PreMacro"], GNOME)
159 end
160 if steps1 == steps2 then
161 GSPrintDebugMessage(L["Same Sequence Steps"], GNOME)
162 else
163 GSPrintDebugMessage(L["Different Sequence Steps"], GNOME)
164 end
165 if seq1.PostMacro == seq2.PostMacro then
166 GSPrintDebugMessage(L["Matching PostMacro"], GNOME)
167 else
168 GSPrintDebugMessage(L["Different PostMacro"], GNOME)
169 end
170 if seq1.helpTxt == seq2.helpTxt then
171 GSPrintDebugMessage(L["Matching helpTxt"], GNOME)
172 else
173 GSPrintDebugMessage(L["Different helpTxt"], GNOME)
174 end
175
176 end
177 return match
178end
179
180GSDebugOutput = ""
181
182GSStaticSequenceDebug = "SEQUENCEDEBUG"
183
184
185--- <code>GSStaticPriority</code> is a static step function that goes 1121231234123451234561234567
186-- use this like StepFunction = GSStaticPriority, in a macro
187-- This overides the sequential behaviour that is standard in GS
188GSStaticPriority = [[
189 limit = limit or 1
190 if step == limit then
191 limit = limit % #macros + 1
192 step = 1
193 else
194 step = step % #macros + 1
195 end
196]]
197
198--- <code>GSStaticLoopPriority</code> is a static step function that goes 1121231234123451234561234567
199-- but it does this within an internal loop. So more like 123343456
200-- If the macro has loopstart or loopstop defined then it will use this instead of GSStaticPriority
201GSStaticLoopPriority = [[
202 if step < loopstart then
203 step = step + 1
204 elseif looplimit <= 1 then
205 -- when we get to the end reset to loopstart
206 limit = limit or loopstart
207 if step == limit then
208 limit = limit % loopstop + 1
209 step = loopstart
210 if looplimit == loopiter then
211 loopiter = 1
212 self:SetAttribute('loopiter', loopiter)
213 end
214 else
215 step = step + 1
216 end
217 elseif step > looplimit then
218 step = step + 1
219 elseif loopiter == looplimit then
220 step = loopstop + 1
221 elseif step == #macros then
222 step = 1
223 self:SetAttribute('loopiter', 1)
224 else
225 limit = limit or loopstart
226 if step == limit then
227 limit = limit % loopstop + 1
228 step = loopstart
229 if limit == loopiter then
230 loopiter = loopiter + 1
231 self:SetAttribute('loopiter', loopiter)
232 end
233 else
234 step = step + 1
235 end
236 end
237]]
238
239--- <code>GSStaticLoopPriority</code> is a static step function that
240-- operates in a sequential mode but with an internal loop.
241-- eg 12342345
242GSStaticLoopSequential = [[
243 --print("Step" .. step)
244 --print("Num Mcros " .. #macros)
245 --print("Start " .. loopstart)
246 --print("Stop " .. loopstop)
247 --print("Limit " .. looplimit)
248 --print("iter " .. loopiter)
249
250 if step < loopstart then
251 -- I am before the loop increment to next step.
252 --print(step .. " I am before the loop increment to next step.")
253 step = step + 1
254 elseif looplimit <= 1 then
255 -- when we get to the end reset to loopstart
256 --print(step .. " When we get to the end reset to loopstart")
257 if step == loopstop then
258 step = loopstart
259 loopiter = loopiter + 1
260 self:SetAttribute('loopiter', loopiter)
261 else
262 step = step + 1
263 end
264 elseif step > loopstop then
265 -- I am outside the loop
266 --print(step .. " I am outside the loop")
267 step = step + 1
268 elseif loopiter == looplimit then
269 -- I am at the outside bound of the loop
270 --print(step .. " I am at the outside bound of the loop")
271 if step == #macros then
272 step = 1
273 loopiter = 1
274 self:SetAttribute('loopiter', 1)
275 else
276 step = step + 1
277 end
278 elseif step == loopstop then
279 --print("I am at loop stop")
280 step = loopstart
281 loopiter = loopiter + 1
282 self:SetAttribute('loopiter', loopiter)
283 elseif step == #macros then
284 -- I am at the very end reset
285 step = 1
286 self:SetAttribute('loopiter', 1)
287 --print(step .. " I am at the very end reset")
288 else
289 -- I am in the middle
290 --print(step .. " I am in the middle")
291 step = step + 1
292 --print("Incrementing")
293 end
294]]
295
296
297--- Experimental attempt to load a WeakAuras string.
298function GSLoadWeakauras(str)
299 local WeakAuras = WeakAuras
300
301 if WeakAuras then
302 WeakAuras.ImportString(str)
303 end
304end
305
306--- Return the Active Sequence Version for a Sequence.
307function GSGetActiveSequenceVersion(SequenceName)
308 local vers = 1
309 if not GSisEmpty(GSMasterOptions.ActiveSequenceVersions[SequenceName]) then
310 vers = GSMasterOptions.ActiveSequenceVersions[SequenceName]
311 end
312 return vers
313end
314
315--- Return the next version value for a sequence.
316-- a <code>last</code> value of true means to get the last remaining version
317function GSGetNextSequenceVersion(SequenceName, last)
318 local nextv = 0
319 GSPrintDebugMessage("GSGetNextSequenceVersion " .. SequenceName, "GSGetNextSequenceVersion")
320 if not GSisEmpty(GSMasterOptions.SequenceLibrary[SequenceName]) then
321 for k,_ in ipairs(GSMasterOptions.SequenceLibrary[SequenceName]) do
322 nextv = k
323 end
324 end
325 if not last then
326 nextv = nextv + 1
327 end
328 if nextv == 0 then
329 -- no entries found setting to a key of 1
330 nextv = 1
331 end
332 return nextv
333
334end
335
336--- Return a table of Known Sequence Versions
337function GSGetKnownSequenceVersions(SequenceName)
338 if not GSisEmpty(SequenceName) then
339 local t = {}
340 for k,_ in pairs(GSMasterOptions.SequenceLibrary[SequenceName]) do
341 --print (k)
342 t[k] = k
343 end
344 return t, GSMasterOptions.ActiveSequenceVersions[SequenceName]
345 end
346end
347
348--- Delete a sequence version
349function GSDeleteSequenceVersion(sequenceName, version)
350 if not GSisEmpty(sequenceName) then
351 local _, selectedversion = GSGetKnownSequenceVersions(sequenceName)
352 local sequence = GSMasterOptions.SequenceLibrary[sequenceName][version]
353 if sequence.source ~= GSStaticSourceLocal then
354 GSPrint(L["You cannot delete this version of a sequence. This version will be reloaded as it is contained in "] .. GSMasterOptions.NUMBER .. sequence.source .. GSStaticStringRESET, GNOME)
355 elseif not GSisEmpty(GSMasterOptions.SequenceLibrary[sequenceName][version]) then
356 GSMasterOptions.SequenceLibrary[sequenceName][version] = nil
357 end
358 if version == selectedversion then
359 newversion = GSGetNextSequenceVersion(sequenceName, true)
360 if newversion >0 then
361 GSSetActiveSequenceVersion(sequenceName, newversion)
362 else
363 GSMasterOptions.ActiveSequenceVersions[sequenceName] = nil
364 end
365 end
366 end
367end
368
369--- Set the Active version of a sequence
370function GSSetActiveSequenceVersion(sequenceName, version)
371 -- This may need more logic but for the moment iuf they are not equal set somethng.
372 GSMasterOptions.ActiveSequenceVersions[sequenceName] = version
373end
374
375--- Return the characters current spec id
376function GSGetCurrentSpecID()
377 local currentSpec = GetSpecialization()
378 return currentSpec and select(1, GetSpecializationInfo(currentSpec)) or 0
379end
380
381--- Return the characters class id
382function GSGetCurrentClassID()
383 local _, _, currentclassId = UnitClass("player")
384 return currentclassId
385end
386
387--- Return whether to store the macro in Personal Character Macros or Account Macros
388function GSsetMacroLocation()
389 local numAccountMacros, numCharacterMacros = GetNumMacros()
390 local returnval = 1
391 if numCharacterMacros >= MAX_CHARACTER_MACROS - 1 and GSMasterOptions.overflowPersonalMacros then
392 returnval = nil
393 end
394 return returnval
395end
396
397--- Add a macro for a sequence amd register it in the list of known sequences
398function GSregisterSequence(sequenceName, icon, forceglobalstub)
399 local sequenceIndex = GetMacroIndexByName(sequenceName)
400 local numAccountMacros, numCharacterMacros = GetNumMacros()
401 if sequenceIndex > 0 then
402 -- Sequence exists do nothing
403 GSPrintDebugMessage(L["Moving on - macro for "] .. sequenceName .. L[" already exists."], GNOME)
404 else
405 -- Create Sequence as a player sequence
406 if numCharacterMacros >= MAX_CHARACTER_MACROS - 1 and not GSMasterOptions.overflowPersonalMacros and not forceglobalstub then
407 GSPrint(GSMasterOptions.AuthorColour .. L["Close to Maximum Personal Macros.|r You can have a maximum of "].. MAX_CHARACTER_MACROS .. L[" macros per character. You currently have "] .. GSMasterOptions.EmphasisColour .. numCharacterMacros .. L["|r. As a result this macro was not created. Please delete some macros and reenter "] .. GSMasterOptions.CommandColour .. L["/gs|r again."], GNOME)
408 elseif numAccountMacros >= MAX_ACCOUNT_MACROS - 1 and GSMasterOptions.overflowPersonalMacros then
409 GSPrint(L["Close to Maximum Macros.|r You can have a maximum of "].. MAX_CHARACTER_MACROS .. L[" macros per character. You currently have "] .. GSMasterOptions.EmphasisColour .. numCharacterMacros .. L["|r. You can also have a maximum of "] .. MAX_ACCOUNT_MACROS .. L[" macros per Account. You currently have "] .. GSMasterOptions.EmphasisColour .. numAccountMacros .. L["|r. As a result this macro was not created. Please delete some macros and reenter "] .. GSMasterOptions.CommandColour .. L["/gs|r again."], GNOME)
410 else
411 sequenceid = CreateMacro(sequenceName, (GSMasterOptions.setDefaultIconQuestionMark and "INV_MISC_QUESTIONMARK" or icon), '#showtooltip\n/click ' .. sequenceName, (forceglobalstub and false or GSsetMacroLocation()) )
412 GSModifiedSequences[sequenceName] = true
413 end
414 end
415end
416
417--- Check if the specID provided matches the plauers current class.
418function GSisSpecIDForCurrentClass(specID)
419 local _, specname, specdescription, specicon, _, specrole, specclass = GetSpecializationInfoByID(specID)
420--if specID > 15 then
421-- GSPrintDebugMessage(L["Checking if specID "] .. specID .. " " .. specclass .. L[" equals "] .. currentenglishclass)
422-- else
423-- GSPrintDebugMessage(L["Checking if specID "] .. specID .. L[" equals currentclassid "] .. currentclassId)
424-- end
425 return (specclass==currentenglishclass or specID==currentclassId)
426end
427
428--- Check if a macro has been created and if not create it.
429function GSCheckMacroCreated(SequenceName, globalstub)
430 local macroIndex = GetMacroIndexByName(SequenceName)
431 if macroIndex and macroIndex ~= 0 then
432 if not GSModifiedSequences[SequenceName] then
433 GSModifiedSequences[SequenceName] = true
434 EditMacro(macroIndex, nil, nil, '#showtooltip\n/click ' .. SequenceName)
435 end
436 else
437 icon = GSMasterOptions.SequenceLibrary[SequenceName][GSGetActiveSequenceVersion(SequenceName)].icon
438 GSregisterSequence(SequenceName, icon, globalstub)
439 end
440
441end
442
443--- This removes a macro Stub.
444function GSdeleteMacroStub(sequenceName)
445 local mname, _, mbody = GetMacroInfo(sequenceName)
446 if mname == sequenceName then
447 trimmedmbody = mbody:gsub("[^%w ]", "")
448 compar = '#showtooltip\n/click ' .. mname
449 trimmedcompar = compar:gsub("[^%w ]", "")
450 if string.lower(trimmedmbody) == string.lower(trimmedcompar) then
451 GSPrint(L[" Deleted Orphaned Macro "] .. mname, GNOME)
452 DeleteMacro(sequenceName)
453 end
454 end
455end
456
457--- Disable all versions of a sequence and delete any macro stubs.
458function GSDisableSequence(SequenceName)
459 GSMasterOptions.DisabledSequences[SequenceName] = true
460 GSdeleteMacroStub(SequenceName)
461end
462
463--- Enable all versions of a sequence and recreate any macro stubs.
464function GSEnableSequence(SequenceName)
465 GSMasterOptions.DisabledSequences[SequenceName] = nil
466 GSCheckMacroCreated(SequenceName)
467end
468
469--- Add a sequence to the library
470function GSAddSequenceToCollection(sequenceName, sequence, version)
471 local confirmationtext = ""
472 --Perform some validation checks on the Sequence.
473 if GSisEmpty(sequence.specID) then
474 -- set to currentSpecID
475 sequence.specID = GSGetCurrentSpecID()
476 confirmationtext = " " .. L["Sequence specID set to current spec of "] .. sequence.specID .. "."
477 end
478 sequence.specID = sequence.specID + 0 -- force to a number.
479 if GSisEmpty(sequence.author) then
480 -- set to unknown author
481 sequence.author = "Unknown Author"
482 confirmationtext = " " .. L["Sequence Author set to Unknown"] .. "."
483 end
484 if GSisEmpty(sequence.helpTxt) then
485 -- set to currentSpecID
486 sequence.helpTxt = "No Help Information"
487 confirmationtext = " " .. L["No Help Information Available"] .. "."
488 end
489
490 -- CHeck for colissions
491 local found = false
492 if not GSisEmpty(GSMasterOptions.SequenceLibrary[sequenceName]) then
493 if not GSisEmpty(GSMasterOptions.SequenceLibrary[sequenceName][version]) then
494 found = true
495 end
496 end
497 if found then
498 -- check if source the same. If so ignore
499 if sequence.source ~= GSMasterOptions.SequenceLibrary[sequenceName][version].source then
500 -- different source. if local Ignore
501 if sequence.source == GSStaticSourceLocal then
502 -- local version - add as new version
503 GSPrint (L["A sequence collision has occured. Your local version of "] .. sequenceName .. L[" has been added as a new version and set to active. Please review if this is as expected."], GNOME)
504 GSAddSequenceToCollection(sequenceName, sequence, GSGetNextSequenceVersion(sequenceName))
505 else
506 if GSisEmpty(sequence.source) then
507 GSPrint(L["A sequence collision has occured. "] .. L["Two sequences with unknown sources found."] .. " " .. sequenceName, GNOME)
508 else
509 GSPrint (L["A sequence collision has occured. "] .. sequence.source .. L[" tried to overwrite the version already loaded from "] .. GSMasterOptions.SequenceLibrary[sequenceName][version].source .. L[". This version was not loaded."], Gnome)
510 end
511 end
512 end
513 else
514 -- New Sequence
515 if GSisEmpty(GSMasterOptions.SequenceLibrary[sequenceName]) then
516 -- Sequence is new
517 GSMasterOptions.SequenceLibrary[sequenceName] = {}
518 end
519 if GSisEmpty(GSMasterOptions.SequenceLibrary[sequenceName][version]) then
520 -- This version is new
521 -- print(sequenceName .. " " .. version)
522 GSMasterOptions.SequenceLibrary[sequenceName][version] = {}
523 end
524 -- evaluate version
525 if version ~= GSMasterOptions.ActiveSequenceVersions[sequenceName] then
526
527 GSSetActiveSequenceVersion(sequenceName, version)
528 end
529
530 GSMasterOptions.SequenceLibrary[sequenceName][version] = sequence
531 local makemacrostub = false
532 local globalstub = false
533 if sequence.specID == GSGetCurrentSpecID() or sequence.specID == GSGetCurrentClassID() then
534 makemacrostub = true
535 elseif GSMasterOptions.autoCreateMacroStubsClass then
536 if GSisSpecIDForCurrentClass(sequence.specID) then
537 makemacrostub = true
538 end
539 elseif GSMasterOptions.autoCreateMacroStubsGlobal then
540 if sequence.specID == 0 then
541 makemacro = true
542 globalstub = true
543 end
544 end
545 if makemacrostub then
546 if GSMasterOptions.DisabledSequences[sequenceName] == true then
547 GSdeleteMacroStub(sequenceName)
548 else
549 GSCheckMacroCreated(sequenceName, globalstub)
550 end
551 end
552 end
553 if not GSisEmpty(confirmationtext) then
554 GSPrint(GSMasterOptions.EmphasisColour .. sequenceName .. "|r" .. L[" was imported with the following errors."] .. " " .. confirmationtext, GNOME)
555 end
556end
557
558--- Load a collection of Sequences
559function GSImportMacroCollection(Sequences)
560 for k,v in pairs(Sequences) do
561 if GSisEmpty(v.version) then
562 v.version = 1
563 end
564 GSAddSequenceToCollection(k, v, v.version)
565 end
566end
567
568--- Load sequences found in addon Mods. authorversion is the version of hte mod where the collection was loaded from.
569function GSImportLegacyMacroCollections(str, authorversion)
570 for k,v in pairs(GSMasterSequences) do
571 if GSisEmpty(v.version) then
572 v.version = 1
573 end
574 if GSisEmpty(authorversion) then
575 authorversion = 1
576 end
577 v.source = str
578 v.authorversion = authorversion
579 GSAddSequenceToCollection(k, v, v.version)
580 GSMasterSequences[k] = nil
581 end
582end
583
584-- Load any Load on Demand addon packs.
585-- Only load those beginning with GS-
586for i=1,GetNumAddOns() do
587 if not IsAddOnLoaded(i) and GetAddOnInfo(i):find("^GS%-") then
588 local name, _, _, _, _, _ = GetAddOnInfo(i)
589 if name ~= "GS-SequenceEditor" and name ~= "GS-SequenceTranslator" then
590 --print (name)
591 local loaded = LoadAddOn(i);
592 if loaded then
593 local authorversion = GetAddOnMetadata(name, "Version")
594 GSImportLegacyMacroCollections(name, authorversion)
595 GSAddInPacks[name] = true
596 else
597 GSUnloadedAddInPacks[name] = true
598 end
599 end
600
601 end
602
603end
604
605
606local escapes = {
607 ["|c%x%x%x%x%x%x%x%x"] = "", -- color start
608 ["|r"] = "", -- color end
609 ["|H.-|h(.-)|h"] = "%1", -- links
610 ["|T.-|t"] = "", -- textures
611 ["{.-}"] = "", -- raid target icons
612}
613
614--- remove WoW Text Markup from a sequence
615function GSTRUnEscapeSequence(sequence)
616 local i = 1
617 for _,v in ipairs(sequence) do
618 --print (i .. " " .. v)
619 sequence[i] = GSTRUnEscapeString(v)
620 i = i + 1
621 end
622 if not GSisEmpty(sequence.PreMacro) then
623 sequence.PreMacro = GSTRUnEscapeString(sequence.PreMacro)
624 end
625 if not GSisEmpty(sequence.PostMacro) then
626 sequence.PostMacro = GSTRUnEscapeString(sequence.PostMacro)
627 end
628 return sequence
629end
630
631--- remove WoW Text Markup from a string
632function GSTRUnEscapeString(str)
633 for k, v in pairs(escapes) do
634 str = gsub(str, k, v)
635 end
636 return str
637end