-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathTheoryCraftClassicUI.lua
91 lines (84 loc) · 2.72 KB
/
TheoryCraftClassicUI.lua
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
local _TOOLTIPTAB = 1
local _BUTTONTEXTTAB = 2
local _ADVANCEDTAB = 3
--local _MITIGATIONTAB = 4
local _, class = UnitClass("player")
TheoryCraft_NotStripped = true
local function findpattern(text, pattern, start)
if (text and pattern and (string.find(text, pattern, start))) then
return string.sub(text, string.find(text, pattern, start))
else
return ""
end
end
local function round(arg1, decplaces)
if (decplaces == nil) then decplaces = 0 end
if arg1 == nil then arg1 = 0 end
return string.format ("%."..decplaces.."f", arg1)
end
local function AddMods(mult, mod, all, healing, damage, school, prefix, suffix, pre2)
local tmp = TheoryCraft_GetStat("All"..mod)*mult
if tmp ~= 0 then
if all ~= "DONT" then
TheoryCraftAddMod(all, prefix..tmp..suffix)
end
end
tmp = TheoryCraft_GetStat("Healing"..mod)*mult
if tmp ~= 0 then
TheoryCraftAddMod(healing, prefix..tmp..suffix)
end
tmp = TheoryCraft_GetStat("Damage"..mod)*mult
if tmp ~= 0 then
TheoryCraftAddMod(damage, prefix..tmp..suffix)
end
if pre2 == nil then pre2 = "" end
for k,v in pairs(TheoryCraft_PrimarySchools) do
tmp = TheoryCraft_GetStat(v.name..mod)*mult
if tmp ~= 0 then
TheoryCraftAddMod(pre2..v.name..school, prefix..tmp..suffix)
end
end
end
function TheoryCraft_Combo1Click()
local optionID = self:GetID()
UIDropDownMenu_SetSelectedID(TheoryCrafttryfirst, optionID)
TheoryCraft_Settings["tryfirst"] = self.value
TheoryCraft_DeleteTable(TheoryCraft_UpdatedButtons)
end
function TheoryCraft_Combo2Click()
local optionID = self:GetID()
UIDropDownMenu_SetSelectedID(TheoryCrafttrysecond, optionID)
TheoryCraft_Settings["trysecond"] = self.value
TheoryCraft_DeleteTable(TheoryCraft_UpdatedButtons)
end
function TheoryCraft_Combo3Click()
local optionID = self:GetID()
UIDropDownMenu_SetSelectedID(TheoryCrafttryfirstsfg, optionID)
TheoryCraft_Settings["tryfirstsfg"] = self.value
TheoryCraft_DeleteTable(TheoryCraft_UpdatedButtons)
end
function TheoryCraft_Combo4Click()
local optionID = self:GetID()
UIDropDownMenu_SetSelectedID(TheoryCrafttrysecondsfg, optionID)
TheoryCraft_Settings["trysecondsfg"] = self.value
TheoryCraft_DeleteTable(TheoryCraft_UpdatedButtons)
end
local info = {}
local function formattext(a, field, places)
if places == nil then
places = 0
end
if (field == "averagedam") or (field == "averageheal") then
if TheoryCraft_Settings["dontcrit"] then
field = field.."nocrit"
end
end
if a[field] == nil then
return nil
end
if (field == "maxoomdam") or (field == "maxoomdamremaining") or (field == "maxoomdamfloored") or
(field == "maxoomheal") or (field == "maxoomhealremaining") or (field == "maxoomhealfloored") then
return round(a[field]/1000*10^places)/10^places.."k"
end
return round(a[field]*10^places)/10^places
end