-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.lua
More file actions
233 lines (208 loc) · 7.17 KB
/
init.lua
File metadata and controls
233 lines (208 loc) · 7.17 KB
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
-- 'tv' stands for thievery
local addonName, tv = ...
local PICKPOCKET_SPELLID = 921
SLASH_THIEVERYCONFIGSHOW1 = "/thief"
SLASH_THIEVERYCONFIGSHOW2 = "/thievery"
SLASH_THIEVERYCONFIGSHOW3 = "/teef"
SlashCmdList["THIEVERYCONFIGSHOW"] = function()
Thievery_ConfigPanel:Show()
end
function Thievery_CheckVersion()
end
if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then
tv.gameVersion = 1
elseif WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC or WOW_PROJECT_ID == 19 then
tv.gameVersion = 2
elseif WOW_PROJECT_ID == WOW_PROJECT_CLASSIC then
tv.gameVersion = 3
elseif WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC then
tv.gameVersion = 4
else
tv.gameVersion = 0
end
function Thievery_IsSecret(value)
if tv.gameVersion == 1 then
if issecretvalue(value) then return true end
end
return false
end
function Thievery_ScrubSecret(...)
if tv.gameVersion == 1 then
return scrubsecretvalues(...)
end
return ...
end
Thievery_UI = {
VisualLocation = {},
}
Thievery_Config ={
ppKey = nil,
Checkboxes = {},
}
Thievery_SavedCVars = {
SpeedyMode = {},
}
function Thievery_SavedVariables()
if not Thievery_UI then
Thievery_UI = {}
end
if not Thievery_UI.VisualLocation then
Thievery_UI.VisualLocation = {}
end
if not Thievery_Config then
Thievery_Config = {}
end
if not Thievery_Config.Checkboxes then
Thievery_Config.Checkboxes = {}
end
if not Thievery_Config.Checkboxes[1] then
Thievery_Config.Checkboxes[1] = {}
end
if Thievery_Config.Checkboxes[1].speedyMode == nil then
Thievery_Config.Checkboxes[1].speedyMode = false
end
if Thievery_Config.Checkboxes[1].playSound == nil then
Thievery_Config.Checkboxes[1].playSound = true
end
if Thievery_Config.Checkboxes[1].enableSap == nil then
Thievery_Config.Checkboxes[1].enableSap = false
end
if Thievery_Config.Checkboxes[1].lockpicking == nil then
Thievery_Config.Checkboxes[1].lockpicking = true
end
if Thievery_Config.Checkboxes[1].debugMode == nil then
Thievery_Config.Checkboxes[1].debugMode = false
end
if not Thievery_Config.Checkboxes[2] then
Thievery_Config.Checkboxes[2] = {}
end
if Thievery_Config.Checkboxes[2].lockpicking == nil then
Thievery_Config.Checkboxes[2].lockpicking = true
end
if Thievery_Config.Checkboxes[2].lockpickAnim == nil then
Thievery_Config.Checkboxes[2].lockpickAnim = true
end
if Thievery_Config.Checkboxes[2].lockpickSound == nil then
Thievery_Config.Checkboxes[2].lockpickSound = true
end
if not Thievery_SavedCVars then
Thievery_SavedCVars = {}
end
if not Thievery_SavedCVars.SpeedyMode then
Thievery_SavedCVars.SpeedyMode = {}
end
end
-- not a saved variable
Thievery_Target = {}
function Thievery_SingleDelayer(delay, timeElapsed, elapsedThreshhold, delayFrame, cycleFunk, endFunk)
delayFrame:SetScript("OnUpdate", function(self, elapsed)
timeElapsed = timeElapsed + elapsed
if timeElapsed > elapsedThreshhold then
if cycleFunk then
if cycleFunk() == true then
--print("Breaking delayer")
self:SetScript("OnUpdate", nil)
return
end
end
delay = delay - timeElapsed
timeElapsed = 0
end
if delay <= 0 then
self:SetScript("OnUpdate", nil)
endFunk()
return
end
end)
end
function Thievery_BetaPrint(text, ...)
if Thievery_Config.Checkboxes[1].debugMode == true then
print(text, ...)
end
end
function Thievery_BetaDump(dump)
if Thievery_Config.Checkboxes[1].debugMode == true then
DevTools_Dump(dump)
end
end
function Thievery_BetaTableToString(tbl)
if Thievery_Config.Checkboxes[1].debugMode == true then
local tableToString = ""
for i, v in pairs(tbl) do
local element = "[" .. tostring(i) .. ":" .. tostring(v) .. "]"
tableToString = tableToString .. " " .. element
end
print(tableToString)
end
end
function Thievery_OnLoad(self)
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("ADDON_LOADED")
self:RegisterEvent("PLAYER_LOGOUT")
self:SetScript("OnEvent", Thievery_EventLoader)
Thievery_SetupConfigPanel_PreSavedVars(self)
local playerClass = UnitClassBase("player")
if playerClass ~= "ROGUE" then
return
end
self.pickpocketButton:RegisterForClicks("AnyUp", "AnyDown")
self.pickpocketButton:RegisterEvent("PLAYER_SOFT_INTERACT_CHANGED")
self.pickpocketButton:RegisterEvent("PLAYER_SOFT_ENEMY_CHANGED")
self.pickpocketButton:RegisterEvent("PLAYER_TARGET_CHANGED")
self.pickpocketButton:RegisterEvent("UPDATE_STEALTH")
self.pickpocketButton:RegisterEvent("PLAYER_REGEN_DISABLED")
self.pickpocketButton:RegisterEvent("PLAYER_REGEN_ENABLED")
self.pickpocketButton:SetScript("OnEvent", Thievery_Events)
local gameVersion = tv.gameVersion
if gameVersion == 1 then
self.pickpocketButton:SetAttribute("type", "macro")
local spellName = C_Spell.GetSpellName(PICKPOCKET_SPELLID)
self.pickpocketButton:SetAttribute("macrotext", "/cast " .. spellName)
elseif gameVersion == 2 or gameVersion == 3 then
--____________________________________________________________________________
-- Pickpocketing with SecureActionButton bugs out in Classic
-- use SetOverrideBindingSpell directly instead
--____________________________________________________________________________
end
end
Thievery_TempCVars = {
SoftTargetEnemy = {
active = false, cached = nil, setTo = "3", updating = false,
},
SoftTargetEnemyRange = {
active = false, cached = nil, setTo = "15", updating = false,
},
SoftTargetEnemyArc = {
active = false, cached = nil, setTo = "2", updating = false,
},
autoLootRate = {
active = false, cached = nil, setTo = "50", updating = false,
},
autoLootDefault = {
active = false, cached = nil, setTo = "1", updating = false,
},
}
local ppTalent
if ppTalent == true then
Thievery_TempCVars["SoftTargetEnemyRange"].setTo = 15
else
Thievery_TempCVars["SoftTargetEnemyRange"].setTo = 15
end
Thievery_TempCVarHandler = CreateFrame("Frame", "Example_CVarHandler", UIParent, "Legolando_TempCVarHandlerTemplate_Thievery")
Thievery_TempCVarHandler.tempCVarsTable = Thievery_TempCVars
Thievery_TempCVarHandler:Init()
function Thievery_EventLoader(self, event, unit, ...)
local arg4, arg5 = ...
if event == "ADDON_LOADED" and unit == "Thievery" then
Thievery_SavedVariables()
Thievery_SetupConfigPanel_PostSavedVars(self)
Thievery_UpdateVisualPosition()
elseif event == "PLAYER_ENTERING_WORLD" then
if unit == false and arg4 == false then return end
if tv.gameVersion ~= 0 and tv.gameVersion ~= 4 then
Thievery_ActivateLockpicking(Thievery_Config.Checkboxes[2].lockpicking)
end
elseif event == "PLAYER_LOGOUT" then
Thievery_TempCVarHandler:ReleaseAll()
end
end