-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathplanetaryboard.rbxmx
More file actions
4890 lines (4803 loc) · 190 KB
/
Copy pathplanetaryboard.rbxmx
File metadata and controls
4890 lines (4803 loc) · 190 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
<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">
<Meta name="ExplicitAutoJoints">true</Meta>
<External>null</External>
<External>nil</External>
<Item class="Model" referent="RBXF74322DFFFD445F09099B18CE5FEED8B">
<Properties>
<token name="LevelOfDetail">0</token>
<CoordinateFrame name="ModelMeshCFrame">
<X>9.42601585</X>
<Y>-6.82475519</Y>
<Z>0.0053408742</Z>
<R00>1</R00>
<R01>0</R01>
<R02>0</R02>
<R10>0</R10>
<R11>1.0000875</R11>
<R12>-5.84198517e-07</R12>
<R20>0</R20>
<R21>5.82214341e-07</R21>
<R22>1.0000875</R22>
</CoordinateFrame>
<SharedString name="ModelMeshData">yuZpQdnvvUBOTYh1jqZ2cA==</SharedString>
<Vector3 name="ModelMeshSize">
<X>0</X>
<Y>0</Y>
<Z>0</Z>
</Vector3>
<token name="ModelStreamingMode">0</token>
<bool name="NeedsPivotMigration">false</bool>
<Ref name="PrimaryPart">null</Ref>
<float name="ScaleFactor">0.943856001</float>
<SharedString name="SlimHash">yuZpQdnvvUBOTYh1jqZ2cA==</SharedString>
<OptionalCoordinateFrame name="WorldPivotData">
<CFrame>
<X>8.79601479</X>
<Y>5.3690362</Y>
<Z>14.6814594</Z>
<R00>1</R00>
<R01>0</R01>
<R02>0</R02>
<R10>0</R10>
<R11>1</R11>
<R12>0</R12>
<R20>0</R20>
<R21>0</R21>
<R22>1</R22>
</CFrame>
</OptionalCoordinateFrame>
<BinaryString name="AttributesSerialize"></BinaryString>
<SecurityCapabilities name="Capabilities">0</SecurityCapabilities>
<bool name="DefinesCapabilities">false</bool>
<string name="Name">Planetary | Sessions Board</string>
<int64 name="SourceAssetId">-1</int64>
<BinaryString name="Tags"></BinaryString>
</Properties>
<Item class="UnionOperation" referent="RBX90C0879A7A244E0785349794E6FFAFBB">
<Properties>
<Content name="AssetId"><null></null></Content>
<BinaryString name="ChildData"></BinaryString>
<SharedString name="ChildData2">sVTolcfWK0T8BTItDsce5A==</SharedString>
<int name="ComponentIndex">-1</int>
<token name="FormFactor">3</token>
<Vector3 name="InitialSize">
<X>9.43999958</X>
<Y>5.28000021</Y>
<Z>0.229999542</Z>
</Vector3>
<BinaryString name="MeshData"></BinaryString>
<SharedString name="MeshData2">7uXJ8KDipp5okVBBirXvLA==</SharedString>
<bool name="OffCentered">false</bool>
<BinaryString name="PhysicsData"></BinaryString>
<token name="RenderFidelity">0</token>
<float name="SmoothingAngle">0</float>
<NetAssetRef name="SolidMeshHolder">yuZpQdnvvUBOTYh1jqZ2cA==</NetAssetRef>
<bool name="UsePartColor">true</bool>
<SharedString name="AeroMeshData">yuZpQdnvvUBOTYh1jqZ2cA==</SharedString>
<token name="FluidFidelityInternal">0</token>
<bool name="InertiaMigrated">false</bool>
<SharedString name="PhysicalConfigData">D/XnHVATkeMvRNmb/tlvhw==</SharedString>
<Vector3 name="UnscaledCofm">
<X>-5.90058662e-16</X>
<Y>9.63099069e-07</Y>
<Z>0.0607905462</Z>
</Vector3>
<Vector3 name="UnscaledVolInertiaDiags">
<X>8.67282009</X>
<Y>25.8781013</Y>
<Z>34.5296249</Z>
</Vector3>
<Vector3 name="UnscaledVolInertiaOffDiags">
<X>-2.23862571e-15</X>
<Y>1.49765338e-16</Y>
<Z>1.66153328e-07</Z>
</Vector3>
<float name="UnscaledVolume">2.83793235</float>
<bool name="Anchored">true</bool>
<bool name="AudioCanCollide">true</bool>
<float name="BackParamA">-0.5</float>
<float name="BackParamB">0.5</float>
<token name="BackSurface">0</token>
<token name="BackSurfaceInput">0</token>
<float name="BottomParamA">-0.5</float>
<float name="BottomParamB">0.5</float>
<token name="BottomSurface">0</token>
<token name="BottomSurfaceInput">0</token>
<CoordinateFrame name="CFrame">
<X>8.79601479</X>
<Y>5.36910772</Y>
<Z>14.6814566</Z>
<R00>1</R00>
<R01>0</R01>
<R02>0</R02>
<R10>0</R10>
<R11>1.00000131</R11>
<R12>9.69268399e-09</R12>
<R20>0</R20>
<R21>-4.6740718e-09</R21>
<R22>1.00000131</R22>
</CoordinateFrame>
<bool name="CanCollide">true</bool>
<bool name="CanQuery">true</bool>
<bool name="CanTouch">true</bool>
<bool name="CastShadow">true</bool>
<string name="CollisionGroup">Default</string>
<int name="CollisionGroupId">0</int>
<Color3uint8 name="Color3uint8">4279308561</Color3uint8>
<PhysicalProperties name="CustomPhysicalProperties">
<CustomPhysics>false</CustomPhysics>
</PhysicalProperties>
<bool name="EnableFluidForces">true</bool>
<float name="FrontParamA">-0.5</float>
<float name="FrontParamB">0.5</float>
<token name="FrontSurface">0</token>
<token name="FrontSurfaceInput">0</token>
<float name="LeftParamA">-0.5</float>
<float name="LeftParamB">0.5</float>
<token name="LeftSurface">0</token>
<token name="LeftSurfaceInput">0</token>
<bool name="Locked">false</bool>
<bool name="Massless">false</bool>
<token name="Material">1088</token>
<string name="MaterialVariantSerialized"></string>
<CoordinateFrame name="PivotOffset">
<X>0</X>
<Y>0</Y>
<Z>0</Z>
<R00>1</R00>
<R01>0</R01>
<R02>0</R02>
<R10>0</R10>
<R11>1</R11>
<R12>0</R12>
<R20>0</R20>
<R21>0</R21>
<R22>1</R22>
</CoordinateFrame>
<float name="Reflectance">0</float>
<float name="RightParamA">-0.5</float>
<float name="RightParamB">0.5</float>
<token name="RightSurface">0</token>
<token name="RightSurfaceInput">0</token>
<int name="RootPriority">0</int>
<Vector3 name="RotVelocity">
<X>0</X>
<Y>0</Y>
<Z>0</Z>
</Vector3>
<float name="TopParamA">-0.5</float>
<float name="TopParamB">0.5</float>
<token name="TopSurface">0</token>
<token name="TopSurfaceInput">0</token>
<float name="Transparency">0</float>
<Vector3 name="Velocity">
<X>0</X>
<Y>0</Y>
<Z>0</Z>
</Vector3>
<Vector3 name="size">
<X>8.90999985</X>
<Y>4.98356009</Y>
<Z>0.217086449</Z>
</Vector3>
<BinaryString name="AttributesSerialize"></BinaryString>
<SecurityCapabilities name="Capabilities">0</SecurityCapabilities>
<bool name="DefinesCapabilities">false</bool>
<string name="Name">Union</string>
<int64 name="SourceAssetId">-1</int64>
<BinaryString name="Tags"></BinaryString>
</Properties>
</Item>
<Item class="ModuleScript" referent="RBX2DADE7F8E26642B3B73F770543D26B5B">
<Properties>
<Content name="LinkedSource"><null></null></Content>
<ProtectedString name="Source"><![CDATA[local Config = {
baseurl = "INSTANCE_URL_PLACEHOLDER", -- the URL of your instance, eg.: https://egg.planetaryapp.cloud/ or https://YOURDOMAIN.com/ (your Top Level Domain may change, additionally if the instance is under a subdomain, please include it.)
api_key = "<apikey>", -- automatically generated key
workspace_id = "<wid>", -- your workspace id
event_type = "<type>", -- the default event, if it's not set on the table below, set "all" if you want it to show all upcoming events, available "shift", "event", "training"...
duration = 60, -- the amount of minutes a session will last, if not set on the table below
refresh = 30, -- the amount of time, in seconds, it'll refresh to show new sessions.
only_show_claimed = <oclaimed>, -- only show the claimed sessions, if false will show all unclaimed sessions, if true, you guessed it.
join_button = {
show = true,
appear_before_start = 15, -- the amount of minutes before the start of the session, the join button will appear, once the session has started, the button will be locked.
color = "orbit" -- orbit, red, blue, purple, or any hex color: eg.: "#ff0099"
},
customization = {
mode = "<mode>", -- light or dark mode?
colored_profiles = true, -- show the colored profiles, if you have the custom theme enabled, if not, it will use the default theme.
color_profile_color = "orbit", -- "orbit", "red", "purple" etc... or any hex color: eg.: "#ff0099"
clock_format = "<cformat>", -- 12h or 24h
}
}
return Config
]]></ProtectedString>
<string name="ScriptGuid">{9B12BCB7-D0E3-4688-B0A3-7813F53F5EB9}</string>
<BinaryString name="AttributesSerialize"></BinaryString>
<SecurityCapabilities name="Capabilities">0</SecurityCapabilities>
<bool name="DefinesCapabilities">false</bool>
<string name="Name">Configuration</string>
<int64 name="SourceAssetId">-1</int64>
<BinaryString name="Tags"></BinaryString>
</Properties>
<Item class="Script" referent="RBX12FAF1DA74C4409E8041C5F8DA6F579A">
<Properties>
<ProtectedString name="Source"><![CDATA[local Config = require(script.Parent)
local httpservice = game:GetService("HttpService")
local Player = game:GetService("Players")
local Screen = script.Parent.Parent.Screen.SurfaceGui
local SessionsScreen = Screen.Sessions
local NoPlanned = Screen.NoPlanned
local ErrorScreen = Screen.ErrorScreen
local SessionFrame = SessionsScreen.ScrollingFrame.SessionFrame.Frame
local type = ""
local rn = DateTime.now()
local tomorrow = DateTime.fromUnixTimestamp(rn.UnixTimestamp + (86400))
local isLight = string.lower(Config.customization.mode) == "light"
local function c(light, dark) return isLight and light or dark end
local COLOR_RESOLVABLE = {
["orbit"] = Color3.fromHex("ff0099"),
["purple"] = c(Color3.new(0.407843, 0, 0.815686), Color3.new(0.65098, 0, 1)),
["lavender"] = c(Color3.new(0.470588, 0.32549, 0.615686), Color3.new(0.611765, 0.423529, 0.8)),
["red"] = c(Color3.new(0.898039, 0.117647, 0.129412), Color3.new(0.729412, 0.0941176, 0.105882)),
["blue"] = c(Color3.new(0.356863, 0.72549, 0.898039), Color3.new(0.286275, 0.588235, 0.72549)),
["green"] = c(Color3.new(0, 0.898039, 0.329412), Color3.new(0, 0.772549, 0.282353)),
["pink"] = c(Color3.new(0.882353, 0.376471, 0.898039), Color3.new(0.698039, 0.298039, 0.713725)),
["rose"] = c(Color3.fromHex("f43f5e"), Color3.fromHex("fb7185")),
["coral"] = c(Color3.fromHex("f97316"), Color3.fromHex("fb923c")),
["amber"] = c(Color3.fromHex("f59e0b"), Color3.fromHex("fbbf24")),
["gold"] = c(Color3.fromHex("eab308"), Color3.fromHex("facc15")),
["lime"] = c(Color3.fromHex("84cc16"), Color3.fromHex("a3e635")),
["mint"] = c(Color3.fromHex("10b981"), Color3.fromHex("34d399")),
["teal"] = c(Color3.fromHex("14b8a6"), Color3.fromHex("2dd4bf")),
["cyan"] = c(Color3.fromHex("06b6d4"), Color3.fromHex("22d3ee")),
["sky"] = c(Color3.fromHex("0ea5e9"), Color3.fromHex("38bdf8")),
["indigo"] = c(Color3.fromHex("6366f1"), Color3.fromHex("818cf8")),
["violet"] = c(Color3.fromHex("8b5cf6"), Color3.fromHex("a78bfa")),
["fuchsia"] = c(Color3.fromHex("d946ef"), Color3.fromHex("e879f9")),
["crimson"] = c(Color3.fromHex("dc143c"), Color3.fromHex("e8365d")),
["peach"] = c(Color3.fromHex("ff6b6b"), Color3.fromHex("ff8e8e")),
["mauve"] = c(Color3.fromHex("9d4edd"), Color3.fromHex("b57bee")),
["sage"] = c(Color3.fromHex("87a878"), Color3.fromHex("a8c99a")),
["dusk"] = c(Color3.fromHex("7c83a0"), Color3.fromHex("a0a8c0")),
["champagne"] = c(Color3.fromHex("c9a96e"), Color3.fromHex("e0c48a")),
["slate"] = c(Color3.fromHex("64748b"), Color3.fromHex("94a3b8")),
}
local HTTP_ERRORS = {
[100] = "Continue", [101] = "Switching Protocols", [102] = "Processing", [103] = "Early Hints",
[200] = "OK", [201] = "Created", [202] = "Accepted", [203] = "Non-Authoritative Information",
[204] = "No Content", [205] = "Reset Content", [206] = "Partial Content", [207] = "Multi-Status",
[208] = "Already Reported", [226] = "IM Used",
[300] = "Multiple Choices", [301] = "Moved Permanently", [302] = "Found", [303] = "See Other",
[304] = "Not Modified", [305] = "Use Proxy", [307] = "Temporary Redirect", [308] = "Permanent Redirect",
[400] = "Bad Request", [401] = "Unauthorized", [402] = "Payment Required", [403] = "Forbidden",
[404] = "Not Found", [405] = "Method Not Allowed", [406] = "Not Acceptable",
[407] = "Proxy Authentication Required", [408] = "Request Timeout", [409] = "Conflict",
[410] = "Gone", [411] = "Length Required", [412] = "Precondition Failed", [413] = "Content Too Large",
[414] = "URI Too Long", [415] = "Unsupported Media Type", [416] = "Range Not Satisfiable",
[417] = "Expectation Failed", [418] = "I'm a teapot", [421] = "Misdirected Request",
[422] = "Unprocessable Content", [423] = "Locked", [424] = "Failed Dependency", [425] = "Too Early",
[426] = "Upgrade Required", [428] = "Precondition Required", [429] = "Too Many Requests",
[431] = "Request Header Fields Too Large", [451] = "Unavailable For Legal Reasons",
[500] = "Internal Server Error", [501] = "Not Implemented", [502] = "Bad Gateway",
[503] = "Service Unavailable", [504] = "Gateway Timeout", [505] = "HTTP Version Not Supported",
[506] = "Variant Also Negotiates", [507] = "Insufficient Storage", [508] = "Loop Detected",
[510] = "Not Extended", [511] = "Network Authentication Required",
}
local oldWarn = warn
local oldPrint = print
warn = function(...)
local args = {...}
oldWarn(`[Planetary Sessions - {os.date("%H:%M:%S")}]`, unpack(args))
end
print = function(...)
local args = {...}
oldPrint(`[Planetary Sessions - {os.date("%H:%M:%S")}]`, unpack(args))
end
if not httpservice.HttpEnabled then
error("[Planetary | Sessions Board] HTTP requests disabled. Enable in Game Settings > Security > Allow HTTP requests.")
end
if #Config.api_key == 0 then
warn("API key hasn't been set.")
return
end
if #Config.baseurl == 0 then
warn("Base URL hasn't been set.")
return
end
if #Config.workspace_id == 0 then
warn("Workspace ID hasn't been set.")
return
end
if #Config.event_type == 0 then
warn("Event type hasn't been set.")
return
end
if not Config.refresh then
warn("Renew sessions hasn't been set.")
return
end
if not Config.duration then
warn("Session duration hasn't been set.")
return
end
if #Config.customization.clock_format == 0 then
warn("Clock format hasn't been set.")
return
end
if string.lower(Config.event_type) == "event" then
type = "events"
elseif string.lower(Config.event_type) == "shift" then
type = "shifts"
elseif string.lower(Config.event_type) == "training" then
type = "trainings"
else
type = "sessions"
end
local colors = {}
for _, color in pairs(COLOR_RESOLVABLE) do
table.insert(colors, color)
end
local function resolveHex(input)
if typeof(input) ~= "string" or #input == 0 then return nil end
local stripped = input:gsub("#", ""):gsub("%s+", "")
if #stripped ~= 6 then return nil end
local success, color = pcall(Color3.fromHex, stripped)
return success and color or nil
end
local function resolveColor(input)
if typeof(input) ~= "string" or #input == 0 then return nil end
local stripped = input:gsub("%s+", "")
if string.sub(stripped, 1, 1) == "#" then
return resolveHex(stripped)
else
return COLOR_RESOLVABLE[string.lower(stripped)]
end
end
local function isAllowedSessionType(sessionCategory)
local selectedFilter = string.lower(Config.event_type)
if selectedFilter == "all" then
return true
end
local normalizedCategory = string.lower(sessionCategory or "")
return normalizedCategory == selectedFilter
end
local function isLive(currentTime, startTime): boolean
local endtime = startTime + (Config.duration * 60)
return currentTime >= startTime and currentTime <= endtime
end
local function formatTimeRemaining(seconds)
if seconds <= 0 then
return "Occurring"
end
local days = math.floor(seconds / 86400)
local hours = math.floor((seconds % 86400) / 3600)
local minutes = math.floor((seconds % 3600) / 60)
local secs = seconds % 60
if days > 0 then
return string.format("%dd %dh %dm", days, hours, minutes)
elseif hours > 0 then
return string.format("%dh %dm", hours, minutes)
elseif minutes > 0 then
return string.format("%dm %ds", minutes, secs)
else
return string.format("%ds", secs)
end
end
local function GetInstance()
local Payload = {
Url = Config.baseurl .. "api/public/v1/workspace/" .. Config.workspace_id .."/info",
Method = "GET",
Headers = {
["Content-Type"] = "application/json",
["Authorization"] = Config.api_key
}
}
local success, response = pcall(function()
return httpservice:RequestAsync(Payload)
end)
if success and response.StatusCode == 200 then
print("Successfully connected to Planetary API")
return httpservice:JSONDecode(response.Body)
else
warn("Failed to connect to Planetary API: " .. tostring(response))
return nil
end
end
local function getSessions()
local startDate = rn:FormatUniversalTime("YYYY-MM-DDT00:00:00Z", "en-us")
local endDate = tomorrow:FormatUniversalTime("YYYY-MM-DDTHH:mm:ssZ", "en-us")
local categoryParam = string.lower(Config.event_type) ~= "all"
and ("&category=" .. string.lower(Config.event_type))
or ""
local Payload = {
Url = Config.baseurl .. "api/public/v1/workspace/" .. Config.workspace_id
.. "/sessions/calendar?startDate=" .. startDate .. "&endDate=" .. endDate .. categoryParam,
Method = "GET",
Headers = {
["Authorization"] = Config.api_key
}
}
for attempt = 1, 3 do
local success, response = pcall(function()
return httpservice:RequestAsync(Payload)
end)
if success and response.Success then
local decodeSuccess, decoded = pcall(function()
return httpservice:JSONDecode(response.Body)
end)
if decodeSuccess then
print("Successfully fetched " .. #(decoded.sessions or {}) .. " sessions")
return decoded.sessions or {}
end
warn("Failed to decode response on attempt " .. attempt)
else
warn("Failed to fetch data on attempt " .. attempt .. ": " .. tostring(response))
if not success or not response.Success then
ErrorScreen.Visible = true
local decodeSuccess, decoded = pcall(function()
return httpservice:JSONDecode(response.Body)
end)
if decodeSuccess then
ErrorScreen.ErrorLabel.Text = tostring(response.StatusCode)
.. " (" .. (HTTP_ERRORS[response.StatusCode] or "Unknown") .. ") - "
.. (decoded.error or "Unknown error")
else
ErrorScreen.ErrorLabel.Text = tostring(response.StatusCode)
.. " (" .. (HTTP_ERRORS[response.StatusCode] or "Unknown") .. ") - Unable to grab response error"
end
end
end
task.wait(1)
end
return {}
end
local function InitTopbar()
local sessionTypeText = ({
shift = "Upcoming Shifts",
training = "Upcoming Trainings",
event = "Upcoming Events",
all = "Upcoming Sessions"
})[string.lower(Config.event_type)] or "Upcoming Sessions"
SessionsScreen.Topbar.Left.SessionType.Text = sessionTypeText
end
local function getCohostInfo(userId)
local payload = {
Url = "https://users.roproxy.com/v1/users/" .. userId,
Method = "GET"
}
local success, response = pcall(function()
return httpservice:RequestAsync(payload)
end)
if success and response.Success then
local decodeSuccess, decoded = pcall(function()
return httpservice:JSONDecode(response.Body)
end)
if decodeSuccess then
return decoded
end
end
return nil
end
local function createSessionFrame(session)
local newSession = SessionFrame:Clone()
newSession.TextButton.Visible = false
if session.host then
local hostSuccess, hostInfo = pcall(function()
return Player:GetNameFromUserIdAsync(session.host.userId)
end)
if hostSuccess then
newSession.Hosts.Host.TextLabel.Text = hostInfo
newSession.Hosts.Host.hostImage.ImageLabel.Image =
Player:GetUserThumbnailAsync(session.host.userId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size352x352)
if Config.customization.colored_profiles then
local profileColor = resolveColor(Config.customization.color_profile_color) or colors[math.random(1, #colors)]
newSession.Hosts.Host.hostImage.ImageLabel.BackgroundColor3 = profileColor
end
end
else
newSession.Hosts.Host.TextLabel.Text = "UNCLAIMED"
newSession.Hosts.Host.hostImage.ImageLabel.Image =
Player:GetUserThumbnailAsync(1, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size352x352)
end
if session.participants and #session.participants > 0 then
local cohostData = getCohostInfo(session.participants[1].userId)
if cohostData then
local rest = ""
if #session.participants > 1 then
rest = ", and " .. (#session.participants - 1) .. " other cohost"
.. (#session.participants > 2 and "s" or "") .. "."
end
newSession.Hosts.Cohost.TextLabel.Text = cohostData.name .. rest
newSession.Hosts.Cohost.CohostImage.ImageLabel.Image =
Player:GetUserThumbnailAsync(cohostData.id, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size352x352)
if Config.customization.colored_profiles then
local cohostColor = resolveColor(Config.customization.color_profile_color) or colors[math.random(1, #colors)]
newSession.Hosts.Cohost.CohostImage.ImageLabel.BackgroundColor3 = cohostColor
end
else
newSession.Hosts.Cohost:Destroy()
end
else
newSession.Hosts.Cohost:Destroy()
end
local sessionStartTime = DateTime.fromIsoDate(session.date).UnixTimestamp
local currentTime = DateTime.now().UnixTimestamp
local timeUntilStart = sessionStartTime - currentTime
if game.GameId ~= session.type.gameId and session.host and session.type.gameId then
if (Config.join_button.appear_before_start >= timeUntilStart / 60) and (session.status == "scheduled") then
newSession.TextButton.Visible = true
newSession.TextButton:SetAttribute("placeid", session.type.gameId)
elseif session.status == "in-progress" then
newSession.TextButton.Visible = true
newSession.TextButton.Interactable = false
newSession.TextButton.BackgroundColor3 = Color3.new(0.211765, 0.211765, 0.211765)
newSession.TextButton.Text = "LOCKED"
end
newSession.TextButton.Script.Enabled = true
end
if not isLive(currentTime, sessionStartTime) then
newSession.LiveFrame:Destroy()
end
local timeText
if timeUntilStart > 0 then
timeText = formatTimeRemaining(timeUntilStart)
end
newSession.EventInfo.EventName.Text = `{session.name} {timeUntilStart > 0 and `<font color="#575757" weight="400">({timeText})</font>` or ""}`
return newSession
end
local function PopulateSessions()
for _, child in pairs(SessionsScreen.ScrollingFrame:GetChildren()) do
if child:IsA("Frame") then
if child.Name == "spacer" then continue end
child:Destroy()
end
end
NoPlanned.Visible = false
ErrorScreen.Visible = false
local sessions = getSessions()
local displayedCount = 0
for _, session in pairs(sessions) do
if Config.only_show_claimed then
if not session.host then
continue
end
end
local sessionStartTime = DateTime.fromIsoDate(session.date).UnixTimestamp
local sessionEndTime = sessionStartTime + (Config.duration * 60)
local currentTime = DateTime.now().UnixTimestamp
if currentTime > sessionEndTime then
continue
end
local sessionCategory = session.type.category
if isAllowedSessionType(sessionCategory) then
local sessionFrame = createSessionFrame(session)
sessionFrame.Parent = SessionsScreen.ScrollingFrame
sessionFrame.Visible = true
displayedCount = displayedCount + 1
end
end
if displayedCount == 0 then
NoPlanned.Visible = true
NoPlanned.TextLabel.Text = "Woah! No " .. type .. "?"
warn("No sessions to display", "info")
end
end
local function InitUI()
if isLight then
Screen.bg.BackgroundColor3 = Color3.fromRGB(202, 202, 202)
Screen.bg.ImageLabel.ImageColor3 = Color3.fromRGB(27, 27, 27)
Screen.Sessions.Topbar.Left.SessionType.TextColor3 = Color3.fromRGB(21, 21, 21)
Screen.Sessions.Topbar.Right.Time.TextColor3 = Color3.fromRGB(21, 21, 21)
Screen.Sessions.Topbar.UIStroke.Color = Color3.fromRGB(97, 97, 97)
Screen.Sessions.Topbar.BackgroundColor3 = Color3.fromRGB(145, 145, 145)
Screen.Sessions.ScrollingFrame.SessionFrame.Frame.BackgroundColor3 = Color3.fromRGB(111, 111, 111)
Screen.Sessions.ScrollingFrame.SessionFrame.Frame.UIStroke.Color = Color3.fromRGB(124, 124, 124)
Screen.Sessions.ScrollingFrame.SessionFrame.Frame.EventInfo.EventName.TextColor3 = Color3.fromRGB(21, 21, 21)
Screen.Sessions.ScrollingFrame.SessionFrame.Frame.Hosts.Cohost.TextLabel.TextColor3 = Color3.fromRGB(21, 21, 21)
Screen.Sessions.ScrollingFrame.SessionFrame.Frame.Hosts.Host.TextLabel.TextColor3 = Color3.fromRGB(21, 21, 21)
Screen.Sessions.ScrollingFrame.SessionFrame.Frame.Hosts.Host.hostImage.ImageLabel.UIStroke.Color = Color3.fromRGB(116, 116, 116)
end
local finalColor = resolveColor(Config.join_button.color) or COLOR_RESOLVABLE["orbit"]
Screen.Sessions.ScrollingFrame.SessionFrame.Frame.TextButton.BackgroundColor3 = finalColor
end
local function Init()
local success, err = pcall(function()
local PlaceHolder = Screen:FindFirstChild("Placeholder")
if PlaceHolder then
PlaceHolder:Destroy()
end
Screen.Sessions.Visible = true
Screen.NoPlanned.Visible = false
Screen.ErrorScreen.Visible = false
local Instance = GetInstance()
InitTopbar()
InitUI()
while true do
PopulateSessions()
task.wait(Config.refresh)
end
end)
if not success then
warn("Error occurred: " .. tostring(err), "warn")
ErrorScreen.Visible = true
ErrorScreen.ErrorLabel.Text = "An internal error occurred while running the board.\n" .. tostring(err)
task.wait(30)
Init()
end
end
Init()]]></ProtectedString>
<bool name="Disabled">false</bool>
<Content name="LinkedSource"><null></null></Content>
<token name="RunContext">0</token>
<string name="ScriptGuid">{937D051B-2954-44DF-AC62-78B1EEA9FFE0}</string>
<BinaryString name="AttributesSerialize"></BinaryString>
<SecurityCapabilities name="Capabilities">0</SecurityCapabilities>
<bool name="DefinesCapabilities">false</bool>
<string name="Name">Engine</string>
<int64 name="SourceAssetId">-1</int64>
<BinaryString name="Tags"></BinaryString>
</Properties>
</Item>
</Item>
<Item class="Part" referent="RBXFA113A45EBB3466A8E2875A834317440">
<Properties>
<token name="shape">1</token>
<token name="formFactorRaw">1</token>
<bool name="Anchored">true</bool>
<bool name="AudioCanCollide">true</bool>
<float name="BackParamA">-0.5</float>
<float name="BackParamB">0.5</float>
<token name="BackSurface">0</token>
<token name="BackSurfaceInput">0</token>
<float name="BottomParamA">-0.5</float>
<float name="BottomParamB">0.5</float>
<token name="BottomSurface">0</token>
<token name="BottomSurfaceInput">0</token>
<CoordinateFrame name="CFrame">
<X>8.81488991</X>
<Y>5.35964537</Y>
<Z>14.6625805</Z>
<R00>0.99999994</R00>
<R01>0</R01>
<R02>0</R02>
<R10>0</R10>
<R11>1.00000131</R11>
<R12>1.05577236e-08</R12>
<R20>0</R20>
<R21>-4.6740718e-09</R21>
<R22>1.00000119</R22>
</CoordinateFrame>
<bool name="CanCollide">true</bool>
<bool name="CanQuery">true</bool>
<bool name="CanTouch">true</bool>
<bool name="CastShadow">true</bool>
<string name="CollisionGroup">Default</string>
<int name="CollisionGroupId">0</int>
<Color3uint8 name="Color3uint8">4279308561</Color3uint8>
<PhysicalProperties name="CustomPhysicalProperties">
<CustomPhysics>false</CustomPhysics>
</PhysicalProperties>
<bool name="EnableFluidForces">true</bool>
<float name="FrontParamA">-0.5</float>
<float name="FrontParamB">0.5</float>
<token name="FrontSurface">0</token>
<token name="FrontSurfaceInput">0</token>
<float name="LeftParamA">-0.5</float>
<float name="LeftParamB">0.5</float>
<token name="LeftSurface">0</token>
<token name="LeftSurfaceInput">0</token>
<bool name="Locked">false</bool>
<bool name="Massless">false</bool>
<token name="Material">272</token>
<string name="MaterialVariantSerialized"></string>
<CoordinateFrame name="PivotOffset">
<X>0</X>
<Y>0</Y>
<Z>0</Z>
<R00>1</R00>
<R01>0</R01>
<R02>0</R02>
<R10>0</R10>
<R11>1</R11>
<R12>0</R12>
<R20>0</R20>
<R21>0</R21>
<R22>1</R22>
</CoordinateFrame>
<float name="Reflectance">0</float>
<float name="RightParamA">-0.5</float>
<float name="RightParamB">0.5</float>
<token name="RightSurface">0</token>
<token name="RightSurfaceInput">0</token>
<int name="RootPriority">0</int>
<Vector3 name="RotVelocity">
<X>0</X>
<Y>0</Y>
<Z>0</Z>
</Vector3>
<float name="TopParamA">-0.5</float>
<float name="TopParamB">0.5</float>
<token name="TopSurface">0</token>
<token name="TopSurfaceInput">0</token>
<float name="Transparency">0</float>
<Vector3 name="Velocity">
<X>0</X>
<Y>0</Y>
<Z>0</Z>
</Vector3>
<Vector3 name="size">
<X>8.57021236</X>
<Y>4.71927977</Y>
<Z>0.179332644</Z>
</Vector3>
<BinaryString name="AttributesSerialize"></BinaryString>
<SecurityCapabilities name="Capabilities">0</SecurityCapabilities>
<bool name="DefinesCapabilities">false</bool>
<string name="Name">Screen</string>
<int64 name="SourceAssetId">-1</int64>
<BinaryString name="Tags"></BinaryString>
</Properties>
<Item class="SurfaceGui" referent="RBXEEE831305CA8405AB8CAE64908D6A628">
<Properties>
<bool name="AlwaysOnTop">false</bool>
<float name="Brightness">1</float>
<Vector2 name="CanvasSize">
<X>800</X>
<Y>600</Y>
</Vector2>
<bool name="ClipsDescendants">true</bool>
<float name="LightInfluence">1</float>
<float name="MaxDistance">1000</float>
<float name="PixelsPerStud">211.896729</float>
<token name="SizingMode">1</token>
<float name="ToolPunchThroughDistance">0</float>
<float name="ZOffset">0</float>
<bool name="Active">true</bool>
<Ref name="Adornee">null</Ref>
<token name="Face">5</token>
<bool name="Enabled">true</bool>
<bool name="ResetOnSpawn">true</bool>
<bool name="TabKeyboardNavigation">false</bool>
<token name="ZIndexBehavior">1</token>
<bool name="AutoLocalize">true</bool>
<Ref name="RootLocalizationTable">null</Ref>
<token name="SelectionBehaviorDown">0</token>
<token name="SelectionBehaviorLeft">0</token>
<token name="SelectionBehaviorRight">0</token>
<token name="SelectionBehaviorUp">0</token>
<bool name="SelectionGroup">false</bool>
<BinaryString name="AttributesSerialize"></BinaryString>
<SecurityCapabilities name="Capabilities">0</SecurityCapabilities>
<bool name="DefinesCapabilities">false</bool>
<string name="Name">SurfaceGui</string>
<int64 name="SourceAssetId">-1</int64>
<BinaryString name="Tags"></BinaryString>
</Properties>
<Item class="Frame" referent="RBX1171D43F10A94AA8A5896EFC144F00C4">
<Properties>
<token name="Style">0</token>
<bool name="Active">false</bool>
<Vector2 name="AnchorPoint">
<X>0</X>
<Y>0</Y>
</Vector2>
<token name="AutomaticSize">0</token>
<Color3 name="BackgroundColor3">
<R>0.0901960805</R>
<G>0.0901960805</G>
<B>0.0901960805</B>
</Color3>
<float name="BackgroundTransparency">0</float>
<Color3 name="BorderColor3">
<R>0</R>
<G>0</G>
<B>0</B>
</Color3>
<token name="BorderMode">0</token>
<int name="BorderSizePixel">0</int>
<bool name="ClipsDescendants">false</bool>
<bool name="Draggable">false</bool>
<token name="InputSink">0</token>
<bool name="Interactable">false</bool>
<int name="LayoutOrder">-1</int>
<Ref name="NextSelectionDown">null</Ref>
<Ref name="NextSelectionLeft">null</Ref>
<Ref name="NextSelectionRight">null</Ref>
<Ref name="NextSelectionUp">null</Ref>
<UDim2 name="Position">
<XS>0</XS>
<XO>0</XO>
<YS>0</YS>
<YO>0</YO>
</UDim2>
<float name="Rotation">0</float>
<bool name="Selectable">false</bool>
<Ref name="SelectionImageObject">null</Ref>
<int name="SelectionOrder">0</int>
<UDim2 name="Size">
<XS>1</XS>
<XO>0</XO>
<YS>1</YS>
<YO>0</YO>
</UDim2>
<token name="SizeConstraint">0</token>
<bool name="Visible">true</bool>
<int name="ZIndex">-1</int>
<bool name="AutoLocalize">true</bool>
<Ref name="RootLocalizationTable">null</Ref>
<token name="SelectionBehaviorDown">0</token>
<token name="SelectionBehaviorLeft">0</token>
<token name="SelectionBehaviorRight">0</token>
<token name="SelectionBehaviorUp">0</token>
<bool name="SelectionGroup">false</bool>
<BinaryString name="AttributesSerialize"></BinaryString>
<SecurityCapabilities name="Capabilities">0</SecurityCapabilities>
<bool name="DefinesCapabilities">false</bool>
<string name="Name">bg</string>
<int64 name="SourceAssetId">-1</int64>
<BinaryString name="Tags"></BinaryString>
</Properties>
<Item class="ImageLabel" referent="RBXDD910340A4CF48AD892FD6AB2E9CB58F">
<Properties>
<Content name="Image"><url>rbxassetid://122239748503967</url></Content>
<Color3 name="ImageColor3">
<R>1</R>
<G>1</G>
<B>1</B>
</Color3>
<Vector2 name="ImageRectOffset">
<X>0</X>
<Y>0</Y>
</Vector2>
<Vector2 name="ImageRectSize">
<X>0</X>
<Y>0</Y>
</Vector2>
<float name="ImageTransparency">0.949999988</float>
<token name="ResampleMode">0</token>
<token name="ScaleType">0</token>
<Rect2D name="SliceCenter">
<min>
<X>0</X>
<Y>0</Y>
</min>
<max>
<X>0</X>
<Y>0</Y>
</max>
</Rect2D>
<float name="SliceScale">1</float>
<UDim2 name="TileSize">
<XS>1</XS>
<XO>0</XO>
<YS>1</YS>
<YO>0</YO>
</UDim2>
<bool name="Active">false</bool>
<Vector2 name="AnchorPoint">
<X>0.5</X>
<Y>0.5</Y>
</Vector2>
<token name="AutomaticSize">0</token>
<Color3 name="BackgroundColor3">
<R>1</R>
<G>1</G>
<B>1</B>
</Color3>
<float name="BackgroundTransparency">1</float>
<Color3 name="BorderColor3">
<R>0</R>
<G>0</G>
<B>0</B>
</Color3>
<token name="BorderMode">0</token>
<int name="BorderSizePixel">0</int>
<bool name="ClipsDescendants">false</bool>
<bool name="Draggable">false</bool>
<token name="InputSink">0</token>
<bool name="Interactable">true</bool>
<int name="LayoutOrder">0</int>
<Ref name="NextSelectionDown">null</Ref>
<Ref name="NextSelectionLeft">null</Ref>
<Ref name="NextSelectionRight">null</Ref>
<Ref name="NextSelectionUp">null</Ref>
<UDim2 name="Position">
<XS>0.0500000007</XS>
<XO>0</XO>
<YS>0.899999976</YS>
<YO>0</YO>
</UDim2>
<float name="Rotation">0</float>
<bool name="Selectable">false</bool>
<Ref name="SelectionImageObject">null</Ref>
<int name="SelectionOrder">0</int>
<UDim2 name="Size">
<XS>0.800000012</XS>
<XO>0</XO>
<YS>0.800000012</YS>
<YO>0</YO>
</UDim2>
<token name="SizeConstraint">0</token>
<bool name="Visible">true</bool>
<int name="ZIndex">1</int>
<bool name="AutoLocalize">true</bool>