diff --git a/resources/scripts/commands/debug/ClassJob.lua b/resources/scripts/commands/debug/ClassJob.lua index 767e05a..e143e7e 100644 --- a/resources/scripts/commands/debug/ClassJob.lua +++ b/resources/scripts/commands/debug/ClassJob.lua @@ -1,6 +1,5 @@ required_rank = GM_RANK_DEBUG function onCommand(args, player) - local parts = split(args) - player:set_classjob(parts[1]) + player:set_classjob(tonumber(args[1])) end diff --git a/resources/scripts/commands/debug/Festival.lua b/resources/scripts/commands/debug/Festival.lua index 8752273..306b5e4 100644 --- a/resources/scripts/commands/debug/Festival.lua +++ b/resources/scripts/commands/debug/Festival.lua @@ -4,14 +4,12 @@ required_rank = GM_RANK_DEBUG command_sender = "[festival] " function onCommand(args, player) - local parts = split(args) - local argc = #parts local usage = "\nUsage: !festival " - local id1 = tonumber(parts[1]) or 0 - local id2 = tonumber(parts[2]) or 0 - local id3 = tonumber(parts[3]) or 0 - local id4 = tonumber(parts[4]) or 0 + local id1 = args[1] + local id2 = args[2] or 0 + local id3 = args[3] or 0 + local id4 = args[4] or 0 player:set_festival(id1, id2, id3, id4) printf(player, "Festival(s) changed to %s, %s, %s and %s.", id1, id2, id3, id4) diff --git a/resources/scripts/commands/debug/Nudge.lua b/resources/scripts/commands/debug/Nudge.lua index 7082e79..d9b5655 100644 --- a/resources/scripts/commands/debug/Nudge.lua +++ b/resources/scripts/commands/debug/Nudge.lua @@ -4,14 +4,13 @@ required_rank = GM_RANK_DEBUG command_sender = "[nudge] " function onCommand(args, player) - local parts = split(args) - local argc = #parts + local argc = #args local pos = player.position local angle = player.rotation + (math.pi / 2) local distance = 5 local direction = 0 - local arg1 = parts[1] - local arg2 = parts[2] + local arg1 = args[1] + local arg2 = args[2] local checkArg1 = tonumber(arg1) local checkArg2 = tonumber(arg2) local vertical = { diff --git a/resources/scripts/commands/debug/SetPos.lua b/resources/scripts/commands/debug/SetPos.lua index b24f310..28f8e8e 100644 --- a/resources/scripts/commands/debug/SetPos.lua +++ b/resources/scripts/commands/debug/SetPos.lua @@ -1,6 +1,5 @@ required_rank = GM_RANK_DEBUG function onCommand(args, player) - local parts = split(args) - player:set_position({ x = tonumber(parts[1]), y = tonumber(parts[2]), z = tonumber(parts[3]) }, 0) + player:set_position({ x = tonumber(args[1]), y = tonumber(args[2]), z = tonumber(args[3]) }, 0) end diff --git a/resources/scripts/commands/debug/Unlock.lua b/resources/scripts/commands/debug/Unlock.lua index 32d1de1..6afd923 100644 --- a/resources/scripts/commands/debug/Unlock.lua +++ b/resources/scripts/commands/debug/Unlock.lua @@ -2,8 +2,7 @@ required_rank = GM_RANK_DEBUG command_sender = "[unlock] " function onCommand(args, player) - local parts = split(args) - local argc = #parts + local argc = #args local usage = "\nThis command teaches the user an action, emote, etc.\nUsage: !useaction " @@ -12,13 +11,13 @@ function onCommand(args, player) return end - if parts[1] == "all" then + if args[1] == "all" then for i = 0, 511, 1 do player:unlock(i) end printf(player, "Everything is unlocked!", id) else - local id = tonumber(parts[1]) + local id = tonumber(args[1]) if not id then printf(player, "Error parsing unlock id! Make sure the id is an integer."..usage) diff --git a/src/bin/kawari-world.rs b/src/bin/kawari-world.rs index 001a708..d7cbf99 100644 --- a/src/bin/kawari-world.rs +++ b/src/bin/kawari-world.rs @@ -546,10 +546,10 @@ async fn client_loop( lua.globals().set("required_rank", mlua::Value::Nil)?; if connection.player_data.gm_rank as u8 >= required_rank? { - let mut func_args = ""; + let mut func_args = Vec::new(); if parts.len() > 1 { - func_args = &chat_message.message[command_name.len() + 2..]; - tracing::info!("Args passed to Lua command {}: {}", command_name, func_args); + func_args = (&parts[1..]).to_vec(); + tracing::info!("Args passed to Lua command {}: {:?}", command_name, func_args); } else { tracing::info!("No additional args passed to Lua command {}.", command_name); }