-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathocto.lua
4698 lines (4077 loc) · 199 KB
/
octo.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
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--[[
Library Made for https://octohook.xyz/
Developed by liam#4567
Modified by tatar0071#0627
Ik this code is really shit in some places lol
will rewrite again i was just using some rly old stuff that i was lazy to rewrite
could've been a lot better and more optimized in some places and some things arent done as they should've been
got lazy when trying to make disable all roblox input when ui is open sooo that will be added later =)
]]
-- // Load
local startupArgs = ({...})[1] or {}
if getgenv().library ~= nil then
getgenv().library:Unload();
end
if not game:IsLoaded() then
game.Loaded:Wait()
end
local function gs(a)
return game:GetService(a)
end
-- // Variables
local players, http, runservice, inputservice, tweenService, stats, actionservice = gs('Players'), gs('HttpService'), gs('RunService'), gs('UserInputService'), gs('TweenService'), gs('Stats'), gs('ContextActionService')
local localplayer = players.LocalPlayer
local setByConfig = false
local floor, ceil, huge, pi, clamp = math.floor, math.ceil, math.huge, math.pi, math.clamp
local c3new, fromrgb, fromhsv = Color3.new, Color3.fromRGB, Color3.fromHSV
local next, newInstance, newUDim2, newVector2 = next, Instance.new, UDim2.new, Vector2.new
local isexecutorclosure = isexecutorclosure or is_synapse_function or is_sirhurt_closure or iskrnlclosure;
local executor = (
syn and 'syn' or
getexecutorname and getexecutorname() or
'unknown'
)
local library = {
windows = {};
indicators = {};
flags = {};
options = {};
connections = {};
drawings = {};
instances = {};
utility = {};
notifications = {};
tweens = {};
theme = {};
zindexOrder = {
['indicator'] = 950;
['window'] = 1000;
['dropdown'] = 1200;
['colorpicker'] = 1100;
['watermark'] = 1300;
['notification'] = 1400;
['cursor'] = 1500;
},
stats = {
['fps'] = 0;
['ping'] = 0;
};
images = {
['gradientp90'] = 'https://raw.githubusercontent.com/portallol/luna/main/modules/gradient90.png';
['gradientp45'] = 'https://raw.githubusercontent.com/portallol/luna/main/modules/gradient45.png';
['colorhue'] = 'https://raw.githubusercontent.com/portallol/luna/main/modules/lgbtqshit.png';
['colortrans'] = 'https://raw.githubusercontent.com/portallol/luna/main/modules/trans.png';
};
numberStrings = {['Zero'] = 0, ['One'] = 1, ['Two'] = 2, ['Three'] = 3, ['Four'] = 4, ['Five'] = 5, ['Six'] = 6, ['Seven'] = 7, ['Eight'] = 8, ['Nine'] = 9};
signal = loadstring(game:HttpGet('https://raw.githubusercontent.com/Quenty/NevermoreEngine/main/src/signal/src/Shared/Signal.lua'))();
open = false;
opening = false;
hasInit = false;
cheatname = startupArgs.cheatname or 'octohook';
gamename = startupArgs.gamename or 'universal';
fileext = startupArgs.fileext or '.txt';
}
library.themes = {
{
name = 'Default',
theme = {
['Accent'] = fromrgb(191, 64, 191);
['Background'] = fromrgb(18,18,18);
['Border'] = fromrgb(0,0,0);
['Border 1'] = fromrgb(60,60,60);
['Border 2'] = fromrgb(35,35,35);
['Border 3'] = fromrgb(10,10,10);
['Primary Text'] = fromrgb(235,235,235);
['Group Background'] = fromrgb(35,35,35);
['Selected Tab Background'] = fromrgb(35,35,35);
['Unselected Tab Background'] = fromrgb(18,18,18);
['Selected Tab Text'] = fromrgb(245,245,245);
['Unselected Tab Text'] = fromrgb(145,145,145);
['Section Background'] = fromrgb(18,18,18);
['Option Text 1'] = fromrgb(245,245,245);
['Option Text 2'] = fromrgb(195,195,195);
['Option Text 3'] = fromrgb(145,145,145);
['Option Border 1'] = fromrgb(50,50,50);
['Option Border 2'] = fromrgb(0,0,0);
['Option Background'] = fromrgb(35,35,35);
["Risky Text"] = fromrgb(175, 21, 21);
["Risky Text Enabled"] = fromrgb(255, 41, 41);
}
}
}
local blacklistedKeys = {
Enum.KeyCode.Unknown,
Enum.KeyCode.W,
Enum.KeyCode.A,
Enum.KeyCode.S,
Enum.KeyCode.D,
Enum.KeyCode.Slash,
Enum.KeyCode.Tab,
Enum.KeyCode.Escape
}
local whitelistedBoxKeys = {
Enum.KeyCode.Zero,
Enum.KeyCode.One,
Enum.KeyCode.Two,
Enum.KeyCode.Three,
Enum.KeyCode.Four,
Enum.KeyCode.Five,
Enum.KeyCode.Six,
Enum.KeyCode.Seven,
Enum.KeyCode.Eight,
Enum.KeyCode.Nine
}
local keyNames = {
[Enum.KeyCode.LeftControl] = 'LCTRL';
[Enum.KeyCode.RightControl] = 'RCTRL';
[Enum.KeyCode.LeftShift] = 'LSHIFT';
[Enum.KeyCode.RightShift] = 'RSHIFT';
[Enum.UserInputType.MouseButton1] = 'MB1';
[Enum.UserInputType.MouseButton2] = 'MB2';
[Enum.UserInputType.MouseButton3] = 'MB3';
}
library.button1down = library.signal.new()
library.button1up = library.signal.new()
library.mousemove = library.signal.new()
library.unloaded = library.signal.new();
local button1down, button1up, mousemove = library.button1down, library.button1up, library.mousemove
local mb1down = false;
local utility = library.utility
do
function utility:Connection(signal, func)
local c = signal:Connect(func)
table.insert(library.connections, c)
return c
end
function utility:Instance(class, properties)
local inst = newInstance(class)
for prop, val in next, properties or {} do
local s,e = pcall(function()
inst[prop] = val
end)
if not s then
printconsole(e, 255,0,0)
end
end
return inst
end
function utility:HasProperty(obj, prop)
return ({(pcall(function() local a = obj[prop] end))})[1]
end
function utility:ToRGB(c3)
return c3.R*255,c3.G*255,c3.B*255
end
function utility:AddRGB(a,b)
local r1,g1,b1 = self:ToRGB(a);
local r2,g2,b2 = self:ToRGB(b);
return fromrgb(clamp(r1+r2,0,255),clamp(g1+g2,0,255),clamp(b1+b2,0,255))
end
function utility:ConvertNumberRange(val,oldmin,oldmax,newmin,newmax)
return (((val - oldmin) * (newmax - newmin)) / (oldmax - oldmin)) + newmin
end
function utility:UDim2ToVector2(udim2, vector2)
local x,y
x = udim2.X.Offset + self:ConvertNumberRange(udim2.X.Scale,0,1,0,vector2.X)
y = udim2.Y.Offset + self:ConvertNumberRange(udim2.Y.Scale,0,1,0,vector2.Y)
return newVector2(x,y)
end
function utility:Lerp(a,b,c)
return a + (b-a) * c
end
function utility:Tween(obj, prop, val, time, direction, style)
if self:HasProperty(obj, prop) then
if library.tweens[obj] then
if library.tweens[obj][prop] then
library.tweens[obj][prop]:Cancel()
end
end
local startVal = obj[prop];
local a = 0;
local tween = {
Completed = library.signal.new();
};
library.tweens[obj] = library.tweens[obj] or {};
library.tweens[obj][prop] = tween;
tween.Connection = self:Connection(runservice.RenderStepped, function(dt)
a = a + (dt / time);
if a >= 1 or obj == nil then
tween:Cancel();
end
pcall(function()
local progress = tweenService:GetValue(a, style or Enum.EasingStyle.Linear, direction or Enum.EasingDirection.In)
local newVal
if typeof(startVal) == 'number' then
newVal = utility:Lerp(startVal, val, progress);
else
newVal = startVal:Lerp(val, progress);
end
obj[prop] = newVal;
end)
end)
function tween:Cancel()
tween.Connection:Disconnect();
tween.Completed:Fire();
table.clear(tween);
library.tweens[obj][prop] = nil;
end
return tween;
else
printconsole('unable to tween: invalid property '..tostring(prop)..' for object '..tostring(obj), 255,0,0)
end
end
function utility:DetectTableChange(indexcallback,newindexcallback)
if indexcallback == nil then
warn('DetectTableChange: Argument #1 (indexcallback) is nil, function may not work as expected.')
elseif newindexcallback == nil then
warn('DetectTableChange: Argument #2 (newindexcallback) is nil, function may not work as expected.')
end
local proxy = newproxy(true);
local mt = getmetatable(proxy);
mt.__index = indexcallback
mt.__newindex = newindexcallback
return proxy
end
function utility:MouseOver(obj)
local mousePos = inputservice:GetMouseLocation();
local x1 = obj.Position.X
local y1 = obj.Position.Y
local x2 = x1 + obj.Size.X
local y2 = y1 + obj.Size.Y
return (mousePos.X >= x1 and mousePos.Y >= y1 and mousePos.X <= x2 and mousePos.Y <= y2)
end
function utility:GetHoverObject()
local objects = {}
for i,v in next, library.drawings do
if v.Object.Visible and v.Class == 'Square' and self:MouseOver(v.Object) then
table.insert(objects,v.Object)
end
end
table.sort(objects,function(a,b)
return a.ZIndex > b.ZIndex
end)
return objects[1]
end
function utility:Draw(class, properties)
local blacklistedProperties = {'Object','Children','Class'}
local drawing = {
Object = Drawing.new(class);
Children = {};
ThemeColor = '';
OutlineThemeColor = '';
ThemeColorOffset = 0;
OutlineThemeColorOffset = 0;
Parent = nil;
Size = newUDim2(0,0,0,0);
Position = newUDim2(0,0,0,0);
AbsoluteSize = newVector2(0,0);
AbsolutePosition = newVector2(0,0);
Hover = false;
Visible = true;
MouseButton1Down = library.signal.new();
MouseButton2Down = library.signal.new();
MouseButton1Up = library.signal.new();
MouseButton2Up = library.signal.new();
MouseEnter = library.signal.new();
MouseLeave = library.signal.new();
Class = class;
}
function drawing:Update()
-- if drawing.Parent then
local parent = drawing.Parent ~= nil and library.drawings[drawing.Parent.Object] or nil
local parentSize,parentPos,parentVis = workspace.CurrentCamera.ViewportSize, Vector2.new(0,0), true;
if parent ~= nil then
parentSize = (parent.Class == 'Square' or parent.Class == 'Image') and parent.Object.Size or parent.Class == 'Text' and parent.TextBounds or workspace.CurrentCamera.ViewportSize
parentPos = parent.Object.Position
parentVis = parent.Object.Visible
end
if drawing.Class == 'Square' or drawing.Class == 'Image' then
drawing.Object.Size = typeof(drawing.Size) == 'Vector2' and drawing.Size or typeof(drawing.Size) == 'UDim2' and utility:UDim2ToVector2(drawing.Size,parentSize)
end
if drawing.Class == 'Square' or drawing.Class == 'Image' or drawing.Class == 'Circle' or drawing.Class == 'Text' then
drawing.Object.Position = parentPos + (typeof(drawing.Position) == 'Vector2' and drawing.Position or utility:UDim2ToVector2(drawing.Position,parentSize))
end
drawing.Object.Visible = (parentVis and drawing.Visible) and true or false
-- end
drawing:UpdateChildren()
end
function drawing:UpdateChildren()
for i,v in next, drawing.Children do
v:Update()
end
end
function drawing:GetDescendants()
local descendants = {};
local function a(t)
for _,v in next, t.Children do
table.insert(descendants, v);
a(v)
end
end
a(self)
return descendants;
end
library.drawings[drawing.Object] = drawing
-- this is really stupid lol
local proxy = utility:DetectTableChange(
function(obj,i)
return drawing[i] == nil and drawing.Object[i] or drawing[i]
end,
function(obj,i,v)
if not table.find(blacklistedProperties,i) then
local lastval = drawing[i]
if i == 'Size' and (class == 'Square' or class == 'Image') then
drawing.Object.Size = utility:UDim2ToVector2(v,drawing.Parent == nil and workspace.CurrentCamera.ViewportSize or drawing.Parent.Object.Size);
drawing.AbsoluteSize = drawing.Object.Size;
elseif i == 'Position' and (class == 'Square' or class == 'Image' or class == 'Text') then
drawing.Object.Position = utility:UDim2ToVector2(v,drawing.Parent == nil and newVector2(0,0) or drawing.Parent.Object.Position);
drawing.AbsolutePosition = drawing.Object.Position;
elseif i == 'Parent' then
if drawing.Parent ~= nil then
drawing.Parent.Children[drawing] = nil
end
if v ~= nil then
table.insert(v.Children,drawing)
end
elseif i == 'Visible' then
drawing.Visible = v
elseif i == 'Font' and v == 2 and executor == 'ScriptWare' then
v = 1
end
pcall(function()
drawing.Object[i] = v
end)
if drawing[i] ~= nil or i == 'Parent' then
drawing[i] = v
end
if table.find({'Size','Position','Position','Visible','Parent'},i) then
drawing:Update()
end
if table.find({'ThemeColor','OutlineThemeColor','ThemeColorOffset','OutlineThemeColorOffset'},i) and lastval ~= v then
library.UpdateThemeColors()
end
end
end)
function drawing:Remove()
for i,v in next, self.Children do
v:Remove();
end
if drawing.Parent then
drawing.Parent.Children[drawing.Object] = nil;
end
library.drawings[drawing.Object] = nil;
drawing.Object:Remove();
table.clear(drawing);
end
properties = typeof(properties) == 'table' and properties or {}
if class == 'Square' and properties.Filled == nil then
properties.Filled = true;
end
if properties.Visible == nil then
properties.Visible = true;
end
for i,v in next, properties do
proxy[i] = v
end
drawing:Update()
return proxy
end
end
library.utility = utility
function library:Unload()
library.unloaded:Fire();
for _,c in next, self.connections do
c:Disconnect()
end
for obj in next, self.drawings do
obj:Remove()
end
table.clear(self.drawings)
getgenv().library = nil
end
function library:init()
if self.hasInit then
return
end
local tooltipObjects = {};
makefolder(self.cheatname)
makefolder(self.cheatname..'/assets')
makefolder(self.cheatname..'/'..self.gamename)
makefolder(self.cheatname..'/'..self.gamename..'/configs');
function self:SetTheme(theme)
for i,v in next, theme do
self.theme[i] = v;
end
self.UpdateThemeColors();
end
function self:GetConfig(name)
if isfile(self.cheatname..'/'..self.gamename..'/configs/'..name..self.fileext) then
return readfile(self.cheatname..'/'..self.gamename..'/configs/'..name..self.fileext);
end
end
function self:LoadConfig(name)
local cfg = self:GetConfig(name)
if not cfg then
self:SendNotification('Error loading config: Config does not exist. ('..tostring(name)..')', 5, c3new(1,0,0));
return
end
local s,e = pcall(function()
setByConfig = true
for flag,value in next, http:JSONDecode(cfg) do
local option = library.options[flag]
if option ~= nil then
if option.class == 'toggle' then
option:SetState(value == nil and false or (value == 1 and true or false));
elseif option.class == 'slider' then
option:SetValue(value == nil and 0 or value)
elseif option.class == 'bind' then
option:SetBind(value == nil and 'none' or (utility:HasProperty(Enum.KeyCode, value) and Enum.KeyCode[value] or Enum.UserInputType[value]));
elseif option.class == 'color' then
option:SetColor(value == nil and c3new(1,1,1) or c3new(value[1], value[2], value[3]));
option:SetTrans(value == nil and 1 or value[4]);
elseif option.class == 'list' then
option:Select(value == nil and '' or value);
elseif option.class == 'box' then
option:SetInput(value == nil and '' or value)
end
end
end
setByConfig = false
end)
if s then
self:SendNotification('Successfully loaded config: '..name, 5, c3new(0,1,0));
else
self:SendNotification('Error loading config: '..tostring(e)..'. ('..tostring(name)..')', 5, c3new(1,0,0));
end
end
function self:SaveConfig(name)
if not self:GetConfig(name) then
self:SendNotification('Error saving config: Config does not exist. ('..tostring(name)..')', 5, c3new(1,0,0));
return
end
local s,e = pcall(function()
local cfg = {};
for flag,option in next, self.options do
if option.class == 'toggle' then
cfg[flag] = option.state and 1 or 0;
elseif option.class == 'slider' then
cfg[flag] = option.value;
elseif option.class == 'bind' then
cfg[flag] = option.bind.Name;
elseif option.class == 'color' then
cfg[flag] = {
option.color.r,
option.color.g,
option.color.b,
option.trans,
}
elseif option.class == 'list' then
cfg[flag] = option.selected;
elseif option.class == 'box' then
cfg[flag] = option.input
end
end
writefile(self.cheatname..'/'..self.gamename..'/configs/'..name..self.fileext, http:JSONEncode(cfg));
end)
if s then
self:SendNotification('Successfully saved config: '..name, 5, c3new(0,1,0));
else
self:SendNotification('Error saving config: '..tostring(e)..'. ('..tostring(name)..')', 5, c3new(1,0,0));
end
end
for i,v in next, self.images do
if not isfile(self.cheatname..'/assets/'..i..'.oh') then
writefile(self.cheatname..'/assets/'..i..'.oh', game:HttpGet(v))
end
self.images[i] = readfile(self.cheatname..'/assets/'..i..'.oh');
end
self.cursor1 = utility:Draw('Triangle', {Filled = true, Color = fromrgb(255,255,255), ZIndex = self.zindexOrder.cursor});
self.cursor2 = utility:Draw('Triangle', {Filled = true, Color = fromrgb(85,85,85), self.zindexOrder.cursor-1});
local function updateCursor()
self.cursor1.Visible = self.open
self.cursor2.Visible = self.open
if self.cursor1.Visible then
local pos = inputservice:GetMouseLocation();
self.cursor1.PointA = pos;
self.cursor1.PointB = pos + newVector2(16,5);
self.cursor1.PointC = pos + newVector2(5,16);
self.cursor2.PointA = self.cursor1.PointA + newVector2(0, 0)
self.cursor2.PointB = self.cursor1.PointB + newVector2(1, 1)
self.cursor2.PointC = self.cursor1.PointC + newVector2(1, 1)
end
end
local screenGui = Instance.new('ScreenGui');
if syn then syn.protect_gui(screenGui); end
screenGui.Parent = game:GetService('CoreGui');
screenGui.Enabled = true;
utility:Instance('ImageButton', {
Parent = screenGui,
Visible = true,
Modal = true,
Size = UDim2.new(1,0,1,0),
ZIndex = 9999999999,
Transparency = 1;
})
utility:Connection(library.unloaded, function()
screenGui:Destroy()
end)
utility:Connection(inputservice.InputBegan, function(input, gpe)
if self.hasInit then
if input.KeyCode == self.toggleKey and not library.opening and not gpe then
self:SetOpen(not self.open)
task.spawn(function()
library.opening = true;
task.wait(.15);
library.opening = false;
end)
end
if library.open then
local hoverObj = utility:GetHoverObject();
local hoverObjData = library.drawings[hoverObj];
if input.UserInputType == Enum.UserInputType.MouseButton1 then
mb1down = true;
button1down:Fire()
if hoverObj and hoverObjData then
hoverObjData.MouseButton1Down:Fire(inputservice:GetMouseLocation())
end
-- // Update Sliders Click
if library.draggingSlider ~= nil then
local rel = inputservice:GetMouseLocation() - library.draggingSlider.objects.background.Object.Position;
local val = utility:ConvertNumberRange(rel.X, 0 , library.draggingSlider.objects.background.Object.Size.X, library.draggingSlider.min, library.draggingSlider.max);
library.draggingSlider:SetValue(val)
end
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
if hoverObj and hoverObjData then
hoverObjData.MouseButton2Down:Fire(inputservice:GetMouseLocation())
end
end
end
end
end)
utility:Connection(inputservice.InputEnded, function(input, gpe)
if self.hasInit and library.open then
local hoverObj = utility:GetHoverObject();
local hoverObjData = library.drawings[hoverObj];
if input.UserInputType == Enum.UserInputType.MouseButton1 then
mb1down = false;
button1up:Fire();
if hoverObj and hoverObjData then
hoverObjData.MouseButton1Up:Fire(inputservice:GetMouseLocation())
end
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
if hoverObj and hoverObjData then
hoverObjData.MouseButton2Up:Fire(inputservice:GetMouseLocation())
end
end
end
end)
utility:Connection(inputservice.InputChanged, function(input, gpe)
if input.UserInputType == Enum.UserInputType.MouseMovement then
if library.open then
mousemove:Fire(inputservice:GetMouseLocation());
updateCursor();
if library.CurrentTooltip ~= nil then
local mousePos = inputservice:GetMouseLocation()
tooltipObjects.background.Position = UDim2.new(0,mousePos.X + 15,0,mousePos.Y + 15)
tooltipObjects.background.Size = UDim2.new(0,tooltipObjects.text.TextBounds.X + 6 + (library.CurrentTooltip.risky and 60 or 0),0,tooltipObjects.text.TextBounds.Y + 2)
end
local hoverObj = utility:GetHoverObject();
for _,v in next, library.drawings do
local hover = hoverObj == v.Object;
if hover and not v.Hover then
v.Hover = true;
v.MouseEnter:Fire(inputservice:GetMouseLocation());
elseif not hover and v.Hover then
v.Hover = false;
v.MouseLeave:Fire(inputservice:GetMouseLocation());
end
end
if mb1down then
-- // Update Sliders Drag
if library.draggingSlider ~= nil then
local rel = inputservice:GetMouseLocation() - library.draggingSlider.objects.background.Object.Position;
local val = utility:ConvertNumberRange(rel.X, 0 , library.draggingSlider.objects.background.Object.Size.X, library.draggingSlider.min, library.draggingSlider.max);
library.draggingSlider:SetValue(val)
end
end
end
end
end)
function self:SetOpen(bool)
self.open = bool;
screenGui.Enabled = bool;
if bool and library.flags.disablemenumovement then
actionservice:BindAction(
'FreezeMovement',
function()
return Enum.ContextActionResult.Sink
end,
false,
unpack(Enum.PlayerActions:GetEnumItems())
)
else
actionservice:UnbindAction('FreezeMovement');
end
updateCursor();
for _,window in next, self.windows do
window:SetOpen(bool);
end
library.CurrentTooltip = nil;
tooltipObjects.background.Visible = false
end
function self.UpdateThemeColors()
for _,v in next, library.drawings do
if v.ThemeColor and library.theme[v.ThemeColor] then
v.Object.Color = utility:AddRGB(library.theme[v.ThemeColor],fromrgb(v.ThemeColorOffset,v.ThemeColorOffset,v.ThemeColorOffset))
end
if v.ThemeColorOutline and library.theme[v.ThemeColorOutline] then
v.Object.OutlineColor = utility:AddRGB(library.theme[v.ThemeColorOutline],fromrgb(v.OutlineThemeColorOffset,v.OutlineThemeColorOffset,v.OutlineThemeColorOffset))
end
end
end
function self:SendNotification(message, time, color)
time = time or 5
if typeof(message) ~= 'string' then
return error(string.format('invalid message type, got %s, expected string', typeof(message)))
elseif typeof(time) ~= 'number' then
return error(string.format('invalid time type, got %s, expected number', typeof(time)))
elseif color ~= nil and typeof(color) ~= 'Color3' then
return error(string.format('invalid color type, got %s, expected color3', typeof(time)))
end
local notification = {};
self.notifications[notification] = true
do
local objs = notification;
local z = self.zindexOrder.notification;
notification.holder = utility:Draw('Square', {
Position = newUDim2(0, 0, 0, 75);
Transparency = 0;
})
notification.background = utility:Draw('Square', {
Size = newUDim2(1,0,1,0);
Position = newUDim2(0, -500, 0, 0);
Parent = notification.holder;
ThemeColor = 'Background';
ZIndex = z;
})
notification.border1 = utility:Draw('Square', {
Size = newUDim2(1,2,1,2);
Position = newUDim2(0,-1,0,-1);
ThemeColor = 'Border 2';
Parent = notification.background;
ZIndex = z-1;
})
objs.border2 = utility:Draw('Square', {
Size = newUDim2(1,2,1,2);
Position = newUDim2(0,-1,0,-1);
ThemeColor = 'Border 3';
Parent = objs.border1;
ZIndex = z-2;
})
notification.gradient = utility:Draw('Image', {
Size = newUDim2(1,0,1,0);
Data = self.images.gradientp90;
Parent = notification.background;
Transparency = .5;
ZIndex = z+1;
})
notification.accentBar = utility:Draw('Square',{
Size = newUDim2(0,5,1,4);
Position = newUDim2(0,0,0,-2);
Parent = notification.background;
ThemeColor = color == nil and 'Accent' or '';
ZIndex = z+5;
})
notification.text = utility:Draw('Text', {
Position = newUDim2(0,13,0,2);
ThemeColor = 'Primary Text';
Text = message;
Outline = true;
Font = 2;
Size = 13;
ZIndex = z+4;
Parent = notification.background;
})
if color then
notification.accentBar.Color = color;
end
end
function notification:Remove()
library.notifications[notification] = nil;
self.holder:Remove();
library:UpdateNotifications()
end
task.spawn(function()
self:UpdateNotifications();
notification.background.Size = newUDim2(0, notification.text.TextBounds.X + 20, 0, 19)
task.wait();
utility:Tween(notification.background, 'Position', newUDim2(0,0,0, 0), .1);
task.wait(time);
for i,v in next, notification do
if typeof(v) ~= 'function' then
utility:Tween(v, 'Transparency', 0, .15);
end
end
utility:Connection(utility:Tween(notification.background, 'Position', newUDim2(0,-500,0, 0), .25).Completed, (function()
notification:Remove();
end))
end)
end
function self:UpdateNotifications()
local i = 0
for v in next, self.notifications do
utility:Tween(v.holder, 'Position', newUDim2(0,0,0, 75 + (i * 30)), .15)
i += 1
end
end
function self.NewIndicator(data)
local indicator = {
title = data.title or 'indicator',
enabled = data.enabled or false,
position = data.position or newUDim2(0,15,0,300),
values = {},
objects = {valueObjects = {}},
spacing = ' ',
};
table.insert(self.indicators, indicator)
-- Create Objects --
do
local z = self.zindexOrder.indicator;
local objs = indicator.objects;
objs.background = utility:Draw('Square', {
Size = newUDim2(0, 200, 0, 16);
Position = indicator.position;
ThemeColor = 'Background';
ZIndex = z;
})
objs.border1 = utility:Draw('Square', {
Size = newUDim2(1,2,1,2);
Position = newUDim2(0,-1,0,-1);
ThemeColor = 'Border 2';
Parent = objs.background;
ZIndex = z-1;
})
objs.border2 = utility:Draw('Square', {
Size = newUDim2(1,2,1,2);
Position = newUDim2(0,-1,0,-1);
ThemeColor = 'Border 3';
Parent = objs.border1;
ZIndex = z-2;
})
objs.topborder = utility:Draw('Square', {
Size = newUDim2(1,0,0,1);
ThemeColor = 'Accent';
Parent = objs.background;
ZIndex = z+1;
})
objs.textlabel = utility:Draw('Text', {
Position = newUDim2(.5,0,0,1);
ThemeColor = 'Primary Text';
Text = indicator.title;
Size = 13;
Font = 2;
ZIndex = z+2;
Center = true;
Outline = true;
Parent = objs.background;
});
end
--------------------
function indicator:Update()
local xSize = 125
local yPos = 0
table.sort(self.values, function(a,b)
return a.order < b.order;
end)
for _,v in next, self.values do
v.objects.keyLabel.Text = tostring(v.key);
v.objects.valueLabel.Text = tostring(v.value);
v.objects.valueLabel.Position = newUDim2(1,-(v.objects.valueLabel.TextBounds.X + 3),0,0)
v.objects.background.Position = newUDim2(0,0,1,3 + yPos)
v.objects.background.Visible = v.enabled
if v.enabled then
yPos = yPos + 16 + 3
local x = (v.objects.keyLabel.TextBounds.X + 10 + v.objects.valueLabel.TextBounds.X)
if x > xSize then
xSize = x
end
end
end
self.objects.background.Size = newUDim2(0,xSize + 8,0,16)
self.objects.background.Position = self.position
end
function indicator:AddValue(data)
local value = {
key = data.key or '',
value = data.value or '',
order = data.order or #self.values+1,
enabled = data.enabled == nil and true or data.enabled,
objects = {},
}
table.insert(self.values, value);
-- Create Objects --
do
local z = library.zindexOrder.indicator;
local objs = value.objects;
objs.background = utility:Draw('Square', {
Size = newUDim2(1, 0, 0, 16);
ThemeColor = 'Background';
ZIndex = z;
Parent = indicator.objects.background;
})
objs.border1 = utility:Draw('Square', {
Size = newUDim2(1,2,1,2);
Position = newUDim2(0,-1,0,-1);
ThemeColor = 'Border 2';
Parent = objs.background;
ZIndex = z-1;
})
objs.border2 = utility:Draw('Square', {
Size = newUDim2(1,2,1,2);
Position = newUDim2(0,-1,0,-1);
ThemeColor = 'Border 3';
Parent = objs.border1;
ZIndex = z-2;
})
objs.keyLabel = utility:Draw('Text', {
Position = newUDim2(0,3,0,1);
ThemeColor = 'Option Text 2';
Size = 13;
Font = 2;
ZIndex = z+2;
Outline = true;
Parent = objs.background;
});
objs.valueLabel = utility:Draw('Text', {
Position = newUDim2(0,0,0,1);
ThemeColor = 'Option Text 2';
Size = 13;
Font = 2;
ZIndex = z+2;
Outline = true;
Parent = objs.background;
});
end
--------------------
function value:Remove()
table.remove(indicator.values, table.find(indicator.values, value))
self.objects.background:Remove()
table.clear(self)
indicator:Update();
end
function value:SetEnabled(bool)
if typeof(bool) == 'boolean' then
self.enabled = bool
indicator:Update()
end
end