vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 local _, class = UnitClass("player")
2  
3 TheoryCraft_Data.TargetBuffs = {}
4 TheoryCraft_Data.PlayerBuffs = {}
5  
6 local function findpattern(text, pattern, start)
7 if (text and pattern and (string.find(text, pattern, start))) then
8 return string.sub(text, string.find(text, pattern, start))
9 else
10 return ""
11 end
12 end
13  
14 local function TheoryCraft_AddAllBuffs(target, data, buffs)
15 TheoryCraftTooltip:ClearLines()
16 local i, buff, a, defaulttarget, _, start, found, type
17 if target == "player" then
18 local _, _, _, _, _, _, meleemod = UnitDamage("player")
19 data["Meleemodifier"] = -1+meleemod
20 data["Rangedmodifier"] = -1+meleemod
21 end
22 if class == "DRUID" then
23 local oldstance = TheoryCraft_Data.currentstance
24 TheoryCraft_Data.currentstance = nil
25 local _, active
26 _, _, active = GetShapeshiftFormInfo(1)
27 if active then TheoryCraft_Data.currentstance = 1 end
28 _, _, active = GetShapeshiftFormInfo(3)
29 if active then TheoryCraft_Data.currentstance = 3 end
30 if TheoryCraft_Data.currentstance ~= oldstance then
31 TheoryCraft_Data.redotalents = true
32 end
33 end
34 if buffs == "debuffs" then
35 a = TheoryCraft_Debuffs
36 defaulttarget = "target"
37 else
38 a = TheoryCraft_Buffs
39 defaulttarget = "player"
40 end
41 for i = 1, 16 do
42 if buffs == "debuffs" then
43 buff = UnitDebuff(target, i)
44 else
45 buff = UnitBuff(target, i)
46 end
47 if buff then
48 TheoryCraftTooltipTextLeft1:SetText(nil)
49 TheoryCraftTooltip:SetOwner(UIParent,"ANCHOR_NONE")
50 if buffs == "debuffs" then
51 TheoryCraftTooltip:SetUnitDebuff(target, i)
52 else
53 TheoryCraftTooltip:SetUnitBuff(target, i)
54 end
55 ltext = TheoryCraftTooltipTextLeft2
56 if (ltext) and (not ltext:IsVisible()) then
57 ltext = nil
58 end
59 if (ltext) then ltext = ltext:GetText() end
60 if ltext then
61 for k, v in pairs(a) do
62 if ((not v.target) and (target == defaulttarget)) or (v.target == target) then
63 _, start, found = strfind(ltext, v.text)
64 if _ then
65 type = v.type
66 if (v.amount == nil) then
67 data[type] = (data[type] or 0) + tonumber(found)
68 elseif (v.amount == "n/100") then
69 data[type] = (data[type] or 0) + tonumber(found)/100
70 elseif (v.amount == "totem") then
71 data[type] = (data[type] or 0) + tonumber(found)/2*5
72 elseif (v.amount == "hl") then
73 data[type] = (data[type] or 0) + tonumber(found)/2.5*3.5
74 elseif (v.amount == "fol") then
75 data[type] = (data[type] or 0) + tonumber(found)/1.5*3.5
76 else
77 data[type] = (data[type] or 0) + v.amount
78 end
79 end
80 end
81 end
82 end
83 end
84 end
85 end
86  
87 local old = {}
88 local old2 = {}
89  
90 function TheoryCraft_UpdateBuffs(arg1, dontgen)
91 if (arg1 == "player") then
92 TheoryCraft_DeleteTable(TheoryCraft_Data.PlayerBuffs)
93 TheoryCraft_AddAllBuffs("player", TheoryCraft_Data.PlayerBuffs)
94 TheoryCraft_AddAllBuffs("player", TheoryCraft_Data.PlayerBuffs, "debuffs")
95 if dontgen == nil then
96 if TheoryCraft_Data.redotalents then
97 TheoryCraft_UpdateTalents(true)
98 TheoryCraft_Data.redotalents = nil
99 end
100 TheoryCraft_LoadStats()
101 TheoryCraft_UpdateArmor()
102 TheoryCraft_GenerateAll()
103 end
104 elseif (arg1 == "target") then
105 TheoryCraft_DeleteTable(old)
106 TheoryCraft_CopyTable(TheoryCraft_Data.TargetBuffs, old)
107 TheoryCraft_DeleteTable(TheoryCraft_Data.TargetBuffs)
108 TheoryCraft_AddAllBuffs("target", TheoryCraft_Data.TargetBuffs)
109 TheoryCraft_AddAllBuffs("target", TheoryCraft_Data.TargetBuffs, "debuffs")
110 if dontgen == nil then
111 if TheoryCraft_Data.redotalents then
112 TheoryCraft_UpdateTalents(true)
113 TheoryCraft_Data.redotalents = nil
114 end
115 TheoryCraft_DeleteTable(old2)
116 TheoryCraft_CopyTable(TheoryCraft_Data.Stats, old2)
117 TheoryCraft_LoadStats()
118 if (TheoryCraft_IsDifferent(old, TheoryCraft_Data.TargetBuffs)) or (TheoryCraft_IsDifferent(old2, TheoryCraft_Data.Stats)) then
119 TheoryCraft_UpdateArmor()
120 TheoryCraft_GenerateAll()
121 end
122 end
123 end
124 end