-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource.lua
329 lines (323 loc) · 10.4 KB
/
source.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
local robloxdriver = {}
local Players = game:GetService("Players")
local player = Players.LocalPlayer
if rconsolename then
rconsolename("robloxdriver")
end
function robloxdriver:debug(status, reason)
local statuses = {
["error"] = "@@RED@@",
["warn"] = "@@YELLOW@@",
["print"] = "@@LIGHT_GREEN@@"
}
for i, v in pairs(statuses) do
if status == i then
if rconsoleprint then
rconsoleprint(v)
rconsoleprint("[" .. string.upper(i) .. "] ")
rconsoleprint("@@WHITE@@")
rconsoleprint(reason .. "\n")
end
if i == "error" then
wait(5)
game:Shutdown()
end
end
end
end
function robloxdriver:indentifyMSDN(key)
key = string.lower(key)
local list = {
["0x30"] = "0",
["0x31"] = "1",
["0x32"] = "2",
["0x33"] = "3",
["0x34"] = "4",
["0x35"] = "5",
["0x36"] = "6",
["0x37"] = "7",
["0x38"] = "8",
["0x39"] = "9",
["0x41"] = "A",
["0x42"] = "B",
["0x43"] = "C",
["0x44"] = "D",
["0x45"] = "E",
["0x46"] = "F",
["0x47"] = "G",
["0x48"] = "H",
["0x49"] = "I",
["0x4A"] = "J",
["0x4B"] = "K",
["0x4C"] = "L",
["0x4D"] = "M",
["0x4F"] = "F",
["0x50"] = "P",
["0x51"] = "Q",
["0x52"] = "R",
["0x53"] = "S",
["0x54"] = "T",
["0x55"] = "U",
["0x56"] = "V",
["0x57"] = "W",
["0x58"] = "X",
["0x59"] = "Y",
["0x5A"] = "Z"
}
for i, v in pairs(list) do
if v == string.upper(key) then
return i
end
end
end
function robloxdriver:new()
local driver = {}
driver.Character = {}
function driver.Character:click_element(element)
pcall(
function()
if not element then
return robloxdriver:debug("error", "Element expected got nil when using click_element")
else
for i, v in pairs(element:GetDescendants()) do
if v:IsA("ClickDetector") then
fireclickdetector(v)
return robloxdriver:debug("print", "Clicked " .. element.Name)
end
end
end
end
)
end
function driver.Character:touch_element(element)
pcall(
function()
for i, v in pairs(element:GetDescendants()) do
if v.ClassName:match("Part") then
firetouchinterest(player.Character.HumanoidRootPart, v, 0)
firetouchinterest(player.Character.HumanoidRootPart, v, 1)
end
end
end
)
end
function driver.Character:reset()
if isrbxactive then
keypress(0x1B)
wait(0.1)
keyrelease(0x1B)
wait(0.5)
keypress(tonumber("0x52"))
wait(0.1)
keyrelease(tonumber("0x52"))
wait(0.1)
keypress(tonumber("0x0D"))
wait(0.1)
keyrelease(tonumber("0x0D"))
end
end
function driver.Character:jump()
if isrbxactive and player.Character then
keypress(0x20)
wait(0.05)
keyrelease(0x20)
end
end
if rconsoleprint then
rconsoleprint("")
end
function driver:find_element(text)
if typeof(text) == "string" then
for i, v in pairs(player.PlayerGui:GetDescendants()) do
local x = nil
pcall(
function()
if v.Text == text then
x = v
end
end
)
pcall(
function()
if v.PlaceholderText == text then
x = v
end
end
)
pcall(
function()
if v.ImageId == text then
x = v
end
end
)
pcall(
function()
if v.Image == text then
x = v
end
end
)
if x then
robloxdriver:debug("print", "Found element " .. text)
return x
end
end
for i, v in pairs(player.PlayerGui:GetDescendants()) do
local x = nil
pcall(
function()
if v.Text:match(text) then
x = v
end
end
)
pcall(
function()
if v.PlaceholderText:match(text) then
x = v
end
end
)
pcall(
function()
if v.ImageId:match(text) then
x = v
end
end
)
pcall(
function()
if v.Image:match(text) then
x = v
end
end
)
if x then
robloxdriver:debug("print", "Found element " .. text)
return x
end
end
else
robloxdriver:debug("error", "String expected got " .. typeof(text) .. " when finding element")
end
return robloxdriver:debug("warn", "No Text or ImageID found when attempting to find element '" .. text .. "'.")
end
function driver:click(guiobject)
if typeof(guiobject) ~= "Instance" then
if isrbxactive then
mouse1click()
robloxdriver:debug("print", "Clicked mouse")
end
else
if guiobject.ClassName:match("Button") and guiobject.Visible then
for z, m in pairs(getconnections(guiobject.MouseButton1Click)) do
m:Fire()
end
for z, m in pairs(getconnections(guiobject.MouseButton1Down)) do
m:Fire()
end
robloxdriver:debug("print", "Successfully clicked " .. v.Name)
else
for i, v in pairs(guiobject.Parent:GetChildren()) do
if v.ClassName:match("Button") and v.Visible then
for z, m in pairs(getconnections(v.MouseButton1Click)) do
m:Fire()
end
for z, m in pairs(getconnections(v.MouseButton1Down)) do
m:Fire()
end
robloxdriver:debug("print", "Successfully clicked " .. v.Name)
end
end
end
end
end
function driver:keypress(key, length)
if not length then
length = 0
end
if isrbxactive then
keypress(tonumber(robloxdriver:indentifyMSDN(key)))
wait(length)
keyrelease(tonumber(robloxdriver:indentifyMSDN(key)))
end
end
function driver:type_textbox(object, message)
local z = 0
if object then
if typeof(object) == "Instance" then
if object:IsA("TextBox") then
for i = 0, #message do
local x = tonumber("0.0" .. math.random(4, 9))
z = z + x
wait(x)
object.Text = string.sub(message, 1, i)
end
end
end
end
robloxdriver:debug("print", "Typed " .. message .. " in " .. z .. " seconds")
end
function driver:find_workspace_element(object, all)
if typeof(object) == "string" then
local objects = {}
for i, v in pairs(game:GetService("Workspace"):GetDescendants()) do
if v.ClassName:match("Text") and not v:IsA("Texture") then
if v.Text == object then
if all then
table.insert(objects, v)
else
return v
end
end
else
if v.Name == object then
if not all then
return v
else
table.insert(objects, v)
end
end
end
end
for i, v in pairs(game:GetService("Workspace"):GetDescendants()) do
if v.ClassName:match("Text") and not v:IsA("Texture") then
if v.Text:match(object) then
if all then
table.insert(objects, v)
else
return v
end
end
else
if v.Name:match(object) then
if not all then
return v
else
table.insert(objects, v)
end
end
end
end
local function getobj(tablel)
local tablell = 0
for i, v in pairs(tablel) do
tablell = tablell + 1
end
return tablell
end
if not getobj(objects) then
return robloxdriver:debug(
"warn",
"No Text or ImageID found when attempting to find element '" .. text .. "'."
)
else
return objects
end
end
-- robloxdriver:debug("error", "String expected got " .. typeof(text) .. " when finding element")
end
return driver
end
return robloxdriver