vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | |
2 | function RecapPanel_Populate(arg1) |
||
3 | |||
4 | local i,totalmeleemiss,text,found |
||
5 | |||
6 | if recap.Combatant[arg1] and not recap.Opt.LightData.value then |
||
7 | |||
8 | --[[ Populate Panel 1: Incoming ]] |
||
9 | |||
10 | -- melee damage |
||
11 | RecapPanelMeleeDamageText:SetText(recap.Combatant[arg1].Incoming.MeleeDamage or 0) |
||
12 | RecapPanelNonMeleeDamageText:SetText(recap.Combatant[arg1].Incoming.NonMeleeDamage or 0) |
||
13 | i = (recap.Combatant[arg1].Incoming.MeleeDamage or 0) + (recap.Combatant[arg1].Incoming.NonMeleeDamage or 0) |
||
14 | if i>0 then |
||
15 | RecapPanelMeleeDamagePText:SetText(string.format("%d%%",100*(recap.Combatant[arg1].Incoming.MeleeDamage or 0)/i)) |
||
16 | RecapPanelNonMeleeDamagePText:SetText(string.format("%d%%",100*(recap.Combatant[arg1].Incoming.NonMeleeDamage or 0)/i)) |
||
17 | else |
||
18 | RecapPanelMeleeDamagePText:SetText("--") |
||
19 | RecapPanelNonMeleeDamagePText:SetText("--") |
||
20 | end |
||
21 | |||
22 | -- melee misses |
||
23 | totalmeleemiss = (recap.Combatant[arg1].Incoming.MeleeMissed or 0) + (recap.Combatant[arg1].Incoming.MeleeBlocked or 0) + (recap.Combatant[arg1].Incoming.MeleeDodged or 0) + (recap.Combatant[arg1].Incoming.MeleeParried or 0) |
||
24 | RecapPanelMeleeHitsText:SetText(recap.Combatant[arg1].Incoming.MeleeHits or 0) |
||
25 | RecapPanelMeleeMissedText:SetText(totalmeleemiss) |
||
26 | RecapPanelMeleeCritsText:SetText(recap.Combatant[arg1].Incoming.MeleeCrits or 0) |
||
27 | i = (recap.Combatant[arg1].Incoming.MeleeHits or 0) + totalmeleemiss + (recap.Combatant[arg1].Incoming.MeleeCrits or 0) |
||
28 | if i>0 then |
||
29 | RecapPanelMeleeMissedPText:SetText(string.format("%.1f%%",100*totalmeleemiss/i)) |
||
30 | else |
||
31 | RecapPanelMeleeMissedPText:SetText("--") |
||
32 | end |
||
33 | |||
34 | -- melee hits/crits % |
||
35 | i = i - totalmeleemiss |
||
36 | if i>0 then |
||
37 | RecapPanelMeleeCritsPText:SetText(string.format("%.1f%%",100*(recap.Combatant[arg1].Incoming.MeleeCrits or 0)/i)) |
||
38 | else |
||
39 | RecapPanelMeleeCritsPText:SetText("--") |
||
40 | end |
||
41 | |||
42 | RecapPanelNonMeleeHitsText:SetText(recap.Combatant[arg1].Incoming.NonMeleeHits or 0) |
||
43 | RecapPanelNonMeleeMissedText:SetText(recap.Combatant[arg1].Incoming.NonMeleeMissed or 0) |
||
44 | RecapPanelNonMeleeCritsText:SetText(recap.Combatant[arg1].Incoming.NonMeleeCrits or 0) |
||
45 | i = (recap.Combatant[arg1].Incoming.NonMeleeHits or 0) + (recap.Combatant[arg1].Incoming.NonMeleeMissed or 0) + (recap.Combatant[arg1].Incoming.NonMeleeCrits or 0) |
||
46 | if i>0 then |
||
47 | RecapPanelNonMeleeMissedPText:SetText(string.format("%.1f%%",100*(recap.Combatant[arg1].Incoming.NonMeleeMissed or 0)/i)) |
||
48 | else |
||
49 | RecapPanelNonMeleeMissedPText:SetText("--") |
||
50 | end |
||
51 | |||
52 | i = i - (recap.Combatant[arg1].Incoming.NonMeleeMissed or 0) |
||
53 | if i>0 then |
||
54 | RecapPanelNonMeleeCritsPText:SetText(string.format("%.1f%%",100*(recap.Combatant[arg1].Incoming.NonMeleeCrits or 0)/i)) |
||
55 | else |
||
56 | RecapPanelNonMeleeCritsPText:SetText("--") |
||
57 | end |
||
58 | |||
59 | RecapPanelMeleeMaxText:SetText(recap.Combatant[arg1].Incoming.MeleeMax or 0) |
||
60 | RecapPanelNonMeleeMaxText:SetText(recap.Combatant[arg1].Incoming.NonMeleeMax or 0) |
||
61 | |||
62 | if ((recap.Combatant[arg1].Incoming.MeleeHits or 0)+(recap.Combatant[arg1].Incoming.MeleeCrits or 0))>0 then |
||
63 | RecapPanelMeleeAvgText:SetText(string.format("%d",(recap.Combatant[arg1].Incoming.MeleeDamage or 0)/((recap.Combatant[arg1].Incoming.MeleeHits or 0)+(recap.Combatant[arg1].Incoming.MeleeCrits or 0)))) |
||
64 | else |
||
65 | RecapPanelMeleeAvgText:SetText("0") |
||
66 | end |
||
67 | if (recap.Combatant[arg1].Incoming.NonMeleeHits or 0)>0 then |
||
68 | RecapPanelNonMeleeAvgText:SetText(string.format("%d",(recap.Combatant[arg1].Incoming.NonMeleeDamage or 0)/((recap.Combatant[arg1].Incoming.NonMeleeHits or 0)+(recap.Combatant[arg1].Incoming.NonMeleeCrits or 0)))) |
||
69 | else |
||
70 | RecapPanelNonMeleeAvgText:SetText("0") |
||
71 | end |
||
72 | |||
73 | i = totalmeleemiss + (recap.Combatant[arg1].Incoming.MeleeHits or 0) + (recap.Combatant[arg1].Incoming.MeleeCrits or 0) |
||
74 | if i>0 then |
||
75 | RecapPanelMissMissedText:SetText(string.format("%d (%.1f%%)",recap.Combatant[arg1].Incoming.MeleeMissed or 0, 100*(recap.Combatant[arg1].Incoming.MeleeMissed or 0)/i)) |
||
76 | RecapPanelMissDodgedText:SetText(string.format("%d (%.1f%%)",recap.Combatant[arg1].Incoming.MeleeDodged or 0, 100*(recap.Combatant[arg1].Incoming.MeleeDodged or 0)/i)) |
||
77 | RecapPanelMissParriedText:SetText(string.format("%d (%.1f%%)",recap.Combatant[arg1].Incoming.MeleeParried or 0, 100*(recap.Combatant[arg1].Incoming.MeleeParried or 0)/i)) |
||
78 | RecapPanelMissBlockedText:SetText(string.format("%d (%.1f%%)",recap.Combatant[arg1].Incoming.MeleeBlocked or 0, 100*(recap.Combatant[arg1].Incoming.MeleeBlocked or 0)/i)) |
||
79 | else |
||
80 | RecapPanelMissMissedText:SetText("--") |
||
81 | RecapPanelMissDodgedText:SetText("--") |
||
82 | RecapPanelMissParriedText:SetText("--") |
||
83 | RecapPanelMissBlockedText:SetText("--") |
||
84 | end |
||
85 | |||
86 | |||
87 | --[[ Populate Panel 2: Outgoing details ]] |
||
88 | |||
89 | recap_temp.DetailSelected = 0 |
||
90 | RecapPanel_ConstructDetails(arg1) |
||
91 | if recap_temp.DetailsListSize>1 then |
||
92 | RecapPanel_PopulateDetails(arg1,1) |
||
93 | else |
||
94 | RecapPanel_PopulateDetails(arg1,0) |
||
95 | end |
||
96 | RecapPanelOutgoingTotalLabel:SetText(recap.Opt.PanelDetail.value~="Miss" and recap.Opt.PanelDetail.value or "Miss/Over") |
||
97 | RecapPanelDetailsScrollBar_Update() |
||
98 | |||
99 | end |
||
100 | |||
101 | -- populate elements that work in and out of light data mode |
||
102 | |||
103 | if recap.Combatant[arg1] then |
||
104 | |||
105 | --[[ Populate common elements ]] |
||
106 | |||
107 | if recap.Combatant[arg1].Faction and recap_temp.FactionIcons[recap.Combatant[arg1].Faction] then |
||
108 | RecapPanelFaction:SetTexture(recap_temp.FactionIcons[recap.Combatant[arg1].Faction]) |
||
109 | else |
||
110 | RecapPanelFaction:SetTexture("") |
||
111 | end |
||
112 | |||
113 | if recap.Combatant[arg1].Class and recap_temp.ClassIcons[recap.Combatant[arg1].Class] then |
||
114 | RecapPanelClass:SetTexCoord(recap_temp.ClassIcons[recap.Combatant[arg1].Class].left,recap_temp.ClassIcons[recap.Combatant[arg1].Class].right,recap_temp.ClassIcons[recap.Combatant[arg1].Class].top,recap_temp.ClassIcons[recap.Combatant[arg1].Class].bottom) |
||
115 | else |
||
116 | RecapPanelClass:SetTexCoord(.9,1,.9,1) |
||
117 | end |
||
118 | |||
119 | if recap.Combatant[arg1].Friend then |
||
120 | RecapPanelName:SetTextColor(recap_temp.ColorDmgOut.r,recap_temp.ColorDmgOut.g,recap_temp.ColorDmgOut.b) |
||
121 | else |
||
122 | RecapPanelName:SetTextColor(1,1,1) |
||
123 | end |
||
124 | RecapPanelName:SetText(arg1) |
||
125 | |||
126 | if recap.Combatant[arg1].Level==-1 then |
||
127 | RecapPanelLevel:SetText("??") |
||
128 | elseif tonumber(recap.Combatant[arg1].Level) and tonumber(recap.Combatant[arg1].Level)>0 then |
||
129 | RecapPanelLevel:SetText(recap.Combatant[arg1].Level) |
||
130 | else |
||
131 | RecapPanelLevel:SetText(" ") |
||
132 | end |
||
133 | |||
134 | --[[ Populate Panel 3: Summary ]] |
||
135 | |||
136 | RecapPanelLastTimeText:SetText(Recap_FormatTime(recap.Combatant[arg1].LastTime)) |
||
137 | RecapPanelLastMaxText:SetText(recap.Combatant[arg1].LastMaxHit) |
||
138 | RecapPanelLastDeathsText:SetText(recap.Combatant[arg1].LastKills) |
||
139 | RecapPanelLastHealsText:SetText(recap.Combatant[arg1].LastHeal) |
||
140 | RecapPanelLastDmgInText:SetText(recap.Combatant[arg1].LastDmgIn) |
||
141 | RecapPanelLastDmgOutText:SetText(recap.Combatant[arg1].LastDmgOut) |
||
142 | RecapPanelLastDPSText:SetText(string.format("%.1f",recap.Combatant[arg1].LastDPS)) |
||
143 | |||
144 | RecapPanelAllTimeText:SetText(Recap_FormatTime(recap.Combatant[arg1].TotalTime)) |
||
145 | RecapPanelAllMaxText:SetText(recap.Combatant[arg1].TotalMaxHit) |
||
146 | RecapPanelAllDeathsText:SetText(recap.Combatant[arg1].TotalKills) |
||
147 | RecapPanelAllHealsText:SetText(recap.Combatant[arg1].TotalHeal) |
||
148 | RecapPanelAllDmgInText:SetText(recap.Combatant[arg1].TotalDmgIn) |
||
149 | RecapPanelAllDmgOutText:SetText(recap.Combatant[arg1].TotalDmgOut) |
||
150 | RecapPanelAllDPSText:SetText(string.format("%.1f",recap.Combatant[arg1].TotalDPS)) |
||
151 | |||
152 | if recap.Combatant[arg1].Friend then |
||
153 | RecapPanelLastHealsText:SetTextColor(recap_temp.ColorHeal.r,recap_temp.ColorHeal.g,recap_temp.ColorHeal.b) |
||
154 | RecapPanelAllHealsText:SetTextColor(recap_temp.ColorHeal.r,recap_temp.ColorHeal.g,recap_temp.ColorHeal.b) |
||
155 | RecapPanelLastDmgInText:SetTextColor(recap_temp.ColorDmgIn.r,recap_temp.ColorDmgIn.g,recap_temp.ColorDmgIn.b) |
||
156 | RecapPanelAllDmgInText:SetTextColor(recap_temp.ColorDmgIn.r,recap_temp.ColorDmgIn.g,recap_temp.ColorDmgIn.b) |
||
157 | RecapPanelLastDmgOutText:SetTextColor(recap_temp.ColorDmgOut.r,recap_temp.ColorDmgOut.g,recap_temp.ColorDmgOut.b) |
||
158 | RecapPanelAllDmgOutText:SetTextColor(recap_temp.ColorDmgOut.r,recap_temp.ColorDmgOut.g,recap_temp.ColorDmgOut.b) |
||
159 | RecapPanelLastDPSText:SetTextColor(recap_temp.ColorDmgOut.r,recap_temp.ColorDmgOut.g,recap_temp.ColorDmgOut.b) |
||
160 | RecapPanelAllDPSText:SetTextColor(recap_temp.ColorDmgOut.r,recap_temp.ColorDmgOut.g,recap_temp.ColorDmgOut.b) |
||
161 | else |
||
162 | RecapPanelLastHealsText:SetTextColor(1,1,1) |
||
163 | RecapPanelAllHealsText:SetTextColor(1,1,1) |
||
164 | RecapPanelLastDmgInText:SetTextColor(1,1,1) |
||
165 | RecapPanelAllDmgInText:SetTextColor(1,1,1) |
||
166 | RecapPanelLastDmgOutText:SetTextColor(1,1,1) |
||
167 | RecapPanelAllDmgOutText:SetTextColor(1,1,1) |
||
168 | RecapPanelLastDPSText:SetTextColor(1,1,1) |
||
169 | RecapPanelAllDPSText:SetTextColor(1,1,1) |
||
170 | end |
||
171 | |||
172 | end |
||
173 | |||
174 | end |
||
175 | |||
176 | -- tooltips for individual entries |
||
177 | function RecapPanel_Entry_OnEnter() |
||
178 | |||
179 | id = this:GetID() |
||
180 | |||
181 | if id and id>0 then |
||
182 | if this:GetName()=="RecapPanelOutgoingMissP" and RecapPanelOutgoingMissPLabel:GetText()=="Overhealing" then |
||
183 | Recap_OnTooltip("PanelEntryOverheal",getglobal(this:GetName().."Text"):GetText()) |
||
184 | else |
||
185 | Recap_OnTooltip("PanelEntry"..id,getglobal(this:GetName().."Text"):GetText()) |
||
186 | end |
||
187 | end |
||
188 | end |
||
189 | |||
190 | function RecapPanel_Entry_OnClick() |
||
191 | |||
192 | local id,header,text,sel = this:GetID() |
||
193 | |||
194 | if id and id>0 and getglobal(this:GetName().."Text"):GetText()~=" " and getglobal(this:GetName().."Text"):GetText()~="--" then |
||
195 | header = Recap_GetTooltip("PanelEntry"..id) |
||
196 | if this:GetName()=="RecapPanelOutgoingMissP" and RecapPanelOutgoingMissPLabel:GetText()=="Overhealing" then |
||
197 | header = "Overhealing" |
||
198 | end |
||
199 | if header and IsShiftKeyDown() and ChatFrameEditBox:IsVisible() and recap_temp.Selected~=0 then |
||
200 | text = recap_temp.List[recap_temp.Selected].Name..recap_temp.Local.Possessive..header |
||
201 | if id>=45 and id<=56 and recap_temp.DetailsListSize>1 then |
||
202 | sel = recap_temp.DetailSelected |
||
203 | if sel==0 then |
||
204 | sel = 1 |
||
205 | end |
||
206 | text = text.." for "..string.sub(recap_temp.DetailsList[sel].Effect,2) |
||
207 | end |
||
208 | text = text..": "..getglobal(this:GetName().."Text"):GetText() |
||
209 | Recap_InsertChat(text) |
||
210 | end |
||
211 | end |
||
212 | end |
||
213 | |||
214 | function RecapPanel_Show(name) |
||
215 | |||
216 | if recap.Opt.ShowPanel.value then |
||
217 | |||
218 | if recap_temp.Selected>0 then |
||
219 | name = recap_temp.List[recap_temp.Selected].Name |
||
220 | end |
||
221 | |||
222 | RecapPanel_Populate(name) |
||
223 | RecapPanel:Show() |
||
224 | end |
||
225 | end |
||
226 | |||
227 | function RecapPanel_Hide(arg1) |
||
228 | |||
229 | if arg1 then |
||
230 | recap_temp.Selected = 0 |
||
231 | recap_temp.DetailSelected = 0 |
||
232 | RecapScrollBar_Update() |
||
233 | end |
||
234 | |||
235 | if recap_temp.Selected==0 then |
||
236 | RecapPanel:Hide() |
||
237 | end |
||
238 | end |
||
239 | |||
240 | function RecapPanelTab_OnEnter() |
||
241 | |||
242 | local id = this:GetID() |
||
243 | |||
244 | if id and id>0 then |
||
245 | if recap.Opt.LightData.value and id<3 then |
||
246 | Recap_OnTooltip("PanelTabDisabled"..id) |
||
247 | else |
||
248 | Recap_OnTooltip("PanelTab"..id) |
||
249 | end |
||
250 | end |
||
251 | |||
252 | end |
||
253 | |||
254 | function RecapPanelTab_OnClick() |
||
255 | |||
256 | local id = this:GetID() |
||
257 | if recap.Opt.LightData.value then |
||
258 | id = 3 |
||
259 | end |
||
260 | recap.Opt.PanelView.value = id |
||
261 | RecapPanel_SwitchPanels(id) |
||
262 | end |
||
263 | |||
264 | function RecapPanel_SwitchPanels(panel) |
||
265 | |||
266 | for i=1,3 do |
||
267 | getglobal("RecapPanelTab"..i):UnlockHighlight() |
||
268 | getglobal("RecapSubPanel"..i):Hide() |
||
269 | end |
||
270 | getglobal("RecapPanelTab"..recap.Opt.PanelView.value):LockHighlight() |
||
271 | getglobal("RecapSubPanel"..recap.Opt.PanelView.value):Show() |
||
272 | end |
||
273 | |||
274 | function RecapPanel_ConstructDetails(name) |
||
275 | |||
276 | local dmgtotal, healtotal, subtotal, i = 0,0 |
||
277 | |||
278 | recap_temp.DetailsListSize = 1 |
||
279 | |||
280 | if not recap_temp.DetailsList then |
||
281 | recap_temp.DetailsList = {} |
||
282 | end |
||
283 | |||
284 | for i in recap.Combatant[name].Detail do |
||
285 | if not recap_temp.DetailsList[recap_temp.DetailsListSize] then |
||
286 | recap_temp.DetailsList[recap_temp.DetailsListSize] = {} |
||
287 | end |
||
288 | recap_temp.DetailsList[recap_temp.DetailsListSize].Effect = i |
||
289 | recap_temp.DetailsList[recap_temp.DetailsListSize].Total = (recap.Combatant[name].Detail[i].HitsDmg or 0) + (recap.Combatant[name].Detail[i].CritsDmg or 0) + (recap.Combatant[name].Detail[i].TicksDmg or 0) |
||
290 | recap_temp.DetailsList[recap_temp.DetailsListSize].Max = math.max(recap.Combatant[name].Detail[i].TicksMax or 0,math.max(recap.Combatant[name].Detail[i].HitsMax or 0,recap.Combatant[name].Detail[i].CritsMax or 0)) |
||
291 | subtotal = (recap.Combatant[name].Detail[i].Hits or 0) + (recap.Combatant[name].Detail[i].Crits or 0) |
||
292 | recap_temp.DetailsList[recap_temp.DetailsListSize].Avg = string.format("%d",(subtotal>0 and (((recap.Combatant[name].Detail[i].HitsDmg or 0)+(recap.Combatant[name].Detail[i].CritsDmg or 0)+(recap.Combatant[name].Detail[i].TicksDmg or 0))/subtotal) or 0)) |
||
293 | subtotal = recap.Combatant[name].Detail[i].CritsEvents or 0 |
||
294 | if subtotal>0 then |
||
295 | recap_temp.DetailsList[recap_temp.DetailsListSize].Crits = string.format("%.1f%%",100*(recap.Combatant[name].Detail[i].Crits or 0)/subtotal) |
||
296 | else |
||
297 | recap_temp.DetailsList[recap_temp.DetailsListSize].Crits = "--" |
||
298 | end |
||
299 | |||
300 | if tonumber(string.sub(i,1,1))<3 then |
||
301 | dmgtotal = dmgtotal + recap_temp.DetailsList[recap_temp.DetailsListSize].Total |
||
302 | subtotal = (recap.Combatant[name].Detail[i].Hits or 0) + (recap.Combatant[name].Detail[i].Crits or 0) + (recap.Combatant[name].Detail[i].Missed or 0) |
||
303 | else |
||
304 | healtotal = healtotal + recap_temp.DetailsList[recap_temp.DetailsListSize].Total |
||
305 | subtotal = (recap.Combatant[name].Detail[i].HitsDmg or 0) + (recap.Combatant[name].Detail[i].CritsDmg or 0) + (recap.Combatant[name].Detail[i].Missed or 0) + (recap.Combatant[name].Detail[i].TicksDmg or 0) |
||
306 | end |
||
307 | recap_temp.DetailsList[recap_temp.DetailsListSize].Miss = string.format("%.1f%%",(subtotal>0 and (100*(recap.Combatant[name].Detail[i].Missed or 0)/subtotal) or 0)) |
||
308 | |||
309 | recap_temp.DetailsListSize = recap_temp.DetailsListSize + 1 |
||
310 | end |
||
311 | recap_temp.DetailsList[recap_temp.DetailsListSize] = nil |
||
312 | |||
313 | for i=1,recap_temp.DetailsListSize-1 do |
||
314 | if tonumber(string.sub(recap_temp.DetailsList[i].Effect,1,1))<3 then |
||
315 | subtotal = dmgtotal |
||
316 | else |
||
317 | subtotal = healtotal |
||
318 | end |
||
319 | if subtotal>0 then |
||
320 | recap_temp.DetailsList[i].TotalP = math.floor((100*recap_temp.DetailsList[i].Total)/subtotal+.5) |
||
321 | else |
||
322 | recap_temp.DetailsList[i].TotalP = 0 |
||
323 | end |
||
324 | end |
||
325 | |||
326 | table.sort(recap_temp.DetailsList,RecapPanel_DetailsDamageSort) |
||
327 | |||
328 | end |
||
329 | |||
330 | function RecapPanel_DetailsDamageSort(e1,e2) |
||
331 | |||
332 | local effect1,effect2 = string.sub(e1.Effect,1,1),string.sub(e2.Effect,1,1) |
||
333 | |||
334 | if e1 and e2 and ( ((e1.Total>e2.Total) and (effect1==effect2)) or (effect1<effect2) ) then |
||
335 | return true |
||
336 | else |
||
337 | return false |
||
338 | end |
||
339 | end |
||
340 | |||
341 | function RecapPanelDetailsScrollBar_Update() |
||
342 | |||
343 | local i, index, item,r,g,b |
||
344 | |||
345 | if recap_temp.Loaded and recap_temp.DetailsListSize then |
||
346 | |||
347 | FauxScrollFrame_Update(RecapPanelDetailsScrollBar,recap_temp.DetailsListSize-1,5,5) |
||
348 | |||
349 | for i=1,5 do |
||
350 | index = i + FauxScrollFrame_GetOffset(RecapPanelDetailsScrollBar) |
||
351 | if index < recap_temp.DetailsListSize then |
||
352 | if string.sub(recap_temp.DetailsList[index].Effect,1,1)=="3" then |
||
353 | r,g,b = recap_temp.ColorHeal.r, recap_temp.ColorHeal.g, recap_temp.ColorHeal.b |
||
354 | else |
||
355 | r,g,b = recap_temp.ColorDmgOut.r, recap_temp.ColorDmgOut.g, recap_temp.ColorDmgOut.b |
||
356 | end |
||
357 | getglobal("RecapPanelDetail"..i.."_Name"):SetText(string.sub(recap_temp.DetailsList[index].Effect,2)) |
||
358 | getglobal("RecapPanelDetail"..i.."_Name"):SetTextColor(r,g,b) |
||
359 | getglobal("RecapPanelDetail"..i.."_Total"):SetText(recap_temp.DetailsList[index][recap.Opt.PanelDetail.value]) |
||
360 | if recap.Opt.PanelDetail.value=="Total" then |
||
361 | getglobal("RecapPanelDetail"..i.."_Total"):SetTextColor(r,g,b) |
||
362 | else |
||
363 | getglobal("RecapPanelDetail"..i.."_Total"):SetTextColor(recap_temp.ColorWhite.r,recap_temp.ColorWhite.g,recap_temp.ColorWhite.b) |
||
364 | end |
||
365 | getglobal("RecapPanelDetail"..i.."_TotalP"):SetText(recap_temp.DetailsList[index].TotalP.."%") |
||
366 | getglobal("RecapPanelDetail"..i.."_TotalP"):SetTextColor(r,g,b) |
||
367 | item = getglobal("RecapPanelDetail"..i) |
||
368 | item:Show() |
||
369 | if recap_temp.DetailSelected == index then |
||
370 | item:LockHighlight() |
||
371 | else |
||
372 | item:UnlockHighlight() |
||
373 | end |
||
374 | else |
||
375 | item = getglobal("RecapPanelDetail"..i) |
||
376 | item:Hide() |
||
377 | item:UnlockHighlight() |
||
378 | end |
||
379 | end |
||
380 | end |
||
381 | |||
382 | end |
||
383 | |||
384 | function RecapPanel_PopulateDetails(arg1,sel) |
||
385 | |||
386 | local effect,i |
||
387 | RecapPanelOutgoingDamageText:SetText(" ") |
||
388 | RecapPanelOutgoingHitsText:SetText("--") |
||
389 | RecapPanelOutgoingCritsText:SetText("--") |
||
390 | RecapPanelOutgoingHitsAvgText:SetText("--") |
||
391 | RecapPanelOutgoingCritsAvgText:SetText("--") |
||
392 | RecapPanelOutgoingHitsMaxText:SetText("--") |
||
393 | RecapPanelOutgoingCritsMaxText:SetText("--") |
||
394 | RecapPanelOutgoingTicksText:SetText("--") |
||
395 | RecapPanelOutgoingTicksAvgText:SetText("--") |
||
396 | RecapPanelOutgoingTicksMaxText:SetText("--") |
||
397 | RecapPanelOutgoingMissPText:SetText(" ") |
||
398 | RecapPanelOutgoingCritPText:SetText("--") |
||
399 | |||
400 | if sel>0 and recap_temp.DetailsList[sel].Effect and recap.Combatant[arg1] then |
||
401 | effect = recap_temp.DetailsList[sel].Effect |
||
402 | if string.sub(effect,1,1)=="3" then |
||
403 | RecapPanelOutgoingDamageLabel:SetText("Heal") |
||
404 | RecapPanelOutgoingMissPLabel:SetText("Overhealing") |
||
405 | else |
||
406 | RecapPanelOutgoingDamageLabel:SetText("Damage") |
||
407 | RecapPanelOutgoingMissPLabel:SetText("Misses") |
||
408 | end |
||
409 | RecapPanelOutgoingDamageText:SetText((recap.Combatant[arg1].Detail[effect].HitsDmg or 0)+(recap.Combatant[arg1].Detail[effect].CritsDmg or 0)+(recap.Combatant[arg1].Detail[effect].TicksDmg or 0)) |
||
410 | |||
411 | -- hits: critsevents-crits |
||
412 | i = (recap.Combatant[arg1].Detail[effect].CritsEvents or 0)-(recap.Combatant[arg1].Detail[effect].Crits or 0) |
||
413 | if i>0 then |
||
414 | RecapPanelOutgoingHitsText:SetText(i) |
||
415 | RecapPanelOutgoingHitsMaxText:SetText(recap.Combatant[arg1].Detail[effect].HitsMax or 0) |
||
416 | RecapPanelOutgoingHitsAvgText:SetText(string.format("%d",(recap.Combatant[arg1].Detail[effect].HitsDmg or 0)/i)) |
||
417 | elseif recap.Combatant[arg1].Detail[effect].CritsEvents then |
||
418 | RecapPanelOutgoingHitsText:SetText("0") |
||
419 | end |
||
420 | |||
421 | -- crits |
||
422 | if (recap.Combatant[arg1].Detail[effect].Crits or 0)>0 then |
||
423 | RecapPanelOutgoingCritsText:SetText(recap.Combatant[arg1].Detail[effect].Crits or 0) |
||
424 | RecapPanelOutgoingCritsMaxText:SetText(recap.Combatant[arg1].Detail[effect].CritsMax or 0) |
||
425 | RecapPanelOutgoingCritsAvgText:SetText(string.format("%d",(recap.Combatant[arg1].Detail[effect].CritsDmg or 0)/recap.Combatant[arg1].Detail[effect].Crits)) |
||
426 | elseif recap.Combatant[arg1].Detail[effect].CritsEvents then |
||
427 | RecapPanelOutgoingCritsText:SetText("0") |
||
428 | end |
||
429 | |||
430 | -- ticks |
||
431 | i = (recap.Combatant[arg1].Detail[effect].Hits or 0)-(recap.Combatant[arg1].Detail[effect].CritsEvents or 0) |
||
432 | if i>0 then |
||
433 | RecapPanelOutgoingTicksText:SetText(i) |
||
434 | RecapPanelOutgoingTicksMaxText:SetText(recap.Combatant[arg1].Detail[effect].TicksMax or 0) |
||
435 | RecapPanelOutgoingTicksAvgText:SetText(string.format("%d",(recap.Combatant[arg1].Detail[effect].TicksDmg or 0)/i)) |
||
436 | elseif recap.Combatant[arg1].Detail[effect].TicksMax then |
||
437 | RecapPanelOutgoingTicksText:SetText("0") |
||
438 | end |
||
439 | |||
440 | -- miss/overheal % |
||
441 | if string.sub(effect,1,1)~="3" then |
||
442 | i = (recap.Combatant[arg1].Detail[effect].Hits or 0)+(recap.Combatant[arg1].Detail[effect].Crits or 0)+(recap.Combatant[arg1].Detail[effect].Missed or 0) |
||
443 | if i>0 then |
||
444 | RecapPanelOutgoingMissPText:SetText(((recap.Combatant[arg1].Detail[effect].Missed==i) and (i.." (100%)")) or string.format("%d (%.1f%%)",recap.Combatant[arg1].Detail[effect].Missed or 0,100*(recap.Combatant[arg1].Detail[effect].Missed or 0)/i)) |
||
445 | end |
||
446 | else |
||
447 | i = (recap.Combatant[arg1].Detail[effect].HitsDmg or 0)+(recap.Combatant[arg1].Detail[effect].CritsDmg or 0)+(recap.Combatant[arg1].Detail[effect].Missed or 0)+(recap.Combatant[arg1].Detail[effect].TicksDmg or 0) |
||
448 | if i>0 then |
||
449 | RecapPanelOutgoingMissPText:SetText(string.format("%d (%d%%)",recap.Combatant[arg1].Detail[effect].Missed or 0,100*(recap.Combatant[arg1].Detail[effect].Missed or 0)/i)) |
||
450 | end |
||
451 | end |
||
452 | |||
453 | -- crit % |
||
454 | if (recap.Combatant[arg1].Detail[effect].CritsEvents or 0)>0 then |
||
455 | RecapPanelOutgoingCritPText:SetText(((recap.Combatant[arg1].Detail[effect].CritsEvents==recap.Combatant[arg1].Detail[effect].Crits) and "100%") or string.format("%.1f%%",100*(recap.Combatant[arg1].Detail[effect].Crits or 0)/recap.Combatant[arg1].Detail[effect].CritsEvents)) |
||
456 | end |
||
457 | |||
458 | end |
||
459 | |||
460 | end |
||
461 | |||
462 | function RecapPanel_Detail_OnEnter() |
||
463 | |||
464 | local id = this:GetID() |
||
465 | local index = id + FauxScrollFrame_GetOffset(RecapPanelDetailsScrollBar) |
||
466 | |||
467 | if (index<recap_temp.DetailsListSize) and recap_temp.DetailSelected==0 then |
||
468 | RecapPanel_PopulateDetails(RecapPanelName:GetText(),index) |
||
469 | end |
||
470 | end |
||
471 | |||
472 | function RecapPanel_Detail_OnLeave() |
||
473 | |||
474 | if recap_temp.DetailSelected==0 then |
||
475 | RecapPanel_PopulateDetails(nil,0) |
||
476 | end |
||
477 | end |
||
478 | |||
479 | function RecapPanel_Detail_OnClick() |
||
480 | |||
481 | local id = this:GetID() |
||
482 | local index = id + FauxScrollFrame_GetOffset(RecapPanelDetailsScrollBar) |
||
483 | local linkformat = recap_temp.Local.DamageDetailLink |
||
484 | |||
485 | if IsShiftKeyDown() and index<recap_temp.DetailsListSize and ChatFrameEditBox:IsVisible() then |
||
486 | |||
487 | if string.sub(recap_temp.DetailsList[index].Effect,1,1)=="3" then |
||
488 | linkformat = recap_temp.Local.HealDetailLink |
||
489 | end |
||
490 | ChatFrameEditBox:Insert(string.format(linkformat,RecapPanelName:GetText(), |
||
491 | getglobal("RecapPanelDetail"..id.."_Name"):GetText(), |
||
492 | recap_temp.DetailsList[index].Total, |
||
493 | getglobal("RecapPanelDetail"..id.."_TotalP"):GetText() )) |
||
494 | elseif recap_temp.DetailSelected==index then |
||
495 | recap_temp.DetailSelected = 0 |
||
496 | RecapPanelDetailsScrollBar_Update() |
||
497 | RecapPanel_PopulateDetails(nil,0) |
||
498 | else |
||
499 | recap_temp.DetailSelected = index |
||
500 | RecapPanel_PopulateDetails(RecapPanelName:GetText(),index) |
||
501 | RecapPanelDetailsScrollBar_Update() |
||
502 | end |
||
503 | end |
||
504 | |||
505 | function RecapPanel_OnMouseDown(arg1) |
||
506 | |||
507 | if recap_temp.Loaded and not recap.Opt.Pinned.value and arg1=="LeftButton" then |
||
508 | RecapPanel:StartMoving() |
||
509 | end |
||
510 | end |
||
511 | |||
512 | function RecapPanel_OnMouseUp(arg1) |
||
513 | |||
514 | if recap_temp.Loaded and not recap.Opt.Pinned.value and arg1=="LeftButton" then |
||
515 | RecapPanel:StopMovingOrSizing() |
||
516 | |||
517 | -- check for docking |
||
518 | recap.Opt.PanelAnchor.value = false |
||
519 | |||
520 | if Recap_Near(RecapFrame:GetRight(),RecapPanel:GetLeft()) then |
||
521 | if Recap_Near(RecapFrame:GetTop(),RecapPanel:GetTop()) then |
||
522 | recap.Opt.PanelAnchor = { type="Flag", value=true, Main="TOPRIGHT", Panel="TOPLEFT" } |
||
523 | elseif Recap_Near(RecapFrame:GetBottom(),RecapPanel:GetBottom()) then |
||
524 | recap.Opt.PanelAnchor = { type="Flag", value=true, Main="BOTTOMRIGHT", Panel="BOTTOMLEFT"} |
||
525 | end |
||
526 | elseif Recap_Near(RecapFrame:GetLeft(),RecapPanel:GetRight()) then |
||
527 | if Recap_Near(RecapFrame:GetTop(),RecapPanel:GetTop()) then |
||
528 | recap.Opt.PanelAnchor = { type="Flag", value=true, Main="TOPLEFT", Panel="TOPRIGHT" } |
||
529 | elseif Recap_Near(RecapFrame:GetBottom(),RecapPanel:GetBottom()) then |
||
530 | recap.Opt.PanelAnchor = { type="Flag", value=true, Main="BOTTOMLEFT", Panel="BOTTOMRIGHT" } |
||
531 | end |
||
532 | elseif Recap_Near(RecapFrame:GetRight(),RecapPanel:GetRight()) then |
||
533 | if Recap_Near(RecapFrame:GetTop(),RecapPanel:GetBottom()) then |
||
534 | recap.Opt.PanelAnchor = { type="Flag", value=true, Main="TOPRIGHT", Panel="BOTTOMRIGHT" } |
||
535 | elseif Recap_Near(RecapFrame:GetBottom(),RecapPanel:GetTop()) then |
||
536 | recap.Opt.PanelAnchor = { type="Flag", value=true, Main="BOTTOMRIGHT", Panel="TOPRIGHT" } |
||
537 | end |
||
538 | elseif Recap_Near(RecapFrame:GetLeft(),RecapPanel:GetLeft()) then |
||
539 | if Recap_Near(RecapFrame:GetTop(),RecapPanel:GetBottom()) then |
||
540 | recap.Opt.PanelAnchor = { type="Flag", value=true, Main="TOPLEFT", Panel="BOTTOMLEFT" } |
||
541 | elseif Recap_Near(RecapFrame:GetBottom(),RecapPanel:GetTop()) then |
||
542 | recap.Opt.PanelAnchor = { type="Flag", value=true, Main="BOTTOMLEFT", Panel="TOPLEFT" } |
||
543 | end |
||
544 | end |
||
545 | |||
546 | if recap.Opt.PanelAnchor.value then |
||
547 | RecapPanel:ClearAllPoints() |
||
548 | RecapPanel:SetPoint(recap.Opt.PanelAnchor.Panel,"RecapFrame",recap.Opt.PanelAnchor.Main,Recap_PanelOffset("x"),Recap_PanelOffset("y")) |
||
549 | end |
||
550 | |||
551 | end |
||
552 | end |
||
553 | |||
554 | function Recap_PanelOffset(arg1) |
||
555 | |||
556 | local anchor |
||
557 | local dockoffset = { ["TOPRIGHTTOPLEFT"] = { x=-4,y=0 }, |
||
558 | ["BOTTOMRIGHTBOTTOMLEFT"] = { x=-4,y=0 }, |
||
559 | ["TOPLEFTTOPRIGHT"] = { x=4,y=0 }, |
||
560 | ["BOTTOMLEFTBOTTOMRIGHT"] = { x=4,y=0 }, |
||
561 | ["TOPRIGHTBOTTOMRIGHT"] = { x=0,y=-4 }, |
||
562 | ["BOTTOMRIGHTTOPRIGHT"] = { x=0,y=4 }, |
||
563 | ["TOPLEFTBOTTOMLEFT"] = { x=0,y=-4 }, |
||
564 | ["BOTTOMLEFTTOPLEFT"] = { x=0,y=4 } } |
||
565 | |||
566 | anchor = recap.Opt.PanelAnchor.Main..recap.Opt.PanelAnchor.Panel |
||
567 | if dockoffset[anchor] and arg1 then |
||
568 | return dockoffset[anchor][arg1] |
||
569 | else |
||
570 | return 0 |
||
571 | end |
||
572 | end |
||
573 | |||
574 | -- returns true if the two values are close to each other |
||
575 | function Recap_Near(arg1,arg2) |
||
576 | |||
577 | local isnear = false |
||
578 | |||
579 | if (math.max(arg1,arg2)-math.min(arg1,arg2)) < 15 then |
||
580 | isnear = true |
||
581 | end |
||
582 | |||
583 | return isnear |
||
584 | end |
||
585 | |||
586 | function RecapDetailHeader_OnMouseUp(arg1) |
||
587 | |||
588 | if arg1=="RightButton" then |
||
589 | RecapCreateMenu(recap_temp.DetailMenu) |
||
590 | end |
||
591 | end |
||
592 | |||
593 | -- this substitutes ChatFrameEditBox:Insert. If 'msg' will fit in the current editbox, |
||
594 | -- it will :Insert. If not, it will automatically send 'msg' over the current chatType |
||
595 | -- across as many lines as needed, breaking lines by 'delimiter', a single-character |
||
596 | -- string. (if no delimiter is given it will use "]"). If a delimeter isn't found, it |
||
597 | -- will hard-break every 255 characters. |
||
598 | function Recap_InsertChat(msg,delimiter) |
||
599 | |||
600 | local channel,chatnumber = ChatFrameEditBox.chatType |
||
601 | local cx,i,m_start,m_end,done |
||
602 | |||
603 | delimiter = string.sub(delimiter or "]",1,1) |
||
604 | |||
605 | if channel=="WHISPER" then |
||
606 | chatnumber = ChatFrameEditBox.tellTarget |
||
607 | elseif channel=="CHANNEL" then |
||
608 | chatnumber = ChatFrameEditBox.channelTarget |
||
609 | end |
||
610 | |||
611 | cx = string.len(ChatFrameEditBox:GetText()) |
||
612 | |||
613 | if cx+string.len(msg)<255 then |
||
614 | ChatFrameEditBox:Insert(msg) |
||
615 | else |
||
616 | if cx>0 then |
||
617 | SendChatMessage(ChatFrameEditBox:GetText(),channel,nil,chatnumber) |
||
618 | ChatFrameEditBox:SetText("") |
||
619 | end |
||
620 | |||
621 | cx = string.len(msg) |
||
622 | m_start = 1 |
||
623 | |||
624 | while not done do |
||
625 | m_end = nil |
||
626 | for i=m_start,cx do |
||
627 | if ((string.sub(msg,i,i)==delimiter and (i-m_start)<255)) or ((i-m_start<255) and i==cx) then |
||
628 | m_end = i |
||
629 | end |
||
630 | if (i-m_start)>254 and not m_end then |
||
631 | m_end = i |
||
632 | end |
||
633 | end |
||
634 | SendChatMessage(string.sub(msg,m_start,m_end),channel,nil,chatnumber) |
||
635 | m_start = m_end+1 |
||
636 | if m_start>cx then |
||
637 | done = true |
||
638 | end |
||
639 | end |
||
640 | end |
||
641 | |||
642 | end |
||
643 | |||
644 | |||
645 | function RecapDetailHeader_OnClick() |
||
646 | |||
647 | local text,alltext = "","" |
||
648 | local channel,chatnumber = ChatFrameEditBox.chatType |
||
649 | |||
650 | if IsShiftKeyDown() and ChatFrameEditBox:IsVisible() and recap_temp.Selected~=0 then |
||
651 | |||
652 | if channel=="WHISPER" then |
||
653 | chatnumber = ChatFrameEditBox.tellTarget |
||
654 | elseif channel=="CHANNEL" then |
||
655 | chatnumber = ChatFrameEditBox.channelTarget |
||
656 | end |
||
657 | |||
658 | alltext = (recap.Opt.SpamRows.value and "__ " or "")..recap_temp.List[recap_temp.Selected].Name.."'s "..Recap_GetTooltip(recap.Opt.PanelDetail.value)..(recap.Opt.SpamRows.value and " __" or ":") |
||
659 | if recap.Opt.SpamRows.value then |
||
660 | SendChatMessage(alltext,channel,nil,chatnumber) |
||
661 | end |
||
662 | for i=1,recap_temp.DetailsListSize-1 do |
||
663 | if recap_temp.DetailsList[i][recap.Opt.PanelDetail.value]~="0.0%" and recap_temp.DetailsList[i][recap.Opt.PanelDetail.value]~="--" then |
||
664 | text = string.sub(recap_temp.DetailsList[i].Effect,2)..(string.sub(recap_temp.DetailsList[i].Effect,1,1)=="3" and "*" or "")..(recap.Opt.SpamRows.value and ": " or " ")..recap_temp.DetailsList[i][recap.Opt.PanelDetail.value]..(recap.Opt.PanelDetail.value=="Total" and (" ("..recap_temp.DetailsList[i].TotalP.."%)") or "") |
||
665 | if not recap.Opt.SpamRows.value then |
||
666 | alltext = alltext.." ["..text.."]" |
||
667 | else |
||
668 | SendChatMessage(text,channel,nil,chatnumber) |
||
669 | end |
||
670 | end |
||
671 | end |
||
672 | if not recap.Opt.SpamRows.value then |
||
673 | Recap_InsertChat(alltext) |
||
674 | end |
||
675 | end |
||
676 | end |