forked from JeffP07/TheorycraftClassic
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTheoryCraftClassicGear.lua
662 lines (648 loc) · 22.5 KB
/
TheoryCraftClassicGear.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
TheoryCraft_Data.EquipEffects = {}
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_AddEquipEffect (slotname, test, data, equippedsets)
if (test ~= "test") then
TheoryCraftTooltip:SetOwner(UIParent,"ANCHOR_NONE")
TheoryCraftTooltip:SetInventoryItem ("player", GetInventorySlotInfo(slotname.."Slot"))
end
if (getglobal("TheoryCraftTooltipTextLeft1") == nil) then
return
end
local ltext = getglobal(TheoryCraftTooltip:GetName().."TextLeft1"):GetText()
if (data["name"] == ltext) and (data["numlines"] == TheoryCraftTooltip:NumLines()) then
return
end
for k,v in pairs(data) do
data[k] = nil
end
if data["procs"] == nil then data["procs"] = {} end
for k,v in pairs(equippedsets) do
equippedsets[k] = nil
end
data["name"] = ltext
data["numlines"] = TheoryCraftTooltip:NumLines()
local index = 2
ltext = getglobal("TheoryCraftTooltipTextLeft"..index)
if ltext then
ltext = ltext:GetText()
end
rtext = getglobal("TheoryCraftTooltipTextRight"..index)
if rtext then
if (not getglobal("TheoryCraftTooltipTextRight"..index):IsVisible()) then
rtext = nil
else
rtext = rtext:GetText()
end
end
local itemLink = GetInventoryItemLink("player",GetInventorySlotInfo(slotname.."Slot"))
if(itemLink) then
stats = GetItemStats(itemLink)
if (stats) then
local found = stats["ITEM_MOD_SPELL_HEALING_DONE_SHORT"] or 0
data["Healing"] = (data["Healing"] or 0) + found
end
end
local s2 = 1
local is = 1
local i2 = 1
local ignoreline = false
local startpos, endpos, found, foundme
while (ltext ~= nil) do
if strfind(ltext, TheoryCraft_Locale.Set) then
local numpieces = tonumber(findpattern(findpattern(ltext, TheoryCraft_Locale.Set), "%d+"))
while (string.len(ltext) > 0) and (string.sub(ltext, string.len(ltext), string.len(ltext)) == " ") do
ltext = string.sub(ltext, 1, string.len(ltext)-1)
end
while (string.len(ltext) > 0) and (string.sub(ltext, string.len(ltext), string.len(ltext)) ~= " ") do
ltext = string.sub(ltext, 1, string.len(ltext)-1)
end
while (string.len(ltext) > 0) and (string.sub(ltext, string.len(ltext), string.len(ltext)) == " ") do
ltext = string.sub(ltext, 1, string.len(ltext)-1)
end
local setname = ltext
equippedsets[setname] = (equippedsets[setname] or 0)+1
if TheoryCraft_SetBonuses[setname] == nil then
TheoryCraft_SetBonuses[setname] = {}
end
local foundbonuses = {}
local idx = 1
index = index + 1
ltext = getglobal(TheoryCraftTooltip:GetName().."TextLeft"..index)
while (ltext ~= nil) do
ltext = ltext:GetText()
if ltext == nil then break end
if strfind(string.sub(ltext, 1, 4), "%d+") then
foundbonuses[idx] = {}
foundbonuses[idx]["pieces"] = tonumber(findpattern(ltext, "%d+"))
ltext = string.sub(ltext, 5+string.len(TheoryCraft_Locale.ID_Set))
foundbonuses[idx]["text"] = ltext
idx = idx + 1
end
index = index + 1
ltext = getglobal(TheoryCraftTooltip:GetName().."TextLeft"..index)
end
local newbonuses = {}
i = 1
for k,v in pairs(TheoryCraft_SetBonuses[setname]) do
if (v["pieces"] and v["pieces"] <= numpieces) then
newbonuses[i] = v
i = i + 1
end
end
for k,v in pairs(foundbonuses) do
newbonuses[i] = v
i = i + 1
end
TheoryCraft_SetBonuses[setname] = newbonuses
break
end
if (strfind(ltext, "^"..TheoryCraft_Locale.ID_Equip)) then
foundme = false
for k, v in pairs(TheoryCraft_Equips) do
if (v.slot == nil) or (v.slot == slotname) then
if ((foundme == false) or (v.me == nil)) then
_, start, found = strfind(ltext, v.text)
if _ then
if v.proc then
i2 = 1
if data["procs"] == nil then
data["procs"] = {}
end
while data["procs"][i2] do i2 = i2 + 1 end
data["procs"][i2] = {}
data["procs"][i2].amount = v.amount
data["procs"][i2].proc = v.proc
data["procs"][i2].duration = v.duration
data["procs"][i2].exact = v.exact
data["procs"][i2].type = v.type
else
if (v.amount) then
data[v.type] = (data[v.type] or 0) + v.amount
else
data[v.type] = (data[v.type] or 0) + tonumber(found)
end
if (v.me) then
foundme = true
end
end
end
end
end
end
else
foundme = false
if rtext then
for k, v in pairs(TheoryCraft_EquipEveryRight) do
if (v.slot == nil) or (v.slot == slotname) then
if (foundme == false) or (v.me == nil) then
_, start, found = strfind(rtext, v.text)
if _ then
if (v.amount) then
data[v.type] = (data[v.type] or 0) + v.amount
else
data[v.type] = (data[v.type] or 0) + found
end
if (v.me) then foundme = true end
end
end
end
end
end
ignoreline = false
for k, v in pairs(TheoryCraft_IgnoreLines) do
if strfind(ltext, v) then
ignoreline = true
break
end
end
if not ignoreline then
foundme = false
for k, v in pairs(TheoryCraft_EquipEveryLine) do
if (v.slot == nil) or (v.slot == slotname) then
if (not foundme) or (not v.me) then
_, start, found = strfind(ltext, v.text)
if _ then
if (v.amount) then
data[v.type] = (data[v.type] or 0) + v.amount
else
data[v.type] = (data[v.type] or 0) + found
end
if (v.me) then foundme = true end
end
end
end
end
end
end
index = index + 1
ltext = getglobal("TheoryCraftTooltipTextLeft"..index)
rtext = getglobal("TheoryCraftTooltipTextRight"..index)
if ltext then
ltext = ltext:GetText()
end
if rtext then
if (not getglobal("TheoryCraftTooltipTextRight"..index):IsVisible()) then
rtext = nil
else
rtext = rtext:GetText()
end
end
end
TheoryCraftTooltip:ClearLines()
return true
end
function TheoryCraft_CombineTables(tab1, tab2)
if tab2 == nil then tab2 = tab1 return end
for k,v in pairs(tab1) do
if type(v) == "table" then
tab2[k] = TheoryCraft_CombineTables(v, tab2[k])
elseif tonumber(v) and tonumber(tab2[k] or 0) then
tab2[k] = v + (tab2[k] or 0)
end
end
end
local function TheoryCraft_AddAllEquips(outfit, force)
local i2 = 1
local resetall = true
if not force and UnitAffectingCombat("player") then
resetall = false
end
if (TheoryCraft_Outfits[outfit]) == nil then
outfit = 1
end
if TheoryCraft_Data["SlotData"] == nil then
TheoryCraft_Data["SlotData"] = {}
TheoryCraft_Data["SetData"] = {}
end
TheoryCraft_Data.OldOutfit = outfit
if TheoryCraft_Data.StatsToDo == nil then
TheoryCraft_Data.StatsToDo = {}
end
TheoryCraft_DeleteTable(TheoryCraft_Data.StatsToDo)
for k, v in pairs(TheoryCraft_Outfits[outfit].wear) do
TheoryCraft_Data.StatsToDo[v] = true
if TheoryCraft_Data["SlotData"][v] == nil then
TheoryCraft_Data["SlotData"][v] = {}
TheoryCraft_Data["SlotData"][v]["procs"] = {}
end
if TheoryCraft_Data["SetData"][v] == nil then
TheoryCraft_Data["SetData"][v] = {}
end
if (v == "MainHand") or (v == "SecondaryHand") or (v == "Ranged") or (v == "Ammo") then
changed = TheoryCraft_AddEquipEffect(v, nil, TheoryCraft_Data["SlotData"][v], TheoryCraft_Data["SetData"][v])
elseif (resetall) then
changed = TheoryCraft_AddEquipEffect(v, nil, TheoryCraft_Data["SlotData"][v], TheoryCraft_Data["SetData"][v])
end
end
if not TheoryCraft_Data.EquipEffects then
TheoryCraft_Data.EquipEffects = {}
end
if not TheoryCraft_Data.EquipedSets then
TheoryCraft_Data.EquippedSets = {}
end
TheoryCraft_DeleteTable(TheoryCraft_Data.EquipEffects)
TheoryCraft_DeleteTable(TheoryCraft_Data.EquippedSets)
for k, v in pairs(TheoryCraft_Data.StatsToDo) do
TheoryCraft_CombineTables(TheoryCraft_Data.SlotData[k], TheoryCraft_Data.EquipEffects)
TheoryCraft_CombineTables(TheoryCraft_Data.SetData[k], TheoryCraft_Data.EquippedSets)
end
data = TheoryCraft_Data.EquipEffects
local i = 1
if (outfit == 2) then
TheoryCraft_Outfits[outfit].meleecritchance = 0
TheoryCraft_Outfits[outfit].formattackpower = 0
TheoryCraft_Outfits[outfit].rangedattackpower = 0
TheoryCraft_Outfits[outfit].attackpower = 0
TheoryCraft_Outfits[outfit].strength = 0
TheoryCraft_Outfits[outfit].agility = 0
TheoryCraft_Outfits[outfit].stamina = 0
TheoryCraft_Outfits[outfit].intellect = 0
TheoryCraft_Outfits[outfit].spirit = 0
TheoryCraft_Outfits[outfit].totalmana = 0
TheoryCraft_Outfits[outfit].totalhealth = 0
if (TheoryCraft_Settings["CustomOutfit"] == nil) then
TheoryCraft_Settings["CustomOutfit"] = TheoryCraft_Outfits[outfit]
TheoryCraft_Settings["CustomOutfit"].slots = {}
end
local k, v
while (TheoryCraft_SlotNames[i]) do
if ((TheoryCraft_SlotNames[i-1] == nil) or (TheoryCraft_SlotNames[i].slot ~= TheoryCraft_SlotNames[i-1].slot)) and (TheoryCraft_Settings["CustomOutfit"].slots[TheoryCraft_SlotNames[i].slot]) then
if TheoryCraft_Settings["CustomOutfit"].slots[TheoryCraft_SlotNames[i].slot] == nil then
TheoryCraft_Settings["CustomOutfit"].slots[TheoryCraft_SlotNames[i].slot] = {}
end
if TheoryCraft_Settings["CustomOutfit"].slots[TheoryCraft_SlotNames[i].slot]["stats"] == nil then TheoryCraft_Settings["CustomOutfit"].slots[TheoryCraft_SlotNames[i].slot]["stats"] = {} end
local a = TheoryCraft_Settings["CustomOutfit"].slots[TheoryCraft_SlotNames[i].slot]["stats"]
TheoryCraft_Outfits[outfit].meleecritchance = TheoryCraft_Outfits[outfit].meleecritchance+(a.meleecritchance or 0)
TheoryCraft_Outfits[outfit].formattackpower = TheoryCraft_Outfits[outfit].formattackpower+(a.formattackpower or 0)
TheoryCraft_Outfits[outfit].rangedattackpower = TheoryCraft_Outfits[outfit].rangedattackpower+(a.rangedattackpower or 0)
TheoryCraft_Outfits[outfit].attackpower = TheoryCraft_Outfits[outfit].attackpower+(a.attackpower or 0)
TheoryCraft_Outfits[outfit].strength = TheoryCraft_Outfits[outfit].strength+(a.strength or 0)
TheoryCraft_Outfits[outfit].agility = TheoryCraft_Outfits[outfit].agility+(a.agility or 0)
TheoryCraft_Outfits[outfit].stamina = TheoryCraft_Outfits[outfit].stamina+(a.stamina or 0)
TheoryCraft_Outfits[outfit].intellect = TheoryCraft_Outfits[outfit].intellect+(a.intellect or 0)
TheoryCraft_Outfits[outfit].spirit = TheoryCraft_Outfits[outfit].spirit+(a.spirit or 0)
TheoryCraft_Outfits[outfit].totalmana = TheoryCraft_Outfits[outfit].totalmana+(a.totalmana or 0)
TheoryCraft_Outfits[outfit].totalhealth = TheoryCraft_Outfits[outfit].totalhealth+(a.totalhealth or 0)
if a.settype then
TheoryCraft_Data.EquippedSets[a.settype] = (TheoryCraft_Data.EquippedSets[a.settype] or 0) + 1
end
a = TheoryCraft_Settings["CustomOutfit"].slots[TheoryCraft_SlotNames[i].slot]["data"]
if type(a) == "table" then
for k,v in pairs(a) do
if k ~= "procs" then
if tonumber(v) then
data[k] = (tonumber(data[k]) or 0)+v
end
else
for k,v in pairs(a["procs"]) do
i2 = 1
if data["procs"] == nil then
data["procs"] = {}
end
while data["procs"][i2] do i2 = i2 + 1 end
data["procs"][i2] = {}
data["procs"][i2].amount = v.amount
data["procs"][i2].proc = v.proc
data["procs"][i2].duration = v.duration
data["procs"][i2].exact = v.exact
data["procs"][i2].type = v.type
end
end
end
end
end
i = i + 1
end
local returndata
for k,count in pairs(TheoryCraft_Data.EquippedSets) do
if TheoryCraft_SetBonuses[k] then
for k,v in pairs(TheoryCraft_SetBonuses[k]) do
if (v["pieces"] <= count) then
returndata = {}
returndata = TheoryCraft_DequipLine(v["text"], returndata)
for k,v in pairs(returndata) do
TheoryCraft_Outfits[outfit][k] = (TheoryCraft_Outfits[outfit][k] or 0) - v
end
returndata = {}
returndata = TheoryCraft_DequipSpecial(v["text"], returndata)
for k,v in pairs(returndata) do
data[k] = (data[k] or 0) - v
end
end
end
end
end
else
while (TheoryCraft_Outfits[outfit].newstat[i]) do
if TheoryCraft_Outfits[outfit].newstat[i].proc then
i2 = 1
if data["procs"] == nil then
data["procs"] = {}
end
while data["procs"][i2] do i2 = i2 + 1 end
data["procs"][i2] = {}
data["procs"][i2].amount = TheoryCraft_Outfits[outfit].newstat[i].amount
data["procs"][i2].proc = TheoryCraft_Outfits[outfit].newstat[i].proc
data["procs"][i2].duration = TheoryCraft_Outfits[outfit].newstat[i].duration
data["procs"][i2].exact = TheoryCraft_Outfits[outfit].newstat[i].exact
data["procs"][i2].type = TheoryCraft_Outfits[outfit].newstat[i].type
else
data[TheoryCraft_Outfits[outfit].newstat[i].type] = (data[TheoryCraft_Outfits[outfit].newstat[i].type] or 0) + TheoryCraft_Outfits[outfit].newstat[i].amount
end
i = i + 1
end
for k,v in pairs(TheoryCraft_Locale.SetTranslator) do
if v.id == TheoryCraft_Outfits[outfit].name then
if TheoryCraft_SetBonuses[v.translated] then
local returndata
TheoryCraft_Data.EquippedSets[v.translated] = 100
for k,v in pairs(TheoryCraft_SetBonuses[v.translated]) do
returndata = {}
returndata = TheoryCraft_DequipSpecial(v["text"], returndata)
for k,v in pairs(returndata) do
data[k] = (data[k] or 0) - v
end
end
end
break
end
end
end
local i2, ltext, _, start, found, foundme
for k,count in pairs(TheoryCraft_Data.EquippedSets) do
if TheoryCraft_SetBonuses[k] then
foundme = false
for k,v in pairs(TheoryCraft_SetBonuses[k]) do
if (v["pieces"] <= count) then
ltext = v["text"]
foundme = false
for k, v in pairs(TheoryCraft_Equips) do
if (v.slot == nil) or (v.slot == slotname) then
if ((foundme == false) or (v.me == nil)) then
_, start, found = strfind(ltext, v.text)
if _ then
if v.proc then
i2 = 1
if data["procs"] == nil then
data["procs"] = {}
end
while data["procs"][i2] do i2 = i2 + 1 end
data["procs"][i2] = {}
data["procs"][i2].amount = v.amount
data["procs"][i2].proc = v.proc
data["procs"][i2].duration = v.duration
data["procs"][i2].exact = v.exact
data["procs"][i2].type = v.type
else
if (v.amount) then
data[v.type] = (data[v.type] or 0) + v.amount
else
data[v.type] = (data[v.type] or 0) + tonumber(found)
end
if (v.me) then
foundme = true
end
end
end
end
end
end
foundme = false
for k, v in pairs(TheoryCraft_Sets) do
if (v.slot == nil) or (v.slot == slotname) then
if ((foundme == false) or (v.me == nil)) then
_, start, found = strfind(ltext, v.text)
if _ then
if v.proc then
i2 = 1
if data["procs"] == nil then
data["procs"] = {}
end
while data["procs"][i2] do i2 = i2 + 1 end
data["procs"][i2] = {}
data["procs"][i2].amount = v.amount
data["procs"][i2].proc = v.proc
data["procs"][i2].duration = v.duration
data["procs"][i2].exact = v.exact
data["procs"][i2].type = v.type
else
if (v.amount) then
if v.amount == "n/100" then
data[v.type] = (data[v.type] or 0) + tonumber(found)/100
else
data[v.type] = (data[v.type] or 0) + v.amount
end
else
data[v.type] = (data[v.type] or 0) + tonumber(found)
end
if (v.me) then
foundme = true
end
end
end
end
end
end
end
end
end
end
end
local old = {}
local old2 = {}
function TheoryCraft_UpdateGear(arg1, dontgen, force)
if TheoryCraft_SetBonuses == nil then
TheoryCraft_SetBonuses = {}
end
if (arg1 ~= "player") then return end
if not force then
if UnitAffectingCombat("player") then
TheoryCraft_Data.regenaftercombat = true
end
end
TheoryCraft_DeleteTable(old)
TheoryCraft_CopyTable(TheoryCraft_Data.EquipEffects, old)
TheoryCraft_AddAllEquips(TheoryCraft_Data["outfit"], force)
if TheoryCraft_Data.EquipEffects["MeleeAPMult"] == nil then
TheoryCraft_Data.EquipEffects["MeleeAPMult"] = 1
end
if (dontgen == nil) then
TheoryCraft_DeleteTable(old2)
TheoryCraft_CopyTable(TheoryCraft_Data.Stats, old2)
TheoryCraft_DeleteTable(TheoryCraft_Data.Stats)
TheoryCraft_LoadStats()
if (TheoryCraft_IsDifferent(old, TheoryCraft_Data.EquipEffects)) or (TheoryCraft_IsDifferent(old2, TheoryCraft_Data.Stats)) then
TheoryCraft_GenerateAll()
end
end
end
function TheoryCraft_DequipLine(line, returndata)
local _, start, found
for k, v in pairs(TheoryCraft_Dequips) do
if strfind(line, TheoryCraft_Locale.Set) then
return returndata
end
_, start, found = strfind(line, v.text)
if found then
if v.type == "all" then
returndata["strength"] = (returndata["strength"] or 0)-found
returndata["agility"] = (returndata["agility"] or 0)-found
returndata["stamina"] = (returndata["stamina"] or 0)-found
returndata["intellect"] = (returndata["intellect"] or 0)-found
returndata["spirit"] = (returndata["spirit"] or 0)-found
elseif v.type == "formattackpower" then
returndata[v.type] = (returndata[v.type] or 0)-found
break
elseif v.type == "attackpower" then
returndata[v.type] = (returndata[v.type] or 0)-found
returndata["rangedattackpower"] = (returndata["rangedattackpower"] or 0)-found
break
else
returndata[v.type] = (returndata[v.type] or 0)-found
end
end
end
return returndata
end
local b = TheoryCraft_SetsDequipOnly
function TheoryCraft_DequipSpecial(line, returndata)
local i = 1
local amount
while (b[i]) do
if strfind(line, TheoryCraft_Locale.Set) then
return returndata
end
if string.find(line, b[i].text) then
if b[i].amount == "n" then
amount = tonumber(findpattern(findpattern(line, b[i].text), "%d+"))
elseif b[i].amount == "n/100" then
amount = tonumber(findpattern(findpattern(line, b[i].text), "%d+"))/100
else
amount = b[i].amount
end
returndata[b[i].type] = (returndata[b[i].type] or 0)-amount
end
i = i + 1
end
return returndata
end
function TheoryCraft_DequipEffect (slotname, returndata, equippedsets)
if (slotname ~= "test") then
TheoryCraftTooltip:SetOwner(UIParent,"ANCHOR_NONE")
TheoryCraftTooltip:SetInventoryItem ("player", GetInventorySlotInfo(slotname.."Slot"))
end
local index = 1
local i, found
local ltext
while (getglobal("TheoryCraftTooltipTextLeft"..index) ~= nil) do
ltext = getglobal("TheoryCraftTooltipTextLeft"..index):GetText();
if (ltext == nil) then
break
end
if strfind(ltext, TheoryCraft_Locale.Set) then
if equippedsets then
ltext = string.sub(ltext, 1, string.find(ltext, TheoryCraft_Locale.Set)-2)
equippedsets[ltext] = (equippedsets[ltext] or 0)+1
end
break
else
returndata = TheoryCraft_DequipLine(ltext, returndata)
end
index = index + 1
end
TheoryCraftTooltip:ClearLines()
return returndata
end
function TheoryCraft_AddToCustom(linkid)
if (TheoryCraft_Settings["CustomOutfit"] == nil) then
TheoryCraft_Settings["CustomOutfit"] = TheoryCraft_Outfits[3]
end
if (TheoryCraft_Settings["CustomOutfit"].slots == nil) then
TheoryCraft_Settings["CustomOutfit"].slots = {}
end
if (linkid == nil) or (string.find(linkid, "item:%d+:%d+:%d+:%d+") == nil) then
return
end
linkid = string.sub(linkid, string.find(linkid, "item:%d+:%d+:%d+:%d+"))
if linkid == nil then
return
end
TheoryCraftTooltip:SetOwner(UIParent,"ANCHOR_NONE")
TheoryCraftTooltip:SetHyperlink(linkid)
if (getglobal(TheoryCraftTooltip:GetName().."TextLeft1") == nil) then
return
end
local itemname, itemlink, itemrarity = GetItemInfo(linkid)
local r, g, b, hex = GetItemQualityColor(itemrarity)
itemname = hex.."|H"..itemlink.."|h["..itemname.."]|h|r"
local index = 1
local ltext = getglobal(TheoryCraftTooltip:GetName().."TextLeft"..index):GetText()
if ltext == nil then
return
end
local found = false
local realslot = false
local both = false
while (ltext ~= nil) and (found == false) do
local i = 1
while (TheoryCraft_SlotNames[i]) do
if (ltext == TheoryCraft_SlotNames[i].text) then
if (found) then
if TheoryCraft_Settings["CustomOutfit"].slots[found] then
TheoryCraft_Settings["CustomOutfit"].slots[TheoryCraft_SlotNames[i].slot] = TheoryCraft_Settings["CustomOutfit"].slots[found]
end
else
found = TheoryCraft_SlotNames[i].slot
realslot = TheoryCraft_SlotNames[i].realslot
both = TheoryCraft_SlotNames[i].both
end
end
i = i + 1
end
ltext = getglobal(TheoryCraftTooltip:GetName().."TextLeft"..index):GetText()
index = index + 1
end
if found == false then
return
end
if both then
TheoryCraft_Settings["CustomOutfit"].slots["Off HandItemName"] = nil
TheoryCraft_Settings["CustomOutfit"].slots["Off Hand"] = nil
end
local itemdata = {}
local equippedsets = {}
TheoryCraft_AddEquipEffect (realslot, "test", itemdata, equippedsets)
TheoryCraft_Settings["CustomOutfit"].slots[found] = {}
TheoryCraft_Settings["CustomOutfit"].slots[found]["data"] = itemdata
TheoryCraft_Settings["CustomOutfit"].slots[found]["name"] = itemname
TheoryCraftTooltip:SetOwner(UIParent,"ANCHOR_NONE")
TheoryCraftTooltip:SetHyperlink(linkid)
if (getglobal(TheoryCraftTooltip:GetName().."TextLeft1") == nil) then
return
end
local returndata = {}
returndata = TheoryCraft_DequipEffect ("test", returndata)
TheoryCraft_Settings["CustomOutfit"].slots[found]["stats"] = {}
local a = TheoryCraft_Settings["CustomOutfit"].slots[found]["stats"]
for k,v in pairs(equippedsets) do
a.settype = k
end
if returndata["meleecritchance"] then a.meleecritchance = -returndata["meleecritchance"] end
if returndata["formattackpower"] then a.formattackpower = -returndata["formattackpower"] end
if returndata["rangedattackpower"] then a.rangedattackpower = -returndata["rangedattackpower"] end
if returndata["attackpower"] then a.attackpower = -returndata["attackpower"] end
if returndata["strength"] then a.strength = -returndata["strength"] end
if returndata["agility"] then a.agility = -returndata["agility"] end
if returndata["stamina"] then a.stamina = -returndata["stamina"] end
if returndata["intellect"] then a.intellect = -returndata["intellect"] end
if returndata["spirit"] then a.spirit = -returndata["spirit"] end
if returndata["totalmana"] then a.totalmana = -returndata["totalmana"] end
if returndata["totalhealth"] then a.totalhealth = -returndata["totalhealth"] end
end