Moved reports to control

This commit is contained in:
Cooldude2606
2019-06-21 22:00:15 +01:00
parent 4626f0d58f
commit fec4f0c184
83 changed files with 33670 additions and 8768 deletions

View File

@@ -1,6 +1,6 @@
local Roles = require 'expcore.roles'
local Commands = require 'expcore.commands'
local ReportsControl = require 'modules.addons.reports-control'
local Reports = require 'modules.control.reports'
local format_chat_player_name = ext_require('expcore.common','format_chat_player_name')
require 'config.expcore-commands.parse_general'
@@ -20,7 +20,7 @@ end)
:register(function(player,action_player,reason,raw)
local action_player_name_color = format_chat_player_name(action_player)
local by_player_name_color = format_chat_player_name(player)
if ReportsControl.report_player(action_player,reason,player.name) then
if Reports.report_player(action_player,player.name,reason) then
game.print{'expcom-report.non-admin',action_player_name_color,reason}
Roles.print_to_roles_higher('Trainee',{'expcom-report.admin',action_player_name_color,by_player_name_color,reason})
else
@@ -33,7 +33,7 @@ Commands.new_command('get-reports','Gets a list of all reports that a player has
:add_alias('reports','list-reports')
:register(function(player,action_player,raw)
if action_player then
local reports = ReportsControl.get_player_reports(action_player)
local reports = Reports.get_reports(action_player)
local action_player_name_color = format_chat_player_name(action_player)
Commands.print{'expcom-report.player-report-title',action_player_name_color}
for player_name,reason in pairs(reports) do
@@ -41,11 +41,11 @@ Commands.new_command('get-reports','Gets a list of all reports that a player has
Commands.print{'expcom-report.list',by_player_name_color,reason}
end
else
local user_reports = ReportsControl.user_reports
local user_reports = Reports.user_reports
Commands.print{'expcom-report.player-count-title'}
for player_name,reports in pairs(user_reports) do
local player_name_color = format_chat_player_name(player_name)
local report_count = ReportsControl.count_player_reports(player_name)
local report_count = Reports.count_reports(player_name)
Commands.print{'expcom-report.list',player_name_color,report_count}
end
end
@@ -56,11 +56,11 @@ Commands.new_command('clear-reports','Clears all reports from a player or just t
:add_param('from-player',true,'player')
:register(function(player,action_player,from_player,raw)
if from_player then
if not ReportsControl.remove_player_report(action_player,from_player.name) then
if not Reports.remove_report(action_player,from_player.name,player.name) then
return Commands.error{'expcom-report.not-reported'}
end
else
if not ReportsControl.clear_player_reports(action_player) then
if not Reports.remove_all(action_player,player.name) then
return Commands.error{'expcom-report.not-reported'}
end
end