From ec7d6382280c72bccac6643e3ca794983ea2b5f5 Mon Sep 17 00:00:00 2001 From: plague006 Date: Fri, 22 Feb 2019 17:28:41 -0500 Subject: [PATCH] on-join -> welcome --- features/donator_commands.lua | 19 ++++++++++--------- locale/en/redmew.cfg | 8 ++++---- resources/color_presets.lua | 3 ++- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/features/donator_commands.lua b/features/donator_commands.lua index f5597c6d..959b2270 100644 --- a/features/donator_commands.lua +++ b/features/donator_commands.lua @@ -11,12 +11,13 @@ local format = string.format --- Saves the player's message local function add_message(args, player, table_name) local str = tostring(args.value) - if not str or str == 'false' then + if not str then Game.player_print({'donator_commands.add_message_fail_not_string'}, Color.fail) return end + Donator.add_donator_message(player.name, table_name, str) - Game.player_print({'donator_commands.add_message_success'}, Color.success) + Game.player_print({'donator_commands.add_message_success', str}, Color.success) end --- Deletes one of the player's message @@ -38,12 +39,12 @@ end --- Lists the player's messages local function list_messages(player, table_name) local messages = Donator.get_donator_messages(player.name, table_name) - if messages then + if messages and #messages > 0 then for k, v in pairs(messages) do Game.player_print(format('[%s] %s', k, v)) end else - Game.player_print({'donator_commands.list_message_fail_no_messages'}, Color.warning) + Game.player_print({'donator_commands.list_message_no_messages'}, Color.info) end end @@ -61,8 +62,8 @@ local function command_path_decider(args, player, table_name) end --- Decides which function to call depending on the first arg to the command -local function donator_join_message_command(args, player) - local table_name = 'join_messages' +local function donator_welcome_message_command(args, player) + local table_name = 'welcome_messages' command_path_decider(args, player, table_name) end @@ -75,15 +76,15 @@ end -- Commands Command.add( - 'donator-join-message', + 'donator-welcome-message', { - description = 'Adds, deletes, or lists donator on-join messages.', + description = 'Adds, deletes, or lists donator welcome messages.', arguments = {'add|delete|list', 'value'}, default_values = {value = false}, capture_excess_arguments = true, donator_only = true }, - donator_join_message_command + donator_welcome_message_command ) Command.add( diff --git a/locale/en/redmew.cfg b/locale/en/redmew.cfg index 1878a411..7e0c3ead 100644 --- a/locale/en/redmew.cfg +++ b/locale/en/redmew.cfg @@ -29,13 +29,13 @@ whois_formatter=__1__\n__2__\n__3__\n__4__\n__5__\n__6__\n__7__\n__8__\n__9__\n_ [donator_commands] add_message_fail_not_string=Must enter a value to set as message. -add_message_success=Join message added. +add_message_success=Message added: __1__ delete_message_fail_not_number=Must enter a number to delete. delete_message_success=Message deleted: __1__ delete_message_fail_no_message=No message to delete. -list_message_fail_no_messages=No messages listed. -donator_message_wrong_arg1=Correct use: /donator-join-message add|delete|list -donator_join_message_help=Adds, deletes, or lists donator on-join messages. +list_message_no_messages=No messages listed. +donator_message_wrong_arg1=Correct use: /donator-welcome-message add|delete|list +donator_welcome_message_help=Adds, deletes, or lists donator on-welcome messages. donator_death_message_help=Adds, deletes, or lists donator on-death messages. [command] diff --git a/resources/color_presets.lua b/resources/color_presets.lua index 2e7a6beb..0dd965e4 100644 --- a/resources/color_presets.lua +++ b/resources/color_presets.lua @@ -158,5 +158,6 @@ return { [30] = {r = 0.093, g = 0.768, b = 0.172}, -- admin success = {r = 0, g = 255, b = 0}, warning = {r = 255, g = 255, b = 0}, - fail = {r = 255, g = 0, b = 0} + fail = {r = 255, g = 0, b = 0}, + info = {r = 255, g = 255, b = 255} }