public
Fork of lowlee/lowavoidance
Description: WoW Addon - Attack tables are so fucking confusing...
Homepage: http://www.tekkub.net
Clone URL: git://github.com/tekkub/idhitthat.git
Click here to lend your support to: idhitthat and make a donation at www.pledgie.com !
idhitthat / melee.lua
100644 137 lines (99 sloc) 5.432 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
local L = tek_locale
local tip = LibStub("tektip-1.0").new(4, "LEFT", "RIGHT", "RIGHT", "RIGHT")
 
local _, class = UnitClass("player")
 
local hasHP, nocs, nocsv, hotc, hotcv
local function gettable(canglance, isdual, infront)
hasHP = UnitAura("player", "Heroic Presence")
 
local glance = canglance and 25 or 0
local miss = math.max(8 + (isdual and 19 or 0) - (hasHP and 1 or 0) - GetCombatRatingBonus(CR_HIT_MELEE), 0)
local parry = infront and math.max(9 - GetExpertisePercent(), 0) or 0
local dodge = math.max(6.5 - GetExpertisePercent(), 0)
local block = infront and 6.5 or 0
local crit = GetCritChance()
local hit = 0
 
if class == "DEATHKNIGHT" and not infront then
nocs, _, _, _, nocsv = GetTalentInfo(2,6)
if nocsv > 0 then miss = math.max(0, miss - nocsv) else nocsv = nil end
end
 
if class == "SHAMAN" and not infront then
nocs, _, _, _, nocsv = GetTalentInfo(2,19)
if nocsv > 0 then miss, nocsv = math.max(0, miss - nocsv*2), nocsv*2 else nocsv = nil end
end
 
if class == "PALADIN" then
hotc, _, _, _, hotcv = GetTalentInfo(3,4)
if hotcv > 0 then crit = crit + hotcv else hotcv = nil end
end
 
local leftover = 100
 
miss = math.min(miss, leftover)
leftover = leftover - miss
 
dodge = math.min(dodge, leftover)
leftover = leftover - dodge
 
parry = math.min(parry, leftover)
leftover = leftover - parry
 
glance = math.min(glance, leftover)
leftover = leftover - glance
 
block = math.min(block, leftover)
leftover = leftover - block
 
crit = math.min(crit, leftover)
leftover = leftover - crit
 
hit = leftover
 
return hit, crit, miss, dodge, glance, parry, block
end
 
 
tek_register("Interface\\Icons\\INV_Sword_26", function(self)
local hit, crit, miss, dodge, glance = gettable(true)
 
local dhit, dcrit, dmiss, ddodge, dglance = gettable(true, true)
local shit, scrit, smiss, sdodge, sglance = gettable()
 
 
tip:SetPoint("BOTTOMLEFT", self, "TOPRIGHT")
 
tip:AddLine("Melee Tables", 1,1,1)
tip:AddMultiLine("", "Normal", "Dual", "Special")
 
tip:AddMultiLine(L["Critical"], string.format("%.2f%%", crit), string.format("%.2f%%", dcrit), string.format("%.2f%%", scrit), nil,nil,nil, .5,1,.5, .5,1,.5, .5,1,.5)
tip:AddMultiLine(L["Hit"], string.format("%.2f%%", hit), string.format("%.2f%%", dhit), string.format("%.2f%%", shit), nil,nil,nil, 1,1,1, 1,1,1, 1,1,1)
tip:AddMultiLine(L["Miss"], string.format("%.2f%%", miss), string.format("%.2f%%", dmiss), string.format("%.2f%%", smiss), nil,nil,nil, 1,.5,0, 1,.5,0, 1,.5,0)
tip:AddMultiLine(L["Dodge"], string.format("%.2f%%", dodge), string.format("%.2f%%", ddodge), string.format("%.2f%%", sdodge), nil,nil,nil, 1,.5,0, 1,.5,0, 1,.5,0)
tip:AddMultiLine(L["Glancing"], string.format("%.2f%%", glance), string.format("%.2f%%", dglance), string.format("%.2f%%", sglance), nil,nil,nil, 1,.5,0, 1,.5,0, 1,.5,0)
 
if hasHP or nocsv then
tip:AddLine(" ")
tip:AddLine("Hit Bonuses", 1,1,1)
if hasHP then tip:AddLine(hasHP.. " |cffffffff(+1%)") end
if nocsv then tip:AddLine(nocs.. "* |cffffffff(+"..nocsv.."%)") end
if nocsv then tip:AddLine("*Dual-wield only", 0.5, 0.5, 1) end
end
 
if hotcv then
tip:AddLine(" ")
tip:AddLine("Crit Bonuses", 1,1,1)
if hotcv then tip:AddLine(hotc.. "* |cffffffff(+"..hotcv.."%)") end
if hotcv then tip:AddLine("*When debuff is applied", 0.5, 0.5, 1) end
end
 
tip:AddLine(" ")
tip:AddLine("All values are vs. mobs 3 levels above the player, attacking |cffccffccfrom behind|r, with capped weapon skill.", 0,1,0, true)
 
tip:Show()
end, tip)
 
 
local tip2 = LibStub("tektip-1.0").new(3, "LEFT", "RIGHT", "RIGHT")
tek_register("Interface\\Icons\\INV_Hammer_01", function(self)
local hit, crit, miss, dodge, glance, parry, block = gettable(true, false, true)
local shit, scrit, smiss, sdodge, sglance, sparry, sblock = gettable(false, false, true)
 
 
tip2:SetPoint("BOTTOMLEFT", self, "TOPRIGHT")
 
tip2:AddLine("Tank Melee Tables", 1,1,1)
tip2:AddMultiLine("", "Normal", "Special")
 
tip2:AddMultiLine(L["Critical"], string.format("%.2f%%", crit), string.format("%.2f%%", scrit), nil,nil,nil, .5,1,.5, .5,1,.5)
tip2:AddMultiLine(L["Hit"], string.format("%.2f%%", hit), string.format("%.2f%%", shit), nil,nil,nil, 1,1,1, 1,1,1)
tip2:AddMultiLine(L["Miss"], string.format("%.2f%%", miss), string.format("%.2f%%", smiss), nil,nil,nil, 1,.5,0, 1,.5,0)
tip2:AddMultiLine(L["Dodge"], string.format("%.2f%%", dodge), string.format("%.2f%%", sdodge), nil,nil,nil, 1,.5,0, 1,.5,0)
tip2:AddMultiLine(L["Parry"], string.format("%.2f%%", parry), string.format("%.2f%%", sparry), nil,nil,nil, 1,.5,0, 1,.5,0)
tip2:AddMultiLine(L["Block"], string.format("%.2f%%", block), string.format("%.2f%%", sblock), nil,nil,nil, 1,.5,0, 1,.5,0)
tip2:AddMultiLine(L["Glancing"], string.format("%.2f%%", glance), string.format("%.2f%%", sglance), nil,nil,nil, 1,.5,0, 1,.5,0)
 
if hasHP then
tip2:AddLine(" ")
tip2:AddLine("Hit Bonuses", 1,1,1)
if hasHP then tip2:AddLine(hasHP.. " |cffffffff(+1%)") end
end
 
if hotcv then
tip2:AddLine(" ")
tip2:AddLine("Crit Bonuses", 1,1,1)
if hotcv then tip2:AddLine(hotc.. "* |cffffffff(+"..hotcv.."%)") end
if hotcv then tip2:AddLine("*When debuff is applied", 0.5, 0.5, 1) end
end
 
tip2:AddLine(" ")
tip2:AddLine("All values are vs. mobs 3 levels above the player, attacking |cffccffccfrom in front|r, with capped weapon skill.", 0,1,0, true)
 
tip2:Show()
end, tip2)