-
-
Notifications
You must be signed in to change notification settings - Fork 231
Make a better fallback module and add it to master #1886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ccuser44
wants to merge
5
commits into
Epix-Incorporated:master
Choose a base branch
from
ccuser44:patch-17
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5fb61f5
Create ADONIS_CRITICAL_INCIDENT.lua
ccuser44 f4cc823
Update ADONIS_CRITICAL_INCIDENT.lua
ccuser44 1e7ff11
Fix syntax for notification function parameters
ccuser44 dee4a10
Fix typo
ccuser44 175fe5f
Refactor ACMI footer and improve service status handling
ccuser44 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,227 @@ | ||
| local SETTINGS_OVERRIDE = { -- Why do these need to be overriden in the first place. | ||
| Theme = "Default"; -- Should the settings override be removed?? I think so, but I'll leave it for now. | ||
| MobileTheme = "Default"; | ||
| DefaultTheme = "Default"; | ||
| SaveAdmins = false; | ||
| FunCommands = false; | ||
| PlayerCommands = true; | ||
| CommandFeedback = true; | ||
| CrossServerCommands = false; | ||
| ChatCommands = true; | ||
| CodeExecution = false; | ||
| SilentCommandDenials = false; | ||
| Console = false; | ||
| Console_AdminsOnly = false; | ||
| HelpSystem = false; | ||
| HelpButton = false; | ||
| DonorCapes = false; | ||
| DonorCommands = false; | ||
| LocalCapes = false; | ||
| Detection = false; | ||
| CheckClients = false; | ||
| ExploitNotifications = false; | ||
| CharacterCheckLogs = false; | ||
| AntiNoclip = false; | ||
| AntiRootJointDeletion = false; | ||
| AntiMultiTool = false; | ||
| AntiGod = false; | ||
| AntiSpeed = false; | ||
| AntiBuildingTools = false; | ||
| AntiAntiIdle = false; | ||
| ExploitGuiDetection = false; | ||
| Notification = false; | ||
| G_API = false; | ||
| G_Access = false; | ||
| } | ||
|
|
||
| local ACMI_HEADER = { | ||
| ""; | ||
| "ADONIS CRITICAL INCIDENT"; | ||
| ""; | ||
| "Adonis is currently running in restricted mode."; | ||
| "Most features have been removed and Adonis can now only use core functions limited to basic user moderation functionality."; | ||
| "A service failure event has occured, and Adonis has had to fall back to the backup. Error code: 1A.Rx503."; | ||
| "Scroll down for a list of functionality losses."; | ||
| ""; | ||
| "We are working hard to resolve the issue and normal operations will hopefully resume soon."; | ||
| "See our offical group for more information."; | ||
| ""; | ||
| "https://www.roblox.com/groups/886423/Epix-Incorporated"; | ||
| ""; | ||
| "Adonis functionality changes:"; | ||
| } | ||
|
|
||
| local ACMI_FOOTER = { | ||
| ""; | ||
| "Core"; | ||
| ""; | ||
| "Server Plugins <font color = 'rgb(0,255,0)'>[Services remain operational.]</font>"; | ||
| "Client Plugins <font color = 'rgb(0,255,0)'>[Services remain operational.]</font>"; | ||
| ""; | ||
| "AntiExploit <font color = 'rgb(255,0,0)'>[Loss of services.]</font>"; | ||
| "(SERVER)AntiCheat <font color = 'rgb(255,0,0)'>[Loss of services.]</font>"; | ||
| "(CLIENT)AntiCheat <font color = 'rgb(255,0,0)'>[Loss of services.]</font>"; | ||
| "HelpSystem <font color = 'rgb(255,0,0)'>[Loss of services.]</font>"; | ||
| "WebPanel <font color = 'rgb(255,0,0)'>[Loss of services.]</font>"; | ||
| "CrossServer Functions <font color = 'rgb(255,0,0)'>[Loss of services.]</font>"; | ||
| "_G Services <font color = 'rgb(255,0,0)'>[Loss of services.]</font>"; | ||
| "TrelloAPI <font color = 'rgb(0,255,0)'>[Services remain operational.]</font>"; | ||
| "DataStore <font color = 'rgb(0,255,0)'>[Services remain operational.]</font>"; | ||
| ""; | ||
| "Client:"; | ||
| ""; | ||
| "UI Themes <font color = 'rgb(255,0,0)'>[Loss of services.]</font>"; | ||
| } | ||
|
|
||
| local AVAILABLE_COMMAND_MODULES = { "Donors", "Fun", "Players", "Moderators", "Admins", "HeadAdmins", "Creators" } | ||
|
|
||
| return function(Vargs) | ||
| local service = Vargs.Service | ||
| local server = Vargs.Server | ||
| local Settings = server.Settings | ||
|
|
||
| if not server.Variables then | ||
| server.Variables = { _isBackupByCriticalPlugin = true } | ||
| end | ||
|
|
||
| local Core = server.Core | ||
| local Admin = server.Admin | ||
| local Remote = server.Remote | ||
| local Logs = server.Logs | ||
| local Variables = server.Variables | ||
| local Functions = server.Functions | ||
|
|
||
| if not server.CriticalMode then -- Only run this code if server flips flag. This should *only* be on for the fallback module! | ||
| return | ||
| end | ||
|
|
||
| local function createPaddingForList(list) | ||
| local maxSize = 0 | ||
|
|
||
| for i, v in ipairs(list) do | ||
| if type(v) == "table" then | ||
| if string.len(v[1]) > maxSize then | ||
| maxSize = string.len(v[1]) | ||
| end | ||
| end | ||
| end | ||
|
|
||
| for i, v in ipairs(list) do | ||
| if type(v) == "table" then | ||
| v[2] = string.rep(" ", maxSize - string.len(v[1])) | ||
| list[i] = table.concat(v, " ") | ||
| end | ||
| end | ||
|
|
||
| return list | ||
| end | ||
|
|
||
| local function getFormattedStatus(name, status) | ||
| return `<font color = 'rgb({status ~= true and 255 or 0}, {status == true and 255 or status == false and 0 or 162}, {0})'>[{name}]</font>` | ||
| end | ||
|
|
||
| local function getCommandStatusData() | ||
| local list = table.create(#AVAILABLE_COMMAND_MODULES) | ||
| list[1], list[2], list[3] = "", "Commands:", "" | ||
|
|
||
| for i, v in ipairs(AVAILABLE_COMMAND_MODULES) do | ||
| if not server.CommandModules or not server.CommandModules:FindFirstChild(v) or not pcall(require, server.CommandModules[v]) then | ||
| table.insert(list, {v, "", getFormattedStatus("Loss of services.", false)}) | ||
| else | ||
| table.insert(list, {v, "", getFormattedStatus("Temporary loss of services. Essential commands remain.", "warn")}) | ||
| end | ||
| end | ||
|
|
||
| return list | ||
| end | ||
|
|
||
| local function genOverrideListData() | ||
| local list = {"", "Settings:", ""} | ||
|
|
||
| if not Settings then | ||
| table.insert(list, {"All setting data", "", getFormattedStatus("Loss of services.", false)}) | ||
| else | ||
| for k, v in pairs(SETTINGS_OVERRIDE) do | ||
| table.insert(list, {k, "", getFormattedStatus(type(v) ~= "boolean" and "Has been forced to 'Default'." or v and "Has been forced enabled." or "Has been forced disabled.", type(v) ~= "boolean" and "warn" or v)}) | ||
| end | ||
| end | ||
|
|
||
| return list | ||
| end | ||
|
|
||
| local function getServiceStatusData() | ||
| local list = table.clone(Variables.ACMI_HEADER) | ||
|
|
||
| table.move(getCommandStatusData(), 1, #AVAILABLE_COMMAND_MODULES + 3, #list + 1, list) | ||
| table.move(genOverrideListData(), 1, service.CountTable(SETTINGS_OVERRIDE) + 3, #list + 1, list) | ||
| table.move(table.clone(Variables.ACMI_FOOTER), 1, #Variables.ACMI_FOOTER, #list + 1, list) -- TODO: Make this check status dynamically as well | ||
| Variables.CachedACMI = list | ||
|
|
||
| print(createPaddingForList(list)) | ||
| return list | ||
| end | ||
|
|
||
| local function onPlayerAdded(p: Player) | ||
| local data = Core.GetPlayer(p) | ||
|
|
||
| if Admin.GetLevel(p) > 0 then | ||
| Functions.Notification( | ||
| "Adonis Restricted Mode", | ||
| "Click to view more information.", | ||
| {p}, | ||
| 900, | ||
| "rbxassetid://7467273592", | ||
| Core.Bytecode("client.Remote.Send('ProcessCommand', ':aciminfo')") | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| if server.Panic then | ||
| server.Panic("ADONIS WAS STARTED IN CRITICAL MODE!") | ||
| end | ||
|
|
||
| if Logs and Logs.AddLog then | ||
| Logs.AddLog("Errors", { | ||
| Text = "ADONIS CRITICAL INCIDENT"; | ||
| Desc = "Adonis MainModule has failed to load. Resorted to backup."; | ||
| }) | ||
|
|
||
| Logs.AddLog("Script", { | ||
| Text = "ADONIS CRITICAL INCIDENT"; | ||
| Desc = "Adonis MainModule has failed to load. Resorted to backup."; | ||
| }) | ||
| end | ||
|
|
||
| if Settings then | ||
| for k, v in SETTINGS_OVERRIDE do | ||
| Settings[k] = v | ||
| end | ||
| end | ||
|
|
||
| Variables.ACMI_HEADER, Variables.ACMI_FOOTER = ACMI_HEADER, ACMI_FOOTER | ||
| server.Commands.ACIMInfo = { | ||
| Prefix = Settings.Prefix; | ||
| Commands = {"ACIMInfo"}; | ||
| Args = {}; | ||
| Description = "Show a list of functionality loss."; | ||
| AdminLevel = 0; | ||
| Hidden = false; | ||
| Function = function(plr: Player, args: {string}, data) | ||
| Remote.MakeGui(plr, "List", { | ||
| Title = "Adonis Critical Incident", | ||
| Icon = "rbxassetid://7467273592", | ||
| Table = Variables.CachedACMI or getServiceStatusData(), | ||
| Font = "Code", | ||
| PageSize = 100; | ||
| Size = {750, 400}, | ||
| PagesEnabled = false; | ||
| Dots = true; | ||
| Sanitize = false; | ||
| Stacking = true; | ||
| RichText = true; | ||
| }) | ||
| end | ||
| }; | ||
|
|
||
| service.Events.PlayerAdded:Connect(onPlayerAdded) -- TODO: Check if already in players this fires for, if not then add a getplayers for loop | ||
| end | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.