-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource.lua
More file actions
1228 lines (1227 loc) · 35.9 KB
/
source.lua
File metadata and controls
1228 lines (1227 loc) · 35.9 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
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
--[[] [|] [|] [|||||||||] [|||||||||] [||] [||] [|] [|||||||||] [|] [|] [||] [||]
[|] [|] [|] [|] [|] [||||] [||||] [|] [|] [|] [|] [|] [||||] [||||]
[|] [|] [|] [|] [|] [|] [|||] [|] [|] [|] [|] [|] [|] [|] [|||] [|]
[|] [|] [|] [|] [|] [|] [|] [|] [|||||||||] [|] [|] [|] [|] [|] [|]
[|] [|] [|] [|] [|] [|] [|] [|] [|] [|] [|] [|] [|] [|]
[|] [|] [|] [|] [|] [|] [|] [|] [|] [|] [|] [|] [|] [|]
[||||] [||||||||] [|] [|||||||||] [|] [|] [|] [|] [|] [||||] [|] []]
if not game:IsLoaded() then
game.Loaded:Wait()
end
local function load(name: string)
return loadstring(readfile(`{name}.lua`), name)
end
load("Conversio")()
for name, func in load("Utilitas")({}) do
getfenv()[name] = func
end
local hiddenGui: Folder | CoreGui = if gethui
then waitForSignal(function()
wait()
return gethui()
end)
else service("CoreGui")
local hiddenGuiParent = hiddenGui.Parent
local globalEnvironment = if getgenv then getgenv() else shared
local settings
do
local defaultSettings = {
scale = 1,
stayOpen = false,
autoUpdate = true,
loadOnRejoin = true,
playIntro = "always",
notifications = "all",
keybind = "LeftBracket",
}
local settingsTable = jsonDecode(
isfile and isfile("ultimatumSettings.json") and readfile("ultimatumSettings.json"):gsub("^%bA{", "{"),
defaultSettings
)
for settingName in settingsTable do
if defaultSettings[settingName] == nil then
settingsTable[settingName] = nil
end
end
settings = setmetatable({}, {
__index = function(_, index)
return settingsTable[index]
end,
__newindex = function(_, index, value)
settingsTable[index] = value
if writefile then
local formattedSettings = {}
for settingName, settingValue in settingsTable do
table.insert(
formattedSettings,
`\t{("%q"):format(settingName)}: {if type(settingValue) == "string"
then ("%q"):format(settingValue)
else tostring(settingValue)},`
)
end
table.sort(formattedSettings, function(string0, string1)
if #string0 < #string1 then
return true
elseif #string1 < #string0 then
return false
end
string0, string1 = { string0:byte(1, -2) }, { string1:byte(1, -2) }
for Integer = 1, math.max(#string0, #string1) do
if (string0[Integer] or -1) < (string1[Integer] or -1) then
return true
elseif (string1[Integer] or -1) < (string0[Integer] or -1) then
return false
end
end
return false
end)
formattedSettings[#formattedSettings] = formattedSettings[#formattedSettings]:sub(1, -2)
writefile(
"ultimatumSettings.json",
`All settings for Ultimatum.\nDo not edit this file unless you know what you're doing.\nEvery setting can be changed in-game using the "Settings" command.\n\x7B\n{table.concat(
formattedSettings,
"\n"
)}\n\x7D`
)
end
end,
}) :: {
_: any,
scale: number,
keybind: string,
stayOpen: boolean,
autoUpdate: boolean,
loadOnRejoin: boolean,
playIntro: "always" | "once" | "never",
notifications: "all" | "important" | "none",
}
end
settings._ = nil
local gui = create({
holder = {
Parent = hiddenGui,
ClassName = "ScreenGui",
Properties = {
ResetOnSpawn = false,
IgnoreGuiInset = true,
OnTopOfCoreBlur = true,
DisplayOrder = 0x7FFFFFFF,
ZIndexBehavior = Enum.ZIndexBehavior.Global,
},
},
screenCover = {
Parent = "holder",
ClassName = "Frame",
Properties = {
ZIndex = -1,
BackgroundTransparency = 1,
Size = UDim2.new(1, 0, 1, 0),
BackgroundColor3 = Color3.new(),
},
},
main = {
Parent = "holder",
ClassName = "Frame",
Properties = {
ZIndex = 1,
ClipsDescendants = true,
BackgroundTransparency = 1,
Size = UDim2.new(0.25, 0, 0.25, 0),
AnchorPoint = Vector2.new(0.5, 0.5),
Position = UDim2.new(0.5, 0, 0.4, 0),
BackgroundColor3 = Color3.fromHex("505064"),
},
},
mainCorner = {
Parent = "main",
ClassName = "UICorner",
Properties = { CornerRadius = UDim.new(0.5, 0) },
},
mainGradient = {
Parent = "main",
ClassName = "UIGradient",
Properties = {
Rotation = 90,
Color = ColorSequence.new(Color3.new(1, 1, 1), Color3.new(0.5, 0.5, 0.5)),
},
},
mainAspectRatioConstraint = {
Parent = "main",
ClassName = "UIAspectRatioConstraint",
Properties = { DominantAxis = Enum.DominantAxis.Height },
},
mainListLayout = {
Parent = "main",
ClassName = "UIListLayout",
Properties = { SortOrder = Enum.SortOrder.LayoutOrder },
},
commandBarSection = {
Parent = "main",
ClassName = "Frame",
Properties = {
LayoutOrder = 1,
BackgroundTransparency = 1,
Size = UDim2.new(1, 0, 1, 0),
},
},
commandBarListLayout = {
Parent = "commandBarSection",
ClassName = "UIListLayout",
Properties = {
Padding = UDim.new(0, 4),
SortOrder = Enum.SortOrder.LayoutOrder,
FillDirection = Enum.FillDirection.Horizontal,
VerticalAlignment = Enum.VerticalAlignment.Center,
HorizontalAlignment = Enum.HorizontalAlignment.Center,
},
},
logo = {
Parent = "commandBarSection",
ClassName = "ImageLabel",
Properties = {
Rotation = 90,
ImageTransparency = 1,
BackgroundTransparency = 1,
Size = UDim2.new(0.8, 0, 0.8, 0),
Image = "rbxassetid://0X24024E438",
},
},
commandBarBackground = {
Parent = "commandBarSection",
ClassName = "Frame",
Properties = {
LayoutOrder = 1,
Visible = false,
ClipsDescendants = true,
AnchorPoint = Vector2.xAxis,
Size = UDim2.new(1, -44, 0.8, 0),
BackgroundColor3 = Color3.fromHex("191932"),
},
},
commandBar = {
Parent = "commandBarBackground",
ClassName = "TextBox",
Properties = {
Text = "",
TextSize = 14,
Font = Enum.Font.Arial,
ClearTextOnFocus = false,
BackgroundTransparency = 1,
Size = UDim2.new(1, -20, 1, 0),
Position = UDim2.new(0, 10, 0, 0),
TextColor3 = Color3.new(1, 1, 1),
TextXAlignment = Enum.TextXAlignment.Left,
PlaceholderColor3 = Color3.fromHex("A0A0A0"),
PlaceholderText = `Enter a command (Keybind:\u{200A}{service("UserInput"):GetStringForKeyCode(
Enum.KeyCode[settings.keybind]
)}\u{200A})`,
},
},
commandBarCorner = {
Parent = "commandBarBackground",
ClassName = "UICorner",
Properties = { CornerRadius = UDim.new(0, 4) },
},
suggestionsSection = {
Parent = "main",
ClassName = "Frame",
Properties = {
ClipsDescendants = true,
BackgroundTransparency = 1,
},
},
suggestionsScroll = {
Parent = "suggestionsSection",
ClassName = "ScrollingFrame",
Properties = {
BorderSizePixel = 0,
ScrollBarThickness = 0,
ScrollingEnabled = false,
BackgroundTransparency = 1,
Size = UDim2.new(1, -8, 1, -8),
Position = UDim2.new(0, 4, 0, 4),
},
},
suggestionsGridLayout = {
Parent = "suggestionsScroll",
ClassName = "UIGridLayout",
Properties = {
CellPadding = UDim2.new(),
CellSize = UDim2.new(1, 0, 0, 20),
SortOrder = Enum.SortOrder.LayoutOrder,
},
},
suggestionSelector = {
Parent = "suggestionsSection",
ClassName = "Frame",
Properties = {
BackgroundTransparency = 1,
Size = UDim2.new(1, -2, 0, 20),
},
},
selectorCorner = {
Parent = "suggestionSelector",
ClassName = "UICorner",
Properties = { CornerRadius = UDim.new(0, 2) },
},
selectorBorder = {
Parent = "suggestionSelector",
ClassName = "UIStroke",
Properties = {
Enabled = false,
Color = Color3.new(1, 1, 1),
},
},
notificationHolder = {
Parent = "holder",
ClassName = "Frame",
Properties = {
AnchorPoint = Vector2.one,
BackgroundTransparency = 1,
Size = UDim2.new(1 / 3, 0, 1, -20),
Position = UDim2.new(1, -10, 1, -10),
},
},
notificationListLayout = {
Parent = "notificationHolder",
ClassName = "UIListLayout",
Properties = {
Padding = UDim.new(0, 10),
SortOrder = Enum.SortOrder.LayoutOrder,
VerticalAlignment = Enum.VerticalAlignment.Bottom,
HorizontalAlignment = Enum.HorizontalAlignment.Right,
},
},
}) :: {
main: Frame,
logo: ImageLabel,
holder: ScreenGui,
screenCover: Frame,
commandBar: TextBox,
mainCorner: UICorner,
commandBarSection: Frame,
mainGradient: UIGradient,
selectorBorder: UIStroke,
selectorCorner: UICorner,
notificationHolder: Frame,
suggestionSelector: Frame,
suggestionsSection: Frame,
commandBarCorner: UICorner,
commandBarBackground: Frame,
mainListLayout: UIListLayout,
suggestionsScroll: ScrollingFrame,
commandBarListLayout: UIListLayout,
suggestionsGridLayout: UIGridLayout,
notificationListLayout: UIListLayout,
mainAspectRatioConstraint: UIAspectRatioConstraint,
}
local notificationIds = {}
local function notify(options: {
text: string,
title: string,
yields: boolean,
duration: number,
important: boolean,
calculateDuration: boolean,
})
options = valid.table(options, {
duration = 5,
yields = false,
important = false,
text = "(no text)",
title = "Ultimatum",
calculateDuration = true,
})
options.text = `<b>{options.title}</b>\n{options.text}`
if settings.notifications == "none" or settings.notifications == "important" and not options.important then
return
end
local id
repeat
id = randomString({
Length = 5,
Format = "%s",
})
until not table.find(notificationIds, id)
table.insert(notificationIds, id)
local notification: {
main: Frame,
mainCorner: UICorner,
mainGradient: UIGradient,
content: TextLabel,
} =
create({
main = {
Parent = gui.notificationHolder,
ClassName = "Frame",
Properties = {
ClipsDescendants = true,
AnchorPoint = Vector2.one,
BackgroundTransparency = 1,
BackgroundColor3 = Color3.fromHex("505064"),
},
},
mainCorner = {
Parent = "main",
ClassName = "UICorner",
Properties = { CornerRadius = UDim.new(0, 4) },
},
mainGradient = {
Parent = "main",
ClassName = "UIGradient",
Properties = {
Rotation = 90,
Color = ColorSequence.new(Color3.new(1, 1, 1), Color3.new(0.5, 0.5, 0.5)),
},
},
content = {
Parent = "main",
ClassName = "TextLabel",
Properties = {
TextSize = 14,
RichText = true,
TextWrapped = true,
Text = options.text,
TextTransparency = 1,
Font = Enum.Font.Arial,
BackgroundTransparency = 1,
Size = UDim2.new(1, -20, 1, -20),
Position = UDim2.new(0, 10, 0, 10),
TextColor3 = Color3.new(1, 1, 1),
TextXAlignment = Enum.TextXAlignment.Left,
},
},
})
if options.calculateDuration then
for _ in utf8.graphemes(notification.content.ContentText) do
options.duration += 0.06
end
end
options.duration += 0.25
local Size = service("Text"):GetTextSize(
notification.content.ContentText,
14,
Enum.Font.Arial,
Vector2.new(gui.notificationHolder.AbsoluteSize.X, gui.notificationHolder.AbsoluteSize.Y)
)
notification.main.Size = UDim2.new(0, Size.X + 22, 0, Size.Y + 20)
Size = notification.main.Size
notification.main.Size = UDim2.new(Size.X.Scale, Size.X.Offset, 0, 0)
animate(
notification.main,
{
secondsTime = 0.25,
properties = {
Size = Size,
BackgroundTransparency = 0,
},
},
notification.content,
{
secondsTime = 0.25,
properties = { TextTransparency = 0 },
easingStyle = Enum.EasingStyle.Linear,
}
)
task.delay(
options.duration,
animate,
notification.main,
{
secondsTime = 1,
properties = { BackgroundTransparency = 1 },
},
notification.content,
{
secondsTime = 1,
yields = true,
properties = { TextTransparency = 1 },
easingStyle = Enum.EasingStyle.Linear,
},
notification.main,
{
secondsTime = 0.25,
properties = { Size = UDim2.new(Size.X.Scale, Size.X.Offset, 0, 0) },
}
)
options.duration += 1.25
task.spawn(function()
local Start = os.clock()
repeat
notification.main.LayoutOrder = table.find(notificationIds, id)
wait()
until options.duration < os.clock() - Start
table.remove(notificationIds, table.find(notificationIds, id))
end)
if options.yields then
wait(options.duration)
destroy(notification)
else
task.delay(options.duration, destroy, notification)
end
end
local function checkAxis(axis)
return workspace.CurrentCamera.ViewportSize[axis] / 2
< gui.logo.AbsolutePosition[axis] + gui.logo.AbsoluteSize[axis] / 2
end
local debounce, lastLeft = true, 0
local function resizeMain(x, y)
x = if settings.stayOpen then 400 else valid.number(x, 400)
y = valid.number(y, 40)
gui.commandBarBackground.LayoutOrder = if checkAxis("X") then -1 else 1
gui.commandBarSection.LayoutOrder = if checkAxis("Y") then 1 else -1
animate(
gui.main,
{
secondsTime = 0.25,
properties = {
Size = UDim2.new(0, x, 0, y),
Position = gui.main.Position + UDim2.new(
0,
if checkAxis("X") then gui.main.AbsoluteSize.X - x else 0,
0,
if checkAxis("Y") then gui.main.AbsoluteSize.Y - y else 0
),
},
},
gui.commandBarBackground,
{
secondsTime = 0.25,
properties = { Visible = 40 < x },
}
)
end
local commands = {}
local connections
local function runCommand(text)
for _, input in text:split("/") do
local arguments = input:split(" ")
local command = arguments[1]
table.remove(arguments, 1)
local ranCommand
for commandNames, commandInfo in commands do
if commandInfo.Toggles then
commandNames = `{commandNames}_{commandInfo.Toggles}`
end
commandNames = commandNames:split("_")
local resume
for _, commandName in commandNames do
if commandName:lower() == command:lower() then
commandInfo.Arguments = valid.table(commandInfo.Arguments)
for argumentIndex, argumentProperties in commandInfo.Arguments do
if argumentProperties.Required and not arguments[argumentIndex] then
notify({
title = "Missing Argument",
text = `The command "{commandNames[1]}" requires you to enter the argument "{argumentProperties.Name}"`,
})
break
end
if argumentProperties.Concatenate then
arguments[argumentIndex] = table.concat(arguments, " ", argumentIndex)
for index = argumentIndex + 1, #arguments do
arguments[index] = nil
end
end
arguments[argumentIndex] = valid[argumentProperties.Type:lower()](
arguments[argumentIndex],
argumentProperties.Substitute
)
end
if commandInfo.Toggles then
local enabled = true
for _, Toggle in commandInfo.Toggles:lower():split("_") do
if Toggle == command:lower() then
enabled = false
break
end
end
if commandInfo.ToggleCheck then
if (commandInfo.Enabled or false) == enabled then
enabled = if enabled then "En" else "Dis"
notify({
title = `Already {enabled}abled`,
text = `The command is already {enabled:lower()}abled`,
})
return
end
end
commandInfo.Enabled = enabled
table.insert(arguments, 1, enabled)
end
if commandInfo.Variables then
table.insert(arguments, 1, commandInfo.Variables)
end
commandInfo.Function(unpack(arguments))
resume, ranCommand = true, true
break
end
end
if resume then
break
end
end
if not ranCommand then
notify({
title = "Not a Command",
text = `There are not any commands named "{command}"`,
})
end
end
end
local function addConnections(givenConnections)
for name, connection in valid.table(givenConnections) do
if typeof(connection) == "RBXScriptConnection" and connection.Connected then
connections[if type(name) ~= "number" then name else #connections + 1] = connection
table.insert(connections, connection)
end
end
end
local function removeConnections(givenConnections)
for _, connection in valid.table(givenConnections) do
if typeof(connection) == "RBXScriptConnection" then
destroy(connection)
pcall(table.remove, connections, table.find(connections, connection))
end
end
end
local function enableDrag(frame, isMain)
local dragConnection
local inputBegan, inputEnded, removed =
connect(frame.InputBegan, function(input, ignore)
if not ignore and not debounce and input.UserInputType.Name == "MouseButton1" then
if isMain then
resizeMain(40)
end
debounce = true
dragConnection = connect(service("Run").RenderStepped, function()
service("UserInput").OverrideMouseIconBehavior = Enum.OverrideMouseIconBehavior.ForceHide
local mousePosition = service("UserInput"):GetMouseLocation()
local screenSize, frameSize, anchorPoint = gui.holder.AbsoluteSize, frame.AbsoluteSize, frame.AnchorPoint
mousePosition = UDim2.new(math.round(math.clamp(mousePosition.X - frameSize.X / 2 + frameSize.X * anchorPoint.X, frameSize.X * anchorPoint.X, screenSize.X - frameSize.X * (1 - anchorPoint.X))) / screenSize.X, 0, math.round(math.clamp(mousePosition.Y - frameSize.Y / 2 + frameSize.Y * anchorPoint.Y, frameSize.Y * anchorPoint.Y, screenSize.Y - frameSize.Y * (1 - anchorPoint.Y))) / screenSize.Y, 0)
animate(frame, {
secondsTime = 0,
properties = { Position = mousePosition },
})
end)
addConnections({ dragConnection })
end
end), connect(service("UserInput").InputEnded, function(Input)
if dragConnection and Input.UserInputType.Name == "MouseButton1" then
service("UserInput").OverrideMouseIconBehavior = Enum.OverrideMouseIconBehavior.None
removeConnections({ dragConnection })
dragConnection = nil
debounce = false
if isMain then
resizeMain()
end
end
end)
removed = connect(frame.AncestryChanged, function()
if not frame:IsDescendantOf(hiddenGui) then
removeConnections({
removed,
inputBegan,
inputEnded,
dragConnection,
})
end
end)
addConnections({
removed,
inputBegan,
inputEnded,
})
end
local function createWindow(title: string, dataList)
local window = create({
{
Name = "Main",
Parent = gui.holder,
ClassName = "Frame",
Properties = {
Active = true,
ClipsDescendants = true,
Size = UDim2.new(0, 500, 0, 250),
AnchorPoint = Vector2.new(0.5, 0.5),
Position = UDim2.new(0.5, 0, 1, 125),
BackgroundColor3 = Color3.fromHex("505064"),
},
},
{
Name = "MainCorner",
Parent = "Main",
ClassName = "UICorner",
Properties = { CornerRadius = UDim.new(0, 4) },
},
{
Name = "MainGradient",
Parent = "Main",
ClassName = "UIGradient",
Properties = {
Rotation = 90,
Color = ColorSequence.new(Color3.new(1, 1, 1), Color3.new(0.5, 0.5, 0.5)),
},
},
{
Name = "Title",
Parent = "Main",
ClassName = "TextLabel",
Properties = {
TextSize = 14,
Font = Enum.Font.Arial,
BackgroundTransparency = 1,
Size = UDim2.new(1, -45, 0, 20),
Position = UDim2.new(0, 5, 0, 0),
TextColor3 = Color3.new(1, 1, 1),
Text = valid.string(title, "Ultimatum"),
TextXAlignment = Enum.TextXAlignment.Left,
},
},
{
Name = "TitleGradient",
Parent = "Title",
ClassName = "UIGradient",
Properties = {
Transparency = NumberSequence.new({
NumberSequenceKeypoint.new(0, 0),
NumberSequenceKeypoint.new(0.95, 0),
NumberSequenceKeypoint.new(1, 1),
}),
},
},
{
Name = "Close",
Parent = "Main",
ClassName = "ImageButton",
Properties = {
Modal = true,
AutoButtonColor = false,
BackgroundTransparency = 1,
Size = UDim2.new(0, 14, 0, 14),
Position = UDim2.new(1, -17, 0, 3),
Image = "rbxasset://textures/DevConsole/Close.png",
},
},
{
Name = "Minimize",
Parent = "Main",
ClassName = "ImageButton",
Properties = {
Modal = true,
AutoButtonColor = false,
BackgroundTransparency = 1,
Size = UDim2.new(0, 14, 0, 14),
Position = UDim2.new(1, -37, 0, 3),
Image = "rbxasset://textures/DevConsole/Minimize.png",
},
},
{
Name = "Display",
Parent = "Main",
ClassName = "ScrollingFrame",
Properties = {
BorderSizePixel = 0,
ScrollBarThickness = 0,
BackgroundTransparency = 1,
Size = UDim2.new(1, -8, 1, -24),
Position = UDim2.new(0, 4, 0, 20),
},
},
{
Name = "DisplayListLayout",
Parent = "Display",
ClassName = "UIListLayout",
Properties = { SortOrder = Enum.SortOrder.LayoutOrder },
},
})
local windowConnections = {}
for index, data in dataList do
local main = newInstance("TextLabel", nil, {
LayoutOrder = index,
Font = Enum.Font.Arial,
Text = ` {data.Text}`,
BackgroundTransparency = 1,
TextStrokeTransparency = 0.8,
Size = UDim2.new(1, 0, 0, 20),
TextXAlignment = Enum.TextXAlignment.Left,
});
({
slider = function() end,
})[data.Type]()
end
animate(window.Main, {
yields = true,
properties = { Position = UDim2.new(0.5, 0, 0.5, 0) },
})
enableDrag(window.Main)
table.insert(windowConnections, connect(window.Minimize.MouseButton1Click, function() end))
table.insert(
windowConnections,
connect(window.Close.MouseButton1Click, function()
removeConnections(windowConnections)
animate(window.Main, {
yields = true,
easingDirection = Enum.EasingDirection.In,
properties = { Position = UDim2.new(window.Main.Position.X.Scale, 0, 1, 125) },
})
destroy(window)
end)
)
return window
end
local function fireTouchInterest(toucher: BasePart, touched: BasePart, touchTime: number?)
touchTime = valid.number(touchTime, 0)
if firetouchinterest then
for on = 0, 1 do
firetouchinterest(toucher, touched, on)
if on == 0 then
wait(touchTime)
end
end
else
local oldCanCollide, oldCanTouch, oldCFrame = touched.CanCollide, touched.CanTouch, touched.CFrame
touched.CanCollide, touched.CanTouch, touched.CFrame = true, true, toucher.CFrame
wait(touchTime)
touched.CFrame, touched.CanTouch, touched.CanCollide = oldCFrame, oldCanTouch, oldCanCollide
end
end
local ignoreUpdate, selected
local suggestions = {}
local function scrollSuggestions(input: "Up" | "Down")
if 0 < #suggestions then
selected = (selected + (if input == "Up" then -1 elseif input == "Down" then 1 else 0) - 1) % #suggestions + 1
local oldCanvasPosition = gui.suggestionsScroll.CanvasPosition
gui.suggestionsScroll.CanvasPosition = Vector2.new(0, 20 * (selected - 3))
animate(gui.suggestionSelector, {
secondsTime = 0.25,
properties = {
Position = UDim2.new(
0,
1,
0,
4 + suggestions[selected].UI.AbsolutePosition.Y - gui.suggestionsScroll.AbsolutePosition.Y
),
},
})
local canvasPosition = gui.suggestionsScroll.CanvasPosition
gui.suggestionsScroll.CanvasPosition = oldCanvasPosition
animate(gui.suggestionsScroll, {
secondsTime = 0.25,
properties = { CanvasPosition = canvasPosition },
})
end
end
local function updateSuggestions()
if service("UserInput"):GetFocusedTextBox() == gui.commandBar and not ignoreUpdate then
ignoreUpdate = true
gui.commandBar.Text = gui.commandBar.Text:gsub("^%W+", ""):gsub("\t", "")
ignoreUpdate = false
gui.commandBar.TextXAlignment = Enum.TextXAlignment[if gui.commandBar.TextFits then "Left" else "Right"]
local command = gui.commandBar.Text:split("/")
command = ((command[#command] or ""):split(" ")[1] or ""):lower()
gui.suggestionsScroll.CanvasSize = UDim2.new()
gui.suggestionsGridLayout.Parent = nil
destroy(suggestions)
for commandNames, commandInfo in commands do
commandNames = (if commandInfo.Toggles then `{commandNames}_{commandInfo.Toggles}` else commandNames):split(
"_"
)
for _, commandName in commandNames do
if commandName:lower():find(command, 1, true) then
local displayName = if commandInfo.Toggles and commandInfo.Enabled
then commandInfo.Toggles:split("_")[1]
else commandNames[1]
table.insert(suggestions, {
Command = displayName,
CommandNames = commandNames,
Display = ("<font color = '#FFFFFF'>%s</font>%s%s"):format(
displayName,
if commandInfo.Arguments
then (function()
local arguments = {}
for _, argumentInfo in commandInfo.Arguments do
table.insert(
arguments,
`{argumentInfo.Name}: {argumentInfo.Type}{if argumentInfo.Required then "" else "?"}`
)
end
return ` <i>{table.concat(arguments, " ")}</i>`
end)()
else "",
if commandInfo.Toggles then " [Toggles]" else ""
),
})
break
end
end
end
if #command < 2 then
table.sort(suggestions, function(suggestion0, suggestion1)
suggestion0 = service("Text"):GetTextSize(suggestion0.Command, 14, Enum.Font.Arial, Vector2.one * 1e6).X
suggestion1 = service("Text"):GetTextSize(suggestion1.Command, 14, Enum.Font.Arial, Vector2.one * 1e6).X
return if checkAxis("Y") then suggestion0 < suggestion1 else suggestion1 < suggestion0
end)
else
local function matchRate(suggestion)
local highestMatch = 0
for _, name in suggestion.CommandNames do
local matchPercent = 1 - #name:lower():gsub(command, "") / #name
if highestMatch < matchPercent then
highestMatch = matchPercent
end
end
return highestMatch
end
table.sort(suggestions, function(suggestion0, suggestion1)
return if checkAxis("Y")
then matchRate(suggestion1) < matchRate(suggestion0)
else matchRate(suggestion0) < matchRate(suggestion1)
end)
end
for index, suggestion in suggestions do
suggestion.UI = newInstance("TextLabel", gui.suggestionsScroll, {
TextSize = 14,
RichText = true,
BorderSizePixel = 0,
LayoutOrder = index,
Font = Enum.Font.Arial,
Text = suggestion.Display,
BackgroundTransparency = 1,
TextStrokeTransparency = 0.8,
BackgroundColor3 = Color3.new(1, 1, 1),
TextColor3 = Color3.fromHex("A0A0A0"),
TextXAlignment = Enum.TextXAlignment.Left,
})
end
if 0 < #suggestions then
selected = if checkAxis("Y") then 1 else #suggestions
gui.selectorBorder.Enabled = true
else
selected = nil
gui.selectorBorder.Enabled = false
end
gui.suggestionsGridLayout.Parent = gui.suggestionsScroll
local commandNumber = #gui.suggestionsScroll:GetChildren() - 1
gui.suggestionsScroll.CanvasSize = UDim2.new(0, 0, 0, 20 * commandNumber)
gui.suggestionsScroll.CanvasPosition = Vector2.yAxis * (if checkAxis("Y") then 0 else 20 * commandNumber)
gui.suggestionSelector.Position = if checkAxis("Y") then UDim2.new(0, 1, 0, 4) else UDim2.new(0, 1, 1, -24)
resizeMain(nil, if 0 < commandNumber then 48 + 20 * math.min(commandNumber, 5) else 40)
end
end
local sendValue = newInstance("BindableEvent")
local removing
connections = {
connect(owner.CharacterAdded, function(NewCharacter: Model)
sendValue:Fire("Character", NewCharacter)
end),
connect(owner.ChildAdded, function(Object: Backpack | PlayerGui)
if valid.instance(Object, "Backpack") then
sendValue:Fire("Backpack", Object)
elseif valid.instance(Object, "PlayerGui") then
sendValue:Fire("PlayerGui", Object)
end
end),
isfile and connect(service("Run").Heartbeat, function()
local newCharacter = getCharacter(owner, 0)
if newCharacter and newCharacter ~= character then
character = newCharacter
sendValue:Fire("Character", newCharacter)
end
if not valid.instance(gui.holder, "ScreenGui") or not gui.holder:IsDescendantOf(hiddenGui) and not removing then
removing = true
local unfinished = 0
for _, info in commands do
if info.ToggleCheck and info.Enabled then
task.spawn(function()
unfinished += 1
runCommand(info.Toggles:split("_")[1])
unfinished -= 1
end)
end
end
waitForSignal(function()
wait()
return unfinished < 1
end, 5)
destroy(connections, gui, sendValue)
end
end),
queue_on_teleport and connect(owner.OnTeleport, function()
if settings.loadOnRejoin then
local success, result = pcall(
game.HttpGet,
game,
"https://raw.githubusercontent.com/Amourousity/Ultimatum/main/loader.lua",
true
)
queue_on_teleport(if success then result else `warn("HttpGet failed: {result} (Ultimatum cannot run)")`)
end
end),
connect(gui.main.MouseEnter, function()
if not debounce then
service("UserInput").OverrideMouseIconBehavior = Enum.OverrideMouseIconBehavior.ForceShow
lastLeft = os.clock()
resizeMain()
end
end),
connect(gui.main.MouseLeave, function()
if not debounce then
lastLeft = os.clock()
wait(1)
if 1 < os.clock() - lastLeft and not debounce then
service("UserInput").OverrideMouseIconBehavior = Enum.OverrideMouseIconBehavior.None
resizeMain(40)
end
end
end),
connect(gui.commandBar.Focused, function()
if not debounce then
debounce = true
gui.commandBar.PlaceholderText = "Enter a command..."
service("UserInput").OverrideMouseIconBehavior = Enum.OverrideMouseIconBehavior.ForceShow
resizeMain()
task.delay(0.25, updateSuggestions)
end
end),
connect(gui.commandBar.FocusLost, function(sent)
wait()
gui.commandBar.PlaceholderText = "Enter a command"
if sent and 0 < #gui.commandBar.Text then
task.spawn(runCommand, gui.commandBar.Text)
end
gui.commandBar.Text = ""
gui.commandBar.TextXAlignment = Enum.TextXAlignment[if gui.commandBar.TextFits then "Left" else "Right"]
service("UserInput").OverrideMouseIconBehavior = Enum.OverrideMouseIconBehavior.None
resizeMain()
task.delay(0.25, function()
pcall(function()
hiddenGui.Parent = nil
hiddenGui.Parent = hiddenGuiParent