vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | ------------------------------------------------------------------------------- |
2 | -- Titan [CritLine] -- |
||
3 | ------------------------------------------------------------------------------- |
||
4 | --[[ |
||
5 | VERSION HISTORY: |
||
6 | |||
7 | Titan [CritLine] v0.3.7 |
||
8 | -Fixed an bug with DE and FR clients. |
||
9 | |||
10 | Titan [CritLine] v0.3.6 |
||
11 | -Fixed an bug with DE client. |
||
12 | |||
13 | Titan [CritLine] v0.3.5 |
||
14 | -Fixed an bug with DE clients crits not working. |
||
15 | -Fixed a bug with french text on the settings menu. |
||
16 | |||
17 | Titan [CritLine] v0.3.4 |
||
18 | -Fixed an error with the French clients recording one hit as a Crit and Normal hit. |
||
19 | -Settings menu translated to French and German. |
||
20 | -Changed default for Level Adjustment to be off. |
||
21 | |||
22 | Titan [CritLine] v0.3.3 |
||
23 | -Attempts to repair saved data information. |
||
24 | -Fixed an issue with French clients not recording hits. |
||
25 | |||
26 | Titan [CritLine] v0.3.2 |
||
27 | -Fixed an issue with German clients not recording hits. |
||
28 | -Added Right-Click menu to toggle Icon/Text. |
||
29 | -Added better error handling and error recovery. |
||
30 | |||
31 | Titan [CritLine] v0.3.1 |
||
32 | -Added command to rebuild data structure. |
||
33 | -Change archive format to .zip. |
||
34 | |||
35 | Titan [CritLine] v0.3 |
||
36 | -Added level range filter. |
||
37 | -Added attack type to splash screen message (e.g. 'New Ambush Record!') |
||
38 | -Cleaned up summary tooltip. |
||
39 | -Added healing spells. |
||
40 | |||
41 | Titan [CritLine] v0.2 |
||
42 | -Added settings menu |
||
43 | -Added Detailed summary for high damage attacks (ToolTip) |
||
44 | -Toggle for ScreenShot on new damage records. |
||
45 | -Toggle for counting PvP damage only. |
||
46 | -Toggle for sound |
||
47 | -Toggle Splash Screen |
||
48 | |||
49 | Titan [CritLine] v0.1 |
||
50 | -Initial Release |
||
51 | ]] |
||
52 | ------------------------------------------------------------------------------- |
||
53 | |||
54 | DEBUG = false; --A flag for outputting debug info to the console. |
||
55 | |||
56 | TITAN_CRITLINE_ID = "CritLine"; |
||
57 | TITAN_CRITLINE_VERSION = " v0.3.5"; |
||
58 | |||
59 | TITAN_CRITLINE_BUTTON_LABEL = "CL: "; |
||
60 | TITAN_CRITLINE_BUTTON_ICON = "Interface\\AddOns\\TitanCritLine\\TitanCritLine"; |
||
61 | TITAN_CRITLINE_BUTTON_TEXT = "%s/%s"; |
||
62 | |||
63 | HEADER_TEXT_COLOR = "|cffffffff"; --White |
||
64 | SUBHEADER_TEXT_COLOR = "|cffCEA208"; --Gold |
||
65 | BODY_TEXT_COLOR = "|cffffffff"; --?White? |
||
66 | HINT_TEXT_COLOR = "|cff00ff00"; --Green |
||
67 | |||
68 | TitanCritLine_PlayerRealm = ""; |
||
69 | TitanCritLine_PlayerName = ""; |
||
70 | TitanCritLine_PlayerRealmName = ""; |
||
71 | |||
72 | DAMAGE_TYPE_NONHEAL = "0"; |
||
73 | DAMAGE_TYPE_HEAL = "1"; |
||
74 | |||
75 | ------------------------------------------------------------------------------- |
||
76 | function TitanCritLine_DisplaySettings() |
||
77 | |||
78 | --display a settings menu; |
||
79 | TitanCritLine_SettingsFrameTitle:SetText(COLOR(HEADER_TEXT_COLOR, TITAN_CRITLINE_ID.." Settings")); |
||
80 | |||
81 | TitanCritLine_SettingsFrame_Option1Text:SetText(COLOR(SUBHEADER_TEXT_COLOR, TITAN_CRITLINE_OPTION_SPLASH_TEXT)); |
||
82 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["SPLASH"] == "1" ) then |
||
83 | TitanCritLine_SettingsFrame_Option1:SetChecked(true); |
||
84 | end |
||
85 | |||
86 | TitanCritLine_SettingsFrame_Option2Text:SetText(COLOR(SUBHEADER_TEXT_COLOR, TITAN_CRITLINE_OPTION_PLAYSOUNDS_TEXT)); |
||
87 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["PLAYSOUND"] == "1" ) then |
||
88 | TitanCritLine_SettingsFrame_Option2:SetChecked(true); |
||
89 | end |
||
90 | |||
91 | TitanCritLine_SettingsFrame_Option3Text:SetText(COLOR(SUBHEADER_TEXT_COLOR, TITAN_CRITLINE_OPTION_PVPONLY_TEXT)); |
||
92 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["PVPONLY"] == "1" ) then |
||
93 | TitanCritLine_SettingsFrame_Option3:SetChecked(true); |
||
94 | end |
||
95 | |||
96 | TitanCritLine_SettingsFrame_Option4Text:SetText(COLOR(SUBHEADER_TEXT_COLOR, TITAN_CRITLINE_OPTION_SCREENCAP_TEXT)); |
||
97 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["SNAPSHOT"] == "1" ) then |
||
98 | TitanCritLine_SettingsFrame_Option4:SetChecked(true); |
||
99 | end |
||
100 | |||
101 | TitanCritLine_SettingsFrame_Option5Text:SetText(COLOR(SUBHEADER_TEXT_COLOR, TITAN_CRITLINE_OPTION_LVLADJ_TEXT)); |
||
102 | if ( tonumber(TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["LVLADJ"]) > 0 ) then |
||
103 | TitanCritLine_SettingsFrame_Option5:SetChecked(true); |
||
104 | end |
||
105 | |||
106 | TitanCritLine_SettingsFrame_Option6Text:SetText(COLOR(SUBHEADER_TEXT_COLOR, TITAN_CRITLINE_OPTION_FILTER_HEALING_TEXT)); |
||
107 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["FILTER_HEALING"] == "1" ) then |
||
108 | TitanCritLine_SettingsFrame_Option6:SetChecked(true); |
||
109 | end |
||
110 | |||
111 | TitanCritLine_SettingsFrame_Reset:SetText(COLOR(SUBHEADER_TEXT_COLOR, TITAN_CRITLINE_OPTION_RESET_TEXT)); |
||
112 | |||
113 | TitanCritLine_SettingsFrame:Show(); |
||
114 | end |
||
115 | ------------------------------------------------------------------------------- |
||
116 | function TitanPanelRightClickMenu_PrepareCritLineMenu() |
||
117 | |||
118 | local id = TITAN_CRITLINE_ID; |
||
119 | TitanPanelRightClickMenu_AddTitle(TitanPlugins[id].menuText..TITAN_CRITLINE_VERSION); |
||
120 | |||
121 | local info = {}; |
||
122 | info.text = "Settings"; |
||
123 | info.func = TitanCritLine_DisplaySettings; |
||
124 | --info.checked = TitanGetVar(id, "ShowUsedSlots"); |
||
125 | UIDropDownMenu_AddButton(info); |
||
126 | |||
127 | TitanPanelRightClickMenu_AddSpacer(); |
||
128 | TitanPanelRightClickMenu_AddToggleIcon(id); |
||
129 | TitanPanelRightClickMenu_AddToggleLabelText(id); |
||
130 | |||
131 | TitanPanelRightClickMenu_AddSpacer(); |
||
132 | TitanPanelRightClickMenu_AddCommand(TITAN_PANEL_MENU_HIDE, id, TITAN_PANEL_MENU_FUNC_HIDE); |
||
133 | end |
||
134 | ------------------------------------------------------------------------------- |
||
135 | function COLOR(color, msg) |
||
136 | return color..msg..FONT_COLOR_CODE_CLOSE; |
||
137 | end |
||
138 | ------------------------------------------------------------------------------- |
||
139 | function TitanCritLine_OnClick(button) |
||
140 | if (button == "LeftButton") then |
||
141 | TitanCritLine_DisplaySettings(); |
||
142 | end |
||
143 | end |
||
144 | ------------------------------------------------------------------------------- |
||
145 | function TitanPanelCritLine_GetButtonText(id) |
||
146 | local buttonRichText = format(TITAN_CRITLINE_BUTTON_TEXT, COLOR(BODY_TEXT_COLOR, TitanCritLine_GetHighestDamage()), COLOR(BODY_TEXT_COLOR, TitanCritLine_GetHighestCrit())); |
||
147 | |||
148 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["FILTER_HEALING"] == "0") then |
||
149 | buttonRichText = buttonRichText.." - "..format(TITAN_CRITLINE_BUTTON_TEXT, COLOR(BODY_TEXT_COLOR, TitanCritLine_GetHighestHeal()), COLOR(BODY_TEXT_COLOR, TitanCritLine_GetHighestHealCrit())); |
||
150 | end |
||
151 | |||
152 | TitanCritLine_DEBUG("TitanPanelCritLine_GetButtonText: "..TITAN_CRITLINE_BUTTON_LABEL..buttonRichText); |
||
153 | return TITAN_CRITLINE_BUTTON_LABEL, buttonRichText; |
||
154 | end |
||
155 | ------------------------------------------------------------------------------- |
||
156 | function TitanCritLine_OnLoad() |
||
157 | |||
158 | this.registry = { |
||
159 | id = TITAN_CRITLINE_ID, |
||
160 | menuText = TITAN_CRITLINE_ID, |
||
161 | buttonTextFunction = "TitanPanelCritLine_GetButtonText", |
||
162 | tooltipTitle = "CritLine Summary"..TITAN_CRITLINE_VERSION, |
||
163 | tooltipTextFunction = "TitanCritLine_GetSummaryRichText", |
||
164 | icon = TITAN_CRITLINE_BUTTON_ICON, |
||
165 | iconWidth = 16, |
||
166 | savedVariables = { |
||
167 | ShowIcon = 1, |
||
168 | ShowLabelText = 1, |
||
169 | } |
||
170 | }; |
||
171 | |||
172 | this:RegisterEvent("PLAYER_ENTERING_WORLD"); |
||
173 | this:RegisterEvent("CHAT_MSG_COMBAT_SELF_HITS"); |
||
174 | this:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE"); |
||
175 | |||
176 | --Healing Messages |
||
177 | this:RegisterEvent("CHAT_MSG_SPELL_SELF_BUFF"); --On Self |
||
178 | --this:RegisterEvent("CHAT_MSG_SPELL_FRIENDLYPLAYER_BUFF"); --On Friendly |
||
179 | --this:RegisterEvent("CHAT_MSG_SPELL_PET_BUFF"); --On Pet |
||
180 | |||
181 | DEFAULT_CHAT_FRAME:AddMessage(TITAN_CRITLINE_ID.." "..TITAN_CRITLINE_VERSION.." loaded."); |
||
182 | |||
183 | end |
||
184 | ------------------------------------------------------------------------------- |
||
185 | |||
186 | function TitanCritLine_OnEvent() |
||
187 | TitanCritLine_DEBUG("Received Event: "..event); |
||
188 | |||
189 | if (event == "PLAYER_ENTERING_WORLD") then |
||
190 | TitanCritLine_Initialize(); |
||
191 | TitanPanelButton_UpdateButton(TITAN_CRITLINE_ID); |
||
192 | TitanPanelButton_UpdateTooltip(); |
||
193 | |||
194 | elseif (event == "CHAT_MSG_SPELL_SELF_BUFF") then |
||
195 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["FILTER_HEALING"] == "0") then |
||
196 | for attacktype, creaturename, damage in string.gfind(arg1, HEAL_SPELL_CRIT_MSG) do |
||
197 | TitanCritLine_RecordHit(attacktype, "CRIT", tonumber(damage), creaturename, DAMAGE_TYPE_HEAL); |
||
198 | return; |
||
199 | end |
||
200 | for attacktype, creaturename, damage in string.gfind(arg1, HEAL_SPELL_HIT_MSG) do |
||
201 | TitanCritLine_RecordHit(attacktype, "NORMAL", tonumber(damage), creaturename, DAMAGE_TYPE_HEAL); |
||
202 | return; |
||
203 | end |
||
204 | end |
||
205 | elseif (event == "CHAT_MSG_COMBAT_SELF_HITS") then |
||
206 | for creaturename, damage in string.gfind(arg1, COMBAT_CRIT_MSG)do |
||
207 | TitanCritLine_DEBUG("Crit Hit: "..creaturename.." for "..damage); |
||
208 | TitanCritLine_RecordHit(NORMAL_HIT_TEXT, "CRIT", tonumber(damage), creaturename, DAMAGE_TYPE_NONHEAL); |
||
209 | return; |
||
210 | end |
||
211 | |||
212 | for creaturename, damage in string.gfind(arg1, COMBAT_HIT_MSG) do |
||
213 | TitanCritLine_DEBUG("Regular Hit: "..creaturename.." for "..damage); |
||
214 | TitanCritLine_RecordHit(NORMAL_HIT_TEXT, "NORMAL", tonumber(damage), creaturename, DAMAGE_TYPE_NONHEAL); |
||
215 | return; |
||
216 | end |
||
217 | |||
218 | |||
219 | |||
220 | elseif (event == "CHAT_MSG_SPELL_SELF_DAMAGE") then |
||
221 | for attacktype, creaturename, damage in string.gfind(arg1, SPELL_CRIT_MSG) do |
||
222 | TitanCritLine_RecordHit(attacktype, "CRIT", tonumber(damage), creaturename, DAMAGE_TYPE_NONHEAL); |
||
223 | return; |
||
224 | end |
||
225 | |||
226 | for attacktype, creaturename, damage in string.gfind(arg1, SPELL_HIT_MSG) do |
||
227 | TitanCritLine_RecordHit(attacktype, "NORMAL", tonumber(damage), creaturename, DAMAGE_TYPE_NONHEAL); |
||
228 | return; |
||
229 | end |
||
230 | |||
231 | end |
||
232 | end |
||
233 | ------------------------------------------------------------------------------- |
||
234 | function TitanCritLine_Rebuild() |
||
235 | DEFAULT_CHAT_FRAME:AddMessage(TITAN_CRITLINE_ID.." "..TITAN_CRITLINE_VERSION.." rebuilding data."); |
||
236 | TitanCritLineSettings[TitanCritLine_PlayerRealmName] = nil; |
||
237 | TitanCritLine_Initialize(); |
||
238 | DEFAULT_CHAT_FRAME:AddMessage(TITAN_CRITLINE_ID.." "..TITAN_CRITLINE_VERSION.." rebuilding data complete."); |
||
239 | end |
||
240 | ------------------------------------------------------------------------------- |
||
241 | function TitanCritLine_Initialize() |
||
242 | |||
243 | TitanCritLine_DEBUG("Initializing..."); |
||
244 | |||
245 | TitanCritLine_PlayerRealm = GetCVar("realmName"); |
||
246 | TitanCritLine_PlayerName = UnitName("player"); |
||
247 | TitanCritLine_PlayerRealmName = TitanCritLine_PlayerRealm.."."..TitanCritLine_PlayerName; |
||
248 | |||
249 | if (TitanCritLineSettings == nil) then |
||
250 | TitanCritLineSettings = {}; |
||
251 | end |
||
252 | |||
253 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName] == nil) then |
||
254 | TitanCritLineSettings[TitanCritLine_PlayerRealmName] = {}; |
||
255 | end |
||
256 | |||
257 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"] == nil) then |
||
258 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"] = {}; |
||
259 | end |
||
260 | |||
261 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["FILTER_HEALING"] == nil) then |
||
262 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["FILTER_HEALING"] = "1"; |
||
263 | end |
||
264 | |||
265 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["LVLADJ"] == nil) then |
||
266 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["LVLADJ"] = "0"; |
||
267 | end |
||
268 | |||
269 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["SPLASH"] == nil) then |
||
270 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["SPLASH"] = "1"; |
||
271 | end |
||
272 | |||
273 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["PVPONLY"] == nil) then |
||
274 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["PVPONLY"] = "0"; |
||
275 | end |
||
276 | |||
277 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["PLAYSOUND"] == nil) then |
||
278 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["PLAYSOUND"] = "1"; |
||
279 | end |
||
280 | |||
281 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["SNAPSHOT"] == nil) then |
||
282 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["SNAPSHOT"] = "0"; |
||
283 | end |
||
284 | |||
285 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"] == nil) then |
||
286 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"] = {}; |
||
287 | end |
||
288 | |||
289 | TitanCritLine_DEBUG("Initialization Complete."); |
||
290 | |||
291 | end |
||
292 | ------------------------------------------------------------------------------- |
||
293 | function TitanCritLine_RecordHit(AttackType, HitType, Damage, uname, IsHealing) |
||
294 | |||
295 | local targetlvl = UnitLevel("target"); |
||
296 | if (targetlvl == nil) then targetlvl = 0; end |
||
297 | |||
298 | if (Damage == nil) then |
||
299 | TitanCritLine_DEBUG("No Damage! exiting..."); |
||
300 | return; |
||
301 | end |
||
302 | if (uname == nil) then uname = "??"; end |
||
303 | if (UnitLevel("target") == nil) then |
||
304 | TitanCritLine_DEBUG("No Target! exiting..."); |
||
305 | return; |
||
306 | end |
||
307 | if (uname == nil) then uname = "??"; end |
||
308 | if (IsHealing == nil) then |
||
309 | TitanCritLine_DEBUG("IsHealing==nil! exiting..."); |
||
310 | return; |
||
311 | end |
||
312 | |||
313 | if ( (UnitIsPlayer("target") ~= 1) and (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["PVPONLY"] == "1") ) then |
||
314 | TitanCritLine_DEBUG("Target !=player and PvPOnly enabled, exiting..."); |
||
315 | return; |
||
316 | end |
||
317 | |||
318 | --Determine Level Difference |
||
319 | local leveldiff = 0; |
||
320 | if (UnitLevel("player") < UnitLevel("target")) then |
||
321 | leveldiff = (UnitLevel("target") - UnitLevel("player")); |
||
322 | else |
||
323 | leveldiff = (UnitLevel("player") - UnitLevel("target")); |
||
324 | end |
||
325 | |||
326 | TitanCritLine_DEBUG("Level difference: "..leveldiff); |
||
327 | |||
328 | if ( (tonumber(TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["LVLADJ"]) ~= 0) and (tonumber(TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["LVLADJ"]) < leveldiff) ) then |
||
329 | return; |
||
330 | end |
||
331 | |||
332 | if (TitanCritLineSettings == nil) then |
||
333 | return; |
||
334 | end |
||
335 | |||
336 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName] == nil) then |
||
337 | TitanCritLine_DEBUG("TitanCritLineSettings[TitanCritLine_PlayerRealmName] should not be nil at this point!"); |
||
338 | TitanCritLine_Initialize();--attempt recovery.. |
||
339 | end |
||
340 | |||
341 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"] == nil) then |
||
342 | TitanCritLine_DEBUG("TitanCritLineSettings[TitanCritLine_PlayerRealmName][DATA] should not be nil at this point!"); |
||
343 | TitanCritLine_Initialize(); --attempt recovery.. |
||
344 | end |
||
345 | |||
346 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][AttackType] == nil) then |
||
347 | TitanCritLine_DEBUG("Creating TitanCritLineSettings["..TitanCritLine_PlayerRealmName.."][DATA]["..AttackType.."]..."); |
||
348 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][AttackType] = {}; |
||
349 | end |
||
350 | |||
351 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][AttackType][HitType] == nil) then |
||
352 | TitanCritLine_DEBUG("Creating TitanCritLineSettings["..TitanCritLine_PlayerRealmName.."][DATA]["..AttackType.."]["..HitType.."]..."); |
||
353 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][AttackType][HitType] = {}; |
||
354 | end |
||
355 | |||
356 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][AttackType][HitType]["Damage"] == nil or |
||
357 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][AttackType][HitType]["Damage"] < Damage ) then |
||
358 | |||
359 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][AttackType][HitType]["Damage"] = Damage; |
||
360 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][AttackType][HitType]["Target"] = uname; |
||
361 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][AttackType][HitType]["Level"] = UnitLevel("target"); |
||
362 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][AttackType][HitType]["Date"] = date(); |
||
363 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][AttackType][HitType]["IsHeal"] = IsHealing; |
||
364 | TitanCritLine_DisplayNewRecord(AttackType, Damage); |
||
365 | end |
||
366 | end |
||
367 | ------------------------------------------------------------------------------- |
||
368 | function TitanCritLine_DisplayNewRecord(AttackType, DamageAmount) |
||
369 | |||
370 | TitanCritLine_DEBUG(format(TITAN_CRITLINE_NEW_RECORD_MSG, AttackType)); |
||
371 | |||
372 | if(TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["SPLASH"] == "1") then |
||
373 | TitanCritLineSplashFrame:AddMessage(DamageAmount, 1, 1, 1, 1, 3); |
||
374 | TitanCritLineSplashFrame:AddMessage(format(TITAN_CRITLINE_NEW_RECORD_MSG, AttackType), 1, 1, 0, 1, 3); |
||
375 | end |
||
376 | |||
377 | --Play Sound? |
||
378 | if(TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["PLAYSOUND"] == "1") then PlaySound("LEVELUP", 1, 1, 0, 1, 3); end |
||
379 | |||
380 | --ScreenShot? |
||
381 | if(TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["SNAPSHOT"] == "1") then TakeScreenshot(); end |
||
382 | |||
383 | --Update Button Function |
||
384 | TitanPanelButton_UpdateButton(TITAN_CRITLINE_ID); |
||
385 | |||
386 | end |
||
387 | ------------------------------------------------------------------------------- |
||
388 | function TitanCritLine_DisplaySummary() |
||
389 | --display summary; |
||
390 | --use: ScrollingMessageFrame? |
||
391 | TitanCritLine_DisplayDialog(TitanCritLine_GetSummaryRichText()); |
||
392 | end |
||
393 | ------------------------------------------------------------------------------- |
||
394 | function TitanCritLine_GetSummaryRichText() |
||
395 | --build the SummaryDisplay rich text and return it instead of displaying it. |
||
396 | --this is used for displaying as a tooltip. |
||
397 | |||
398 | local hicrit = TitanCritLine_GetHighestCrit(); |
||
399 | local hidmg = TitanCritLine_GetHighestDamage(); |
||
400 | |||
401 | --For healing |
||
402 | local hihealcrit = TitanCritLine_GetHighestHealCrit(); |
||
403 | local hihealdmg = TitanCritLine_GetHighestHeal(); |
||
404 | |||
405 | local rtfAttack=""; |
||
406 | |||
407 | for k,v in pairs (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"]) do |
||
408 | attacktype = k; |
||
409 | rtfAttack = rtfAttack..COLOR(HEADER_TEXT_COLOR, attacktype).."\n"; |
||
410 | for k,v in pairs (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype]) do |
||
411 | if (k == "NORMAL") then |
||
412 | rtfAttack = rtfAttack.." "..COLOR(SUBHEADER_TEXT_COLOR, NORMAL_TEXT).." ["; |
||
413 | else |
||
414 | rtfAttack = rtfAttack.." "..COLOR(SUBHEADER_TEXT_COLOR, CRIT_TEXT).." ["; |
||
415 | end |
||
416 | |||
417 | if ( k == "CRIT") then |
||
418 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["IsHeal"] == "0") then |
||
419 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Damage"] == hicrit) then |
||
420 | rtfAttack = rtfAttack..COLOR(HINT_TEXT_COLOR, TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Damage"]).."]\t"; |
||
421 | else |
||
422 | rtfAttack = rtfAttack..COLOR(BODY_TEXT_COLOR, TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Damage"]).."]\t"; |
||
423 | end |
||
424 | else |
||
425 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Damage"] == hihealcrit) then |
||
426 | rtfAttack = rtfAttack..COLOR(HINT_TEXT_COLOR, TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Damage"]).."]\t"; |
||
427 | else |
||
428 | rtfAttack = rtfAttack..COLOR(BODY_TEXT_COLOR, TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Damage"]).."]\t"; |
||
429 | end |
||
430 | end |
||
431 | else |
||
432 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["IsHeal"] == "0") then |
||
433 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Damage"] == hidmg) then |
||
434 | rtfAttack = rtfAttack..COLOR(HINT_TEXT_COLOR, TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Damage"]).."]\t"; |
||
435 | else |
||
436 | rtfAttack = rtfAttack..COLOR(BODY_TEXT_COLOR, TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Damage"]).."]\t"; |
||
437 | end |
||
438 | else |
||
439 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Damage"] == hihealdmg) then |
||
440 | rtfAttack = rtfAttack..COLOR(HINT_TEXT_COLOR, TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Damage"]).."]\t"; |
||
441 | else |
||
442 | rtfAttack = rtfAttack..COLOR(BODY_TEXT_COLOR, TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Damage"]).."]\t"; |
||
443 | end |
||
444 | end |
||
445 | |||
446 | end |
||
447 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Level"] == -1) then |
||
448 | rtfAttack = rtfAttack..COLOR(BODY_TEXT_COLOR, TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Target"]).." ["..COLOR(BODY_TEXT_COLOR, "??").."]\n"; |
||
449 | else |
||
450 | rtfAttack = rtfAttack..COLOR(BODY_TEXT_COLOR, TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Target"]).." ["..COLOR(BODY_TEXT_COLOR, TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][attacktype][k]["Level"]).."]\n"; |
||
451 | end |
||
452 | end |
||
453 | end |
||
454 | --TitanCritLine_DEBUG("rtfAttack: "..rtfAttack); |
||
455 | return rtfAttack |
||
456 | end |
||
457 | ------------------------------------------------------------------------------- |
||
458 | function TitanCritLine_DisplayAbout() |
||
459 | --Display About Dialog |
||
460 | TitanCritLine_DisplayDialog(TitanCritLine_GetAboutRichText()); |
||
461 | end |
||
462 | ------------------------------------------------------------------------------- |
||
463 | function TitanCritLine_GetAboutRichText() |
||
464 | --build the SummaryAbout rich text and return it instead of displaying it. |
||
465 | --this is used for displaying as a tooltip. |
||
466 | return |
||
467 | COLOR(HEADER_TEXT_COLOR, TITAN_CRITLINE_ID.." v"..TITAN_CRITLINE_VERSION).."\n".. |
||
468 | COLOR(SUBHEADER_TEXT_COLOR, "Concept By: ".."\n".."Sordit").."\n\n".. |
||
469 | COLOR(SUBHEADER_TEXT_COLOR, "Developers: ").."\n".. |
||
470 | COLOR(BODY_TEXT_COLOR, "Sordit: ".."\t".."sordit@spam.com").."\n".. |
||
471 | COLOR(BODY_TEXT_COLOR, "Uggh: ".."\t".."uggh@spam.com").."\n\n".. |
||
472 | COLOR(BODY_TEXT_COLOR, "First off, I would like to thank Sordit for the TitanCritLine concept!").."\n".. |
||
473 | COLOR(BODY_TEXT_COLOR, "It was his idea that sparked my interest in this project, and since").."\n".. |
||
474 | COLOR(BODY_TEXT_COLOR, "then I have been up many nights trying to make this a great UI Mod.").."\n\n".. |
||
475 | COLOR(BODY_TEXT_COLOR, "Why two versions?").."\n".. |
||
476 | COLOR(BODY_TEXT_COLOR, "I prefer to have TitanCritLine as a Titan plugin, and Sordit wants it to").."\n".. |
||
477 | COLOR(BODY_TEXT_COLOR, "be stand-alone. So we are working on standardizing the TitanCritLine core").."\n".. |
||
478 | COLOR(BODY_TEXT_COLOR, "code for the use in both of our mod projects. By doing this, we can").."\n".. |
||
479 | COLOR(BODY_TEXT_COLOR, "benefit off each other enhancements and bug fixes.").."\n\n".. |
||
480 | COLOR(BODY_TEXT_COLOR, "Sordit's Stand-Alone Version:").."\n".. |
||
481 | COLOR(BODY_TEXT_COLOR, "http://ui.worldofwar.net/ui.php?id=810").."\n\n".. |
||
482 | COLOR(BODY_TEXT_COLOR, "Uggh's Titan Plugin Version:").."\n".. |
||
483 | COLOR(BODY_TEXT_COLOR, "http://ui.worldofwar.net/ui.php?id=849"); |
||
484 | end |
||
485 | ------------------------------------------------------------------------------- |
||
486 | function TitanCritLine_SettingsOptionButton_OnClick(arg1) |
||
487 | if ( arg1 == 1 ) then |
||
488 | TitanCritLine_ToggleSplash(); |
||
489 | elseif ( arg1 == 2 ) then |
||
490 | TitanCritLine_ToggleSound(); |
||
491 | elseif ( arg1 == 3 ) then |
||
492 | TitanCritLine_TogglePvP(); |
||
493 | elseif ( arg1 == 4 ) then |
||
494 | TitanCritLine_ToggleScreenShots(); |
||
495 | elseif ( arg1 == 5 ) then |
||
496 | TitanCritLine_ToggleLevelAdjustment(); |
||
497 | elseif ( arg1 == 6 ) then |
||
498 | TitanCritLine_ToggleHealing(); |
||
499 | end |
||
500 | end |
||
501 | ------------------------------------------------------------------------------- |
||
502 | function TitanCritLine_ToggleLevelAdjustment() |
||
503 | |||
504 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["LVLADJ"] == "0" ) then |
||
505 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["LVLADJ"] = "4"; |
||
506 | TitanCritLine_DEBUG(TITAN_CRITLINE_ID.." level adjustment on"); |
||
507 | else |
||
508 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["LVLADJ"] = "0"; |
||
509 | TitanCritLine_DEBUG(TITAN_CRITLINE_ID.." level adjustment off"); |
||
510 | end |
||
511 | end |
||
512 | ------------------------------------------------------------------------------- |
||
513 | function TitanCritLine_ToggleScreenShots() |
||
514 | |||
515 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["SNAPSHOT"] == "0" ) then |
||
516 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["SNAPSHOT"] = "1"; |
||
517 | TitanCritLine_DEBUG(TITAN_CRITLINE_ID.." screen shots on"); |
||
518 | else |
||
519 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["SNAPSHOT"] = "0"; |
||
520 | TitanCritLine_DEBUG(TITAN_CRITLINE_ID.." screen shots off"); |
||
521 | end |
||
522 | end |
||
523 | ------------------------------------------------------------------------------- |
||
524 | function TitanCritLine_ToggleSound() |
||
525 | |||
526 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["PLAYSOUND"] == "0" ) then |
||
527 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["PLAYSOUND"] = "1"; |
||
528 | TitanCritLine_DEBUG(TITAN_CRITLINE_ID.." sound on"); |
||
529 | else |
||
530 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["PLAYSOUND"] = "0"; |
||
531 | TitanCritLine_DEBUG(TITAN_CRITLINE_ID.." sound off"); |
||
532 | end |
||
533 | end |
||
534 | ------------------------------------------------------------------------------- |
||
535 | function TitanCritLine_TogglePvP() |
||
536 | |||
537 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["PVPONLY"] == "0" ) then |
||
538 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["PVPONLY"] = "1"; |
||
539 | TitanCritLine_DEBUG(TITAN_CRITLINE_ID.." pvponly on"); |
||
540 | else |
||
541 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["PVPONLY"] = "0"; |
||
542 | TitanCritLine_DEBUG(TITAN_CRITLINE_ID.." pvponly off"); |
||
543 | end |
||
544 | end |
||
545 | ------------------------------------------------------------------------------- |
||
546 | function TitanCritLine_ToggleSplash() |
||
547 | |||
548 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["SPLASH"] == "0" ) then |
||
549 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["SPLASH"] = "1"; |
||
550 | TitanCritLine_DEBUG(TITAN_CRITLINE_ID.." splash on"); |
||
551 | else |
||
552 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["SPLASH"] = "0"; |
||
553 | info.checked = 0; |
||
554 | TitanCritLine_DEBUG(TITAN_CRITLINE_ID.." splash off"); |
||
555 | end |
||
556 | end |
||
557 | ------------------------------------------------------------------------------- |
||
558 | function TitanCritLine_ToggleHealing() |
||
559 | |||
560 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["FILTER_HEALING"] == "0" ) then |
||
561 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["FILTER_HEALING"] = "1"; |
||
562 | TitanCritLine_DEBUG(TITAN_CRITLINE_ID.." filter healing on"); |
||
563 | else |
||
564 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["SETTINGS"]["FILTER_HEALING"] = "0"; |
||
565 | TitanCritLine_DEBUG(TITAN_CRITLINE_ID.." filter healing off"); |
||
566 | end |
||
567 | end |
||
568 | ------------------------------------------------------------------------------- |
||
569 | function TitanCritLine_Reset() |
||
570 | TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"] = {}; |
||
571 | TitanPanelCritLineButtonText:SetText(TitanPanelCritLine_GetButtonText(0)); |
||
572 | end |
||
573 | ------------------------------------------------------------------------------- |
||
574 | function TitanCritLine_ResetAll() |
||
575 | TitanCritLineSettings = {}; |
||
576 | TitanCritLine_Initialize(); |
||
577 | TitanPanelCritLineButtonText:SetText(TitanPanelCritLine_GetButtonText(0)); |
||
578 | end |
||
579 | ------------------------------------------------------------------------------- |
||
580 | function TitanCritLine_SettingsClose() |
||
581 | TitanCritLine_SettingsFrame:Hide(); |
||
582 | end |
||
583 | ------------------------------------------------------------------------------- |
||
584 | function TitanCritLine_GetHighestCrit() |
||
585 | --loop thru the Table and find the highest crit damage score and return it. |
||
586 | --this is for displaying high records as "345/934" or highlighting in summary fields. |
||
587 | local hidmg = 0; |
||
588 | |||
589 | if (TitanCritLineSettings == nil) then return hidmg; end |
||
590 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName] == nil) then return hidmg; end |
||
591 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"] == nil) then return hidmg; end |
||
592 | |||
593 | for k,v in pairs (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"]) do |
||
594 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["CRIT"] ~= nil ) then |
||
595 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["CRIT"]["IsHeal"] == "0" ) then |
||
596 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["CRIT"]["Damage"] > hidmg ) then |
||
597 | hidmg = TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["CRIT"]["Damage"]; |
||
598 | end |
||
599 | end |
||
600 | end |
||
601 | end |
||
602 | return hidmg; |
||
603 | end |
||
604 | ------------------------------------------------------------------------------- |
||
605 | function TitanCritLine_GetHighestHealCrit() |
||
606 | --loop thru the Table and find the highest crit damage score and return it. |
||
607 | --this is for displaying high records as "345/934" or highlighting in summary fields. |
||
608 | local hidmg = 0; |
||
609 | |||
610 | if (TitanCritLineSettings == nil) then return hidmg; end |
||
611 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName] == nil) then return hidmg; end |
||
612 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"] == nil) then return hidmg; end |
||
613 | |||
614 | for k,v in pairs (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"]) do |
||
615 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["CRIT"] ~= nil ) then |
||
616 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["CRIT"]["IsHeal"] == "1" ) then |
||
617 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["CRIT"]["Damage"] > hidmg ) then |
||
618 | hidmg = TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["CRIT"]["Damage"]; |
||
619 | end |
||
620 | end |
||
621 | end |
||
622 | end |
||
623 | return hidmg; |
||
624 | end |
||
625 | ------------------------------------------------------------------------------- |
||
626 | function TitanCritLine_GetHighestDamage() |
||
627 | --loop thru the Table and find the highest normal damage score and return it. |
||
628 | --this is for displaying high records as "345/934" or highlighting in summary fields. |
||
629 | local hidmg = 0; |
||
630 | |||
631 | if (TitanCritLineSettings == nil) then return hidmg; end |
||
632 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName] == nil) then return hidmg; end |
||
633 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"] == nil) then return hidmg; end |
||
634 | |||
635 | for k,v in pairs (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"]) do |
||
636 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["NORMAL"] ~= nil ) then |
||
637 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["NORMAL"]["IsHeal"] == "0" ) then |
||
638 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["NORMAL"]["Damage"] > hidmg ) then |
||
639 | hidmg = TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["NORMAL"]["Damage"]; |
||
640 | end |
||
641 | end |
||
642 | end |
||
643 | end |
||
644 | return hidmg; |
||
645 | end |
||
646 | ------------------------------------------------------------------------------- |
||
647 | function TitanCritLine_GetHighestHeal() |
||
648 | --loop thru the Table and find the highest normal damage score and return it. |
||
649 | --this is for displaying high records as "345/934" or highlighting in summary fields. |
||
650 | local hidmg = 0; |
||
651 | |||
652 | if (TitanCritLineSettings == nil) then return hidmg; end |
||
653 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName] == nil) then return hidmg; end |
||
654 | if (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"] == nil) then return hidmg; end |
||
655 | |||
656 | for k,v in pairs (TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"]) do |
||
657 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["NORMAL"] ~= nil ) then |
||
658 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["NORMAL"]["IsHeal"] == "1" ) then |
||
659 | if ( TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["NORMAL"]["Damage"] > hidmg ) then |
||
660 | hidmg = TitanCritLineSettings[TitanCritLine_PlayerRealmName]["DATA"][k]["NORMAL"]["Damage"]; |
||
661 | end |
||
662 | end |
||
663 | end |
||
664 | end |
||
665 | return hidmg; |
||
666 | end |
||
667 | ------------------------------------------------------------------------------- |
||
668 | function TitanCritLine_DEBUG(message) |
||
669 | if (DEBUG) then |
||
670 | DEFAULT_CHAT_FRAME:AddMessage("DEBUG: "..message); |
||
671 | end |
||
672 | end |
||
673 | |||
674 | function TitanCritLine_DisplayDialog(message) |
||
675 | GameTooltip:SetText(message); |
||
676 | GameTooltip:Show(); |
||
677 | end |