This repository has been archived by the owner on Dec 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
beta.lua
9505 lines (7814 loc) · 412 KB
/
beta.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
--[[
REDLINE
:**:
:+*%%*+:
:+=.+--+.=+:
:+=. :# #: .=+:
:+=. *- -* .=+:
:+= :# #: =+:
-@*:::. *: :* .:::*@-
:*#=:-=+%--::--%+=-:=#*:
:+=. #-:--:-# .=+:
:+=.-+ +-.=+:
:++%: :%++:
:*#..#*:
:++:
]]--
-- WARNING: this is pretty much entirely shitcode
-- im currently working on a rewrite with 10x more features
-- join discord for updates https://discord.gg/TyKZFQtDvw
if ( _G.RLLOADED and _G.RLNOTIF ) then
_G.RLNOTIF('Oops', 'Redline is already loaded. Destroy the current instance by pressing [END]', 5, 'warn', true)
return
end
if ( not isfolder('REDLINE') ) then
makefolder('REDLINE')
end
local REDLINEVER = 'v0.7.2'
if not game:IsLoaded() then game.Loaded:Wait() end
--- Services
local servContext = game:GetService('ContextActionService')
local servGui = game:GetService('GuiService')
local servHttp = game:GetService('HttpService')
local servNetwork = game:GetService('NetworkClient')
local servPlayers = game:GetService('Players')
local servRun = game:GetService('RunService')
local servTeleport = game:GetService('TeleportService')
local servTween = game:GetService('TweenService')
local servInput = game:GetService('UserInputService')
-- Colors
local colRgb, colNew = Color3.fromRGB, Color3.new
-- UDim2
local dimOffset, dimScale, dimNew = UDim2.fromOffset, UDim2.fromScale, UDim2.new
-- Instances
local instNew = Instance.new
local drawNew = Drawing.new
-- Vectors
local vec3, vec2 = Vector3.new, Vector2.new
-- Other stuff
local isrbxactive = isrbxactive or iswindowactive
local isexecclosure = is_synapse_function or isexecutorclosure or isourclosure
if ( isrbxactive == nil ) then
local active = true
servInput.WindowFocused:Connect(function()
active = true
end)
servInput.WindowFocusReleased:Connect(function()
active = false
end)
getgenv().isrbxactive = function()
return active
end
isrbxactive = isrbxactive
end
local blankfn = function() end -- used for flags
-- { Load in theme } --
local function DecodeThemeJson(json)
json = json:gsub('//[^\n]+','')
local stuff = servHttp:JSONDecode(json)
local theme = stuff['theme']
local RLTHEME
local RLTHEMEFONT
do
RLTHEME = {}
RLTHEMEFONT = theme['Font']
-- this is an extremely shitty idea (but atleast it works for now 👍👍)
local switch = {}
switch['Generic_Outline'] = 'go'
switch['Generic_Shadow'] = 'gs'
switch['Generic_Window'] = 'gw'
switch['Generic_Enabled'] = 'ge'
switch['Background_Menu'] = 'bm'
switch['Background_Module'] = 'bo'
switch['Background_Setting'] = 'bs'
switch['Background_Dropdown'] = 'bd'
switch['Hovering_Menu'] = 'hm'
switch['Hovering_Module'] = 'ho'
switch['Hovering_Setting'] = 'hs'
switch['Hovering_Dropdown'] = 'hd'
switch['Slider_Foreground'] = 'sf'
switch['Slider_Background'] = 'sb'
switch['Text_Main'] = 'tm'
switch['Text_Outline'] = 'to'
for Index, ThemeSetting in pairs(theme) do
if ( typeof(ThemeSetting) ~= 'table' ) then
continue
end
if ( not switch[Index] ) then
continue
end
local Color1 = ThemeSetting['Color']
local Color2 = ThemeSetting['Color2']
local IsGradient = ThemeSetting['Gradient']
local Trans = ThemeSetting['Transparency']
RLTHEME[switch[Index]] = {
colRgb(Color1[1], Color1[2], Color1[3]);
Trans;
IsGradient;
Color2 and colRgb(Color2[1], Color2[2], Color2[3]);
}
end
end
return RLTHEME, RLTHEMEFONT
end
if (isfile('REDLINE/theme.json')) then
_G.RLLOADERROR = 0
local ThemeData, Font
pcall(function()
local FileData = readfile('REDLINE/theme.json')
ThemeData, Font = DecodeThemeJson(FileData)
end)
if ( ThemeData and Font ) then
_G.RLTHEMEDATA = ThemeData
_G.RLTHEMEFONT = Font
else
_G.RLLOADERROR = 2 -- couldnt load theme properly
end
end
--- theme
local RLTHEMEDATA, RLTHEMEFONT do
RLTHEMEFONT = _G.RLTHEMEFONT or 'SourceSans'
RLTHEMEDATA = _G.RLTHEMEDATA or {}
local keys = {
['go'] = { colRgb(075, 075, 080), 0.0, false}; -- generic outline (3rd argument should be true for gradients)
['gs'] = { colRgb(005, 005, 010), 0.0}; -- generic shadow
['gw'] = { colRgb(023, 022, 027), 0.2}; -- generic window
['ge'] = { colRgb(225, 035, 061), 0.7}; -- generic enabled
['bm'] = { colRgb(035, 035, 040), 0.0}; -- header background
['bo'] = { colRgb(030, 030, 035), 0.0}; -- object background
['bs'] = { colRgb(025, 025, 030), 0.0}; -- setting background
['bd'] = { colRgb(020, 020, 025), 0.0}; -- dropdown background
['hm'] = { colRgb(038, 038, 043), 0.0}; -- header hovering
['ho'] = { colRgb(033, 033, 038), 0.0}; -- object hovering
['hs'] = { colRgb(028, 028, 033), 0.0}; -- setting hovering
['hd'] = { colRgb(023, 023, 028), 0.0}; -- dropdown hovering
['sf'] = { colRgb(225, 075, 080), 0.0}; -- slider foreground
['sb'] = { colRgb(033, 033, 038), 0.0}; -- slider background
['tm'] = { colRgb(255, 255, 255), 0.0}; -- main text
['to'] = { colRgb(020, 020, 025), 0.0}; -- outline
}
for i, v in pairs(keys) do
RLTHEMEDATA[i] = RLTHEMEDATA[i] or v
end
end
--- random utility shit
local gradient,twn,ctwn,randstr,stroke,round,uierror
do
do
local gradColor
if ( RLTHEMEDATA['go'][3] ) then
gradColor = ColorSequence.new{
ColorSequenceKeypoint.new(0, RLTHEMEDATA['go'][1]);
ColorSequenceKeypoint.new(1, RLTHEMEDATA['go'][4]);
}
end
function gradient(parent)
local newGradient = instNew('UIGradient')
newGradient.Rotation = 45
newGradient.Color = gradColor
newGradient.Parent = parent
return newGradient
end
end
function stroke(parent, mode, trans)
local str = instNew('UIStroke')
str.ApplyStrokeMode = mode or 'Contextual'
str.Thickness = 1
str.Transparency = trans or RLTHEMEDATA['go'][2]
if ( RLTHEMEDATA['go'][3] ) then -- if gradients are being used, add a gradient
gradient(str)
str.Color = colNew(1, 1, 1)
else
str.Color = RLTHEMEDATA['go'][1] -- leave the color as the default outline
end
str.Parent = parent
return str
end
local info1, info2 = TweenInfo.new(0.1, 10, 1), TweenInfo.new(0.3, 10, 1)
function twn(twn_target, twn_settings, twn_long)
local tween = servTween:Create(
twn_target,
twn_long and info2 or info1,
twn_settings
)
tween:Play()
return tween
end
function ctwn(twn_target, twn_settings, twn_dur, twn_style, twn_dir)
local tween = servTween:Create(
twn_target,
TweenInfo.new(twn_dur,twn_style or 10,twn_dir or 1),
twn_settings
)
tween:Play()
return tween
end
function randstr()
local a = ''
for i = 1, 5 do a = a .. utf8.char(math.random(50,2000)) end
return a
end
function round(num, place)
return math.floor(((num+(place*.5)) / place)) * place
end
function uierror(func, prop, type)
error(('%s failed; %s is not of type %s'):format(func,prop,type), 3)
end
end
local W_WindowOpen = false
local RGBCOLOR
--- ui
local ui = {} do
local ui_Hotkeys = {}
local ui_Connections = {}
local ui_Menus = {}
local ui_Widgets = {}
local ui_Modules = {}
local rgbinsts = {}
local monitor_resolution = servGui:GetScreenResolution()
local monitor_inset = servGui:GetGuiInset()
-- connections
ui_Connections['i'] = servInput.InputBegan:Connect(function(io, gpe)
if ( gpe == false and io.UserInputType.Value == 8 ) then
local kcv = io.KeyCode.Value
for i = 1, #ui_Hotkeys do
local hk = ui_Hotkeys[i]
if (hk[1] == kcv) then
hk[2]()
end
end
end
end)
do
local rgbtime = 0
ui_Connections['r'] = servRun.Heartbeat:Connect(function(deltaTime)
if ( not isrbxactive() ) then
return
end
rgbtime += deltaTime / 10
if ( rgbtime > 1 ) then
rgbtime -= 1
end
RGBCOLOR = Color3.fromHSV(rgbtime, 0.8, 1)
for i = 1, #rgbinsts do
local v = rgbinsts[i]
v[1][ v[2] ] = RGBCOLOR
end
end)
end
-- Gui creation
local w_Screen
local w_TooltipHeader
local w_Tooltip
local w_Backframe
local w_CreditFrame
local w_FriendsFrame
local w_ModFrame
local w_Help
local w_Modal
local w_ProfileFrame
local w_SettingsFrame
local w_ModList
local w_ModListLayout
local w_ModListTitle
local w_MouseCursor
local ModlistPadding = { -- i still have no clue why i thought this was a good idea
dimOffset(-100, 0).X;
dimOffset(8, 0).X;
Enum.TextXAlignment.Left;
'PaddingLeft';
}
do
w_Screen = instNew('ScreenGui')
w_Screen.DisplayOrder = 939393
w_Screen.IgnoreGuiInset = true
w_Screen.Name = randstr()
w_Screen.ZIndexBehavior = Enum.ZIndexBehavior.Global
if ( typeof(syn) == 'table' and typeof(syn.protect_gui) == 'function' and gethui == nil ) then
syn.protect_gui(w_Screen)
end
w_Screen.Parent = (gethui and gethui()) or (get_hidden_gui and get_hidden_gui()) or game.CoreGui
w_Backframe = instNew('Frame')
w_Backframe.BackgroundColor3 = RLTHEMEDATA['gw'][1]
w_Backframe.BackgroundTransparency = RLTHEMEDATA['gw'][2]
w_Backframe.BorderSizePixel = 0
w_Backframe.ClipsDescendants = true
w_Backframe.Position = dimNew(0, 0, 0, 0)
w_Backframe.Size = dimScale(1,1)
w_Backframe.Visible = false
w_Backframe.Parent = w_Screen
w_ModFrame = instNew('Frame')
w_ModFrame.BackgroundTransparency = 1
w_ModFrame.BorderSizePixel = 0
w_ModFrame.ClipsDescendants = false
w_ModFrame.Size = dimScale(1,1)
w_ModFrame.Visible = true
w_ModFrame.Parent = w_Backframe
w_FriendsFrame = instNew('Frame')
w_FriendsFrame.BackgroundTransparency = 1
w_FriendsFrame.BorderSizePixel = 0
w_FriendsFrame.ClipsDescendants = false
w_FriendsFrame.Size = dimScale(1,1)
w_FriendsFrame.Visible = false
w_FriendsFrame.Parent = w_Backframe
w_ProfileFrame = instNew('Frame')
w_ProfileFrame.BackgroundTransparency = 1
w_ProfileFrame.BorderSizePixel = 0
w_ProfileFrame.ClipsDescendants = false
w_ProfileFrame.Size = dimScale(1,1)
w_ProfileFrame.Visible = false
w_ProfileFrame.Parent = w_Backframe
w_SettingsFrame = instNew('Frame')
w_SettingsFrame.BackgroundTransparency = 1
w_SettingsFrame.BorderSizePixel = 0
w_SettingsFrame.ClipsDescendants = false
w_SettingsFrame.Size = dimScale(1,1)
w_SettingsFrame.Visible = false
w_SettingsFrame.Parent = w_Backframe
w_CreditFrame = instNew('Frame')
w_CreditFrame.BackgroundTransparency = 1
w_CreditFrame.BorderSizePixel = 0
w_CreditFrame.ClipsDescendants = false
w_CreditFrame.Size = dimScale(1,1)
w_CreditFrame.Visible = false
w_CreditFrame.Parent = w_Backframe
do
end
w_Modal = instNew('TextButton')
w_Modal.Active = false
w_Modal.BackgroundTransparency = 1
w_Modal.Modal = true
w_Modal.Size = dimOffset(1,1)
w_Modal.Text = ''
w_Modal.Parent = w_ModFrame
w_Help = instNew('TextLabel')
w_Help.AnchorPoint = vec2(1,1)
w_Help.BackgroundTransparency = 1
w_Help.Font = RLTHEMEFONT
w_Help.Position = dimScale(1,1)
w_Help.RichText = true
w_Help.Size = dimOffset(300,300)
w_Help.Text = ''
w_Help.TextColor3 = RLTHEMEDATA['tm'][1]
w_Help.TextSize = 20
w_Help.TextStrokeColor3 = RLTHEMEDATA['to'][1]
w_Help.TextStrokeTransparency = 0
w_Help.TextXAlignment = 'Left'
w_Help.TextYAlignment = 'Top'
w_Help.Visible = false
w_Help.ZIndex = 1
w_Help.Parent = w_ModFrame
w_ModList = instNew('Frame')
w_ModList.AnchorPoint = vec2(0, 1)
w_ModList.BackgroundColor3 = RLTHEMEDATA['gw'][1]
w_ModList.BackgroundTransparency = 1
w_ModList.BorderColor3 = RLTHEMEDATA['gs'][1]
w_ModList.BorderMode = 'Inset'
w_ModList.BorderSizePixel = 1
w_ModList.Position = dimScale(0,1)
w_ModList.Size = dimNew(0,200,0.3,0)
w_ModList.Visible = false
w_ModList.Parent = w_Screen
w_ModListLayout = instNew('UIListLayout')
w_ModListLayout.FillDirection = 'Vertical'
w_ModListLayout.HorizontalAlignment = 'Left'
w_ModListLayout.VerticalAlignment = 'Bottom'
w_ModListLayout.Parent = w_ModList
w_ModListTitle = instNew('TextLabel')
w_ModListTitle.BackgroundTransparency = 1
w_ModListTitle.Font = RLTHEMEFONT
w_ModListTitle.LayoutOrder = 939
w_ModListTitle.Size = dimNew(1, 0, 0, 30)
w_ModListTitle.Text = ' '..'Redline '..REDLINEVER..' '
w_ModListTitle.TextColor3 = RLTHEMEDATA['tm'][1]
w_ModListTitle.TextSize = 24
w_ModListTitle.TextStrokeColor3 = RLTHEMEDATA['to'][1]
w_ModListTitle.TextStrokeTransparency = RLTHEMEDATA['to'][2]
w_ModListTitle.TextTransparency = RLTHEMEDATA['tm'][1]
w_ModListTitle.TextXAlignment = 'Left'
w_ModListTitle.ZIndex = 5
w_ModListTitle.Parent = w_ModList
w_TooltipHeader = instNew('TextLabel')
w_TooltipHeader.BackgroundColor3 = RLTHEMEDATA['bm'][1]
w_TooltipHeader.BackgroundTransparency = RLTHEMEDATA['bm'][2]
w_TooltipHeader.BorderSizePixel = 0
w_TooltipHeader.Font = RLTHEMEFONT
w_TooltipHeader.RichText = true
w_TooltipHeader.Size = dimOffset(175,20)
w_TooltipHeader.Text = 'Hi'
w_TooltipHeader.TextColor3 = RLTHEMEDATA['tm'][1]
w_TooltipHeader.TextSize = 19
w_TooltipHeader.TextStrokeColor3 = RLTHEMEDATA['to'][1]
w_TooltipHeader.TextStrokeTransparency = 0
w_TooltipHeader.TextXAlignment = 'Center'
w_TooltipHeader.Visible = false
w_TooltipHeader.ZIndex = 1500
w_TooltipHeader.Parent = w_Screen
stroke(w_TooltipHeader, 'Border')
w_Tooltip = instNew('TextLabel')
w_Tooltip.BackgroundColor3 = RLTHEMEDATA['gw'][1]
w_Tooltip.BackgroundTransparency = RLTHEMEDATA['gw'][2]
w_Tooltip.BorderSizePixel = 0
w_Tooltip.Font = RLTHEMEFONT
w_Tooltip.Position = dimOffset(0, 21)
w_Tooltip.RichText = true
w_Tooltip.Size = dimOffset(175,25)
w_Tooltip.Text = ''
w_Tooltip.TextColor3 = RLTHEMEDATA['tm'][1]
w_Tooltip.TextSize = 17
w_Tooltip.TextStrokeColor3 = RLTHEMEDATA['to'][1]
w_Tooltip.TextStrokeTransparency = 0
w_Tooltip.TextWrapped = true
w_Tooltip.TextXAlignment = 'Left'
w_Tooltip.TextYAlignment = 'Top'
w_Tooltip.Visible = true
w_Tooltip.ZIndex = 1500
w_Tooltip.Parent = w_TooltipHeader
stroke(w_Tooltip, 'Border')
local tooltipPadding = instNew('UIPadding')
tooltipPadding.PaddingLeft = dimOffset(5, 0).X
tooltipPadding.Parent = w_Tooltip
w_Tooltip:GetPropertyChangedSignal('Text'):Connect(function()
w_Tooltip.Size = dimOffset(175, 25)
local n = dimOffset(0, 5)
for i = 1, 25 do
w_Tooltip.Size += n
if ( w_Tooltip.TextFits ) then
break
end
end
w_Tooltip.Size += n
end)
w_MouseCursor = instNew('ImageLabel')
w_MouseCursor.BackgroundTransparency = 1
w_MouseCursor.Image = 'rbxassetid://8845749987'
w_MouseCursor.ImageColor3 = RLTHEMEDATA['ge'][1]
w_MouseCursor.ImageTransparency = 1
w_MouseCursor.Position = dimOffset(150, 150)
w_MouseCursor.Size = dimOffset(24, 24)
w_MouseCursor.Visible = true
w_MouseCursor.ZIndex = 1500
w_MouseCursor.Parent = w_Screen
end
function ui:manageml(x1,x2,align,paddir)
ModlistPadding[1] = x1 and dimOffset(x1, 0).X or ModlistPadding[1]
ModlistPadding[2] = x2 and dimOffset(x2, 0).X or ModlistPadding[2]
ModlistPadding[4] = paddir or ModlistPadding[4]
if (align and align ~= ModlistPadding[3]) then
-- :troll
local c = w_ModList:GetChildren()
local _ = ModlistPadding[2]
local paddingDir = ModlistPadding[4]
local direction = paddingDir == 'PaddingLeft' and 'PaddingRight' or paddingDir
local value = dimOffset(0,0).X
for i = 1, #c do
local v = c[i]
if (v.ClassName == 'TextLabel' and v ~= w_ModListTitle) then
v.TextXAlignment = align
local p = v.P
--p[__] = _
p[direction] = value
end
end
w_ModListTitle.TextXAlignment = align
ModlistPadding[3] = align
end
return {
w_ModList;
w_ModListLayout;
w_ModListTitle;
}
end
ui_Connections['t'] = servRun.Heartbeat:Connect(function()
local pos = servInput:GetMouseLocation()
local x,y = pos.X, pos.Y
w_TooltipHeader.Position = dimOffset(x+15, y+15)
w_MouseCursor.Position = dimOffset(x-4, y)
end)
local ModListEnable, ModListDisable, ModListInit, ModListModify do
local mods_instance = {}
function ModListEnable(name)
local b = mods_instance[name]
b.TextXAlignment = ModlistPadding[3]
b.Parent = w_ModList
twn(b.P, {[ModlistPadding[4]] = ModlistPadding[2]},true)
twn(b, {Size = dimNew(1, 0, 0, 24), TextTransparency = 0, TextStrokeTransparency = 0},true)
end
function ModListDisable(name)
local b = mods_instance[name]
twn(b.P, {[ModlistPadding[4]] = ModlistPadding[1]},true)
twn(b, {Size = dimNew(0, 0, 0, 0), TextTransparency = 1, TextStrokeTransparency = 1},true)
end
function ModListModify(name, new)
mods_instance[name].Text = new
end
function ModListInit(name)
local label = instNew('TextLabel')
label.Size = dimNew(0, 0, 0, 0)
label.BackgroundTransparency = 1
label.Font = RLTHEMEFONT
label.TextXAlignment = ModlistPadding[3]
label.TextColor3 = RLTHEMEDATA['tm'][1]
label.TextSize = 22
label.Text = name
label.RichText = true
label.TextTransparency = 1
label.TextStrokeTransparency = 1
label.TextStrokeColor3 = RLTHEMEDATA['to'][1]
label.ZIndex = 5
mods_instance[name] = label
table.insert(rgbinsts, {label, 'TextColor3'})
local padding = instNew('UIPadding')
padding.Name = 'P'
padding[ModlistPadding[4]] = ModlistPadding[1]
padding.Parent = label
end
end
-- Base class for stuff
local base_class = {} do
local s1,s2 = dimNew(1,0,1,0), dimNew(0,0,1,0)
-- objtype_action_actiontype
-- Menu funcs
do
base_class.menu_toggle = function(self)
local t = not self.MToggled
self.MToggled = t
self.Menu.Visible = t
twn(self.Icon, {Rotation = t and 0 or 180}, true)
end
base_class.menu_enable = function(self)
self.MToggled = true
self.Menu.Visible = true
twn(self.Icon, {Rotation = 0}, true)
end
base_class.menu_disable = function(self)
self.MToggled = false
self.Menu.Visible = false
twn(self.Icon, {Rotation = 180}, true)
end
base_class.menu_getstate = function(self)
return self.MToggled
end
end
-- Module funcs
do
base_class.module_toggle_menu = function(self)
local t = not self.MToggled
self.MToggled = t
self.Menu.Visible = t
twn(self.Icon, {Rotation = t and 360 or 0}, true)
self.Icon.Text = t and '-' or '+'
end
base_class.module_toggle_self = function(self)
local t = not self.OToggled
self.OToggled = t
task.spawn(self.Flags.Toggled, t)
task.spawn(self.Flags[t and 'Enabled' or 'Disabled'])
twn(self.Effect, {Size = t and s1 or s2}, true)
if (t) then
ModListEnable(self.Name)
else
ModListDisable(self.Name)
end
return self
end
base_class.module_toggle_enable = function(self)
self.OToggled = true
task.spawn(self.Flags.Toggled, true)
task.spawn(self.Flags.Enabled)
twn(self.Effect, {Size = s1}, true)
ModListEnable(self.Name)
return self
end
base_class.module_toggle_disable = function(self)
self.OToggled = false
task.spawn(self.Flags.Toggled, false)
task.spawn(self.Flags.Disabled)
twn(self.Effect, {Size = s2}, true)
ModListDisable(self.Name)
return self
end
base_class.module_toggle_reset = function(self)
if (self.OToggled) then
local f = self.Flags
task.spawn(f.Toggled, false)
task.spawn(f.Disabled)
task.spawn(f.Toggled, true)
task.spawn(f.Enabled)
end
end
base_class.module_getstate_self = function(self) return self.OToggled end
base_class.module_getstate_menu = function(self) return self.MToggled end
base_class.module_setvis = function(self, t, t2)
self.Root.Visible = t
self.Highlight.Visible = t2
end
base_class.module_click_self = function(self)
task.spawn(self.Flags.Clicked)
self.Effect.BackgroundTransparency = 0.8
twn(self.Effect, {BackgroundTransparency = 1}, true)
end
base_class.module_gettext = function(self)
return self.Text
end
end
-- Setting funcs
do
base_class.s_toggle_self = function(self)
local t = not self.Toggled
task.spawn(self.Flags.Toggled, t)
task.spawn(self.Flags.Enabled)
task.spawn(self.Flags.Disabled)
self.Toggled = t
twn(self.Icon, {BackgroundTransparency = t and 0 or 1})
return self
end
base_class.s_toggle_enable = function(self)
self.Toggled = true
task.spawn(self.Flags.Toggled, true)
task.spawn(self.Flags.Enabled)
twn(self.Icon, {BackgroundTransparency = 0})
return self
end
base_class.s_toggle_disable = function(self)
self.Toggled = false
task.spawn(self.Flags.Toggled, false)
task.spawn(self.Flags.Disabled)
twn(self.Icon, {BackgroundTransparency = 1})
return self
end
base_class.s_toggle_reset = function(self)
if (self.Toggled) then
local f = self.Flags
task.spawn(f.Toggled, false)
task.spawn(f.Disabled)
task.spawn(f.Toggled, true)
task.spawn(f.Enabled)
end
end
base_class.s_toggle_getstate = function(self)
return self.Toggled
end
base_class.s_modhotkey_sethotkey = function(self)
local label = self.Label
label.Text = 'Press any key...'
task.wait(0.01)
local cn
cn = servInput.InputBegan:Connect(function(input, gpe)
local code = input.KeyCode
local codeName = code.Name
if ( codeName ~= 'Unknown' ) then
self.Hotkey = code.Value
label.Text = 'Hotkey: ' .. codeName
-- As scuffed as this is, it works
-- To prevent the module being bound from immediately toggling, a short delay is made
task.delay(0.01, function()
local name = self.Parent.Name
for i = 1, #ui_Hotkeys do
if (ui_Hotkeys[i][3] == name) then
table.remove(ui_Hotkeys, i)
break
end
end
table.insert(ui_Hotkeys, {code.Value, function()
self.Parent:Toggle()
end, name})
end)
else
self.Hotkey = nil
label.Text = 'Hotkey: N/A'
local name = self.Parent.Name
for i = 1, #ui_Hotkeys do
if ui_Hotkeys[i][3] == name then
table.remove(ui_Hotkeys, i)
break
end
end
end
cn:Disconnect()
end)
end
base_class.s_modhotkey_gethotkey = function(self)
return self.Hotkey
end
base_class.s_hotkey_sethotkey = function(self)
local label = self.Label
label.Text = 'Press any key...'
task.wait(0.01);
local c;
c = servInput.InputBegan:Connect(function(io,gpe)
local kc = io.KeyCode
local kcv = kc.Value
if (kcv ~= 0) then
self.Hotkey = kc
label.Text = self.Name..': '..kc.Name
task.spawn(self.Flags.HotkeySet, kc, kcv)
else
self.Hotkey = nil
label.Text = self.Name..': N/A'
task.spawn(self.Flags.HotkeySet, nil, 0)
end
c:Disconnect()
end)
end
base_class.s_hotkey_sethotkeyexplicit = function(self, kc)
self.Hotkey = kc
self.Label.Text = self.Name..': '..kc.Name
task.spawn(self.Flags.HotkeySet, kc, kc.Value)
return self
end
base_class.s_hotkey_gethotkey = function(self)
return self.Hotkey
end
base_class.s_dropdown_getselection = function(self)
return self.Selection
end
base_class.s_dropdown_toggle = function(self)
local t = not self.MToggled
self.MToggled = t
self.Menu.Visible = t
task.spawn(self.Flags[ t and 'Opened' or 'Closed'])
twn(self.Icon, {Rotation = t and 0 or 180}, true)
end
base_class.s_ddoption_select_self = function(self)
local parent = self.Parent
local objs = parent.Objects
for i = 1, #objs do objs[i]:Deselect() end
self.Selected = true
parent.Selection = self.Name
task.spawn(parent.Flags['Changed'], self.Name, self)
if (parent.Primary) then
local n = parent.Parent.Name
ModListModify(n, n .. ' <font color="#DFDFDF">['..self.Name..']</font>')
end
twn(self.Effect, {Size = s1}, true)
return self
end
base_class.s_ddoption_deselect_self = function(self)
if (self.Selected) then
self.Selected = false
twn(self.Effect, {Size = s2}, true)
end
return self
end
base_class.s_ddoption_selected_getstate = function(self)
return self.Selected
end
base_class.s_slider_getval = function(self) return self.CurrentVal end
base_class.s_slider_setvalnum = function(self, nval)
local min = self.Min
local cval = self.CurrentVal
local pval = self.PreviousVal
cval = round(math.clamp(nval, min, self.Max), self.Step)
if (pval ~= cval) then
pval = cval
local form = self.StepFormat
self.SliderFill.Position = dimOffset(math.floor((cval - min) * self.Ratio), 0)
self.SliderAmnt.Text = form:format(cval)
if (self.Primary) then
local n = self.Parent.Name
ModListModify(n, n .. (' <font color="#DFDFDF">('..form..')</font>'):format(cval))
end
task.spawn(self.Flags.Changed, cval)
end
self.CurrentVal = cval
end
base_class.s_slider_setvalpos = function(self, xval)
local min = self.Min
local cval = self.CurrentVal
local pval = self.PreviousVal
local pos_normalized = math.clamp(xval - self.SliderBg.AbsolutePosition.X, 0, self.SliderSize)
cval = round((pos_normalized * self.RatioInverse)+min, self.Step)
if (pval ~= cval) then
pval = cval
local form = self.StepFormat
self.SliderFill.Position = dimOffset(math.floor((cval - min)*self.Ratio), 0)
self.SliderAmnt.Text = form:format(cval)
self.CurrentVal = cval
if (self.Primary) then
local n = self.Parent.Name
ModListModify(n, n .. (' <font color="#DFDFDF">('..form..')</font>'):format(cval))
end
task.spawn(self.Flags.Changed, cval)
end
end
end
-- Button funcs
base_class.button_click = function(self)
task.spawn(self.Flags.Clicked)
end
-- Slider funcs
base_class.slider_setval = function(self, value)
value = tonumber(value)
if not value then uierror('slider_setval','value','number') end
local m1,m2,m3 = self.min, self.max, self.step
value = math.clamp(round(value, m3),m1,m2)
self.setval_internal(value)
end
base_class.slider_getval = function(self)
return self.value1
end
-- Input funcs
base_class.input_gettxt = function(self)
return self.Text
end
-- Generic funcs
base_class.generic_tooltip = function(self, tooltip)