PageRenderTime 54ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/AddOns/Blizzard_CombatLog/Blizzard_CombatLog.lua

https://bitbucket.org/Shenton/world-of-warcraft-user-interface-source
Lua | 3672 lines | 2704 code | 358 blank | 610 comment | 453 complexity | 1be40671c61a777a6441264e7422cb8f MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. --[[
  2. -- Blizzard Combat Log
  3. -- by Alexander Yoshi
  4. --
  5. -- This is a prototype combat log designed to serve the
  6. -- majority of needs for WoW players. The new and improved
  7. -- combat log event formatting should allow for the community
  8. -- to develop even better combat logs in the future.
  9. --
  10. -- Thanks to:
  11. -- Chris Heald & Xinhuan - Code Optimization Support
  12. --
  13. --]]
  14. -- Version
  15. -- Constant -- Incrementing this number will erase saved filter settings!!
  16. COMBATLOG_FILTER_VERSION = 4.3;
  17. -- Saved Variable
  18. Blizzard_CombatLog_Filter_Version = 0;
  19. -- Define the log
  20. COMBATLOG = ChatFrame2;
  21. -- BUFF / DEBUFF
  22. AURA_TYPE_BUFF = "BUFF";
  23. AURA_TYPE_DEBUFF = "DEBUFF"
  24. -- Message Limit
  25. COMBATLOG_LIMIT_PER_FRAME = 1;
  26. COMBATLOG_HIGHLIGHT_MULTIPLIER = 1.5;
  27. -- Default Colors
  28. COMBATLOG_DEFAULT_COLORS = {
  29. -- Unit names
  30. unitColoring = {
  31. [COMBATLOG_FILTER_MINE] = {a=1.0,r=0.70,g=0.70,b=0.70}; --{a=1.0,r=0.14,g=1.00,b=0.15};
  32. [COMBATLOG_FILTER_MY_PET] = {a=1.0,r=0.70,g=0.70,b=0.70}; --{a=1.0,r=0.14,g=0.80,b=0.15};
  33. [COMBATLOG_FILTER_FRIENDLY_UNITS] = {a=1.0,r=0.34,g=0.64,b=1.00};
  34. [COMBATLOG_FILTER_HOSTILE_UNITS] = {a=1.0,r=0.75,g=0.05,b=0.05};
  35. [COMBATLOG_FILTER_HOSTILE_PLAYERS] = {a=1.0,r=0.75,g=0.05,b=0.05};
  36. [COMBATLOG_FILTER_NEUTRAL_UNITS] = {a=1.0,r=0.75,g=0.05,b=0.05}; -- {a=1.0,r=0.80,g=0.80,b=0.14};
  37. [COMBATLOG_FILTER_UNKNOWN_UNITS] = {a=1.0,r=0.75,g=0.75,b=0.75};
  38. };
  39. -- School coloring
  40. schoolColoring = {
  41. [SCHOOL_MASK_NONE] = {a=1.0,r=1.00,g=1.00,b=1.00};
  42. [SCHOOL_MASK_PHYSICAL] = {a=1.0,r=1.00,g=1.00,b=0.00};
  43. [SCHOOL_MASK_HOLY] = {a=1.0,r=1.00,g=0.90,b=0.50};
  44. [SCHOOL_MASK_FIRE] = {a=1.0,r=1.00,g=0.50,b=0.00};
  45. [SCHOOL_MASK_NATURE] = {a=1.0,r=0.30,g=1.00,b=0.30};
  46. [SCHOOL_MASK_FROST] = {a=1.0,r=0.50,g=1.00,b=1.00};
  47. [SCHOOL_MASK_SHADOW] = {a=1.0,r=0.50,g=0.50,b=1.00};
  48. [SCHOOL_MASK_ARCANE] = {a=1.0,r=1.00,g=0.50,b=1.00};
  49. };
  50. -- Defaults
  51. defaults = {
  52. spell = {a=1.0,r=1.00,g=1.00,b=1.00};
  53. damage = {a=1.0,r=1.00,g=1.00,b=0.00};
  54. };
  55. -- Line coloring
  56. eventColoring = {
  57. };
  58. -- Highlighted events
  59. highlightedEvents = {
  60. ["PARTY_KILL"] = true;
  61. };
  62. };
  63. COMBATLOG_DEFAULT_SETTINGS = {
  64. -- Settings
  65. fullText = false;
  66. textMode = TEXT_MODE_A;
  67. timestamp = false;
  68. timestampFormat = TEXT_MODE_A_TIMESTAMP;
  69. unitColoring = false;
  70. sourceColoring = true;
  71. destColoring = true;
  72. lineColoring = true;
  73. lineHighlighting = true;
  74. abilityColoring = false;
  75. abilityActorColoring = false;
  76. abilitySchoolColoring = false;
  77. abilityHighlighting = true;
  78. actionColoring = false;
  79. actionActorColoring = false;
  80. actionHighlighting = false;
  81. amountColoring = false;
  82. amountActorColoring = false;
  83. amountSchoolColoring = false;
  84. amountHighlighting = true;
  85. schoolNameColoring = false;
  86. schoolNameActorColoring = false;
  87. schoolNameHighlighting = true;
  88. noMeleeSwingColoring = false;
  89. missColoring = true;
  90. braces = false;
  91. unitBraces = true;
  92. sourceBraces = true;
  93. destBraces = true;
  94. spellBraces = false;
  95. itemBraces = true;
  96. showHistory = true;
  97. lineColorPriority = 1; -- 1 = source->dest->event, 2 = dest->source->event, 3 = event->source->dest
  98. unitIcons = true;
  99. hideBuffs = true;
  100. hideDebuffs = true;
  101. --unitTokens = true;
  102. };
  103. --
  104. -- Combat Log Icons
  105. --
  106. COMBATLOG_ICON_RAIDTARGET1 = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_1.blp:0|t";
  107. COMBATLOG_ICON_RAIDTARGET2 = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_2.blp:0|t";
  108. COMBATLOG_ICON_RAIDTARGET3 = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_3.blp:0|t";
  109. COMBATLOG_ICON_RAIDTARGET4 = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_4.blp:0|t";
  110. COMBATLOG_ICON_RAIDTARGET5 = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_5.blp:0|t";
  111. COMBATLOG_ICON_RAIDTARGET6 = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_6.blp:0|t";
  112. COMBATLOG_ICON_RAIDTARGET7 = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_7.blp:0|t";
  113. COMBATLOG_ICON_RAIDTARGET8 = "|TInterface\\TargetingFrame\\UI-RaidTargetingIcon_8.blp:0|t";
  114. --
  115. -- Default Event List
  116. --
  117. COMBATLOG_EVENT_LIST = {
  118. ["ENVIRONMENTAL_DAMAGE"] = true,
  119. ["SWING_DAMAGE"] = true,
  120. ["SWING_MISSED"] = true,
  121. ["RANGE_DAMAGE"] = true,
  122. ["RANGE_MISSED"] = true,
  123. ["SPELL_CAST_START"] = false,
  124. ["SPELL_CAST_SUCCESS"] = false,
  125. ["SPELL_CAST_FAILED"] = false,
  126. ["SPELL_MISSED"] = true,
  127. ["SPELL_DAMAGE"] = true,
  128. ["SPELL_HEAL"] = true,
  129. ["SPELL_ENERGIZE"] = true,
  130. ["SPELL_DRAIN"] = true,
  131. ["SPELL_LEECH"] = true,
  132. ["SPELL_SUMMON"] = true,
  133. ["SPELL_RESURRECT"] = true,
  134. ["SPELL_CREATE"] = true,
  135. ["SPELL_INSTAKILL"] = true,
  136. ["SPELL_INTERRUPT"] = true,
  137. ["SPELL_EXTRA_ATTACKS"] = true,
  138. ["SPELL_DURABILITY_DAMAGE"] = false,
  139. ["SPELL_DURABILITY_DAMAGE_ALL"] = false,
  140. ["SPELL_AURA_APPLIED"] = false,
  141. ["SPELL_AURA_APPLIED_DOSE"] = false,
  142. ["SPELL_AURA_REMOVED"] = false,
  143. ["SPELL_AURA_REMOVED_DOSE"] = false,
  144. ["SPELL_AURA_BROKEN"] = false,
  145. ["SPELL_AURA_BROKEN_SPELL"] = false,
  146. ["SPELL_AURA_REFRESH"] = false,
  147. ["SPELL_DISPEL"] = true,
  148. ["SPELL_STOLEN"] = true,
  149. ["ENCHANT_APPLIED"] = true,
  150. ["ENCHANT_REMOVED"] = true,
  151. ["SPELL_PERIODIC_MISSED"] = true,
  152. ["SPELL_PERIODIC_DAMAGE"] = true,
  153. ["SPELL_PERIODIC_HEAL"] = true,
  154. ["SPELL_PERIODIC_ENERGIZE"] = true,
  155. ["SPELL_PERIODIC_DRAIN"] = true,
  156. ["SPELL_PERIODIC_LEECH"] = true,
  157. ["SPELL_DISPEL_FAILED"] = true,
  158. ["DAMAGE_SHIELD"] = false,
  159. ["DAMAGE_SHIELD_MISSED"] = false,
  160. ["DAMAGE_SPLIT"] = false,
  161. ["PARTY_KILL"] = true,
  162. ["UNIT_DIED"] = true,
  163. ["UNIT_DESTROYED"] = true,
  164. ["SPELL_BUILDING_DAMAGE"] = true,
  165. ["SPELL_BUILDING_HEAL"] = true,
  166. ["UNIT_DISSIPATES"] = true,
  167. };
  168. COMBATLOG_FLAG_LIST = {
  169. [COMBATLOG_FILTER_MINE] = true,
  170. [COMBATLOG_FILTER_MY_PET] = true,
  171. [COMBATLOG_FILTER_FRIENDLY_UNITS] = true,
  172. [COMBATLOG_FILTER_HOSTILE_UNITS] = true,
  173. [COMBATLOG_FILTER_HOSTILE_PLAYERS] = true,
  174. [COMBATLOG_FILTER_NEUTRAL_UNITS] = true,
  175. [COMBATLOG_FILTER_UNKNOWN_UNITS] = true,
  176. };
  177. EVENT_TEMPLATE_FORMATS = {
  178. ["SPELL_AURA_BROKEN_SPELL"] = TEXT_MODE_A_STRING_3,
  179. ["SPELL_CAST_START"] = TEXT_MODE_A_STRING_2,
  180. ["SPELL_CAST_SUCCESS"] = TEXT_MODE_A_STRING_2
  181. };
  182. --
  183. -- Creates an empty filter
  184. --
  185. function Blizzard_CombatLog_InitializeFilters( settings )
  186. settings.filters =
  187. {
  188. [1] = {
  189. eventList = {};
  190. };
  191. };
  192. end
  193. --
  194. -- Generates a new event list from the COMBATLOG_EVENT_LIST global
  195. --
  196. -- I wish there was a better way built in to do this.
  197. --
  198. -- Returns:
  199. -- An array, indexed by the events, with a value of true
  200. --
  201. function Blizzard_CombatLog_GenerateFullEventList ( )
  202. local eventList = {}
  203. for event, v in pairs ( COMBATLOG_EVENT_LIST ) do
  204. eventList[event] = true;
  205. end
  206. return eventList;
  207. end
  208. function Blizzard_CombatLog_GenerateFullFlagList(flag)
  209. local flagList = {};
  210. for k, v in pairs(COMBATLOG_FLAG_LIST) do
  211. if ( flag ) then
  212. flagList[k] = true
  213. else
  214. flagList[k] = false;
  215. end
  216. end
  217. return flagList;
  218. end
  219. --
  220. -- Default CombatLog Filter
  221. -- This table is used to create new CombatLog filters
  222. --
  223. DEFAULT_COMBATLOG_FILTER_TEMPLATE = {
  224. -- Descriptive Information
  225. hasQuickButton = true;
  226. quickButtonDisplay = {
  227. solo = true;
  228. party = true;
  229. raid = true;
  230. };
  231. -- Default Color and Formatting Options
  232. settings = CopyTable(COMBATLOG_DEFAULT_SETTINGS);
  233. -- Coloring
  234. colors = CopyTable(COMBATLOG_DEFAULT_COLORS);
  235. -- The actual client filters
  236. filters = {
  237. [1] = {
  238. eventList = Blizzard_CombatLog_GenerateFullEventList();
  239. sourceFlags = {
  240. [COMBATLOG_FILTER_MINE] = true,
  241. [COMBATLOG_FILTER_MY_PET] = true;
  242. };
  243. destFlags = nil;
  244. };
  245. [2] = {
  246. eventList = Blizzard_CombatLog_GenerateFullEventList();
  247. sourceFlags = nil;
  248. destFlags = {
  249. [COMBATLOG_FILTER_MINE] = true,
  250. [COMBATLOG_FILTER_MY_PET] = true;
  251. };
  252. };
  253. };
  254. };
  255. local CombatLogUpdateFrame = CreateFrame("Frame", "CombatLogUpdateFrame", UIParent)
  256. local _G = getfenv(0)
  257. local bit_bor = _G.bit.bor
  258. local bit_band = _G.bit.band
  259. local tinsert = _G.tinsert
  260. local tremove = _G.tremove
  261. local math_floor = _G.math.floor
  262. local format = _G.format
  263. local gsub = _G.gsub
  264. local strsub = _G.strsub
  265. -- Make all the constants upvalues. This prevents the global environment lookup + table lookup each time we use one (and they're used a lot)
  266. local COMBATLOG_OBJECT_AFFILIATION_MINE = COMBATLOG_OBJECT_AFFILIATION_MINE
  267. local COMBATLOG_OBJECT_AFFILIATION_PARTY = COMBATLOG_OBJECT_AFFILIATION_PARTY
  268. local COMBATLOG_OBJECT_AFFILIATION_RAID = COMBATLOG_OBJECT_AFFILIATION_RAID
  269. local COMBATLOG_OBJECT_AFFILIATION_OUTSIDER = COMBATLOG_OBJECT_AFFILIATION_OUTSIDER
  270. local COMBATLOG_OBJECT_AFFILIATION_MASK = COMBATLOG_OBJECT_AFFILIATION_MASK
  271. local COMBATLOG_OBJECT_REACTION_FRIENDLY = COMBATLOG_OBJECT_REACTION_FRIENDLY
  272. local COMBATLOG_OBJECT_REACTION_NEUTRAL = COMBATLOG_OBJECT_REACTION_NEUTRAL
  273. local COMBATLOG_OBJECT_REACTION_HOSTILE = COMBATLOG_OBJECT_REACTION_HOSTILE
  274. local COMBATLOG_OBJECT_REACTION_MASK = COMBATLOG_OBJECT_REACTION_MASK
  275. local COMBATLOG_OBJECT_CONTROL_PLAYER = COMBATLOG_OBJECT_CONTROL_PLAYER
  276. local COMBATLOG_OBJECT_CONTROL_NPC = COMBATLOG_OBJECT_CONTROL_NPC
  277. local COMBATLOG_OBJECT_CONTROL_MASK = COMBATLOG_OBJECT_CONTROL_MASK
  278. local COMBATLOG_OBJECT_TYPE_PLAYER = COMBATLOG_OBJECT_TYPE_PLAYER
  279. local COMBATLOG_OBJECT_TYPE_NPC = COMBATLOG_OBJECT_TYPE_NPC
  280. local COMBATLOG_OBJECT_TYPE_PET = COMBATLOG_OBJECT_TYPE_PET
  281. local COMBATLOG_OBJECT_TYPE_GUARDIAN = COMBATLOG_OBJECT_TYPE_GUARDIAN
  282. local COMBATLOG_OBJECT_TYPE_OBJECT = COMBATLOG_OBJECT_TYPE_OBJECT
  283. local COMBATLOG_OBJECT_TYPE_MASK = COMBATLOG_OBJECT_TYPE_MASK
  284. local COMBATLOG_OBJECT_TARGET = COMBATLOG_OBJECT_TARGET
  285. local COMBATLOG_OBJECT_FOCUS = COMBATLOG_OBJECT_FOCUS
  286. local COMBATLOG_OBJECT_MAINTANK = COMBATLOG_OBJECT_MAINTANK
  287. local COMBATLOG_OBJECT_MAINASSIST = COMBATLOG_OBJECT_MAINASSIST
  288. local COMBATLOG_OBJECT_RAIDTARGET1 = COMBATLOG_OBJECT_RAIDTARGET1
  289. local COMBATLOG_OBJECT_RAIDTARGET2 = COMBATLOG_OBJECT_RAIDTARGET2
  290. local COMBATLOG_OBJECT_RAIDTARGET3 = COMBATLOG_OBJECT_RAIDTARGET3
  291. local COMBATLOG_OBJECT_RAIDTARGET4 = COMBATLOG_OBJECT_RAIDTARGET4
  292. local COMBATLOG_OBJECT_RAIDTARGET5 = COMBATLOG_OBJECT_RAIDTARGET5
  293. local COMBATLOG_OBJECT_RAIDTARGET6 = COMBATLOG_OBJECT_RAIDTARGET6
  294. local COMBATLOG_OBJECT_RAIDTARGET7 = COMBATLOG_OBJECT_RAIDTARGET7
  295. local COMBATLOG_OBJECT_RAIDTARGET8 = COMBATLOG_OBJECT_RAIDTARGET8
  296. local COMBATLOG_OBJECT_NONE = COMBATLOG_OBJECT_NONE
  297. local COMBATLOG_OBJECT_SPECIAL_MASK = COMBATLOG_OBJECT_SPECIAL_MASK
  298. local COMBATLOG_FILTER_ME = COMBATLOG_FILTER_ME
  299. local COMBATLOG_FILTER_MINE = COMBATLOG_FILTER_MINE
  300. local COMBATLOG_FILTER_MY_PET = COMBATLOG_FILTER_MY_PET
  301. local COMBATLOG_FILTER_FRIENDLY_UNITS = COMBATLOG_FILTER_FRIENDLY_UNITS
  302. local COMBATLOG_FILTER_HOSTILE_UNITS = COMBATLOG_FILTER_HOSTILE_UNITS
  303. local COMBATLOG_FILTER_HOSTILE_PLAYERS = COMBATLOG_FILTER_HOSTILE_PLAYERS
  304. local COMBATLOG_FILTER_NEUTRAL_UNITS = COMBATLOG_FILTER_NEUTRAL_UNITS
  305. local COMBATLOG_FILTER_UNKNOWN_UNITS = COMBATLOG_FILTER_UNKNOWN_UNITS
  306. local COMBATLOG_FILTER_EVERYTHING = COMBATLOG_FILTER_EVERYTHING
  307. local COMBATLOG = COMBATLOG
  308. local AURA_TYPE_BUFF = AURA_TYPE_BUFF
  309. local AURA_TYPE_DEBUFF = AURA_TYPE_DEBUFF
  310. local SPELL_POWER_MANA = SPELL_POWER_MANA
  311. local SPELL_POWER_RAGE = SPELL_POWER_RAGE
  312. local SPELL_POWER_FOCUS = SPELL_POWER_FOCUS
  313. local SPELL_POWER_ENERGY = SPELL_POWER_ENERGY
  314. local SPELL_POWER_RUNES = SPELL_POWER_RUNES
  315. local SPELL_POWER_RUNIC_POWER = SPELL_POWER_RUNIC_POWER
  316. local SPELL_POWER_SOUL_SHARDS = SPELL_POWER_SOUL_SHARDS;
  317. local SPELL_POWER_ECLIPSE = SPELL_POWER_ECLIPSE;
  318. local SPELL_POWER_HOLY_POWER = SPELL_POWER_HOLY_POWER;
  319. local SPELL_POWER_ALTERNATE_POWER = SPELL_POWER_ALTERNATE_POWER;
  320. local SPELL_POWER_BURNING_EMBERS = SPELL_POWER_BURNING_EMBERS;
  321. local SCHOOL_MASK_NONE = SCHOOL_MASK_NONE
  322. local SCHOOL_MASK_PHYSICAL = SCHOOL_MASK_PHYSICAL
  323. local SCHOOL_MASK_HOLY = SCHOOL_MASK_HOLY
  324. local SCHOOL_MASK_FIRE = SCHOOL_MASK_FIRE
  325. local SCHOOL_MASK_NATURE = SCHOOL_MASK_NATURE
  326. local SCHOOL_MASK_FROST = SCHOOL_MASK_FROST
  327. local SCHOOL_MASK_SHADOW = SCHOOL_MASK_SHADOW
  328. local SCHOOL_MASK_ARCANE = SCHOOL_MASK_ARCANE
  329. local COMBATLOG_LIMIT_PER_FRAME = COMBATLOG_LIMIT_PER_FRAME
  330. local COMBATLOG_HIGHLIGHT_MULTIPLIER = COMBATLOG_HIGHLIGHT_MULTIPLIER
  331. local COMBATLOG_DEFAULT_COLORS = COMBATLOG_DEFAULT_COLORS
  332. local COMBATLOG_DEFAULT_SETTINGS = COMBATLOG_DEFAULT_SETTINGS
  333. local COMBATLOG_ICON_RAIDTARGET1 = COMBATLOG_ICON_RAIDTARGET1
  334. local COMBATLOG_ICON_RAIDTARGET2 = COMBATLOG_ICON_RAIDTARGET2
  335. local COMBATLOG_ICON_RAIDTARGET3 = COMBATLOG_ICON_RAIDTARGET3
  336. local COMBATLOG_ICON_RAIDTARGET4 = COMBATLOG_ICON_RAIDTARGET4
  337. local COMBATLOG_ICON_RAIDTARGET5 = COMBATLOG_ICON_RAIDTARGET5
  338. local COMBATLOG_ICON_RAIDTARGET6 = COMBATLOG_ICON_RAIDTARGET6
  339. local COMBATLOG_ICON_RAIDTARGET7 = COMBATLOG_ICON_RAIDTARGET7
  340. local COMBATLOG_ICON_RAIDTARGET8 = COMBATLOG_ICON_RAIDTARGET8
  341. local COMBATLOG_EVENT_LIST = COMBATLOG_EVENT_LIST
  342. local CombatLog_OnEvent -- for later
  343. local CombatLog_Object_IsA = CombatLog_Object_IsA
  344. -- Create a dummy CombatLogQuickButtonFrame for line 803 of FloatingChatFrame.lua. It causes inappropriate show/hide behavior. Instead, we'll use our own frame display handling.
  345. -- If there are more than 2 combat log frames, then the CombatLogQuickButtonFrame gets tied to the last frame tab's visibility status. Yuck! Let's just instead tie it to the combat log's tab.
  346. local CombatLogQuickButtonFrame, CombatLogQuickButtonFrameProgressBar, CombatLogQuickButtonFrameTexture
  347. _G.CombatLogQuickButtonFrame = CreateFrame("Frame", "CombatLogQuickButtonFrame", UIParent)
  348. local Blizzard_CombatLog_Update_QuickButtons
  349. local Blizzard_CombatLog_PreviousSettings
  350. --
  351. -- Persistant Variables
  352. --
  353. --
  354. -- Default Filters
  355. --
  356. Blizzard_CombatLog_Filter_Defaults = {
  357. -- All of the filters
  358. filters = {
  359. [1] = {
  360. -- Descriptive Information
  361. name = QUICKBUTTON_NAME_MY_ACTIONS;
  362. hasQuickButton = true;
  363. quickButtonName = QUICKBUTTON_NAME_MY_ACTIONS;
  364. quickButtonDisplay = {
  365. solo = true;
  366. party = true;
  367. raid = true;
  368. };
  369. tooltip = QUICKBUTTON_NAME_MY_ACTIONS_TOOLTIP;
  370. -- Default Color and Formatting Options
  371. settings = CopyTable(COMBATLOG_DEFAULT_SETTINGS);
  372. -- Coloring
  373. colors = CopyTable(COMBATLOG_DEFAULT_COLORS);
  374. -- The actual client filters
  375. filters = {
  376. [1] = {
  377. eventList = {
  378. ["ENVIRONMENTAL_DAMAGE"] = false,
  379. ["SWING_DAMAGE"] = true,
  380. ["SWING_MISSED"] = false,
  381. ["RANGE_DAMAGE"] = true,
  382. ["RANGE_MISSED"] = false,
  383. --["SPELL_CAST_START"] = true,
  384. --["SPELL_CAST_SUCCESS"] = true,
  385. --["SPELL_CAST_FAILED"] = true,
  386. ["SPELL_MISSED"] = false,
  387. ["SPELL_DAMAGE"] = true,
  388. ["SPELL_HEAL"] = true,
  389. ["SPELL_ENERGIZE"] = false,
  390. ["SPELL_DRAIN"] = false,
  391. ["SPELL_LEECH"] = false,
  392. ["SPELL_INSTAKILL"] = false,
  393. ["SPELL_INTERRUPT"] = false,
  394. ["SPELL_EXTRA_ATTACKS"] = false,
  395. --["SPELL_DURABILITY_DAMAGE"] = true,
  396. --["SPELL_DURABILITY_DAMAGE_ALL"] = true,
  397. ["SPELL_AURA_APPLIED"] = false,
  398. ["SPELL_AURA_APPLIED_DOSE"] = false,
  399. ["SPELL_AURA_REMOVED"] = false,
  400. ["SPELL_AURA_REMOVED_DOSE"] = false,
  401. ["SPELL_AURA_BROKEN"] = false,
  402. ["SPELL_AURA_BROKEN_SPELL"] = false,
  403. ["SPELL_AURA_REFRESH"] = false,
  404. ["SPELL_DISPEL"] = false,
  405. ["SPELL_STOLEN"] = false,
  406. ["ENCHANT_APPLIED"] = false,
  407. ["ENCHANT_REMOVED"] = false,
  408. ["SPELL_PERIODIC_MISSED"] = false,
  409. ["SPELL_PERIODIC_DAMAGE"] = true,
  410. ["SPELL_PERIODIC_HEAL"] = true,
  411. ["SPELL_PERIODIC_ENERGIZE"] = false,
  412. ["SPELL_PERIODIC_DRAIN"] = false,
  413. ["SPELL_PERIODIC_LEECH"] = false,
  414. ["SPELL_DISPEL_FAILED"] = false,
  415. --["DAMAGE_SHIELD"] = true,
  416. --["DAMAGE_SHIELD_MISSED"] = true,
  417. ["DAMAGE_SPLIT"] = true,
  418. ["PARTY_KILL"] = true,
  419. ["UNIT_DIED"] = false,
  420. ["UNIT_DESTROYED"] = true,
  421. ["UNIT_DISSIPATES"] = true
  422. };
  423. sourceFlags = {
  424. [COMBATLOG_FILTER_MINE] = true
  425. };
  426. destFlags = nil;
  427. };
  428. [2] = {
  429. eventList = {
  430. --["ENVIRONMENTAL_DAMAGE"] = true,
  431. ["SWING_DAMAGE"] = true,
  432. ["SWING_MISSED"] = true,
  433. ["RANGE_DAMAGE"] = true,
  434. ["RANGE_MISSED"] = true,
  435. --["SPELL_CAST_START"] = true,
  436. --["SPELL_CAST_SUCCESS"] = true,
  437. --["SPELL_CAST_FAILED"] = true,
  438. ["SPELL_MISSED"] = true,
  439. ["SPELL_DAMAGE"] = true,
  440. ["SPELL_HEAL"] = true,
  441. ["SPELL_ENERGIZE"] = true,
  442. ["SPELL_DRAIN"] = true,
  443. ["SPELL_LEECH"] = true,
  444. ["SPELL_INSTAKILL"] = true,
  445. ["SPELL_INTERRUPT"] = true,
  446. ["SPELL_EXTRA_ATTACKS"] = true,
  447. --["SPELL_DURABILITY_DAMAGE"] = true,
  448. --["SPELL_DURABILITY_DAMAGE_ALL"] = true,
  449. --["SPELL_AURA_APPLIED"] = true,
  450. --["SPELL_AURA_APPLIED_DOSE"] = true,
  451. --["SPELL_AURA_REMOVED"] = true,
  452. --["SPELL_AURA_REMOVED_DOSE"] = true,
  453. ["SPELL_DISPEL"] = true,
  454. ["SPELL_STOLEN"] = true,
  455. ["ENCHANT_APPLIED"] = true,
  456. ["ENCHANT_REMOVED"] = true,
  457. --["SPELL_PERIODIC_MISSED"] = true,
  458. --["SPELL_PERIODIC_DAMAGE"] = true,
  459. --["SPELL_PERIODIC_HEAL"] = true,
  460. --["SPELL_PERIODIC_ENERGIZE"] = true,
  461. --["SPELL_PERIODIC_DRAIN"] = true,
  462. --["SPELL_PERIODIC_LEECH"] = true,
  463. ["SPELL_DISPEL_FAILED"] = true,
  464. --["DAMAGE_SHIELD"] = true,
  465. --["DAMAGE_SHIELD_MISSED"] = true,
  466. ["DAMAGE_SPLIT"] = true,
  467. ["PARTY_KILL"] = true,
  468. ["UNIT_DIED"] = true,
  469. ["UNIT_DESTROYED"] = true,
  470. ["UNIT_DISSIPATES"] = true
  471. };
  472. sourceFlags = nil;
  473. destFlags = {
  474. [COMBATLOG_FILTER_MINE] = false,
  475. [COMBATLOG_FILTER_MY_PET] = false;
  476. };
  477. };
  478. };
  479. };
  480. [2] = {
  481. -- Descriptive Information
  482. name = QUICKBUTTON_NAME_ME;
  483. hasQuickButton = true;
  484. quickButtonName = QUICKBUTTON_NAME_ME;
  485. quickButtonDisplay = {
  486. solo = true;
  487. party = true;
  488. raid = true;
  489. };
  490. tooltip = QUICKBUTTON_NAME_ME_TOOLTIP;
  491. -- Settings
  492. settings = CopyTable(COMBATLOG_DEFAULT_SETTINGS);
  493. -- Coloring
  494. colors = CopyTable(COMBATLOG_DEFAULT_COLORS);
  495. -- The actual client filters
  496. filters = {
  497. [1] = {
  498. eventList = {
  499. ["ENVIRONMENTAL_DAMAGE"] = true,
  500. ["SWING_DAMAGE"] = true,
  501. ["RANGE_DAMAGE"] = true,
  502. ["SPELL_DAMAGE"] = true,
  503. ["SPELL_HEAL"] = true,
  504. ["SPELL_PERIODIC_DAMAGE"] = true,
  505. ["SPELL_PERIODIC_HEAL"] = true,
  506. ["DAMAGE_SPLIT"] = true,
  507. ["UNIT_DIED"] = true,
  508. ["UNIT_DESTROYED"] = true,
  509. ["UNIT_DISSIPATES"] = true
  510. };
  511. sourceFlags = Blizzard_CombatLog_GenerateFullFlagList(false);
  512. destFlags = nil;
  513. };
  514. [2] = {
  515. eventList = Blizzard_CombatLog_GenerateFullEventList();
  516. sourceFlags = nil;
  517. destFlags = {
  518. [COMBATLOG_FILTER_MINE] = true,
  519. [COMBATLOG_FILTER_MY_PET] = false;
  520. };
  521. };
  522. };
  523. };
  524. };
  525. -- Current Filter
  526. currentFilter = 1;
  527. };
  528. Blizzard_CombatLog_Filters = Blizzard_CombatLog_Filter_Defaults;
  529. -- Combat Log Filter Resetting Code
  530. --
  531. -- args:
  532. -- config - the configuration array we are about to apply
  533. --
  534. function Blizzard_CombatLog_ApplyFilters(config)
  535. if ( not config ) then
  536. return;
  537. end
  538. CombatLogResetFilter()
  539. -- Loop over all associated filters
  540. local eventList;
  541. for k,v in pairs(config.filters) do
  542. local eList
  543. -- Only use the first filter's eventList because for some reason each filter that the player can see actually
  544. -- has two filters, one for source flags and one for dest flags (??), even though only the eventList for the source
  545. -- flags is updated properly
  546. eventList = config.filters[1].eventList;
  547. if ( eventList ) then
  548. for k2,v2 in pairs(eventList) do
  549. if ( v2 == true ) then
  550. -- The true comparison is because check boxes whose parent is unchecked will be non-false but not "true"
  551. eList = eList and (eList .. "," .. k2) or k2
  552. end
  553. end
  554. end
  555. local sourceFlags, destFlags;
  556. if ( v.sourceFlags ) then
  557. sourceFlags = 0;
  558. for k2, v2 in pairs(v.sourceFlags) do
  559. -- Support for GUIDs
  560. if ( type (k2) == "string" ) then
  561. sourceFlags = k2;
  562. break;
  563. end
  564. -- Otherwise OR bits
  565. if ( v2 ) then
  566. sourceFlags = bit_bor(sourceFlags, k2);
  567. end
  568. end
  569. end
  570. if ( v.destFlags ) then
  571. destFlags = 0;
  572. for k2, v2 in pairs(v.destFlags) do
  573. -- Support for GUIDs
  574. if ( type (k2) == "string" ) then
  575. destFlags = k2;
  576. break;
  577. end
  578. -- Otherwise OR bits
  579. if ( v2 ) then
  580. destFlags = bit_bor(destFlags, k2);
  581. end
  582. end
  583. end
  584. if ( type(sourceFlags) == "string" and destFlags == 0 ) then
  585. destFlags = nil;
  586. end
  587. if ( type(destFlags) == "string" and sourceFlags == 0 ) then
  588. sourceFlags = nil;
  589. end
  590. -- This is a HACK!!! Need filters to be able to accept empty or zero sourceFlags or destFlags
  591. if ( sourceFlags == 0 or destFlags == 0 ) then
  592. CombatLogAddFilter("", COMBATLOG_FILTER_MINE, nil);
  593. else
  594. CombatLogAddFilter(eList, sourceFlags, destFlags);
  595. end
  596. end
  597. end
  598. --
  599. -- Combat Log Repopulation Code
  600. --
  601. -- Message Limit
  602. COMBATLOG_MESSAGE_LIMIT = 300;
  603. --
  604. -- Repopulate the combat log with message history
  605. --
  606. function Blizzard_CombatLog_Refilter()
  607. local count = CombatLogGetNumEntries();
  608. COMBATLOG:SetMaxLines(COMBATLOG_MESSAGE_LIMIT);
  609. -- count should be between 1 and COMBATLOG_MESSAGE_LIMIT
  610. count = max(1, min(count, COMBATLOG_MESSAGE_LIMIT));
  611. CombatLogSetCurrentEntry(0);
  612. -- Clear the combat log
  613. COMBATLOG:Clear();
  614. -- Moved setting the max value here, since we don't really need to reset the max every frame, do we?
  615. -- We can't add events while refiltering (:AddFilter short circuits) so this should be safe optimization.
  616. CombatLogQuickButtonFrameProgressBar:SetMinMaxValues(0, count);
  617. CombatLogQuickButtonFrameProgressBar:SetValue(0);
  618. CombatLogQuickButtonFrameProgressBar:Show();
  619. -- Enable the distributed frame
  620. CombatLogUpdateFrame.refiltering = true;
  621. CombatLogUpdateFrame:SetScript("OnUpdate", Blizzard_CombatLog_RefilterUpdate)
  622. Blizzard_CombatLog_RefilterUpdate()
  623. end
  624. --
  625. -- This is a single frame "step" in the refiltering process
  626. --
  627. function Blizzard_CombatLog_RefilterUpdate()
  628. local valid = CombatLogGetCurrentEntry(); -- CombatLogAdvanceEntry(0);
  629. -- Clear the combat log
  630. local total = 0;
  631. while (valid and total < COMBATLOG_LIMIT_PER_FRAME) do
  632. -- Log to the window
  633. local text, r, g, b, a = CombatLog_OnEvent(Blizzard_CombatLog_CurrentSettings, CombatLogGetCurrentEntry());
  634. -- NOTE: be sure to pass in nil for the color id or the color id may override the r, g, b values for this message
  635. if ( text ) then
  636. COMBATLOG:AddMessage( text, r, g, b, nil, true );
  637. end
  638. -- count can be
  639. -- positive to advance from oldest to newest
  640. -- negative to advance from newest to oldest
  641. valid = CombatLogAdvanceEntry(-1)
  642. total = total + 1;
  643. end
  644. -- Show filtering progress bar
  645. CombatLogQuickButtonFrameProgressBar:SetValue(CombatLogQuickButtonFrameProgressBar:GetValue() + total);
  646. if ( not valid or (CombatLogQuickButtonFrameProgressBar:GetValue() >= COMBATLOG_MESSAGE_LIMIT) ) then
  647. CombatLogUpdateFrame.refiltering = false
  648. CombatLogUpdateFrame:SetScript("OnUpdate", nil)
  649. CombatLogQuickButtonFrameProgressBar:Hide();
  650. end
  651. end
  652. --
  653. -- Checks for an event over all filters
  654. --
  655. function Blizzard_CombatLog_HasEvent ( settings, ... )
  656. -- If this actually happens, we have data corruption issues.
  657. if ( not settings.filters ) then
  658. settings.filters = {}
  659. end
  660. for _, filter in pairs (settings.filters) do
  661. if ( filter.eventList ) then
  662. for i = 1, select("#", ...) do
  663. local event = select(i, ...)
  664. if ( filter.eventList[event] == true ) then
  665. return true
  666. end
  667. end
  668. end
  669. end
  670. end
  671. --
  672. -- Checks for an event over all filters
  673. --
  674. function Blizzard_CombatLog_EnableEvent ( settings, ... )
  675. -- If this actually happens, we have data corruption issues.
  676. if ( not settings.filters ) then
  677. settings.filters = Blizzard_CombatLog_InitializeFilters( settings );
  678. end
  679. for _, filter in pairs (settings.filters) do
  680. if ( not filter.eventList ) then
  681. filter.eventList = {};
  682. end
  683. for i = 1, select("#", ...) do
  684. filter.eventList[select(i, ...)] = true;
  685. end
  686. end
  687. end
  688. --
  689. -- Checks for an event over all filters
  690. --
  691. function Blizzard_CombatLog_DisableEvent ( settings, ... )
  692. -- If this actually happens, we have data corruption issues.
  693. if ( not settings.filters ) then
  694. settings.filters = {}
  695. end
  696. for _, filter in pairs (settings.filters) do
  697. if ( filter.eventList ) then
  698. for i = 1, select("#", ...) do
  699. filter.eventList[select(i, ...)] = false;
  700. end
  701. end
  702. end
  703. end
  704. --
  705. -- Creates the action menu popup
  706. --
  707. do
  708. local eventType
  709. local actionMenu = {
  710. [1] = {
  711. text = "string.format(BLIZZARD_COMBAT_LOG_MENU_SPELL_HIDE, eventType)",
  712. func = function () Blizzard_CombatLog_SpellMenuClick ("HIDE", nil, nil, eventType); end;
  713. },
  714. };
  715. function Blizzard_CombatLog_CreateActionMenu(eventType_arg)
  716. -- Update upvalues
  717. eventType = eventType_arg
  718. actionMenu[1].text = string.format(BLIZZARD_COMBAT_LOG_MENU_SPELL_HIDE, eventType_arg);
  719. return actionMenu
  720. end
  721. end
  722. --
  723. -- Creates the spell menu popup
  724. --
  725. do
  726. local spellName, spellId, eventType
  727. local spellMenu = {
  728. [1] = {
  729. text = "string.format(BLIZZARD_COMBAT_LOG_MENU_SPELL_LINK, spellName)",
  730. func = function () Blizzard_CombatLog_SpellMenuClick ("LINK", spellName, spellId, eventType); end;
  731. },
  732. };
  733. local spellMenu2 = {
  734. [2] = {
  735. text = "string.format(BLIZZARD_COMBAT_LOG_MENU_SPELL_HIDE, eventType)",
  736. func = function () Blizzard_CombatLog_SpellMenuClick ("HIDE", spellName, spellId, eventType); end;
  737. },
  738. [3] = {
  739. text = "------------------";
  740. disabled = true;
  741. },
  742. };
  743. function Blizzard_CombatLog_CreateSpellMenu(spellName_arg, spellId_arg, eventType_arg)
  744. -- Update upvalues
  745. spellName, spellId, eventType = spellName_arg, spellId_arg, eventType_arg;
  746. -- Update menu text and filters
  747. spellMenu[1].text = string.format(BLIZZARD_COMBAT_LOG_MENU_SPELL_LINK, spellName);
  748. if ( eventType ) then
  749. spellMenu2[2].text = string.format(BLIZZARD_COMBAT_LOG_MENU_SPELL_HIDE, eventType);
  750. -- Copy the table references over
  751. spellMenu[2] = spellMenu2[2];
  752. if ( DEBUG ) then
  753. spellMenu[3] = spellMenu2[3];
  754. -- These 2 calls update the menus in their respective do-end blocks
  755. spellMenu[4] = Blizzard_CombatLog_FormattingMenu(Blizzard_CombatLog_Filters.currentFilter);
  756. spellMenu[5] = Blizzard_CombatLog_MessageTypesMenu(Blizzard_CombatLog_Filters.currentFilter);
  757. end
  758. else
  759. -- Remove the table references, they are still stored in their various closures
  760. spellMenu[2] = nil;
  761. spellMenu[3] = nil;
  762. spellMenu[4] = nil;
  763. spellMenu[5] = nil;
  764. end
  765. return spellMenu;
  766. end
  767. end
  768. --
  769. -- Temporary Menu
  770. --
  771. do
  772. -- This big table currently only has one upvalue: Blizzard_CombatLog_CurrentSettings
  773. local messageTypesMenu = {
  774. text = "Message Types";
  775. hasArrow = true;
  776. menuList = {
  777. [1] = {
  778. text = "Melee";
  779. hasArrow = true;
  780. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SWING_DAMAGE", "SWING_MISSED"); end;
  781. keepShownOnClick = true;
  782. func = function ( self, arg1, arg2, checked )
  783. Blizzard_CombatLog_MenuHelper ( checked, "SWING_DAMAGE", "SWING_MISSED" );
  784. end;
  785. menuList = {
  786. [1] = {
  787. text = "Damage";
  788. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SWING_DAMAGE");end;
  789. keepShownOnClick = true;
  790. func = function ( self, arg1, arg2, checked )
  791. Blizzard_CombatLog_MenuHelper ( checked, "SWING_DAMAGE" );
  792. end;
  793. };
  794. [2] = {
  795. text = "Failure";
  796. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SWING_MISSED"); end;
  797. keepShownOnClick = true;
  798. func = function ( self, arg1, arg2, checked )
  799. Blizzard_CombatLog_MenuHelper ( checked, "SWING_MISSED" );
  800. end;
  801. };
  802. };
  803. };
  804. [2] = {
  805. text = "Ranged";
  806. hasArrow = true;
  807. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "RANGE_DAMAGE", "RANGE_MISSED"); end;
  808. keepShownOnClick = true;
  809. func = function ( self, arg1, arg2, checked )
  810. Blizzard_CombatLog_MenuHelper ( checked, "RANGED_DAMAGE", "RANGED_MISSED" );
  811. end;
  812. menuList = {
  813. [1] = {
  814. text = "Damage";
  815. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "RANGE_DAMAGE"); end;
  816. keepShownOnClick = true;
  817. func = function ( self, arg1, arg2, checked )
  818. Blizzard_CombatLog_MenuHelper ( checked, "RANGE_DAMAGE" );
  819. end;
  820. };
  821. [2] = {
  822. text = "Failure";
  823. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "RANGE_MISSED"); end;
  824. keepShownOnClick = true;
  825. func = function ( self, arg1, arg2, checked )
  826. Blizzard_CombatLog_MenuHelper ( checked, "RANGE_MISSED" );
  827. end;
  828. };
  829. };
  830. };
  831. [3] = {
  832. text = "Spells";
  833. hasArrow = true;
  834. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_DAMAGE", "SPELL_MISSED", "SPELL_HEAL", "SPELL_ENERGIZE", "SPELL_DRAIN", "SPELL_LEECH", "SPELL_INTERRUPT", "SPELL_EXTRA_ATTACKS", "SPELL_CAST_START", "SPELL_CAST_SUCCESS", "SPELL_CAST_FAILED", "SPELL_INSTAKILL", "SPELL_DURABILITY_DAMAGE" ); end;
  835. keepShownOnClick = true;
  836. func = function ( self, arg1, arg2, checked )
  837. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_DAMAGE", "SPELL_MISSED", "SPELL_HEAL", "SPELL_ENERGIZE", "SPELL_DRAIN", "SPELL_LEECH", "SPELL_INTERRUPT", "SPELL_EXTRA_ATTACKS", "SPELL_CAST_START", "SPELL_CAST_SUCCESS", "SPELL_CAST_FAILED", "SPELL_INSTAKILL", "SPELL_DURABILITY_DAMAGE" );
  838. end;
  839. menuList = {
  840. [1] = {
  841. text = "Damage";
  842. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_DAMAGE"); end;
  843. keepShownOnClick = true;
  844. func = function ( self, arg1, arg2, checked )
  845. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_DAMAGE" );
  846. end;
  847. };
  848. [2] = {
  849. text = "Failure";
  850. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_MISSED"); end;
  851. keepShownOnClick = true;
  852. func = function ( self, arg1, arg2, checked )
  853. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_MISSED" );
  854. end;
  855. };
  856. [3] = {
  857. text = "Heals";
  858. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_HEAL"); end;
  859. keepShownOnClick = true;
  860. func = function ( self, arg1, arg2, checked )
  861. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_HEAL" );
  862. end;
  863. };
  864. [4] = {
  865. text = "Power Gains";
  866. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_ENERGIZE"); end;
  867. keepShownOnClick = true;
  868. func = function ( self, arg1, arg2, checked )
  869. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_ENERGIZE" );
  870. end;
  871. };
  872. [4] = {
  873. text = "Drains";
  874. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_DRAIN", "SPELL_LEECH"); end;
  875. keepShownOnClick = true;
  876. func = function ( self, arg1, arg2, checked )
  877. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_DRAIN", "SPELL_LEECH" );
  878. end;
  879. };
  880. [5] = {
  881. text = "Interrupts";
  882. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_INTERRUPT"); end;
  883. keepShownOnClick = true;
  884. func = function ( self, arg1, arg2, checked )
  885. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_INTERRUPT" );
  886. end;
  887. };
  888. [6] = {
  889. text = "Extra Attacks";
  890. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_EXTRA_ATTACKS"); end;
  891. keepShownOnClick = true;
  892. func = function ( self, arg1, arg2, checked )
  893. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_EXTRA_ATTACKS" );
  894. end;
  895. };
  896. [7] = {
  897. text = "Casting";
  898. hasArrow = true;
  899. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_CAST_START", "SPELL_CAST_SUCCESS", "SPELL_CAST_FAILED"); end;
  900. keepShownOnClick = true;
  901. func = function ( self, arg1, arg2, checked )
  902. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_CAST_START", "SPELL_CAST_SUCCESS", "SPELL_CAST_FAILED");
  903. end;
  904. menuList = {
  905. [1] = {
  906. text = "Start";
  907. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_CAST_START"); end;
  908. keepShownOnClick = true;
  909. func = function ( self, arg1, arg2, checked )
  910. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_CAST_START" );
  911. end;
  912. };
  913. [2] = {
  914. text = "Success";
  915. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_CAST_SUCCESS"); end;
  916. keepShownOnClick = true;
  917. func = function ( self, arg1, arg2, checked )
  918. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_CAST_SUCCESS" );
  919. end;
  920. };
  921. [3] = {
  922. text = "Failed";
  923. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_CAST_FAILED"); end;
  924. keepShownOnClick = true;
  925. func = function ( self, arg1, arg2, checked )
  926. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_CAST_FAILED" );
  927. end;
  928. };
  929. };
  930. };
  931. [8] = {
  932. text = "Special";
  933. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_INSTAKILL", "SPELL_DURABILITY_DAMAGE"); end;
  934. keepShownOnClick = true;
  935. func = function ( self, arg1, arg2, checked )
  936. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_INSTAKILL", "SPELL_DURABILITY_DAMAGE" );
  937. end;
  938. };
  939. };
  940. };
  941. [4] = {
  942. text = "Auras";
  943. hasArrow = true;
  944. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_AURA_APPLIED", "SPELL_AURA_BROKEN", "SPELL_AURA_REFRESH", "SPELL_AURA_BROKEN_SPELL", "SPELL_AURA_APPLIED_DOSE", "SPELL_AURA_REMOVED", "SPELL_AURA_REMOVED_DOSE", "SPELL_DISPEL", "SPELL_STOLEN", "ENCHANT_APPLIED", "ENCHANT_REMOVED" ); end;
  945. keepShownOnClick = true;
  946. func = function ( self, arg1, arg2, checked )
  947. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_AURA_APPLIED", "SPELL_AURA_BROKEN", "SPELL_AURA_REFRESH", "SPELL_AURA_BROKEN_SPELL", "SPELL_AURA_APPLIED_DOSE", "SPELL_AURA_REMOVED", "SPELL_AURA_REMOVED_DOSE", "SPELL_DISPEL", "SPELL_STOLEN", "ENCHANT_APPLIED", "ENCHANT_REMOVED" );
  948. end;
  949. menuList = {
  950. [1] = {
  951. text = "Applied";
  952. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_AURA_APPLIED", "SPELL_AURA_BROKEN", "SPELL_AURA_REFRESH", "SPELL_AURA_BROKEN_SPELL", "SPELL_AURA_APPLIED_DOSE"); end;
  953. keepShownOnClick = true;
  954. func = function ( self, arg1, arg2, checked )
  955. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_AURA_APPLIED", "SPELL_AURA_BROKEN", "SPELL_AURA_REFRESH", "SPELL_AURA_BROKEN_SPELL", "SPELL_AURA_APPLIED_DOSE", "ENCHANT_APPLIED" );
  956. end;
  957. };
  958. [2] = {
  959. text = "Removed";
  960. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_AURA_REMOVED", "SPELL_AURA_REMOVED_DOSE", "ENCHANT_REMOVED" ); end;
  961. keepShownOnClick = true;
  962. func = function ( self, arg1, arg2, checked )
  963. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_AURA_REMOVED", "SPELL_AURA_REMOVED_DOSE" );
  964. end;
  965. };
  966. [3] = {
  967. text = "Dispelled";
  968. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_DISPEL"); end;
  969. keepShownOnClick = true;
  970. func = function ( self, arg1, arg2, checked )
  971. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_DISPEL" );
  972. end;
  973. };
  974. [4] = {
  975. text = "Stolen";
  976. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_STOLEN"); end;
  977. keepShownOnClick = true;
  978. func = function ( self, arg1, arg2, checked )
  979. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_STOLEN" );
  980. end;
  981. };
  982. };
  983. };
  984. [5] = {
  985. text = "Periodics";
  986. hasArrow = true;
  987. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_PERIODIC_DAMAGE", "SPELL_PERIODIC_MISSED", "SPELL_PERIODIC_DRAIN", "SPELL_PERIODIC_ENERGIZE", "SPELL_PERIODIC_HEAL", "SPELL_PERIODIC_LEECH" ); end;
  988. keepShownOnClick = true;
  989. func = function ( self, arg1, arg2, checked )
  990. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_PERIODIC_DAMAGE", "SPELL_PERIODIC_MISSED", "SPELL_PERIODIC_DRAIN", "SPELL_PERIODIC_ENERGIZE", "SPELL_PERIODIC_HEAL", "SPELL_PERIODIC_LEECH" );
  991. end;
  992. menuList = {
  993. [1] = {
  994. text = "Damage";
  995. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_PERIODIC_DAMAGE"); end;
  996. keepShownOnClick = true;
  997. func = function ( self, arg1, arg2, checked )
  998. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_PERIODIC_DAMAGE" );
  999. end;
  1000. };
  1001. [2] = {
  1002. text = "Failure";
  1003. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_PERIODIC_MISSED" ); end;
  1004. keepShownOnClick = true;
  1005. func = function ( self, arg1, arg2, checked )
  1006. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_PERIODIC_MISSED" );
  1007. end;
  1008. };
  1009. [3] = {
  1010. text = "Heals";
  1011. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_PERIODIC_HEAL"); end;
  1012. keepShownOnClick = true;
  1013. func = function ( self, arg1, arg2, checked )
  1014. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_PERIODIC_HEAL" );
  1015. end;
  1016. };
  1017. [4] = {
  1018. text = "Other";
  1019. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "SPELL_PERIODIC_DRAIN", "SPELL_PERIODIC_ENERGIZE", "SPELL_PERIODIC_LEECH"); end;
  1020. keepShownOnClick = true;
  1021. func = function ( self, arg1, arg2, checked )
  1022. Blizzard_CombatLog_MenuHelper ( checked, "SPELL_PERIODIC_DRAIN", "SPELL_PERIODIC_ENERGIZE", "SPELL_PERIODIC_LEECH" );
  1023. end;
  1024. };
  1025. };
  1026. };
  1027. [6] = {
  1028. text = "Other";
  1029. hasArrow = true;
  1030. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "PARTY_KILL", "UNIT_DIED", "UNIT_DESTROYED", "UNIT_DISSIPATES", "DAMAGE_SPLIT", "ENVIRONMENTAL_DAMAGE" ); end;
  1031. keepShownOnClick = true;
  1032. func = function ( self, arg1, arg2, checked )
  1033. Blizzard_CombatLog_MenuHelper ( checked, "PARTY_KILL", "UNIT_DIED", "UNIT_DESTROYED", "UNIT_DISSIPATES", "DAMAGE_SPLIT", "ENVIRONMENTAL_DAMAGE" );
  1034. end;
  1035. menuList = {
  1036. [1] = {
  1037. text = "Kills";
  1038. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "PARTY_KILL"); end;
  1039. keepShownOnClick = true;
  1040. func = function ( self, arg1, arg2, checked )
  1041. Blizzard_CombatLog_MenuHelper ( checked, "PARTY_KILL" );
  1042. end;
  1043. };
  1044. [2] = {
  1045. text = "Deaths";
  1046. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "UNIT_DIED", "UNIT_DESTROYED", "UNIT_DISSIPATES"); end;
  1047. keepShownOnClick = true;
  1048. func = function ( self, arg1, arg2, checked )
  1049. Blizzard_CombatLog_MenuHelper ( checked, "UNIT_DIED", "UNIT_DESTROYED", "UNIT_DISSIPATES" );
  1050. end;
  1051. };
  1052. [3] = {
  1053. text = "Damage Split";
  1054. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "DAMAGE_SPLIT"); end;
  1055. keepShownOnClick = true;
  1056. func = function ( self, arg1, arg2, checked )
  1057. Blizzard_CombatLog_MenuHelper ( checked, "DAMAGE_SPLIT" );
  1058. end;
  1059. };
  1060. [4] = {
  1061. text = "Environmental Damage";
  1062. checked = function() return Blizzard_CombatLog_HasEvent (Blizzard_CombatLog_CurrentSettings, "ENVIRONMENTAL_DAMAGE"); end;
  1063. keepShownOnClick = true;
  1064. func = function ( self, arg1, arg2, checked )
  1065. Blizzard_CombatLog_MenuHelper ( checked, "ENVIRONMENTAL_DAMAGE" );
  1066. end;
  1067. };
  1068. };
  1069. };
  1070. };
  1071. };
  1072. -- functions I see do pass in arguments, update upvalues as necessary.
  1073. function Blizzard_CombatLog_MessageTypesMenu()
  1074. return messageTypesMenu;
  1075. end
  1076. end
  1077. --
  1078. -- Temporary Menu
  1079. --
  1080. do
  1081. local filterId
  1082. local filter
  1083. local currentFilter
  1084. local formattingMenu = {
  1085. text = "Formatting";
  1086. hasArrow = true;
  1087. menuList = {
  1088. {
  1089. text = "Full Text";
  1090. checked = function() return filter.fullText; end;
  1091. func = function(self, arg1, arg2, checked)
  1092. filter.fullText = checked;
  1093. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1094. end;
  1095. keepShownOnClick = true;
  1096. },
  1097. {
  1098. text = "Timestamp";
  1099. checked = function() return filter.timestamp; end;
  1100. func = function(self, arg1, arg2, checked)
  1101. filter.timestamp = checked;
  1102. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1103. end;
  1104. keepShownOnClick = true;
  1105. },
  1106. {
  1107. text = "Unit Name Coloring";
  1108. checked = function() return filter.unitColoring; end;
  1109. func = function(self, arg1, arg2, checked)
  1110. filter.unitColoring = checked;
  1111. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1112. end;
  1113. keepShownOnClick = true;
  1114. },
  1115. {
  1116. text = "Line Coloring";
  1117. checked = function() return filter.lineColoring; end;
  1118. func = function(self, arg1, arg2, checked)
  1119. filter.lineColoring = checked;
  1120. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1121. end;
  1122. keepShownOnClick = true;
  1123. },
  1124. {
  1125. text = "Line Highlighting";
  1126. checked = function() return filter.lineHighlighting; end;
  1127. func = function(self, arg1, arg2, checked)
  1128. filter.lineHighlighting = checked;
  1129. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1130. end;
  1131. keepShownOnClick = true;
  1132. },
  1133. {
  1134. text = "Ability Coloring";
  1135. checked = function() return filter.abilityColoring; end;
  1136. func = function(self, arg1, arg2, checked)
  1137. filter.abilityColoring = checked;
  1138. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1139. end;
  1140. keepShownOnClick = true;
  1141. },
  1142. {
  1143. text = "Ability-by-School Coloring";
  1144. checked = function() return filter.abilitySchoolColoring; end;
  1145. --disabled = not filter.abilityColoring;
  1146. func = function(self, arg1, arg2, checked)
  1147. filter.abilitySchoolColoring = checked;
  1148. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1149. end;
  1150. keepShownOnClick = true;
  1151. },
  1152. {
  1153. text = "Ability-by-Actor Coloring";
  1154. checked = function() return filter.abilityActorColoring; end;
  1155. func = function(self, arg1, arg2, checked)
  1156. filter.abilityActorColoring = checked;
  1157. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1158. end;
  1159. keepShownOnClick = true;
  1160. },
  1161. {
  1162. text = "Ability Highlighting";
  1163. checked = function() return filter.abilityHighlighting; end;
  1164. func = function(self, arg1, arg2, checked)
  1165. filter.abilityHighlighting = checked;
  1166. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1167. end;
  1168. keepShownOnClick = true;
  1169. },
  1170. {
  1171. text = "Action Coloring";
  1172. checked = function() return filter.actionColoring; end;
  1173. func = function(self, arg1, arg2, checked)
  1174. filter.actionColoring = checked;
  1175. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1176. end;
  1177. keepShownOnClick = true;
  1178. },
  1179. {
  1180. text = "Action-by-School Coloring";
  1181. checked = function() return filter.actionSchoolColoring; end;
  1182. func = function(self, arg1, arg2, checked)
  1183. filter.actionSchoolColoring = checked;
  1184. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1185. end;
  1186. keepShownOnClick = true;
  1187. },
  1188. {
  1189. text = "Action-by-Actor Coloring";
  1190. checked = function() return filter.actionActorColoring; end;
  1191. --disabled = not filter.abilityColoring;
  1192. func = function(self, arg1, arg2, checked)
  1193. filter.actionActorColoring = checked;
  1194. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1195. end;
  1196. keepShownOnClick = true;
  1197. },
  1198. {
  1199. text = "Action Highlighting";
  1200. checked = function() return filter.actionHighlighting; end;
  1201. --disabled = not filter.abilityColoring;
  1202. func = function(self, arg1, arg2, checked)
  1203. filter.actionHighlighting = checked;
  1204. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1205. end;
  1206. keepShownOnClick = true;
  1207. },
  1208. {
  1209. text = "Damage Coloring";
  1210. checked = function() return filter.amountColoring; end;
  1211. func = function(self, arg1, arg2, checked)
  1212. filter.amountColoring = checked;
  1213. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1214. end;
  1215. keepShownOnClick = true;
  1216. },
  1217. {
  1218. text = "Damage-by-School Coloring";
  1219. checked = function() return filter.amountSchoolColoring; end;
  1220. --disabled = not filter.amountColoring;
  1221. func = function(self, arg1, arg2, checked)
  1222. filter.amountSchoolColoring = checked;
  1223. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1224. end;
  1225. keepShownOnClick = true;
  1226. },
  1227. {
  1228. text = "Damage-by-Actor Coloring";
  1229. checked = function() return filter.amountActorColoring; end;
  1230. --disabled = not filter.amountColoring;
  1231. func = function(self, arg1, arg2, checked)
  1232. filter.amountActorColoring = checked;
  1233. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1234. end;
  1235. keepShownOnClick = true;
  1236. },
  1237. {
  1238. text = "Damage Highlighting";
  1239. checked = function() return filter.amountHighlighting; end;
  1240. func = function(self, arg1, arg2, checked)
  1241. filter.amountHighlighting = checked;
  1242. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1243. end;
  1244. keepShownOnClick = true;
  1245. },
  1246. {
  1247. text = "Color School Names";
  1248. checked = function() return filter.schoolNameColoring; end;
  1249. func = function(self, arg1, arg2, checked)
  1250. filter.schoolNameColoring = checked;
  1251. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1252. end;
  1253. keepShownOnClick = true;
  1254. },
  1255. {
  1256. text = "School Name Highlighting";
  1257. checked = function() return filter.schoolNameHighlighting; end;
  1258. func = function(self, arg1, arg2, checked)
  1259. filter.schoolNameHighlighting = checked;
  1260. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1261. end;
  1262. keepShownOnClick = true;
  1263. },
  1264. {
  1265. text = "White Swing Rule";
  1266. checked = function() return filter.noMeleeSwingColoring; end;
  1267. func = function(self, arg1, arg2, checked)
  1268. filter.noMeleeSwingColoring = checked;
  1269. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1270. end;
  1271. keepShownOnClick = true;
  1272. },
  1273. {
  1274. text = "Misses Colored Rule";
  1275. checked = function() return filter.missColoring; end;
  1276. func = function(self, arg1, arg2, checked)
  1277. filter.missColoring = checked;
  1278. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1279. end;
  1280. keepShownOnClick = true;
  1281. },
  1282. {
  1283. text = "Braces";
  1284. checked = function() return filter.braces; end;
  1285. func = function(self, arg1, arg2, checked)
  1286. filter.braces = checked;
  1287. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1288. end;
  1289. keepShownOnClick = true;
  1290. },
  1291. {
  1292. text = "Refiltering";
  1293. checked = function() return filter.showHistory; end;
  1294. func = function(self, arg1, arg2, checked)
  1295. filter.showHistory = checked;
  1296. Blizzard_CombatLog_QuickButton_OnClick(currentFilter)
  1297. end;
  1298. keepShownOnClick = true;
  1299. tooltipTitle = "Refiltering";
  1300. tooltipText = "This clears the chat frame and refills it with the last 500 events.";
  1301. },
  1302. };
  1303. };
  1304. function Blizzard_CombatLog_FormattingMenu(filterId_arg)
  1305. -- Update upvalues
  1306. filterId = filterId_arg;
  1307. filter = Blizzard_CombatLog_Filters.filters[filterId].settings;
  1308. currentFilter = Blizzard_CombatLog_Filters.currentFilter;
  1309. return formattingMenu;
  1310. end
  1311. end
  1312. --
  1313. -- Menu Option Helper Function
  1314. --
  1315. function Blizzard_CombatLog_MenuHelper ( checked, ... )
  1316. if ( not checked ) then
  1317. Blizzard_CombatLog_DisableEvent (Blizzard_CombatLog_CurrentSettings, ...);
  1318. else
  1319. Blizzard_CombatLog_EnableEvent (Blizzard_CombatLog_CurrentSettings, ...);
  1320. end
  1321. Blizzard_CombatLog_ApplyFilters(Blizzard_CombatLog_CurrentSettings);
  1322. if ( Blizzard_CombatLog_CurrentSettings.settings.showHistory ) then
  1323. Blizzard_CombatLog_Refilter();
  1324. end
  1325. end;
  1326. --
  1327. -- Blizzard_CombatLog_CreateTabMenu
  1328. --
  1329. -- Creates a context sensitive menu based on the current quick button
  1330. --
  1331. -- args:
  1332. -- settingsIndex - the filter settings to use
  1333. --
  1334. do
  1335. local filterId
  1336. local unitName, unitGUID, special
  1337. local tabMenu = {
  1338. [1] = {
  1339. text = BLIZZARD_COMBAT_LOG_MENU_EVERYTHING;
  1340. func = function () Blizzard_CombatLog_UnitMenuClick ("EVERYTHING", unitName, unitGUID, special); end;
  1341. },
  1342. [2] = {
  1343. text = BLIZZARD_COMBAT_LOG_MENU_SAVE;
  1344. func = function () Blizzard_CombatLog_UnitMenuClick ("SAVE", unitName, unitGUID, special); end;
  1345. },
  1346. [3] = {
  1347. text = BLIZZARD_COMBAT_LOG_MENU_RESET;
  1348. func = function () Blizzard_CombatLog_UnitMenuClick ("RESET", unitName, unitGUID, special); end;
  1349. },
  1350. [4] = {
  1351. text = "--------- Temporary Adjustments ---------";
  1352. disabled = true;
  1353. },
  1354. };
  1355. function Blizzard_CombatLog_CreateTabMenu ( filterId_arg )
  1356. -- Update upvalues
  1357. filterId = filterId_arg
  1358. -- Update menus
  1359. tabMenu[2].disabled = (Blizzard_CombatLog_PreviousSettings == Blizzard_CombatLog_CurrentSettings)
  1360. tabMenu[5] = Blizzard_CombatLog_FormattingMenu(filterId);
  1361. tabMenu[6] = Blizzard_CombatLog_MessageTypesMenu(filterId);
  1362. return tabMenu;
  1363. end
  1364. end
  1365. --
  1366. -- Temporary Menu
  1367. --
  1368. do
  1369. function Blizzard_CombatLog_CreateUnitMenu(unitName

Large files files are truncated, but you can click here to view the full file