vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 -- Eviscerate tracking
2  
3 lazyr.et = {}
4  
5  
6 function lazyr.et.ResetEviscTracking()
7 lazyr.perPlayerConf.eviscTracker = { {0,0}, {0,0}, {0,0}, {0,0}, {0,0} }
8 end
9  
10 function lazyr.et.GetEviscTrackingInfo(cp)
11 local observedDamage = lazyr.perPlayerConf.eviscTracker[cp][1]
12 local observedCt = lazyr.perPlayerConf.eviscTracker[cp][2]
13 return observedDamage, observedCt
14 end
15  
16 function lazyr.et.SetEviscTrackingInfo(cp, observedDamage, observedCt)
17 lazyr.perPlayerConf.eviscTracker[cp][1] = observedDamage
18 lazyr.perPlayerConf.eviscTracker[cp][2] = observedCt
19 end
20  
21 function lazyr.et.TrackEviscerates(arg1)
22 local thisDamage = nil
23 if (lazyr.re(arg1, lrLocale.EVISCERATE_HIT)) then
24 thisDamage = lazyr.match2
25 elseif (lazyr.perPlayerConf.trackEviscCrits and lazyr.re(arg1, lrLocale.EVISCERATE_CRIT)) then
26 thisDamage = lazyr.match2
27 end
28 if (not thisDamage) then
29 return
30 end
31  
32 if (not lazyr.eviscComboPoints or lazyr.eviscComboPoints == 0) then
33 lazyr.d("lazyr.eviscComboPoints is nil or 0, can't record")
34 return
35 end
36  
37 local observedDamage, observedCt = lazyr.et.GetEviscTrackingInfo(lazyr.eviscComboPoints)
38  
39 observedDamage = observedDamage * observedCt
40 local newCt = observedCt + 1
41 observedDamage = observedDamage + thisDamage
42 observedDamage = observedDamage / newCt
43 observedCt = math.min(lazyr.perPlayerConf.eviscerateSample, newCt)
44  
45 lazyr.et.SetEviscTrackingInfo(lazyr.eviscComboPoints, observedDamage, observedCt)
46  
47 local expectedDamage = lazyr.masks.CalculateBaseEviscDamage(lazyr.eviscComboPoints)
48 local thisRatio = thisDamage / expectedDamage
49 local avgRatio = observedDamage / expectedDamage
50 lazyr.d("Eviscerate ("..lazyr.eviscComboPoints.."cp): "..thisDamage.." damage (optimal "..
51 expectedDamage..") "..string.format("%.2f", thisRatio).."/"..
52 string.format("%.2f", avgRatio).." (cur/avg vs. optimal)")
53  
54 lazyr.eviscComboPoints = nil
55 end
56  
57 -- Hook UseAction() so we can record how many combo points the
58 -- player had when he eviscerated.
59 function lazyr.et.UseActionHook(action, checkCursor, onSelf)
60 if (action == lazyr.actions.eviscerate:GetSlot()) then
61 lazyr.eviscComboPoints = GetComboPoints()
62 --lazyr.d("UseActionHook, I see you're eviscerating with "..lazyr.eviscComboPoints.." cps")
63 end
64 return lazyr.UseActionOrig(action, checkCursor, onSelf)
65 end