vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | TheoryCraft_Data.Talents = {} |
2 | local _, class = UnitClass("player") |
||
3 | |||
4 | local function findpattern(text, pattern, start) |
||
5 | if (text and pattern and (string.find(text, pattern, start))) then |
||
6 | return string.sub(text, string.find(text, pattern, start)) |
||
7 | else |
||
8 | return "" |
||
9 | end |
||
10 | end |
||
11 | |||
12 | local function TheoryCraft_AddAllTalents(data, ignoreforce) |
||
13 | local i = 1 |
||
14 | local forcedrank = 0 |
||
15 | |||
16 | |||
17 | data["strmultiplier"] = 1 |
||
18 | data["agimultiplier"] = 1 |
||
19 | data["stammultiplier"] = 1 |
||
20 | data["intmultiplier"] = 1 |
||
21 | data["spiritmultiplier"] = 1 |
||
22 | data["manamultiplier"] = 1 |
||
23 | data["healthmultiplier"] = 1 |
||
24 | local _, race = UnitRace("player") |
||
25 | if (race == "Gnome") then |
||
26 | data["intmultiplier"] = 1.05 |
||
27 | end |
||
28 | if (race == "Human") then |
||
29 | data["spiritmultiplier"] = 1.05 |
||
30 | end |
||
31 | if (race == "Tauren") then |
||
32 | data["healthmultiplier"] = 1.05 |
||
33 | end |
||
34 | data["strmultiplierreal"] = data["strmultiplier"] |
||
35 | data["agimultiplierreal"] = data["agimultiplier"] |
||
36 | data["stammultiplierreal"] = data["stammultiplier"] |
||
37 | data["intmultiplierreal"] = data["intmultiplier"] |
||
38 | data["spiritmultiplierreal"] = data["spiritmultiplier"] |
||
39 | data["manamultiplierreal"] = data["manamultiplier"] |
||
40 | data["healthmultiplierreal"] = data["healthmultiplier"] |
||
41 | |||
42 | local nameTalent, icon, iconx, icony, currank, maxRank = GetTalentInfo(1, 1) |
||
43 | if nameTalent == nil then return end |
||
44 | TheoryCraft_Data.TalentsHaveBeenRead = true |
||
45 | |||
46 | local _, catform, bearform |
||
47 | if class == "DRUID" then |
||
48 | _, _, bearform = GetShapeshiftFormInfo(1) |
||
49 | _, _, catform = GetShapeshiftFormInfo(3) |
||
50 | end |
||
51 | |||
52 | while (TheoryCraft_Talents[i]) do |
||
53 | if (class == TheoryCraft_Talents[i].class) then |
||
54 | if (TheoryCraft_Talents[i].tree) and (TheoryCraft_Talents[i].number) then |
||
55 | nameTalent, icon, iconx, icony, currank, maxRank= GetTalentInfo(TheoryCraft_Talents[i].tree, TheoryCraft_Talents[i].number) |
||
56 | if (currank > 0) then |
||
57 | if (TheoryCraft_Talents[i].firstrank) then |
||
58 | if currank > 1 then |
||
59 | currank = TheoryCraft_Talents[i].firstrank + (currank-1)*TheoryCraft_Talents[i].perrank |
||
60 | else |
||
61 | currank = TheoryCraft_Talents[i].firstrank |
||
62 | end |
||
63 | else |
||
64 | currank = currank*TheoryCraft_Talents[i].perrank |
||
65 | end |
||
66 | end |
||
67 | else |
||
68 | currank = 0 |
||
69 | end |
||
70 | if ((TheoryCraft_Talents[i].forceto == nil) or (TheoryCraft_Talents[i].forceto == -1) or (ignoreforce)) then |
||
71 | if (TheoryCraft_Talents[i].forceonly == nil) then |
||
72 | data[TheoryCraft_Talents[i].bonustype] = (data[TheoryCraft_Talents[i].bonustype] or 0) + currank |
||
73 | end |
||
74 | else |
||
75 | if (TheoryCraft_Talents[i].firstrank) and (TheoryCraft_Talents[i].forceto > 0) then |
||
76 | forcedrank = TheoryCraft_Talents[i].firstrank |
||
77 | if TheoryCraft_Talents[i].forceto > 1 then |
||
78 | forcedrank = forcedrank + (TheoryCraft_Talents[i].forceto-1)*TheoryCraft_Talents[i].perrank |
||
79 | end |
||
80 | else |
||
81 | forcedrank = TheoryCraft_Talents[i].forceto*TheoryCraft_Talents[i].perrank |
||
82 | end |
||
83 | if (TheoryCraft_Talents[i].bonustype == "Predatory") and ((catform) or (bearform)) then |
||
84 | data["AttackPowerTalents"] = (data["AttackPowerTalents"] or 0)-UnitLevel("player")*currank+UnitLevel("player")*forcedrank |
||
85 | end |
||
86 | if TheoryCraft_Talents[i].bonustype == "CritReport" then |
||
87 | data["CritChangeTalents"] = (data["CritChangeTalents"] or 0)+currank-forcedrank |
||
88 | end |
||
89 | if strfind(TheoryCraft_Talents[i].bonustype, "modifier") then |
||
90 | data[TheoryCraft_Talents[i].bonustype] = (data[TheoryCraft_Talents[i].bonustype] or 0) + currank |
||
91 | 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) |
||
92 | elseif strfind(TheoryCraft_Talents[i].bonustype, "manacost") then |
||
93 | data[TheoryCraft_Talents[i].bonustype] = (((data[TheoryCraft_Talents[i].bonustype] or 0)+1)*((1+forcedrank)/(1+currank)))-1 |
||
94 | else |
||
95 | if strfind(TheoryCraft_Talents[i].bonustype, "casttime") then |
||
96 | data[TheoryCraft_Talents[i].bonustype] = (data[TheoryCraft_Talents[i].bonustype] or 0) - currank + forcedrank |
||
97 | else |
||
98 | data[TheoryCraft_Talents[i].bonustype] = (data[TheoryCraft_Talents[i].bonustype] or 0) + forcedrank |
||
99 | end |
||
100 | end |
||
101 | end |
||
102 | if TheoryCraft_Talents[i].bonustype == "Formcritchance" then |
||
103 | data["Formcritchancereal"] = (data["Formcritchancereal"] or 0)+currank |
||
104 | end |
||
105 | local _, _, spec = strfind(TheoryCraft_Talents[i].bonustype, "(.+)spec") |
||
106 | if spec then |
||
107 | data[spec.."specreal"] = (data[spec.."specreal"] or 0)+currank |
||
108 | end |
||
109 | if (TheoryCraft_Talents[i].bonustype == "HotW") then |
||
110 | if catform then |
||
111 | if ((TheoryCraft_Talents[i].forceto == nil) or (TheoryCraft_Talents[i].forceto == -1) or (ignoreforce)) then |
||
112 | data["strmultiplier"] = data["strmultiplier"]+currank |
||
113 | else |
||
114 | data["strmultiplier"] = data["strmultiplier"]+forcedrank |
||
115 | end |
||
116 | data["strmultiplierreal"] = data["strmultiplierreal"]+currank |
||
117 | end |
||
118 | if bearform then |
||
119 | if ((TheoryCraft_Talents[i].forceto == nil) or (TheoryCraft_Talents[i].forceto == -1) or (ignoreforce)) then |
||
120 | data["stammultiplier"] = data["stammultiplier"]+currank |
||
121 | else |
||
122 | data["stammultiplier"] = data["stammultiplier"]+forcedrank |
||
123 | end |
||
124 | data["stammultiplierreal"] = data["stammultiplierreal"]+currank |
||
125 | end |
||
126 | end |
||
127 | if (TheoryCraft_Talents[i].bonustype == "healthmultiplier") then |
||
128 | data["healthmultiplierreal"] = data["healthmultiplierreal"]+currank |
||
129 | end |
||
130 | if (TheoryCraft_Talents[i].bonustype == "manamultiplier") then |
||
131 | data["manamultiplierreal"] = data["manamultiplierreal"]+currank |
||
132 | end |
||
133 | if (TheoryCraft_Talents[i].bonustype == "strmultiplier") then |
||
134 | data["strmultiplierreal"] = data["strmultiplierreal"]+currank |
||
135 | end |
||
136 | if (TheoryCraft_Talents[i].bonustype == "agimultiplier") then |
||
137 | data["agimultiplierreal"] = data["agimultiplierreal"]+currank |
||
138 | end |
||
139 | if (TheoryCraft_Talents[i].bonustype == "stammultiplier") then |
||
140 | data["stammultiplierreal"] = data["stammultiplierreal"]+currank |
||
141 | end |
||
142 | if (TheoryCraft_Talents[i].bonustype == "intmultiplier") then |
||
143 | data["intmultiplierreal"] = data["intmultiplierreal"]+currank |
||
144 | end |
||
145 | if (TheoryCraft_Talents[i].bonustype == "spiritmultiplier") then |
||
146 | data["spiritmultiplierreal"] = data["spiritmultiplierreal"]+currank |
||
147 | end |
||
148 | end |
||
149 | i = i + 1 |
||
150 | end |
||
151 | end |
||
152 | |||
153 | function TheoryCraft_UpdateTalents(dontgen) |
||
154 | local old = TheoryCraft_Data.Talents |
||
155 | -- local old3 = TheoryCraft_Data.TalentsTest |
||
156 | TheoryCraft_Data.Talents = {} |
||
157 | TheoryCraft_AddAllTalents(TheoryCraft_Data.Talents) |
||
158 | -- TheoryCraft_Data.TalentsTest = {} |
||
159 | -- TheoryCraft_AddAllTalents(TheoryCraft_Data.TalentsTest) |
||
160 | if dontgen == nil then |
||
161 | local old2 = TheoryCraft_Data.Stats |
||
162 | TheoryCraft_Data.Stats = {} |
||
163 | TheoryCraft_LoadStats() |
||
164 | if TheoryCraft_IsDifferent(old, TheoryCraft_Data.Talents) or TheoryCraft_IsDifferent(old2, TheoryCraft_Data.Stats) then |
||
165 | TheoryCraft_GenerateAll() |
||
166 | end |
||
167 | end |
||
168 | end |