diff --git a/modules/ExpGamingAdmin/AdminLib/control.lua b/modules/ExpGamingAdmin/AdminLib/control.lua new file mode 100644 index 00000000..8223f5a5 --- /dev/null +++ b/modules/ExpGamingAdmin/AdminLib/control.lua @@ -0,0 +1,93 @@ +--- Desction +-- @module ExpGamingAdmin.AdminLib@4.0.0 +-- @author +-- @license +-- @alais Admin + +-- Module Require +local Game = require('FactorioStdLib@^0.8.0') +local Ranking -- ExpGamingCore.Ranking@^4.0.0 +local Sync -- ExpGamingCore.Sync@^4.0.0 + +-- Module Define +local module_verbose = false +local Admin = { + on_init=function() + if loaded_modules['ExpGamingCore.Ranking@^4.0.0'] then Ranking = require('ExpGamingCore.Ranking@^4.0.0') end + if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end + end, + actions={}, + action_names={} +} + +-- Global Define +local global = global{ + banned = {} +} + +-- Function Define +function Admin.create_reason(reason,name) + local reason = reason or 'No Reason' + if not string.find(string.lower(reason),string.lower(name)) then reason = reason..' - '..name end + if Sync and Sync.info.date ~= '0000/00/00' and not string.find(string.lower(reason),Sync.info.date) then reason = reason..' - '..Sync.info.date end + if not string.find(string.lower(reason),'appeal') then reason = reason..' - Vist www.explosivegaming.nl to appeal.' end + return reason end +end + +function Admin.open(player,pre_select_player,pre_select_action) + if Admin.center then Gui.center.clear(player) Admin.center.open(player,pre_select_player,pre_select_action) end +end + +function Admin.allowed(player) + local player = Game.get_player(player) + if Ranking then + local lowest_admin_power = Ranking.get_group('Admin').lowest.power + return lowest_admin_power >= Ranking.get_rank(player).power + else return player.admin +end + +function Admin.set_banned(player,set) + local player=Game.get_player(player) + if not player then return false end + global.banned[player.name] = set +end + +function Admin.is_banned(player,detail) + local player=Game.get_player(player) + if not player then return false end + local banned = global.banned[player.name] + if banned == true then return true end + if not banned then return false end + if detail then return banned + else return true end +end + +function Admin.add_action(action,callback) + table.insert(Admin.action_names,action) + Admin.actions[string.lower(action)] = callback +end + +function Admin.take_action(action,player,by_player,reason) + if Admin[action] then Admin[action](player,by_player,reason) end + if Admin.actions[string.lower(action)] then Admin.actions[string.lower(action)](player,by_player,reason) end +end + +function Admin.clear_player(player,by_player) + local player, by_player_name = valid_players(player,by_player) + if not player then return end + if Admin.is_banned(player,true) == true then Server.interface(game.unban_player,true,player,by_player) end + if Admin.clear_warings then Admin.clear_warings(player,by_player,true) end + if Admin.clear_reports then Admin.clear_reports(player,by_player,true) end + if Ranking.get_rank(player).group.name == 'Jail' then Server.interface(Ranking.revert,true,player,by_player) end + if Sync then Sync.emit_embeded{ + title='Player Clear', + color=Color.to_hex(defines.text_color.low), + description='A player had their reports and warnings cleared.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + } end + Admin.set_banned(player,false) +end + +-- Module Return +return Admin \ No newline at end of file diff --git a/modules/ExpGamingAdmin/AdminLib/locale/de.cfg b/modules/ExpGamingAdmin/AdminLib/locale/de.cfg new file mode 100644 index 00000000..8a920bf9 --- /dev/null +++ b/modules/ExpGamingAdmin/AdminLib/locale/de.cfg @@ -0,0 +1,15 @@ +[ExpGamingAdmin@4-0-0] +name=Admin-Befehle +tooltip=Die mächtigsten Befehle sind hier zuhause. +no-info-file=Die Informationsdatei wurde nicht gefunden. +message=Wähle einen Spieler und eine Aktion. Stell vor dem Ausführen sicher, dass der Richtige ist! +warning=Achtung, dieser Spieler hat einen höheren Rang als du selbst, weshalb du seinen Rang nicht ändern kannst. +short-reason=Achtung, dies ist ein sehr kurzer Grund. Bitte versuche, mehr Informationen anzugeben. (Warning: The reason is too short. UPDATE) +rank-high=Dieser Spieler hat einen hohen Rang. Bitte benutze nur Ingame-Befehle gegen diese Person, wenn du dir sicher bist! +invalid=Der Spieler oder die Aktion war ungültig. Bitte versuche es noch einmal! +take-action= Ergreife Maßnahme +tooltip-ban=Banne Spieler +tooltip-kick=Kicke Spieler +tooltip-jail=Sperre Spieler ins Gefängnis +tooltip-go-to=Gehe zum Spieler +tooltip-bring=Bringe den Spieler zu dir \ No newline at end of file diff --git a/modules/ExpGamingAdmin/AdminLib/locale/en.cfg b/modules/ExpGamingAdmin/AdminLib/locale/en.cfg new file mode 100644 index 00000000..5d623521 --- /dev/null +++ b/modules/ExpGamingAdmin/AdminLib/locale/en.cfg @@ -0,0 +1,21 @@ +[ExpGamingAdmin@4-0-0] +name=Admin Commands +tooltip=Admin commands make their home here +no-info-file=No info file was found +message=Please select a player and an action to take. Make sure to choose the correct one! +warning=Warning: This player outranks you. Therefore, you cannot edit their rank. +short-reason=Warning: The reason is too short. +rank-high=Warning: This player outranks you. Therefore, you cannot edit their rank. +invalid=The player or the action is invalid. Please try again! +take-action=Take Action +tooltip-ban=Ban Player +tooltip-kick=Kick Player +tooltip-jail=Jail Player +tooltip-go-to=Go To Player +tooltip-bring=Bring Player +temp-ban=__1__ was temporary banned by __2__ and will remain in jail until next reset +report=Report Player +cant-report-ban=Invalid player as player is banned; Either unban or use /clear-all +low-print=__1__ has been reported by a user for: __2__ +high-print=__1__ has been reported by __2__ for: __3__ +cant-report=This player can't be reported. \ No newline at end of file diff --git a/modules/ExpGamingAdmin/AdminLib/locale/fr.cfg b/modules/ExpGamingAdmin/AdminLib/locale/fr.cfg new file mode 100644 index 00000000..c01ee135 --- /dev/null +++ b/modules/ExpGamingAdmin/AdminLib/locale/fr.cfg @@ -0,0 +1,15 @@ +[ExpGamingAdmin@4-0-0] +name=Commandes Admin +tooltip=Des commandes très puissantes résident ici. +no-info-file=Aucun fichier info trouvé +message=Veuillez sélectionner un joueur et une action, faites en sorte que ce soit la bonne ! +warning=Attention, ce joueur est de rang supérieur au vôtre, vous ne pouvez le modifier. +short-reason=Attention, la raison indiquée est trop courte. Soyez concis mais aussi précis. (Warning: The reason is too short. UPDATE) +rank-high=Ce joueur est de rang supérieur, veuillez utiliser une commande dont vous maîtriser l'utilisation ! +invalid=Le Joueur ou l'action est invalide, ré-essayez ! +take-action=Agir +tooltip-ban=Bannir un Joueur +tooltip-kick=Exclure un Joueur +tooltip-jail=Emprisonner un Joueur +tooltip-go-to=Aller à la position d'un Joueur +tooltip-bring=Amener le Joueur à soi diff --git a/modules/ExpGamingAdmin/AdminLib/locale/nl.cfg b/modules/ExpGamingAdmin/AdminLib/locale/nl.cfg new file mode 100644 index 00000000..2fa50fa6 --- /dev/null +++ b/modules/ExpGamingAdmin/AdminLib/locale/nl.cfg @@ -0,0 +1,15 @@ +[ExpGamingAdmin@4-0-0] +name=Admin Commands +tooltip=Admin Commands kan je hier vinden. +no-info-file=Infobestand niet gevonden. +message=Selecteer een speler en de bijbehorende actie. Wees er zeker van dat je de correcte actie kiest. +warning=Fout: Je kan de rank van deze speler niet aanpassen omdat het jouw rank overtreft. +short-reason=Fout: De reden is te kort. (Warning: The reason is too short. UPDATE) +rank-high=Fout: Deze speler overtreft jouw rank. +invalid=Fout: De speler kan niet gevonden worden en/of de actie is onjuist. Probeer opnieuw! +take-action=Actie ondernemen +tooltip-ban=Ban speler +tooltip-kick=Kick speler +tooltip-jail=Jail speler +tooltip-go-to=Ga naar speler +tooltip-bring=Breng speler diff --git a/modules/ExpGamingAdmin/AdminLib/locale/sv-SE.cfg b/modules/ExpGamingAdmin/AdminLib/locale/sv-SE.cfg new file mode 100644 index 00000000..e996652f --- /dev/null +++ b/modules/ExpGamingAdmin/AdminLib/locale/sv-SE.cfg @@ -0,0 +1,19 @@ +[ExpGamingAdmin@4-0-0] +name=Adminkommandon +tooltip=Adminkommando gör dit hem här +no-info-file=Ingen informationsfil kunde hittas +message=Var snäll och välj en spelare och en åtgärd att utfärda, se till att du väljer den rätta! +warning=Warning: Den här spelaren har högre rang än dig. Därför kan du inte redigera dess rang. +short-reason=Warning: Skälet är för kort. +rank-high=Warning: Den här spelaren har högre rang än dig. Därför kan du inte redigera dess rang. +invalid=Spelaren eller åtgärden är ogiltig. Var vänlig och försök igen! +take-action=Utför åtgärd. +tooltip-ban=Bannlys Spelare +tooltip-kick=Sparka Spelare +tooltip-jail=Fängsla Spelare +tooltip-go-to=Gå till Spelare +tooltip-bring=Hämta spelare +report=Rapportera Spelare +low-print=__1__ har blivit rapporterad av __2__ för: __3__ +high-print=__1__ har blivit rapporterad av __2__ för: __3__ +cant-report=Den här spelaren kan inte bli rapporterad. diff --git a/modules/ExpGamingAdmin/AdminLib/softmod.json b/modules/ExpGamingAdmin/AdminLib/softmod.json new file mode 100644 index 00000000..020f540a --- /dev/null +++ b/modules/ExpGamingAdmin/AdminLib/softmod.json @@ -0,0 +1,20 @@ +{ + "name": "AdminLib", + "version": "4.0.0", + "type": "Submodule", + "description": "The base functions required to make the others work.", + "location": "", + "keywords": [ + "lib", + "ExpGaming", + "Admin" + ], + "author": "", + "contact": "", + "license": "", + "dependencies": { + "FactorioStdLib": "^0.8.0", + "ExpGamingCore.Ranking": "?^4.0.0", + "ExpGamingCore.Sync": "?^4.0.0" + } +} \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Ban/control.lua b/modules/ExpGamingAdmin/Ban/control.lua new file mode 100644 index 00000000..5f107bd4 --- /dev/null +++ b/modules/ExpGamingAdmin/Ban/control.lua @@ -0,0 +1,49 @@ +--- Desction +-- @module ExpGamingAdmin.Ban@4.0.0 +-- @author +-- @license +-- @alais ThisModule + +-- Module Require +local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') +local AdminGui = require('ExpGamingAdmin.AdminGui@^4.0.0') +local Server = require('ExpGamingCore.Server@^4.0.0') +local Game = require('FactorioStdLib.Game@^0.8.0') +local Color -- FactorioStdLib.Color@^0.8.0 +local Sync -- ExpGamingCore.Sync@^4.0.0 + +-- Module Define +local module_verbose = false +local ThisModule = { + on_init=function() + if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end + if loaded_modules['FactorioStdLib.Color@^0.8.0'] then Sync = require('FactorioStdLib.Color@^0.8.0') end + end +} + +-- Function Define +AdminGui.add_button('ban','utility/danger_icon',{'ExpGamingAdmin@4-0-0.tooltip-ban'},function(player,byPlayer) + Admin.open(byPlayer,player,'ban') +end) + +function Admin.ban(player,by_player,reason) + local player = Game.get_player(player) + local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' + local reason = Admin.create_reason(reason,by_player_name) + Admin.set_banned(player,true) + if Sync then Sync.emit_embeded{ + title='Player Ban', + color=Color.to_hex(defines.text_color.crit), + description='There was a player banned.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + ['Reason:']=reason + } end + if Admin.move_inventory then Admin.move_inventory(player) end + Server.interface(game.ban_player,true,player,reason) +end + +Admin.add_action('Ban',Admin.ban) + +-- Module Return +return ThisModule \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Ban/softmod.json b/modules/ExpGamingAdmin/Ban/softmod.json new file mode 100644 index 00000000..08176f3a --- /dev/null +++ b/modules/ExpGamingAdmin/Ban/softmod.json @@ -0,0 +1,25 @@ +{ + "name": "Ban", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a custom ban function to the admin command set.", + "location": "", + "keywords": [ + "Ban", + "Admin", + "Set", + "ExpGaming" + ], + "author": "", + "contact": "", + "license": "", + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingAdmin.AdminGui": "^4.0.0", + "ExpGamingCore.Server": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0", + "FactorioStdLib.Color": "?^0.8.0", + "ExpGamingCore.Sync": "?^4.0.0", + "ExpGamingAdmin.ClearInventory": "?^4.0.0" + } +} \ No newline at end of file diff --git a/modules/ExpGamingAdmin/ClearInventory/control.lua b/modules/ExpGamingAdmin/ClearInventory/control.lua new file mode 100644 index 00000000..885d629a --- /dev/null +++ b/modules/ExpGamingAdmin/ClearInventory/control.lua @@ -0,0 +1,58 @@ +--- Desction +-- @module ExpGamingAdmin.ClearInventory@4.0.0 +-- @author +-- @license +-- @alais ThisModule + +-- Module Require +local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') +local Game = require('FactorioStdLib.Game@^0.8.0') + +-- Module Define +local module_verbose = false +local ThisModule = {} + +-- Function Define +local inventorys = { + defines.inventory.player_main, + defines.inventory.player_quickbar, + defines.inventory.player_trash, + defines.inventory.player_guns, + defines.inventory.player_ammo, + defines.inventory.player_armor +} + +function Admin.move_item_to_spawn(item,surface,chests) + local chests = chests or surface.find_entities_filtered{area={{-10,-10},{10,10}},name='iron-chest'} or {} + local chest = nil + while not chest or not chest.get_inventory(defines.inventory.chest).can_insert(item) do + chest = table.remove(chests,1) + if not chest then chest = surface.create_entity{ + name='iron-chest', + position=surface.find_non_colliding_position('iron-chest',{0,0},32,1) + } end + end + chest.get_inventory(defines.inventory.chest).insert(item) + table.insert(chests,chest) + return chests +end + +function Admin.move_inventory(player) + local player = Game.get_player(player) + if not player then return end + local chests = player.surface.find_entities_filtered{area={{-10,-10},{10,10}},name='iron-chest'} or {} + for _,_inventory in pairs(inventorys) do + local inventory = player.get_inventory(_inventory) + if inventory then + for item,count in pairs(inventory.get_contents()) do + local item = {name=item,count=count} + chests = Admin.move_item_to_spawn(item,player.surface,chests) + end + inventory.clear() + end + end +end + +Admin.add_action('Clear Inventory',Admin.move_inventory) +-- Module Return +return ThisModule \ No newline at end of file diff --git a/modules/ExpGamingAdmin/ClearInventory/softmod.json b/modules/ExpGamingAdmin/ClearInventory/softmod.json new file mode 100644 index 00000000..c3ee0e7a --- /dev/null +++ b/modules/ExpGamingAdmin/ClearInventory/softmod.json @@ -0,0 +1,22 @@ +{ + "name": "ClearInventory", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a function to clear a players inventoy and move the items to spawn.", + "location": "", + "keywords": [ + "Spawn", + "Items", + "Admin", + "Move", + "Clear", + "Inventory" + ], + "author": "", + "contact": "", + "license": "", + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0" + } +} \ No newline at end of file diff --git a/to convert/Addons/Guis/admin-gui.lua b/modules/ExpGamingAdmin/Gui/control.lua similarity index 71% rename from to convert/Addons/Guis/admin-gui.lua rename to modules/ExpGamingAdmin/Gui/control.lua index 3360a321..e7f85424 100644 --- a/to convert/Addons/Guis/admin-gui.lua +++ b/modules/ExpGamingAdmin/Gui/control.lua @@ -1,22 +1,68 @@ ---[[ -Explosive Gaming +--- Desction +-- @module ExpGamingAdmin.Gui@4.0.0 +-- @author +-- @license +-- @alais AdminGui -This file can be used with permission but this and the credit below must remain in the file. -Contact a member of management on our discord to seek permission to use our code. -Any changes that you may make to the code are yours but that does not make the script yours. -Discord: https://discord.gg/r6dC2uK -]] ---Please Only Edit Below This Line----------------------------------------------------------- +-- Module Require +local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') +local Gui = require('ExpGamingCore.Gui@^4.0.0') +local Ranking = require('ExpGamingCore.Ranking@^4.0.0') +local Game = require('FactorioStdLib.Game@^0.8.0') +local playerInfo -- ExpGamingPlayer@^4.0.0 -Admin = Admin or {} +-- Module Define +local module_verbose = false +local AdminGui = { + on_init=function() + if loaded_modules['ExpGamingPlayer@^4.0.0'] then playerInfo = require('ExpGamingPlayer@^4.0.0') + else playerInfo = function(player,frame) + frame.add{ + type='label', + caption={'ExpGamingAdmin@4-0-0.no-info-file'} + } + end end + --code + end, + buttons={} +} -local get_player_info = get_player_info or function(player,frame) - frame.add{ - type='label', - caption={'admin-commands.no-info-file'} - } +-- Function Define +function AdminGui.add_button(name,caption,tooltip,callback) + AdminGui.buttons[name] = Gui.inputs.add{ + type='button', + name='admin-gui-'+name, + caption=caption, + tooltip=tooltip + }:on_event('click',function(event) + local parent = event.element.parent + pre_select_player = parent.player and parent.player.caption or nil + callback(pre_select_player,event.player_index) + end) end +function AdminGui.draw(frame,filter_buttons) + local frame = frame.add{ + type='flow', + name='admin' + } + frame.add{ + type='label', + caption='', + name='player' + }.style.visible = false + local function format(btn) + btn.style.height = 30 + btn.style.width = 30 + end + for name,button in pairs(AdminGui.buttons) do + filter_buttons + if not filter_buttons or filter_buttons[name] then format(button:draw(frame)) end + end + return frame.player +end + +-- Gui Define local function _players(_player,root_frame,state) local players = {'Select Player'} local _players = state and game.players or game.connected_players @@ -46,31 +92,19 @@ local player_drop_down = Gui.inputs.add_drop_down('player-drop-down-admin-comman else get_player_info(selected,player_info_flow,true) end local rank = Ranking.get_rank(player) local _rank = Ranking.get_rank(selected) - if rank.power >= _rank.power then element.parent.warning.caption = {'admin-commands.warning'} + if rank.power >= _rank.power then element.parent.warning.caption = {'ExpGamingAdmin@4-0-0.warning'} else element.parent.warning.caption = '' end end) local reason_input = Gui.inputs.add_text('reason-input-admin-commands',false,'Enter Reason',function(player,text,element) if string.len(text) < 20 or text == 'Enter Reason' then - element.parent.warning.caption = {'admin-commands.short-reason'} + element.parent.warning.caption = {'ExpGamingAdmin@4-0-0.short-reason'} else element.parent.warning.caption = '' end end) -local function _actions(player) - return { - 'Select Action', - 'GoTo', - 'Bring', - 'Jail', - 'Kick', - 'Temp Ban', - 'Ban' - } -end - -local action_drop_down = Gui.inputs.add_drop_down('action-drop-down-rank-change',_actions,1,function(player,selected,items,element) +local action_drop_down = Gui.inputs.add_drop_down('action-drop-down-rank-change',{'Select Action',unpack(Admin.action_names)},1,function(player,selected,items,element) element.parent.parent.action.caption = selected if selected == 'Jail' or selected == 'Kick' or selected == 'Ban' or selected == 'Temp Ban' then element.parent['reason-input-admin-commands'].style.visible = true @@ -82,15 +116,15 @@ end) local take_action = Gui.inputs.add{ type='button', name='admin-commands-take', - caption={'admin-commands.take-action'} + caption={'ExpGamingAdmin@4-0-0.take-action'} }:on_event('click',function(event) local dropdowns = event.element.parent local rank = Ranking.get_rank(event.player_index) local _action= dropdowns.parent.action.caption ~= 'Select Action' and dropdowns.parent.action.caption or nil local _player = Game.get_player(dropdowns.parent.player.caption) - if not _player or not _action then dropdowns.warning.caption = {'admin-commands.invalid'} return end + if not _player or not _action then dropdowns.warning.caption = {'ExpGamingAdmin@4-0-0.invalid'} return end local _rank = Ranking.get_rank(_player) - if rank.power >= _rank.power then dropdowns.warning.caption = {'admin-commands.rank-high'} return end + if rank.power >= _rank.power then dropdowns.warning.caption = {'ExpGamingAdmin@4-0-0.rank-high'} return end local _reason = dropdowns['reason-input-admin-commands'] and dropdowns['reason-input-admin-commands'].text if (_action == 'Jail' or _action == 'Kick' or _action == 'Ban' or _action == 'Temp Ban') and (_reason == 'Enter Reason' or string.len(_reason) < 20) then return end Admin.take_action(_action,_player,event.player_index,_reason) @@ -100,7 +134,7 @@ end) Admin.center = Gui.center.add{ name='admin-commands', caption='utility/danger_icon', - tooltip={'admin-commands.tooltip'}, + tooltip={'ExpGamingAdmin@4-0-0.tooltip'}, open=function(event,pre_select_player,pre_select_action) local _player = Game.get_player(pre_select_player) local player = Game.get_player(event) @@ -113,13 +147,13 @@ Admin.center = Gui.center.add{ direction='vertical', style=mod_gui.frame_style } - -- only edit i made was passing diffrent arguments to the draw function + -- only edit i made was passing diffrent arguments to the draw function, try to avoid this local success, err = pcall(_center.draw,center_frame,_player,pre_select_action) if not success then error(err) end player.opened=center_frame end, draw=function(frame,pre_select_player,pre_select_action) - frame.caption={'admin-commands.name'} + frame.caption={'ExpGamingAdmin@4-0-0.name'} local frame = frame.add{ type='flow', direction='horizontal' @@ -137,7 +171,7 @@ Admin.center = Gui.center.add{ player_info_flow.style.width = 200 local label = dropdowns.add{ type='label', - caption={'admin-commands.message'} + caption={'ExpGamingAdmin@4-0-0.message'} } label.style.single_line = false label.style.width = 200 @@ -174,4 +208,7 @@ Admin.center = Gui.center.add{ caption=_caption }.style.visible = false end -} \ No newline at end of file +} + +-- Module Return +return AdminGui \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Gui/softmod.json b/modules/ExpGamingAdmin/Gui/softmod.json new file mode 100644 index 00000000..e53500a8 --- /dev/null +++ b/modules/ExpGamingAdmin/Gui/softmod.json @@ -0,0 +1,23 @@ +{ + "name": "Gui", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a gui that can be used to access all the admin commands.", + "location": "", + "keywords": [ + "Admin", + "ExpGaming", + "Commands", + "Gui" + ], + "author": "", + "contact": "", + "license": "", + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingCore.Gui": "^4.0.0", + "ExpGamingCore.Ranking": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0", + "ExpGamingPlayer": "?^4.0.0" + } +} \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Jail/control.lua b/modules/ExpGamingAdmin/Jail/control.lua new file mode 100644 index 00000000..da8b593f --- /dev/null +++ b/modules/ExpGamingAdmin/Jail/control.lua @@ -0,0 +1,50 @@ +--- Desction +-- @module ExpGamingAdmin.Jail@4.0.0 +-- @author +-- @license +-- @alais ThisModule + +-- Module Require +local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') +local AdminGui = require('ExpGamingAdmin.AdminGui@^4.0.0') +local Server = require('ExpGamingCore.Server@^4.0.0') +local Ranking = require('ExpGamingCore.Ranking@^4.0.0') +local Game = require('FactorioStdLib.Game@^0.8.0') +local Color -- FactorioStdLib.Color@^0.8.0 +local Sync -- ExpGamingCore.Sync@^4.0.0 + +-- Module Define +local module_verbose = false +local ThisModule = { + on_init=function() + if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end + if loaded_modules['FactorioStdLib.Color@^0.8.0'] then Sync = require('FactorioStdLib.Color@^0.8.0') end + end +} + +-- Function Define +AdminGui.add_button('jail','utility/clock',{'ExpGamingAdmin@4-0-0.tooltip-jail'},function(player,byPlayer) + Admin.open(byPlayer,player,'jail') +end) + +function Admin.jail(player,by_player,reason) + local player = Game.get_player(player) + local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' + local reason = Admin.create_reason(reason,by_player_name) + if Sync then Sync.emit_embeded{ + title='Player Jail', + color=Color.to_hex(defines.text_color.med), + description='There was a player jailed.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + ['Reason:']=reason + } end + if Admin.move_inventory then Admin.move_inventory(player) end + Ranking.meta.last_jail = player.name + Server.interface(Ranking.give_rank,true,player,'Jail',by_player_name) +end + +Admin.add_action('Jail',Admin.jail) + +-- Module Return +return ThisModule \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Jail/softmod.json b/modules/ExpGamingAdmin/Jail/softmod.json new file mode 100644 index 00000000..bd37d49d --- /dev/null +++ b/modules/ExpGamingAdmin/Jail/softmod.json @@ -0,0 +1,26 @@ +{ + "name": "Jail", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a jail function to the admin set, require ExpGamingRanking to work.", + "location": "", + "keywords": [ + "Jail", + "Ranking", + "Admin", + "ExpGaming" + ], + "author": "", + "contact": "", + "license": "", + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingAdmin.AdminGui": "^4.0.0", + "ExpGamingCore.Server": "^4.0.0", + "ExpGamingCore.Ranking": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0'", + "FactorioStdLib.Color": "?^0.8.0", + "ExpGamingCore.Sync": "?^4.0.0", + "ExpGamingAdmin.ClearInventory": "?^4.0.0" + } +} \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Kick/control.lua b/modules/ExpGamingAdmin/Kick/control.lua new file mode 100644 index 00000000..b1853868 --- /dev/null +++ b/modules/ExpGamingAdmin/Kick/control.lua @@ -0,0 +1,47 @@ +--- Desction +-- @module ExpGamingAdmin.Kick@4.0.0 +-- @author +-- @license +-- @alais ThisModule + +-- Module Require +local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') +local AdminGui = require('ExpGamingAdmin.AdminGui@^4.0.0') +local Server = require('ExpGamingCore.Server@^4.0.0') +local Game = require('FactorioStdLib.Game@^0.8.0') +local Color -- FactorioStdLib.Color@^0.8.0 +local Sync -- ExpGamingCore.Sync@^4.0.0 + +-- Module Define +local module_verbose = false +local ThisModule = { + on_init=function() + if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end + if loaded_modules['FactorioStdLib.Color@^0.8.0'] then Sync = require('FactorioStdLib.Color@^0.8.0') end + end +} +-- Function Define +AdminGui.add_button('kick','utility/warning_icon',{'ExpGamingAdmin@4-0-0.tooltip-kick'},function(player,byPlayer) + Admin.open(byPlayer,player,'kick') +end) + +function Admin.kick(player,by_player,reason) + local player = Game.get_player(player) + local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' + local reason = Admin.create_reason(reason,by_player_name) + if Sync then Sync.emit_embeded{ + title='Player Kick', + color=Color.to_hex(defines.text_color.high), + description='There was a player kicked.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + ['Reason:']=reason + } end + if Admin.move_inventory then Admin.move_inventory(player) end + Server.interface(game.kick_player,true,player,reason) +end + +Admin.add_action('Kick',Admin.kick) + +-- Module Return +return ThisModule \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Kick/softmod.json b/modules/ExpGamingAdmin/Kick/softmod.json new file mode 100644 index 00000000..7f975937 --- /dev/null +++ b/modules/ExpGamingAdmin/Kick/softmod.json @@ -0,0 +1,25 @@ +{ + "name": "Kick", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a kick function to the admin function set.", + "location": "", + "keywords": [ + "Admin", + "ExpGaming", + "Kick", + "Commands" + ], + "author": "", + "contact": "", + "license": "", + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingAdmin.AdminGui": "^4.0.0", + "ExpGamingCore.Server": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0", + "FactorioStdLib.Color": "?^0.8.0", + "ExpGamingCore.Sync": "?^4.0.0", + "ExpGamingAdmin.ClearInventory": "?^4.0.0" + } +} \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Reports/control.lua b/modules/ExpGamingAdmin/Reports/control.lua new file mode 100644 index 00000000..e12f0bd0 --- /dev/null +++ b/modules/ExpGamingAdmin/Reports/control.lua @@ -0,0 +1,126 @@ +--- Desction +-- @module ThisModule@X.Y.Z +-- @author +-- @license +-- @alais ThisModule + +-- Module Require +local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') +local Server = require('ExpGamingCore.Server@^4.0.0') +local Ranking = require('ExpGamingCore.Ranking@^4.0.0') +local Game = require('FactorioStdLib.Game@^0.8.0') +local Color = require('FactorioStdLib.Color@^0.8.0') +local Sync -- ExpGamingCore.Sync@^4.0.0 + +-- Module Define +local module_verbose = false +local ThisModule = { + on_init=function() + if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end + end +} + +-- Global Define +local global = global{ + reports={}, + varified={} +} + +-- Local Varibles +local report_to_warnings = 1 -- used in count_reports +local varified_to_warings = 3 -- used in count_reports +local reports_needed_for_jail = 6 + +-- Function Define +local function valid_players(player,by_player) + local player = Game.get_player(player) + local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' + return player, by_player_name +end + +local function report_message(player,by_player,reason) + local low_rank = Ranking.get_group('User').highest + local high_rank = Ranking.get_group('Admin').lowest + local player, by_player_name = valid_players(player,by_player) + if not player then return end + if Admin.is_banned(player,true) == 'report' then return end + Ranking.print(low_rank,{'ExpGamingAdmin@4-0-0.low-print',player.name,reason},defines.text_color.info,true) + Ranking.print(high_rank,{'ExpGamingAdmin@4-0-0.high-print',player.name,by_player_name,reason},defines.text_color.med) + if Sync then Sync.emit_embeded{ + title='Player Report', + color=Color.to_hex(defines.text_color.med), + description='A player was reported.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + ['Reason:']=reason + } end +end + +local function cheak_reports(player) + local player = Game.get_player(player) + if not player then return end + local reports = Admin.count_reports(player) + if reports >= reports_needed_for_jail and global.actions[player.name] ~= 'report-jail' and Ranking.get_rank(player).group.name ~= 'Jail' then + global.actions[player.name] = actions.report + Admin.jail(player,'','Too many user reports. Contact an Admin to be unjailed.') + end +end + +function Admin.count_reports(player) + local player = Game.get_player(player) + if not player then return 0 end + local _count = 0 + if global.reports[player.name] then + for _,report in pairs(global.reports[player.name]) do + _count=_count+report_to_warnings + end + end + if global.varified[player.name] then + for _,report in pairs(global.varified[player.name]) do + _count=_count+varified_to_warings + end + end + return _count +end + +function Admin.report(player,by_player,reason) + local player, by_player_name = valid_players(player,by_player) + if not player or Ranking.get_rank(player):allowed('no-report') then return end + if Admin.is_banned(by_player) or Ranking.get_group(by_player).name == 'Jail' then return end + if Ranking.get_rank(by_player):allowed('varified') then + global.varified[player.name] = global.varified[player.name] or {} + local reports = global.varified[player.name] + for _,value in pairs(reports) do + if value[1] == by_player_name then return end + end + table.insert(reports,{by_player_name,reason}) + else + global.reports[player.name] = global.reports[player.name] or {} + local reports = global.reports[player.name] + for _,value in pairs(reports) do + if value[1] == by_player_name then return end + end + table.insert(reports,{by_player_name,reason}) + end + report_message(player,by_player,reason) + cheak_reports(player) +end + +function Admin.clear_reports(player,by_player,no_emit) + local player, by_player_name = valid_players(player,by_player) + if not player then return end + global.reports[player.name]={} + global.varified[player.name]={} + if not no_emit and Sync then + Sync.emit_embeded{ + title='Player Clear', + color=Color.to_hex(defines.text_color.low), + description='A player had their reports cleared.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + } + end +end + +-- Module Return +return ThisModule \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Reports/softmod.json b/modules/ExpGamingAdmin/Reports/softmod.json new file mode 100644 index 00000000..c61f1d3c --- /dev/null +++ b/modules/ExpGamingAdmin/Reports/softmod.json @@ -0,0 +1,26 @@ +{ + "name": "Reports", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a report system into the game that can also push notifactions to discord.", + "location": "", + "keywords": [ + "Report", + "Player", + "Admin", + "ExpGaming", + "Player List", + "Commands" + ], + "author": "", + "contact": "", + "license": "", + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingCore.Server": "^4.0.0", + "ExpGamingCore.Ranking": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0", + "FactorioStdLib.Color": "^0.8.0", + "ExpGamingCore.Sync": "?^4.0.0" + } +} \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Teleport/control.lua b/modules/ExpGamingAdmin/Teleport/control.lua new file mode 100644 index 00000000..4f41a83f --- /dev/null +++ b/modules/ExpGamingAdmin/Teleport/control.lua @@ -0,0 +1,43 @@ +--- Desction +-- @module ExpGamingAdmin.Jail@4.0.0 +-- @author +-- @license +-- @alais ThisModule + +-- Module Require +local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') +local AdminGui = require('ExpGamingAdmin.AdminGui@^4.0.0') +local Game = require('FactorioStdLib.Game@^0.8.0') + +-- Module Define +local module_verbose = false +local ThisModule = {} + +-- Function Define +AdminGui.add_button('goto','utility/export_slot',{'ExpGamingAdmin@4-0-0.tooltip-go-to'},function(player,byPlayer) + Admin.go_to(player,byPlayer) +end) +AdminGui.add_button('bring','utility/import_slot',{'ExpGamingAdmin@4-0-0.tooltip-bring'},function(player,byPlayer) + Admin.bring(player,byPlayer) +end) + +function Admin.tp(from_playaer, to_player) + local _from_player = Game.get_player(from_player) + local _to_player = Game.get_player(to_player) + if not _from_player or not _to_player then return end + _from_player.teleport(_to_player.surface.find_non_colliding_position('player',_to_player.position,32,1),_to_player.surface) +end + +function Admin.go_to(player,by_player) + Admin.tp(by_player, player) +end + +function Admin.bring(player,by_player) + Admin.tp(player, by_player) +end + +Admin.add_action('Go To',Admin.go_to) +Admin.add_action('Bring',Admin.bring) + +-- Module Return +return ThisModule \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Teleport/softmod.json b/modules/ExpGamingAdmin/Teleport/softmod.json new file mode 100644 index 00000000..7ddc3b30 --- /dev/null +++ b/modules/ExpGamingAdmin/Teleport/softmod.json @@ -0,0 +1,24 @@ +{ + "name": "Teleport", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds three function to admin: tp, bring and go to, these all move the player.", + "location": "", + "keywords": [ + "Tp", + "Bring", + "Go To", + "Admin", + "ExpGaming", + "Teleport", + "Commands" + ], + "author": "", + "contact": "", + "license": "", + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingAdmin.AdminGui": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0" + } +} \ No newline at end of file diff --git a/modules/ExpGamingAdmin/TempBan/control.lua b/modules/ExpGamingAdmin/TempBan/control.lua new file mode 100644 index 00000000..5d7cdd50 --- /dev/null +++ b/modules/ExpGamingAdmin/TempBan/control.lua @@ -0,0 +1,46 @@ +--- Desction +-- @module ExpGamingAdmin.Kick@4.0.0 +-- @author +-- @license +-- @alais ThisModule + +-- Module Require +local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') +local Server = require('ExpGamingCore.Server@^4.0.0') +local Ranking = require('ExpGamingCore.Ranking@^4.0.0') +local Game = require('FactorioStdLib.Game@^0.8.0') +local Color = require('FactorioStdLib.Color@^0.8.0') +local Sync -- ExpGamingCore.Sync@^4.0.0 + +-- Module Define +local module_verbose = false +local ThisModule = { + on_init=function() + if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end + end +} + +-- Function Define +function Admin.temp_ban(player,by_player,reason) + local player = Game.get_player(player) + local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' + if not player or Admin.is_banned(player) then return end + Admin.set_banned(player,'temp') + if Sync then Sync.emit_embeded{ + title='Player Temp-Ban', + color=Color.to_hex(defines.text_color.high), + description='A player was jailed.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + ['Reason:']=Admin.create_reason(reason,by_player_name) + } end + game.print({'ExpGamingAdmin@4-0-0.temp-ban',player.name,by_player_name,reason},defines.text_color.info) + if Admin.move_inventory then Admin.move_inventory(player) end + Ranking.meta.last_jail = player.name + Server.interface(Ranking.give_rank,true,player,'Jail',by_player_name) +end + +Admin.add_action('Temp Ban',Admin.temp_ban) + +-- Module Return +return ThisModule \ No newline at end of file diff --git a/modules/ExpGamingAdmin/TempBan/softmod.json b/modules/ExpGamingAdmin/TempBan/softmod.json new file mode 100644 index 00000000..49d67f98 --- /dev/null +++ b/modules/ExpGamingAdmin/TempBan/softmod.json @@ -0,0 +1,26 @@ +{ + "name": "TempBan", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a temp ban function to the admin set, requires ExpGamingCore.Ranking to work.", + "location": "", + "keywords": [ + "Jail", + "Temp Ban", + "Admin", + "ExpGaming", + "Ranking" + ], + "author": "", + "contact": "", + "license": "", + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingCore.Server": "^4.0.0", + "ExpGamingCore.Ranking": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0", + "FactorioStdLib.Color": "^0.8.0", + "ExpGamingCore.Sync": "?^4.0.0", + "ExpGamingAdmin.ClearInventory": "?^4.0.0" + } +} \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Warnings/control.lua b/modules/ExpGamingAdmin/Warnings/control.lua new file mode 100644 index 00000000..674158db --- /dev/null +++ b/modules/ExpGamingAdmin/Warnings/control.lua @@ -0,0 +1,149 @@ +--- Desction +-- @module ThisModule@X.Y.Z +-- @author +-- @license +-- @alais ThisModule + +-- Module Require +local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') +local Server = require('ExpGamingCore.Server@^4.0.0') +local Ranking = require('ExpGamingCore.Ranking@^4.0.0') +local Game = require('FactorioStdLib.Game@^0.8.0') +local Color = require('FactorioStdLib.Color@^0.8.0') +local Sync -- ExpGamingCore.Sync@^4.0.0 + +-- so it can be used during on_init +local take_action = 8 -- below this number no action is taken, the first admin given warning jumps to this number +local remove_warnings_time = {} +local min_time_to_remove_warning = 18000 -- this is in ticks + +-- Module Define +local module_verbose = false +local ThisModule = { + on_init=function() + if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end + if loaded_modules['ExpGamingAdmin.Reports@^4.0.0'] then + take_action = take_action + 1 + table.insert(punishments,{'report',{'ExpGamingAdmin-Warnings@4-0-0.reported'},defines.text_color.med},take_action) + end + end, + on_post=function() + local highest = nil + for power,rank in pairs(Ranking.ranks) do + if not highest and not rank:allowed('no-report') then highest = power-1 end + local _power = power; if highest then _power = power-highest end + if rank:allowed('no-report') then remove_warnings_time[power] = 0 + else remove_warnings_time[power] = min_time_to_remove_warning*_power end + end + end +} + +-- Global Define +local global = global{} + +-- Local Varibles +local punishments = { + {'nothing'}, + {'nothing'}, + {'nothing'}, + {'nothing'}, + {'nothing'}, + {'message',{'ExpGamingAdmin-Warnings@4-0-0.message'},defines.text_color.info}, + {'message',{'ExpGamingAdmin-Warnings@4-0-0.message'},defines.text_color.info}, + {'message',{'ExpGamingAdmin-Warnings@4-0-0.kick-warn'},defines.text_color.med}, + {'kick'}, + {'message',{'ExpGamingAdmin-Warnings@4-0-0.temp-warn'},defines.text_color.high}, + {'temp-ban'}, + {'message',{'ExpGamingAdmin-Warnings@4-0-0.ban-warn'},defines.text_color.high}, + {'message',{'ExpGamingAdmin-Warnings@4-0-0.last-warn'},defines.text_color.crit}, + {'ban'} +} + +-- Function Define +local function valid_players(player,by_player) + local player = Game.get_player(player) + local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' + return player, by_player_name +end + +local function give_punishment(player,by_player,reason) + local player, by_player_name = valid_players(player,by_player) + local warnings = Admin.get_warnings(player) + local punishment = punishments[warnings] + local reason = reason or 'No Other Reason' + if not punishment or punishment[1] == 'nothing' then return + elseif punishment[1] == 'message' then + local message = punishment[2] + local colour = punishment[3] + player_return(message,colour,player) + elseif punishment[1] == 'report' then + local message = punishment[2] + local colour = punishment[3] + player_return(message,colour,player) + Admin.report(player,'',reason) + elseif punishment[1] == 'kick' then + global.actions[player.name] = actions.kick + Admin.kick(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason) + elseif punishment[1] == 'temp-ban' then + Admin.temp_ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason) + elseif punishment[1] == 'ban' then + global.actions[player.name] = actions.ban + Admin.ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason) + end +end + +function Admin.get_warnings(player) + local player = Game.get_player(player) + return global[player.name] or 0 +end + +function Admin.give_warning(player,by_player,reason,min) + local player, by_player_name = valid_players(player,by_player) + if not player then return end + local min = Game.get_player(by_player) and take_action or min or 0 + local warnings = Admin.get_warnings(player) + if warnings < min then warnings = min end + warnings = warnings+1 + global[player.name] = warnings + if warnings > take_action then + player_return({'ExpGamingAdmin-Warnings@4-0-0.warning-given-by',by_player_name},defines.text_color.info,player) + game.print({'ExpGamingAdmin-Warnings@4-0-0.player-warning',player.name,by_player_name,reason}) + end + give_punishment(player,by_player,reason) +end + +function Admin.clear_warings(player,by_player,no_emit) + local player, by_player_name = valid_players(player,by_player) + if not player then return end + global[player.name]=0 + if not no_emit and Sync then + Sync.emit_embeded{ + title='Player Clear', + color=Color.to_hex(defines.text_color.low), + description='A player had their warnings cleared.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + } + end +end + +-- Event Handlers Define +script.on_event(defines.events.on_tick,function(event) + if (game.tick % min_time_to_remove_warning) == 0 then + for name,warnings in pairs(global) do + if warnings > 0 then + local rank = Ranking.get_rank(name) + local time_to_remove = remove_warnings_time[rank.power] + if (game.tick % time_to_remove) == 0 then + global[name]=warnings-1 + if global.warnings[name] > 5 then + player_return({'ExpGamingAdmin-Warnings@4-0-0.remove-warn',global[name],tick_to_display_format(time_to_remove)},defines.text_color.low,name) + end + end + end + end + end +end) + +-- Module Return +return ThisModule \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Warnings/locale/de.cfg b/modules/ExpGamingAdmin/Warnings/locale/de.cfg new file mode 100644 index 00000000..3a62ea44 --- /dev/null +++ b/modules/ExpGamingAdmin/Warnings/locale/de.cfg @@ -0,0 +1,11 @@ +[ExpGamingAdmin-Warnings-4-0-0] +warning-given-by=This Warnings Was Given By: __1__ +player-warning=__1__ was given a warning by __2__ reason: __3__ +temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset +remove-warn=You are had a warning Removed, you have __1__ warnings, next removed in __2__ +message=You Are Currently Reciving Warnings From The Script, This Will Continue Unless You Cease And Desist +reported=You Have Been Reported To The Admins By The Script, Further Acction May Be Taken If You Do Not Cease And Desist. +kick-warn=You Are On A Warning To Be KICKED, The Script Will Auto Kick If You Do Not Cease And Desist. +temp-warn=You Are On A Warning To Be TEMP BANNED, The Script Will Auto Ban If You Do Not Cease And Desist. +ban-warn=You Are On A Warning To Be BANNED, The Script Will Auto Ban If You Do Not Cease And Desist. +last-warn=YOU ARE ON A LAST WARNING TO BE BANNED, THE SCRIPT WILL AUTO BAN IF YOU DO NOT CEASE AND DESIST. \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Warnings/locale/en.cfg b/modules/ExpGamingAdmin/Warnings/locale/en.cfg new file mode 100644 index 00000000..6378521b --- /dev/null +++ b/modules/ExpGamingAdmin/Warnings/locale/en.cfg @@ -0,0 +1,10 @@ +[ExpGamingAdmin-Warnings-4-0-0] +warning-given-by=This warning was given by: __1__ +player-warning=__1__ was given a warning by __2__ for: __3__ +remove-warn=One of your warnings expired. You have __1__ warnings left, next warning will be removed in __2__ +message=You are currently being warned by the system. These will continue until you cease and desist. +reported=You have been reported to the admins by the system. Further action may be taken if you do not cease and desist. +kick-warn=This is your last warning before you get kicked. The system will automatically kick you if you do not cease and desist. +temp-warn=This is your last warning before you get temporary banned. The system will automatically ban you if you do not cease and desist. +ban-warn=WARNING: This is your last warning before you get BANNED. The system will automatically BAN you if you do not cease and desist. +last-warn=WARNING: This is your last warning before you get PERMANENTLY BANNED. The system will automatically PERMANENTLY BAN you if you do not cease and desist. diff --git a/modules/ExpGamingAdmin/Warnings/locale/fr.cfg b/modules/ExpGamingAdmin/Warnings/locale/fr.cfg new file mode 100644 index 00000000..3a62ea44 --- /dev/null +++ b/modules/ExpGamingAdmin/Warnings/locale/fr.cfg @@ -0,0 +1,11 @@ +[ExpGamingAdmin-Warnings-4-0-0] +warning-given-by=This Warnings Was Given By: __1__ +player-warning=__1__ was given a warning by __2__ reason: __3__ +temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset +remove-warn=You are had a warning Removed, you have __1__ warnings, next removed in __2__ +message=You Are Currently Reciving Warnings From The Script, This Will Continue Unless You Cease And Desist +reported=You Have Been Reported To The Admins By The Script, Further Acction May Be Taken If You Do Not Cease And Desist. +kick-warn=You Are On A Warning To Be KICKED, The Script Will Auto Kick If You Do Not Cease And Desist. +temp-warn=You Are On A Warning To Be TEMP BANNED, The Script Will Auto Ban If You Do Not Cease And Desist. +ban-warn=You Are On A Warning To Be BANNED, The Script Will Auto Ban If You Do Not Cease And Desist. +last-warn=YOU ARE ON A LAST WARNING TO BE BANNED, THE SCRIPT WILL AUTO BAN IF YOU DO NOT CEASE AND DESIST. \ No newline at end of file diff --git a/modules/ExpGamingAdmin/Warnings/locale/nl.cfg b/modules/ExpGamingAdmin/Warnings/locale/nl.cfg new file mode 100644 index 00000000..69b8004e --- /dev/null +++ b/modules/ExpGamingAdmin/Warnings/locale/nl.cfg @@ -0,0 +1,11 @@ +[ExpGamingAdmin-Warnings-4-0-0] +warning-given-by=Deze waarschuwing is gegeven door: __1__ +player-warning=__1__ is gewaarschuwd door __2__ met de reden: __3__ +temp-ban=__1__ is verbannen door __2__ en is gejailed tot de volgende reset. +remove-warn=Een waarschuwing is verlopen. Je hebt nu nog maar __1__ waarschuwing, volgende waarschuwing verloopt in __2__ +message=Je ontvangt waarschuwingen door het systeem. Deze waarschuwingen stoppen niet tot je stopt met wat je verkeerd doet. +reported=Je bent gerapporteerd aan de administrators door het systeem. Je zal bestraft worden als je niet stopt met wat je verkeerd doet. +kick-warn=WAARSCHUWING: Dit is je laatste waarschuwing voordat je gekickt wordt. +temp-warn=WAARSCHUWING: Dit is je laatste waarschuwing voordat je tijdelijk verbannen wordt. +ban-warn=WAARSCHUWING: Dit is je laatste waarschuwing voordat je permanent verbannen wordt. +last-warn=DIT IS JE LAATSTE WAARSCHUWING. Het systeem zal je automatisch VERBANNEN als je niet stopt met wat je verkeerd doet. diff --git a/modules/ExpGamingAdmin/Warnings/locale/sv-SE.cfg b/modules/ExpGamingAdmin/Warnings/locale/sv-SE.cfg new file mode 100644 index 00000000..b130aac3 --- /dev/null +++ b/modules/ExpGamingAdmin/Warnings/locale/sv-SE.cfg @@ -0,0 +1,10 @@ +[ExpGamingAdmin-Warnings-4-0-0] +warning-given-by=Den här varningen gavs av: __1__ +player-warning=__1__ var tillfälligt bannlyst av __2__ och kommer att förbli i fängelset tills nästa återställning (reset) +remove-warn=En av dina varningar har gått ut. Du har __1__ varning kvar, nästa varning kommer at tas bort om __2__ +message=Du får för nuvarande varningar av systemet. De kommer fortsätta tills du upphör med överträdelsen. +reported= Du har blivit rapporterad till administrationen av systemet. Mer påföljd kan komma att tas om du inte upphör med överträdelsen. +kick-warn=Det här är din sista varning innan du blir sparkad. Systemet kommer att automatisk sparka dig om du inte upphör med överträdelsen +temp-warn=Det här är din sista varning innan du blir tillfälligt bannlyst. Systemet kommer att automatiskt bannlysa dig om du inte upphör överträdelsen +ban-warn=VARNING: Det här är din sista varning innan du blir bannlyst. Systemet kommer att automatisk bannlysa dig om du inte upphör med överträdelsen. +last-warn=VARNING: Det här är din sista varning innan du blir permanent bannlyst. Systemet kommer att automatiskt permanent bannlysa dig om du inte upphör med överträdelsen. diff --git a/modules/ExpGamingAdmin/Warnings/softmod.json b/modules/ExpGamingAdmin/Warnings/softmod.json new file mode 100644 index 00000000..2eadfc16 --- /dev/null +++ b/modules/ExpGamingAdmin/Warnings/softmod.json @@ -0,0 +1,28 @@ +{ + "name": "Warnings", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a warning system into the admin set which can be used by admins and the script.", + "location": "", + "keywords": [ + "Warning", + "Admin", + "ExpGaming", + "Report", + "Kick", + "Punishments", + "Ban" + ], + "author": "", + "contact": "", + "license": "", + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingCore.Server": "^4.0.0", + "ExpGamingCore.Ranking": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0", + "FactorioStdLib.Color": "^0.8.0", + "ExpGamingAdmin.Reports": "?^4.0.0", + "ExpGamingCore.Sync": "?^4.0.0" + } +} \ No newline at end of file diff --git a/modules/ExpGamingAdmin/softmod.json b/modules/ExpGamingAdmin/softmod.json new file mode 100644 index 00000000..bfd5a7f2 --- /dev/null +++ b/modules/ExpGamingAdmin/softmod.json @@ -0,0 +1,236 @@ +{ + "name": "ExpGamingAdmin", + "version": "4.0.0", + "type": "Collection", + "description": "A set of useful admin commands and functions that can be used by other modules.", + "location": "", + "keywords": [ + "Admin", + "ExpGaming", + "Set", + "Commands", + "Functions", + "Scripts", + "Useful" + ], + "author": "Cooldude2606", + "contact": "Discord: Cooldude2606#5241", + "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", + "submodules": { + "AdminLib": { + "name": "AdminLib", + "version": "4.0.0", + "type": "Submodule", + "description": "The base functions required to make the others work.", + "location": "", + "keywords": [ + "lib", + "ExpGaming", + "Admin" + ], + "dependencies": { + "FactorioStdLib": "^0.8.0", + "ExpGamingCore.Ranking": "?^4.0.0", + "ExpGamingCore.Sync": "?^4.0.0" + } + }, + "Ban": { + "name": "Ban", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a custom ban function to the admin command set.", + "location": "", + "keywords": [ + "Ban", + "Admin", + "Set", + "ExpGaming" + ], + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingAdmin.AdminGui": "^4.0.0", + "ExpGamingCore.Server": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0", + "FactorioStdLib.Color": "?^0.8.0", + "ExpGamingCore.Sync": "?^4.0.0", + "ExpGamingAdmin.ClearInventory": "?^4.0.0" + } + }, + "ClearInventory": { + "name": "ClearInventory", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a function to clear a players inventoy and move the items to spawn.", + "location": "", + "keywords": [ + "Spawn", + "Items", + "Admin", + "Move", + "Clear", + "Inventory" + ], + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0" + } + }, + "Gui": { + "name": "Gui", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a gui that can be used to access all the admin commands.", + "location": "", + "keywords": [ + "Admin", + "ExpGaming", + "Commands", + "Gui" + ], + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingCore.Gui": "^4.0.0", + "ExpGamingCore.Ranking": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0", + "ExpGamingPlayer": "?^4.0.0" + } + }, + "Jail": { + "name": "Jail", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a jail function to the admin set, require ExpGamingRanking to work.", + "location": "", + "keywords": [ + "Jail", + "Ranking", + "Admin", + "ExpGaming" + ], + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingAdmin.AdminGui": "^4.0.0", + "ExpGamingCore.Server": "^4.0.0", + "ExpGamingCore.Ranking": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0'", + "FactorioStdLib.Color": "?^0.8.0", + "ExpGamingCore.Sync": "?^4.0.0", + "ExpGamingAdmin.ClearInventory": "?^4.0.0" + } + }, + "Kick": { + "name": "Kick", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a kick function to the admin function set.", + "location": "", + "keywords": [ + "Admin", + "ExpGaming", + "Kick", + "Commands" + ], + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingAdmin.AdminGui": "^4.0.0", + "ExpGamingCore.Server": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0", + "FactorioStdLib.Color": "?^0.8.0", + "ExpGamingCore.Sync": "?^4.0.0", + "ExpGamingAdmin.ClearInventory": "?^4.0.0" + } + }, + "Reports": { + "name": "Reports", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a report system into the game that can also push notifactions to discord.", + "location": "", + "keywords": [ + "Report", + "Player", + "Admin", + "ExpGaming", + "Player List", + "Commands" + ], + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingCore.Server": "^4.0.0", + "ExpGamingCore.Ranking": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0", + "FactorioStdLib.Color": "^0.8.0", + "ExpGamingCore.Sync": "?^4.0.0" + } + }, + "Teleport": { + "name": "Teleport", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds three function to admin: tp, bring and go to, these all move the player.", + "location": "", + "keywords": [ + "Tp", + "Bring", + "Go To", + "Admin", + "ExpGaming", + "Teleport", + "Commands" + ], + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingAdmin.AdminGui": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0" + } + }, + "TempBan": { + "name": "TempBan", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a temp ban function to the admin set, requires ExpGamingCore.Ranking to work.", + "location": "", + "keywords": [ + "Jail", + "Temp Ban", + "Admin", + "ExpGaming", + "Ranking" + ], + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingCore.Server": "^4.0.0", + "ExpGamingCore.Ranking": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0", + "FactorioStdLib.Color": "^0.8.0", + "ExpGamingCore.Sync": "?^4.0.0", + "ExpGamingAdmin.ClearInventory": "?^4.0.0" + } + }, + "Warnings": { + "name": "Warnings", + "version": "4.0.0", + "type": "Submodule", + "description": "Adds a warning system into the admin set which can be used by admins and the script.", + "location": "", + "keywords": [ + "Warning", + "Admin", + "ExpGaming", + "Report", + "Kick", + "Punishments", + "Ban" + ], + "dependencies": { + "ExpGamingAdmin.AdminLib": "^4.0.0", + "ExpGamingCore.Server": "^4.0.0", + "ExpGamingCore.Ranking": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0", + "FactorioStdLib.Color": "^0.8.0", + "ExpGamingAdmin.Reports": "?^4.0.0", + "ExpGamingCore.Sync": "?^4.0.0" + } + } + } +} \ No newline at end of file diff --git a/modules/ExpGamingBot/autoChat/softmod.json b/modules/ExpGamingBot/autoChat/softmod.json index bf81fd8b..27d138bc 100644 --- a/modules/ExpGamingBot/autoChat/softmod.json +++ b/modules/ExpGamingBot/autoChat/softmod.json @@ -6,9 +6,9 @@ "location": "", "keywords": [ "Chat", - " Bot", - " Jokes", - " Fun" + "Bot", + "Jokes", + "Fun" ], "dependencies": { "FactorioStdLib.Game": "^0.8.0", diff --git a/modules/ExpGamingBot/autoMessage/softmod.json b/modules/ExpGamingBot/autoMessage/softmod.json index a86c7c8d..4b73d181 100644 --- a/modules/ExpGamingBot/autoMessage/softmod.json +++ b/modules/ExpGamingBot/autoMessage/softmod.json @@ -6,9 +6,9 @@ "location": "", "keywords": [ "Bot", - " Chat", - " Auto Message", - " Message" + "Chat", + "Auto Message", + "Message" ], "dependencies": { "ExpGamingCore.Server": "^4.0.0", diff --git a/modules/ExpGamingBot/discordAlerts/softmod.json b/modules/ExpGamingBot/discordAlerts/softmod.json index 964b4957..6d6e18c7 100644 --- a/modules/ExpGamingBot/discordAlerts/softmod.json +++ b/modules/ExpGamingBot/discordAlerts/softmod.json @@ -6,10 +6,10 @@ "location": "", "keywords": [ "Bot", - " Discord", - " Alerts", - " Messages", - " Acctions" + "Discord", + "Alerts", + "Messages", + "Acctions" ], "dependencies": { "ExpGamingCore.Sync": "^4.0.0", diff --git a/modules/ExpGamingBot/softmod.json b/modules/ExpGamingBot/softmod.json index 9d8259aa..2fe22b06 100644 --- a/modules/ExpGamingBot/softmod.json +++ b/modules/ExpGamingBot/softmod.json @@ -6,10 +6,10 @@ "location": "", "keywords": [ "Discord", - " Bot", - " Messages", - " Chat", - " Auto" + "Bot", + "Messages", + "Chat", + "Auto" ], "author": "Cooldude2606", "contact": "Discord: Cooldude2606#5241", @@ -23,9 +23,9 @@ "location": "", "keywords": [ "Chat", - " Bot", - " Jokes", - " Fun" + "Bot", + "Jokes", + "Fun" ], "dependencies": { "FactorioStdLib.Game": "^0.8.0", @@ -41,9 +41,9 @@ "location": "", "keywords": [ "Bot", - " Chat", - " Auto Message", - " Message" + "Chat", + "Auto Message", + "Message" ], "dependencies": { "ExpGamingCore.Server": "^4.0.0", @@ -61,10 +61,10 @@ "location": "", "keywords": [ "Bot", - " Discord", - " Alerts", - " Messages", - " Acctions" + "Discord", + "Alerts", + "Messages", + "Acctions" ], "dependencies": { "ExpGamingCore.Sync": "^4.0.0", diff --git a/modules/ExpGamingCommands/admin/control.lua b/modules/ExpGamingCommands/admin/control.lua index b5b01f45..fcbe67ae 100644 --- a/modules/ExpGamingCommands/admin/control.lua +++ b/modules/ExpGamingCommands/admin/control.lua @@ -7,6 +7,15 @@ local Admin = require('ExpGamingAdmin') +--- Used to clear all parts of a player, removing warnings, reports, jail and temp ban +-- @command clear-all +-- @param player the player to clear +commands.add_command('clear-all', 'Clears a player of any temp-ban, reports or warnings', { + ['player']={true,'player'} +}, function(event,args) + Admin.clear_player(args.player,event.player_index) +end) + return { on_init = function(self) if loaded_modules['ExpGamingAdmin.TempBan'] then verbose('ExpGamingAdmin.TempBan is installed; Loading tempban src') require(module_path..'/src/tempban',{Admin=Admin}) end diff --git a/modules/ExpGamingCommands/admin/src/clear.lua b/modules/ExpGamingCommands/admin/src/clear.lua index 81d2441a..29392ab1 100644 --- a/modules/ExpGamingCommands/admin/src/clear.lua +++ b/modules/ExpGamingCommands/admin/src/clear.lua @@ -7,6 +7,6 @@ commands.add_command('clear-inv', 'Clears a player\'s invetory', { ['player'] = {true,'player-rank'} }, function(event,args) local player = args.player - if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end + if Admin.is_banned(player) then player_return({'ExpGamingAdmin@4-0-0.cant-report-ban',args.player}) return commands.error end Admin.move_inventory(player) end) diff --git a/modules/ExpGamingCommands/admin/src/jail.lua b/modules/ExpGamingCommands/admin/src/jail.lua index 5a4c8831..710dfebd 100644 --- a/modules/ExpGamingCommands/admin/src/jail.lua +++ b/modules/ExpGamingCommands/admin/src/jail.lua @@ -11,7 +11,7 @@ commands.add_command('jail', 'Jails a player', { }, function(event,args) local player = args.player local reason = args.reason - if Ranking.get_rank(player):allowed('no-report') then player_return({'reports.cant-report',args.player}) return commands.error end + if Ranking.get_rank(player):allowed('no-report') then player_return({'ExpGamingAdmin@4-0-0.cant-report',args.player}) return commands.error end if Admin.is_banned(player) then player_return({'commands.cant-report-ban',args.player}) return commands.error end Admin.jail(player,event.player_index,reason) end) diff --git a/modules/ExpGamingCommands/admin/src/report.lua b/modules/ExpGamingCommands/admin/src/report.lua index 8a300243..50a5ad47 100644 --- a/modules/ExpGamingCommands/admin/src/report.lua +++ b/modules/ExpGamingCommands/admin/src/report.lua @@ -12,10 +12,10 @@ commands.add_command('report', 'Reports a player', { local _player = Game.get_player(event) local player = args.player local reason = args.reason - if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end - if Ranking.get_rank(player):allowed('no-report') then player_return({'reports.cant-report',args.player}) return commands.error end - for _,report in pairs(global.addons.reports.reports) do if report[1] == _player.name then player_return({'reports.cant-report',args.player}) return commands.error end end - for _,report in pairs(global.addons.reports.varified) do if report[1] == _player.name then player_return({'reports.cant-report',args.player}) return commands.error end end + if Admin.is_banned(player) then player_return({'ExpGamingAdmin@4-0-0.cant-report-ban',args.player}) return commands.error end + if Ranking.get_rank(player):allowed('no-report') then player_return({'ExpGamingAdmin@4-0-0.cant-report',args.player}) return commands.error end + for _,report in pairs(global.addons.reports.reports) do if report[1] == _player.name then player_return({'ExpGamingAdmin@4-0-0.cant-report',args.player}) return commands.error end end + for _,report in pairs(global.addons.reports.varified) do if report[1] == _player.name then player_return({'ExpGamingAdmin@4-0-0.cant-report',args.player}) return commands.error end end Admin.report(player,event.player_index,reason) end) diff --git a/modules/ExpGamingCommands/admin/src/tempban.lua b/modules/ExpGamingCommands/admin/src/tempban.lua index 1a55c690..64d93427 100644 --- a/modules/ExpGamingCommands/admin/src/tempban.lua +++ b/modules/ExpGamingCommands/admin/src/tempban.lua @@ -10,15 +10,6 @@ commands.add_command('temp-ban', 'Temporarily ban a player', { }, function(event,args) local player = args.player local reason = args.reason - if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end + if Admin.is_banned(player) then player_return({'ExpGamingAdmin@4-0-0.cant-report-ban',args.player}) return commands.error end Admin.temp_ban(player,event.player_index,reason) -end) - ---- Used to clear all parts of a player, removing warnings, reports, jail and temp ban --- @command clear-all --- @param player the player to clear -commands.add_command('clear-all', 'Clears a player of any temp-ban, reports or warnings', { - ['player']={true,'player'} -}, function(event,args) - Admin.clear_player(args.player,event.player_index) end) \ No newline at end of file diff --git a/modules/ExpGamingCommands/admin/src/warnings.lua b/modules/ExpGamingCommands/admin/src/warnings.lua index 2a389eb9..61375731 100644 --- a/modules/ExpGamingCommands/admin/src/warnings.lua +++ b/modules/ExpGamingCommands/admin/src/warnings.lua @@ -11,8 +11,8 @@ commands.add_command('warn', 'Gives a player a warning', { }, function(event,args) local player = args.player local reason = args.reason - if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end - if Ranking.get_rank(player):allowed('no-report') then player_return({'reports.cant-report',args.player}) return commands.error end + if Admin.is_banned(player) then player_return({'ExpGamingAdmin@4-0-0.cant-report-ban',args.player}) return commands.error end + if Ranking.get_rank(player):allowed('no-report') then player_return({'ExpGamingAdmin@4-0-0.cant-report',args.player}) return commands.error end Admin.give_warning(player,event.player_index,reason) end) @@ -23,6 +23,6 @@ commands.add_command('clear-warnings', 'Clears a player\'s warnings', { ['player'] = {true,'player'} }, function(event,args) local player = args.player - if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end + if Admin.is_banned(player) then player_return({'ExpGamingAdmin@4-0-0.cant-report-ban',args.player}) return commands.error end Admin.clear_warings(player,event.player_index) end) \ No newline at end of file diff --git a/modules/ExpGamingCore/Gui/src/center.lua b/modules/ExpGamingCore/Gui/src/center.lua index 73cc2b30..639521b0 100644 --- a/modules/ExpGamingCore/Gui/src/center.lua +++ b/modules/ExpGamingCore/Gui/src/center.lua @@ -37,6 +37,7 @@ end -- @treturn table the gui element flow function center.get_flow(player) local player = Game.get_player(player) + if not player then error('Invalid player') end return player.gui.center.exp_center or player.gui.center.add{name='exp_center',type='flow'} end @@ -47,6 +48,7 @@ end -- @treturn boelon based on if it successed or not function center.open(player,center) local player = Game.get_player(player) + if not player then error('Invalid player') return false end Gui.center.clear(player) if not Gui.data.center[center] then return false end Gui.data.center[center].open{ @@ -64,6 +66,7 @@ end -- @treturn boelon based on if it successed or not function center.open_tab(player,center,tab) local player = Game.get_player(player) + if not player then error('Invalid player') end if not Gui.center.open(player,center) then return false end local name = center..'_'..tab if not Gui.data.inputs_button[name] then return false end diff --git a/modules/ExpGamingCore/Sync/control.lua b/modules/ExpGamingCore/Sync/control.lua index c13d4024..164e70f8 100644 --- a/modules/ExpGamingCore/Sync/control.lua +++ b/modules/ExpGamingCore/Sync/control.lua @@ -29,6 +29,7 @@ local global = global{ server_description='A factorio server for everyone', reset_time='On Demand', time='Day Mth 00 00:00:00 UTC Year', + date='0000/00/00', time_set={0,'0.00M'}, last_update={0,'0.00M'}, time_period={18000,'5.00M'}, @@ -282,12 +283,12 @@ end -- @usage Sync.time -- string -- @tparam[opt=nil] string set the date time to be set -- @treturn boolean if the datetime set was successful -Sync.time=add_metatable({},function(set) +Sync.time=add_metatable({},function(full,date) local info = Sync.info - if not is_type(set,'string') then return false end - info.time = set - info.time_set[1] = game.tick - info.time_set[2] = tick_to_display_format(game.tick) + if not is_type(full,'string') then return false end + info.time = full + info.date = date + info.time_set[1] = Sync.tick_format(game.tick) return true end,function() local info = Sync.info return info.time..' (+'..(game.tick-info.time_set[1])..' Ticks)' end) diff --git a/modules/index.lua b/modules/index.lua deleted file mode 100644 index 46350d70..00000000 --- a/modules/index.lua +++ /dev/null @@ -1,10 +0,0 @@ --- not_luadoc=true ---- Used to index the files to be loaded -return { - ['GlobalLib-ExpGamingLib']='./modules/ExpGamingLib', - ['commands']='./modules/ExpGamingCore/Commands', - ['Gui']='./modules/ExpGamingCore/Gui', - ['Ranking']='./modules/ExpGamingCore/Ranking', - ['Server']='./modules/ExpGamingCore/Server', - ['Sync']='./modules/ExpGamingCore/Sync', -} \ No newline at end of file diff --git a/to convert/Addons/Admin/admin.lua b/to convert/Addons/Admin/admin.lua deleted file mode 100644 index 7523c739..00000000 --- a/to convert/Addons/Admin/admin.lua +++ /dev/null @@ -1,229 +0,0 @@ ---[[ -Explosive Gaming - -This file can be used with permission but this and the credit below must remain in the file. -Contact a member of management on our discord to seek permission to use our code. -Any changes that you may make to the code are yours but that does not make the script yours. -Discord: https://discord.gg/r6dC2uK -]] ---Please Only Edit Below This Line----------------------------------------------------------- - -Admin = Admin or {} - -local function append_name(reason,name) - local reason = reason or 'No Reason' - if not string.find(string.lower(reason),string.lower(name)) then return reason..' - '..name - else return reason end -end - -local function open(player,pre_select_player,pre_select_action) - if Admin.center then Gui.center.clear(player) Admin.center.open(player,pre_select_player,pre_select_action) end -end - -function Admin.allowed(player) - local player = Game.get_player(player) - local lowest_admin_power = Ranking.get_group('Admin').lowest.power - return lowest_admin_power >= Ranking.get_rank(player).power -end - -function Admin.btn_flow(frame,buttons) - local frame = frame.add{ - type='flow', - name='admin' - } - frame.add{ - type='label', - caption='', - name='player' - }.style.visible = false - local function format(btn) - btn.style.height = 30 - btn.style.width = 30 - end - if not buttons or buttons.ban then format(Admin.ban_btn:draw(frame)) end - if not buttons or buttons.kick then format(Admin.kick_btn:draw(frame)) end - if not buttons or buttons.jail then format(Admin.jail_btn:draw(frame)) end - if not buttons or buttons.go_to then format(Admin.go_to_btn:draw(frame)) end - if not buttons or buttons.bring then format(Admin.bring_btn:draw(frame)) end - return frame.player -end - -function Admin.take_action(action,player,by_player,reason) - if action == 'Ban' then Admin.ban(player,by_player,reason) - elseif action == 'Temp Ban' and Admin.temp_ban then Admin.temp_ban(player,by_player,reason) - elseif action == 'Kick' then Admin.kick(player,by_player,reason) - elseif action == 'Jail' then Admin.jail(player,by_player,reason) - elseif action == 'GoTo' then Admin.go_to(player,by_player) - elseif action == 'Bring' then Admin.bring(player,by_player) - end -end - -local inventorys = { - defines.inventory.player_main, - defines.inventory.player_quickbar, - defines.inventory.player_trash, - defines.inventory.player_guns, - defines.inventory.player_ammo, - defines.inventory.player_armor, - defines.inventory.player_armor -} - -function Admin.move_item_to_spawn(item,surface,chests) - local chests = chests or surface.find_entities_filtered{area={{-10,-10},{10,10}},name='iron-chest'} or {} - local chest = nil - while not chest or not chest.get_inventory(defines.inventory.chest).can_insert(item) do - chest = table.remove(chests,1) - if not chest then chest = surface.create_entity{ - name='iron-chest', - position=surface.find_non_colliding_position('iron-chest',{0,0},32,1) - } end - end - chest.get_inventory(defines.inventory.chest).insert(item) - table.insert(chests,chest) - return chests -end - -function Admin.move_inventory(player) - local player = Game.get_player(player) - if not player then return end - local chests = player.surface.find_entities_filtered{area={{-10,-10},{10,10}},name='iron-chest'} or {} - for _,_inventory in pairs(inventorys) do - local inventory = player.get_inventory(_inventory) - if inventory then - for item,count in pairs(inventory.get_contents()) do - local item = {name=item,count=count} - chests = Admin.move_item_to_spawn(item,player.surface,chests) - end - inventory.clear() - end - end -end - -Admin.ban_btn = Gui.inputs.add{ - type='button', - name='admin-ban', - caption='utility/danger_icon', - tooltip={'admin-commands.tooltip-ban'} -}:on_event('click',function(event) - local parent = event.element.parent - pre_select_player = parent.player and parent.player.caption or nil - open(event.player_index,pre_select_player,'Ban') -end) - -function Admin.ban(player,by_player,reason) - local player = Game.get_player(player) - local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' - local reason = append_name(reason,by_player_name) - Sync.emit_embeded{ - title='Player Ban', - color=Color.to_hex(defines.text_color.crit), - description='There was a player banned.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player_name, - ['Reason:']=reason - } - Admin.move_inventory(player) - Server.interface(game.ban_player,true,player,reason) -end - -Admin.kick_btn = Gui.inputs.add{ - type='button', - name='admin-kick', - caption='utility/warning_icon', - tooltip={'admin-commands.tooltip-kick'} -}:on_event('click',function(event) - local parent = event.element.parent - pre_select_player = parent.player and parent.player.caption or nil - open(event.player_index,pre_select_player,'Kick') -end) - -function Admin.kick(player,by_player,reason) - local player = Game.get_player(player) - local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' - local reason = append_name(reason,by_player_name) - Sync.emit_embeded{ - title='Player Kick', - color=Color.to_hex(defines.text_color.high), - description='There was a player kicked.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player_name, - ['Reason:']=reason - } - Admin.move_inventory(player) - Server.interface(game.kick_player,true,player,reason) -end - -Admin.jail_btn = Gui.inputs.add{ - type='button', - name='admin-jail', - caption='utility/clock', - tooltip={'admin-commands.tooltip-jail'} -}:on_event('click',function(event) - local parent = event.element.parent - pre_select_player = parent.player and parent.player.caption or nil - open(event.player_index,pre_select_player,'Jail') -end) - -function Admin.jail(player,by_player,reason) - local player = Game.get_player(player) - local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' - local reason = append_name(reason,by_player_name) - Sync.emit_embeded{ - title='Player Jail', - color=Color.to_hex(defines.text_color.med), - description='There was a player jailed.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player_name, - ['Reason:']=reason - } - Admin.move_inventory(player) - Ranking._presets().last_jail = player.name - Server.interface(Ranking.give_rank,true,player,'Jail',by_player_name) -end - -Admin.go_to_btn = Gui.inputs.add{ - type='button', - name='admin-go-to', - caption='utility/export_slot', - tooltip={'admin-commands.tooltip-go-to'} -}:on_event('click',function(event) - local parent = event.element.parent - pre_select_player = parent.player and parent.player.caption or nil - Admin.go_to(pre_select_player,event.player_index) -end) - -function Admin.go_to(player,by_player) - local player = Game.get_player(player) - local _player = Game.get_player(by_player) - _player.teleport(player.surface.find_non_colliding_position('player',player.position,32,1),player.surface) -end - -Admin.bring_btn = Gui.inputs.add{ - type='button', - name='admin-bring', - caption='utility/import_slot', - tooltip={'admin-commands.tooltip-bring'} -}:on_event('click',function(event) - local parent = event.element.parent - pre_select_player = parent.player and parent.player.caption or nil - Admin.bring(pre_select_player,event.player_index) -end) - -function Admin.bring(player,by_player) - local player = Game.get_player(player) - local _player = Game.get_player(by_player) - if not player or not _player then return end - player.teleport(_player.surface.find_non_colliding_position('player',_player.position,32,1),_player.surface) -end - -function Admin.tp(from_playaer, to_player) - local _from_player = Game.get_player(from_player) - local _to_player = Game.get_player(to_player) - - if not _from_player or not _to_player then return end - - if Game.players[_from_player].health >= 0 then return end - if Game.players[_to_player].health >= 0 then return end - - _from_player.teleport(_to_player.surface.find_non_colliding_position('player',_to_player.position,32,1),_to_player.surface) -end diff --git a/to convert/Addons/Admin/reports.lua b/to convert/Addons/Admin/reports.lua deleted file mode 100644 index ccea1637..00000000 --- a/to convert/Addons/Admin/reports.lua +++ /dev/null @@ -1,276 +0,0 @@ ---[[ -Explosive Gaming - -This file can be used with permission but this and the credit below must remain in the file. -Contact a member of management on our discord to seek permission to use our code. -Any changes that you may make to the code are yours but that does not make the script yours. -Discord: https://discord.gg/r6dC2uK -]] ---Please Only Edit Below This Line----------------------------------------------------------- - -local report_to_warnings = 1 -- used in count_reports -local varified_to_warings = 3 -- used in count_reports -local reports_needed_for_jail = 6 -local min_time_to_remove_warning = 18000 -- this is in ticks -local take_action = 8 -- below this number no action is taken, the first admin given warning jumps to this number -local punishments = { - {'nothing'}, - {'nothing'}, - {'nothing'}, - {'nothing'}, - {'nothing'}, - {'message',{'reports.message'},defines.text_color.info}, - {'message',{'reports.message'},defines.text_color.info}, - {'report',{'reports.reported'},defines.text_color.med}, - {'message',{'reports.kick-warn'},defines.text_color.med}, - {'kick'}, - {'message',{'reports.temp-warn'},defines.text_color.high}, - {'temp-ban'}, - {'message',{'reports.ban-warn'},defines.text_color.high}, - {'message',{'reports.last-warn'},defines.text_color.crit}, - {'ban'} -} - -local actions = { - none=0, - report=1, - jail=2, - kick=3, - temp=4, - ban=5 -} - -local function valid_players(player,by_player) - local player = Game.get_player(player) - local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' - local rank = Ranking.get_rank(by_player_name) - return player, by_player_name, rank -end - -local function _reports(reset) - global.addons = not reset and global.addons or {} - global.addons.reports = not reset and global.addons.reports or {warnings={},reports={},varified={},actions={}} - return global.addons.reports -end - -local function get_warnings(player) - local player = Game.get_player(player) - return _reports().warnings[player.name] or 0 -end - -local function report_message(player,by_player,reason) - local low_rank = Ranking.get_group('User').highest - local high_rank = Ranking.get_group('Admin').lowest - local player, by_player_name = valid_players(player,by_player) - if not player then return end - if _reports().actions[player.name] == actions.report then return end - Ranking.print(low_rank,{'reports.low-print',player.name,reason},defines.text_color.info,true) - Ranking.print(high_rank,{'reports.high-print',player.name,by_player_name,reason},defines.text_color.med) - Sync.emit_embeded{ - title='Player Report', - color=Color.to_hex(defines.text_color.med), - description='A player was reported.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player_name, - ['Reason:']=reason - } -end - -local function count_reports(player) - local player = Game.get_player(player) - if not player then return 0 end - local _count = 0 - local data = _reports() - if data.reports[player.name] then - for _,report in pairs(data.reports[player.name]) do - _count=_count+report_to_warnings - end - end - if data.varified[player.name] then - for _,report in pairs(data.varified[player.name]) do - _count=_count+varified_to_warings - end - end - return _count -end - -local function cheak_reports(player) - local player = Game.get_player(player) - if not player then return end - local reports = count_reports(player) - if reports >= reports_needed_for_jail and _reports().actions[player.name] ~= 'report-jail' and Ranking.get_rank(player).group.name ~= 'Jail' then - _reports().actions[player.name] = actions.report - Admin.jail(player,'','Too many user reports. Contact an Admin to be unjailed.') - end -end - -local function give_punishment(player,by_player,reason) - local player, by_player_name = valid_players(player,by_player) - local warnings = get_warnings(player) - local punishment = punishments[warnings] - local reason = reason or 'No Other Reason' - if not punishment or punishment[1] == 'nothing' then return - elseif punishment[1] == 'message' then - local message = punishment[2] - local colour = punishment[3] - player_return(message,colour,player) - elseif punishment[1] == 'report' then - local message = punishment[2] - local colour = punishment[3] - player_return(message,colour,player) - report_message(player,'',reason) - elseif punishment[1] == 'kick' then - _reports().actions[player.name] = actions.kick - Admin.kick(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason) - elseif punishment[1] == 'temp-ban' then - --_reports().actions[player.name] = actions.temp -- see Admin.temp-ban - Admin.temp_ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason) - elseif punishment[1] == 'ban' then - _reports().actions[player.name] = actions.ban - Admin.ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason) - end -end - -function Admin.give_warning(player,by_player,reason,min) - local player, by_player_name = valid_players(player,by_player) - if not player then return end - local min = Game.get_player(by_player) and take_action or min or 0 - local warnings = get_warnings(player) - if warnings < min then warnings = min end - warnings = warnings+1 - _reports().warnings[player.name] = warnings - if warnings > take_action then - player_return({'reports.warning-given-by',by_player_name},defines.text_color.info,player) - game.print({'reports.player-warning',player.name,by_player_name,reason}) - end - give_punishment(player,by_player,reason) -end - -function Admin.report(player,by_player,reason) - local player, by_player_name = valid_players(player,by_player) - if not player or Ranking.get_rank(player):allowed('no-report') then return end - if Admin.is_banned(by_player) or Ranking.get_group(by_player).name == 'Jail' then return end - if Ranking.get_rank(by_player):allowed('varified') then - _reports().varified[player.name] = _reports().varified[player.name] or {} - local reports = _reports().varified[player.name] - for _,value in pairs(reports) do - if value[1] == by_player_name then return end - end - table.insert(reports,{by_player_name,reason}) - else - _reports().reports[player.name] = _reports().reports[player.name] or {} - local reports = _reports().reports[player.name] - for _,value in pairs(reports) do - if value[1] == by_player_name then return end - end - table.insert(reports,{by_player_name,reason}) - end - report_message(player,by_player,reason) - cheak_reports(player) -end - -function Admin.clear_warings(player,by_player,no_emit) - local player, by_player_name = valid_players(player,by_player) - if not player then return end - _reports().warnings[player.name]=0 - if not no_emit then - Sync.emit_embeded{ - title='Player Clear', - color=Color.to_hex(defines.text_color.low), - description='A player had their warnings cleared.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player_name, - } - end -end - -function Admin.clear_reports(player,by_player,no_emit) - local player, by_player_name = valid_players(player,by_player) - if not player then return end - _reports().reports[player.name]={} - _reports().varified[player.name]={} - if not no_emit then - Sync.emit_embeded{ - title='Player Clear', - color=Color.to_hex(defines.text_color.low), - description='A player had their reports cleared.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player_name, - } - end -end - -function Admin.clear_player(player,by_player) - local player, by_player_name = valid_players(player,by_player) - if not player then return end - Admin.clear_warings(player,by_player,true) - Admin.clear_reports(player,by_player,true) - _reports().actions[player.name]=actions.none - if Ranking.get_rank(player).group.name == 'Jail' then Server.interface(Ranking.revert,true,player,by_player) end - Sync.emit_embeded{ - title='Player Clear', - color=Color.to_hex(defines.text_color.low), - description='A player had their reports and warnings cleared.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player_name, - } -end - -function Admin.temp_ban(player,by_player,reason) - local function append_name(reason,name) - local reason = reason or 'No Reason' - if not string.find(string.lower(reason),string.lower(name)) then return reason..' - '..name - else return reason end - end - local player, by_player_name = valid_players(player,by_player) - if not player or Admin.is_banned(player) then return end - _reports().actions[player.name] = actions.temp - Sync.emit_embeded{ - title='Player Temp-Ban', - color=Color.to_hex(defines.text_color.high), - description='A player was jailed.', - ['Player:']='<>'..player.name, - ['By:']='<>'..by_player_name, - ['Reason:']=append_name(reason,by_player_name) - } - game.print({'reports.temp-ban',player.name,by_player_name,reason},defines.text_color.info) - Admin.move_inventory(player) - Ranking._presets().last_jail = player.name - Server.interface(Ranking.give_rank,true,player,'Jail',by_player_name) -end - -function Admin.is_banned(player) - local player=Game.get_player(player) - if not player then return false end - local action = _reports().actions[player.name] - if action == actions.temp then return 'temp' - elseif action == actions.ban then return true - else return false end -end - -Event.register(defines.events.on_tick,function(event) - if not _reports().remove_warnings_time then - _reports().remove_warnings_time = {} - local highest = nil - for power,rank in pairs(Ranking._ranks()) do - if not highest and not rank:allowed('no-report') then highest = power-1 end - local _power = power; if highest then _power = power-highest end - if rank:allowed('no-report') then _reports().remove_warnings_time[power] = 0 - else _reports().remove_warnings_time[power] = min_time_to_remove_warning*_power end - end - end - if (game.tick % min_time_to_remove_warning) == 0 then - for name,warnings in pairs(_reports().warnings) do - if warnings > 0 then - local rank = Ranking.get_rank(name) - local time_to_remove = _reports().remove_warnings_time[rank.power] - if (game.tick % time_to_remove) == 0 then - _reports().warnings[name]=warnings-1 - if _reports().warnings[name] > 5 then - player_return({'reports.remove-warn',_reports().warnings[name],tick_to_display_format(time_to_remove)},defines.text_color.low,name) - end - end - end - end - end -end) diff --git a/to convert/Addons/Guis/announcements.lua b/to convert/Addons/Guis/announcements.lua index 9de20b06..372a34e2 100644 --- a/to convert/Addons/Guis/announcements.lua +++ b/to convert/Addons/Guis/announcements.lua @@ -30,7 +30,7 @@ local send_popup = Gui.inputs.add{ name='send-annoncement', caption='utility/export_slot' }:on_event('click',function(event) - local meta_data = Ranking._presets().meta + local meta_data = Ranking.meta local default = Ranking.get_rank(meta_data.default) local player = Game.get_player(event) local rank = Ranking.get_rank(player) diff --git a/to convert/Addons/Guis/reports.lua b/to convert/Addons/Guis/reports.lua index 5205775c..510a1e7e 100644 --- a/to convert/Addons/Guis/reports.lua +++ b/to convert/Addons/Guis/reports.lua @@ -12,7 +12,7 @@ local confirm_report = Gui.inputs.add{ type='button', name='admin-report-confirm', caption='utility/spawn_flag', - tooltip={'reports.name'} + tooltip={ExpGamingAdmin@4-0-0.name'} }:on_event('click',function(event) local parent = event.element.parent local player = Game.get_player(parent.player.caption) @@ -25,7 +25,7 @@ Admin.report_btn = Gui.inputs.add{ type='button', name='admin-report', caption='utility/spawn_flag', - tooltip={'reports.name'} + tooltip={ExpGamingAdmin@4-0-0.name'} }:on_event('click',function(event) local parent = event.element.parent local player = Game.get_player(parent.children[1].name) @@ -37,7 +37,7 @@ Admin.report_btn = Gui.inputs.add{ name='report-gui' } _player.opened=frame - frame.caption={'reports.name'} + frame.caption={ExpGamingAdmin@4-0-0.name'} frame.add{ type='textfield', name='reason'