mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-31 13:01:39 +09:00
Debuged Command Parse for Roles
This commit is contained in:
@@ -4,7 +4,7 @@ local Roles = require 'expcore.roles'
|
|||||||
require 'config.command_parse_general'
|
require 'config.command_parse_general'
|
||||||
|
|
||||||
Commands.add_parse('role',function(input,player,reject)
|
Commands.add_parse('role',function(input,player,reject)
|
||||||
if not role then return end
|
if not input then return end
|
||||||
local role = Roles.get_role_from_any(input)
|
local role = Roles.get_role_from_any(input)
|
||||||
if not role then
|
if not role then
|
||||||
return reject{'expcore-role.reject-role'}
|
return reject{'expcore-role.reject-role'}
|
||||||
@@ -17,8 +17,8 @@ Commands.add_parse('player-role',function(input,player,reject)
|
|||||||
local input_player = Commands.parse('player',input,player,reject)
|
local input_player = Commands.parse('player',input,player,reject)
|
||||||
if not input_player then return end -- nil check
|
if not input_player then return end -- nil check
|
||||||
local player_highest = Roles.get_player_highest_role(player)
|
local player_highest = Roles.get_player_highest_role(player)
|
||||||
local action_player_highest = Roles.get_player_highest_role(input_player)
|
local input_player_highest = Roles.get_player_highest_role(input_player)
|
||||||
if player_highest.index < action_player_highest.index then
|
if player_highest.index < input_player_highest.index then
|
||||||
return input_player
|
return input_player
|
||||||
else
|
else
|
||||||
return reject{'expcore-roles.reject-player-role'}
|
return reject{'expcore-roles.reject-player-role'}
|
||||||
@@ -26,13 +26,13 @@ Commands.add_parse('player-role',function(input,player,reject)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
Commands.add_parse('player-role-online',function(input,player,reject)
|
Commands.add_parse('player-role-online',function(input,player,reject)
|
||||||
local input_player = Commands.parse('player-rank',input,player,reject)
|
local input_player = Commands.parse('player-role',input,player,reject)
|
||||||
if not input_player then return end -- nil check
|
if not input_player then return end -- nil check
|
||||||
return Commands.parse('player-online',input_player,player,reject)
|
return Commands.parse('player-online',input_player,player,reject)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Commands.add_parse('player-role-alive',function(input,player,reject)
|
Commands.add_parse('player-role-alive',function(input,player,reject)
|
||||||
local input_player = Commands.parse('player-rank',input,player,reject)
|
local input_player = Commands.parse('player-role',input,player,reject)
|
||||||
if not input_player then return end -- nil check
|
if not input_player then return end -- nil check
|
||||||
return Commands.parse('player-alive',input_player,player,reject)
|
return Commands.parse('player-alive',input_player,player,reject)
|
||||||
end)
|
end)
|
||||||
@@ -643,7 +643,7 @@ function Commands.run_command(command_event)
|
|||||||
if Commands.internal_error(success,command_data.name,param_parsed) then
|
if Commands.internal_error(success,command_data.name,param_parsed) then
|
||||||
return command_log(player,command_data,'Internal Error: Param Parse Fail',params,command_event.parameter,param_parsed)
|
return command_log(player,command_data,'Internal Error: Param Parse Fail',params,command_event.parameter,param_parsed)
|
||||||
end
|
end
|
||||||
if param_data.optional == true and param_parsed == nil then
|
if param_data.optional == true and raw_params[index] == nil then
|
||||||
-- if it is optional and param is nil then it is set to default
|
-- if it is optional and param is nil then it is set to default
|
||||||
param_parsed = param_data.default
|
param_parsed = param_data.default
|
||||||
if type(param_parsed) == 'function' then
|
if type(param_parsed) == 'function' then
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ function Roles.get_player_roles(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Roles.get_player_highest_role(player)
|
function Roles.get_player_highest_role(player)
|
||||||
local roles = Roles.get_player_roels(player)
|
local roles = Roles.get_player_roles(player)
|
||||||
if not roles then return end
|
if not roles then return end
|
||||||
local highest
|
local highest
|
||||||
for _,role in pairs(roles) do
|
for _,role in pairs(roles) do
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
local Commands = require 'expcore.commands'
|
local Commands = require 'expcore.commands'
|
||||||
local Roles = require 'expcore.roles'
|
local Roles = require 'expcore.roles'
|
||||||
require 'config.command_parse_general'
|
require 'config.command_parse_general'
|
||||||
require 'config.command_parse_role'
|
require 'config.command_parse_roles'
|
||||||
|
|
||||||
Commands.new_command('kill','Kills yourself or another player.')
|
Commands.new_command('kill','Kills yourself or another player.')
|
||||||
:add_param('player',true,'player-role-alive') -- the player to kill, must be alive to be valid
|
:add_param('player',true,'player-role-alive') -- the player to kill, must be alive to be valid
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
local Commands = require 'expcore.commands'
|
local Commands = require 'expcore.commands'
|
||||||
local Roles = require 'expcore.roles'
|
local Roles = require 'expcore.roles'
|
||||||
require 'config.command_parse_general'
|
require 'config.command_parse_general'
|
||||||
require 'config.command_parse_role'
|
require 'config.command_parse_roles'
|
||||||
|
|
||||||
Commands.new_command('tag','Sets your player tag.')
|
Commands.new_command('tag','Sets your player tag.')
|
||||||
:add_param('tag',false,'string-max-length',20) -- new tag for your player max 20 char
|
:add_param('tag',false,'string-max-length',20) -- new tag for your player max 20 char
|
||||||
|
|||||||
Reference in New Issue
Block a user