-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathTheoryCraftClassicTalents.lua
168 lines (160 loc) · 6.73 KB
/
TheoryCraftClassicTalents.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
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
TheoryCraft_Data.Talents = {}
local _, class = UnitClass("player")
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 TheoryCraft_AddAllTalents(data, ignoreforce)
local i = 1
local forcedrank = 0
data["strmultiplier"] = 1
data["agimultiplier"] = 1
data["stammultiplier"] = 1
data["intmultiplier"] = 1
data["spiritmultiplier"] = 1
data["manamultiplier"] = 1
data["healthmultiplier"] = 1
local _, race = UnitRace("player")
if (race == "Gnome") then
data["intmultiplier"] = 1.05
end
if (race == "Human") then
data["spiritmultiplier"] = 1.05
end
if (race == "Tauren") then
data["healthmultiplier"] = 1.05
end
data["strmultiplierreal"] = data["strmultiplier"]
data["agimultiplierreal"] = data["agimultiplier"]
data["stammultiplierreal"] = data["stammultiplier"]
data["intmultiplierreal"] = data["intmultiplier"]
data["spiritmultiplierreal"] = data["spiritmultiplier"]
data["manamultiplierreal"] = data["manamultiplier"]
data["healthmultiplierreal"] = data["healthmultiplier"]
local nameTalent, icon, iconx, icony, currank, maxRank = GetTalentInfo(1, 1)
if nameTalent == nil then return end
TheoryCraft_Data.TalentsHaveBeenRead = true
local _, catform, bearform
if class == "DRUID" then
_, _, bearform = GetShapeshiftFormInfo(1)
_, _, catform = GetShapeshiftFormInfo(3)
end
while (TheoryCraft_Talents[i]) do
if (class == TheoryCraft_Talents[i].class) then
if (TheoryCraft_Talents[i].tree) and (TheoryCraft_Talents[i].number) then
nameTalent, icon, iconx, icony, currank, maxRank= GetTalentInfo(TheoryCraft_Talents[i].tree, TheoryCraft_Talents[i].number)
if (currank > 0) then
if (TheoryCraft_Talents[i].firstrank) then
if currank > 1 then
currank = TheoryCraft_Talents[i].firstrank + (currank-1)*TheoryCraft_Talents[i].perrank
else
currank = TheoryCraft_Talents[i].firstrank
end
else
currank = currank*TheoryCraft_Talents[i].perrank
end
end
else
currank = 0
end
if ((TheoryCraft_Talents[i].forceto == nil) or (TheoryCraft_Talents[i].forceto == -1) or (ignoreforce)) then
if (TheoryCraft_Talents[i].forceonly == nil) then
data[TheoryCraft_Talents[i].bonustype] = (data[TheoryCraft_Talents[i].bonustype] or 0) + currank
end
else
if (TheoryCraft_Talents[i].firstrank) and (TheoryCraft_Talents[i].forceto > 0) then
forcedrank = TheoryCraft_Talents[i].firstrank
if TheoryCraft_Talents[i].forceto > 1 then
forcedrank = forcedrank + (TheoryCraft_Talents[i].forceto-1)*TheoryCraft_Talents[i].perrank
end
else
forcedrank = TheoryCraft_Talents[i].forceto*TheoryCraft_Talents[i].perrank
end
if (TheoryCraft_Talents[i].bonustype == "Predatory") and ((catform) or (bearform)) then
data["AttackPowerTalents"] = (data["AttackPowerTalents"] or 0)-UnitLevel("player")*currank+UnitLevel("player")*forcedrank
end
if TheoryCraft_Talents[i].bonustype == "CritReport" then
data["CritChangeTalents"] = (data["CritChangeTalents"] or 0)+currank-forcedrank
end
if strfind(TheoryCraft_Talents[i].bonustype, "modifier") then
data[TheoryCraft_Talents[i].bonustype] = (data[TheoryCraft_Talents[i].bonustype] or 0) + currank
data[string.sub(TheoryCraft_Talents[i].bonustype, 1, string.find(TheoryCraft_Talents[i].bonustype, "modifier")-1).."talentmod"] = forcedrank - currank + (data[string.sub(TheoryCraft_Talents[i].bonustype, 1, string.find(TheoryCraft_Talents[i].bonustype, "modifier")-1).."talentmod"] or 0)
elseif strfind(TheoryCraft_Talents[i].bonustype, "manacost") then
data[TheoryCraft_Talents[i].bonustype] = (((data[TheoryCraft_Talents[i].bonustype] or 0)+1)*((1+forcedrank)/(1+currank)))-1
else
if strfind(TheoryCraft_Talents[i].bonustype, "casttime") then
data[TheoryCraft_Talents[i].bonustype] = (data[TheoryCraft_Talents[i].bonustype] or 0) - currank + forcedrank
else
data[TheoryCraft_Talents[i].bonustype] = (data[TheoryCraft_Talents[i].bonustype] or 0) + forcedrank
end
end
end
if TheoryCraft_Talents[i].bonustype == "Formcritchance" then
data["Formcritchancereal"] = (data["Formcritchancereal"] or 0)+currank
end
local _, _, spec = strfind(TheoryCraft_Talents[i].bonustype, "(.+)spec")
if spec then
data[spec.."specreal"] = (data[spec.."specreal"] or 0)+currank
end
if (TheoryCraft_Talents[i].bonustype == "HotW") then
if catform then
if ((TheoryCraft_Talents[i].forceto == nil) or (TheoryCraft_Talents[i].forceto == -1) or (ignoreforce)) then
data["strmultiplier"] = data["strmultiplier"]+currank
else
data["strmultiplier"] = data["strmultiplier"]+forcedrank
end
data["strmultiplierreal"] = data["strmultiplierreal"]+currank
end
if bearform then
if ((TheoryCraft_Talents[i].forceto == nil) or (TheoryCraft_Talents[i].forceto == -1) or (ignoreforce)) then
data["stammultiplier"] = data["stammultiplier"]+currank
else
data["stammultiplier"] = data["stammultiplier"]+forcedrank
end
data["stammultiplierreal"] = data["stammultiplierreal"]+currank
end
end
if (TheoryCraft_Talents[i].bonustype == "healthmultiplier") then
data["healthmultiplierreal"] = data["healthmultiplierreal"]+currank
end
if (TheoryCraft_Talents[i].bonustype == "manamultiplier") then
data["manamultiplierreal"] = data["manamultiplierreal"]+currank
end
if (TheoryCraft_Talents[i].bonustype == "strmultiplier") then
data["strmultiplierreal"] = data["strmultiplierreal"]+currank
end
if (TheoryCraft_Talents[i].bonustype == "agimultiplier") then
data["agimultiplierreal"] = data["agimultiplierreal"]+currank
end
if (TheoryCraft_Talents[i].bonustype == "stammultiplier") then
data["stammultiplierreal"] = data["stammultiplierreal"]+currank
end
if (TheoryCraft_Talents[i].bonustype == "intmultiplier") then
data["intmultiplierreal"] = data["intmultiplierreal"]+currank
end
if (TheoryCraft_Talents[i].bonustype == "spiritmultiplier") then
data["spiritmultiplierreal"] = data["spiritmultiplierreal"]+currank
end
end
i = i + 1
end
end
function TheoryCraft_UpdateTalents(dontgen)
local old = TheoryCraft_Data.Talents
-- local old3 = TheoryCraft_Data.TalentsTest
TheoryCraft_Data.Talents = {}
TheoryCraft_AddAllTalents(TheoryCraft_Data.Talents)
-- TheoryCraft_Data.TalentsTest = {}
-- TheoryCraft_AddAllTalents(TheoryCraft_Data.TalentsTest)
if dontgen == nil then
local old2 = TheoryCraft_Data.Stats
TheoryCraft_Data.Stats = {}
TheoryCraft_LoadStats()
if TheoryCraft_IsDifferent(old, TheoryCraft_Data.Talents) or TheoryCraft_IsDifferent(old2, TheoryCraft_Data.Stats) then
TheoryCraft_GenerateAll()
end
end
end