From 995b05e1f7acaa8b3a8afa0ccf0cc09a4530a909 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Mon, 13 Feb 2017 15:03:39 +0100 Subject: [PATCH] a lot of fixes and improvements to pokemon localization --- src/NadekoBot/Modules/NadekoModule.cs | 4 +-- src/NadekoBot/Modules/Pokemon/Pokemon.cs | 32 +++++++++---------- src/NadekoBot/Modules/Pokemon/PokemonType.cs | 3 ++ .../Resources/ResponseStrings.Designer.cs | 28 ++++++++-------- src/NadekoBot/Resources/ResponseStrings.resx | 14 ++++---- 5 files changed, 41 insertions(+), 40 deletions(-) diff --git a/src/NadekoBot/Modules/NadekoModule.cs b/src/NadekoBot/Modules/NadekoModule.cs index d0aa8433..89e685f3 100644 --- a/src/NadekoBot/Modules/NadekoModule.cs +++ b/src/NadekoBot/Modules/NadekoModule.cs @@ -74,7 +74,7 @@ namespace NadekoBot.Modules public Task ReplyErrorLocalized(string textKey, params object[] replacements) { var text = GetText(textKey); - return Context.Channel.SendErrorAsync(Context.User.Mention + " " +string.Format(text, replacements)); + return Context.Channel.SendErrorAsync(Context.User.Mention + " " + string.Format(text, replacements)); } public Task ConfirmLocalized(string textKey, params object[] replacements) @@ -96,4 +96,4 @@ namespace NadekoBot.Modules { } } -} +} \ No newline at end of file diff --git a/src/NadekoBot/Modules/Pokemon/Pokemon.cs b/src/NadekoBot/Modules/Pokemon/Pokemon.cs index dab998ff..a95a6d5f 100644 --- a/src/NadekoBot/Modules/Pokemon/Pokemon.cs +++ b/src/NadekoBot/Modules/Pokemon/Pokemon.cs @@ -77,9 +77,7 @@ namespace NadekoBot.Modules.Pokemon return PokemonTypes[remainder]; } - - - + private PokemonType StringToPokemonType(string v) { var str = v?.ToUpperInvariant(); @@ -93,8 +91,7 @@ namespace NadekoBot.Modules.Pokemon } return null; } - - + [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] public async Task Attack(string move, IGuildUser targetUser = null) @@ -156,7 +153,7 @@ namespace NadekoBot.Modules.Pokemon var enabledMoves = userType.Moves; if (!enabledMoves.Contains(move.ToLowerInvariant())) { - await ReplyErrorLocalized("invalid_move", move, _prefix).ConfigureAwait(false); + await ReplyErrorLocalized("invalid_move", Format.Bold(move), _prefix).ConfigureAwait(false); return; } @@ -167,7 +164,7 @@ namespace NadekoBot.Modules.Pokemon //apply damage to target targetStats.Hp -= damage; - var response = GetText("attack", move, userType.Icon, targetUser.Mention, targetType.Icon, damage); + var response = GetText("attack", Format.Bold(move), userType.Icon, Format.Bold(targetUser.ToString()), targetType.Icon, Format.Bold(damage.ToString())); //Damage type if (damage < 40) @@ -187,11 +184,11 @@ namespace NadekoBot.Modules.Pokemon if (targetStats.Hp <= 0) { - response += $"\n" + GetText("fainted", targetUser); + response += $"\n" + GetText("fainted", Format.Bold(targetUser.ToString())); } else { - response += $"\n" + GetText("hp_remaining", targetUser, targetStats.Hp); + response += $"\n" + GetText("hp_remaining", Format.Bold(targetUser.ToString()), targetStats.Hp); } //update other stats @@ -232,7 +229,8 @@ namespace NadekoBot.Modules.Pokemon { IGuildUser user = (IGuildUser)Context.User; - if (targetUser == null) { + if (targetUser == null) + { await ReplyErrorLocalized("user_not_found").ConfigureAwait(false); return; } @@ -242,7 +240,7 @@ namespace NadekoBot.Modules.Pokemon var targetStats = Stats[targetUser.Id]; if (targetStats.Hp == targetStats.MaxHp) { - await ReplyErrorLocalized("already_full", targetUser).ConfigureAwait(false); + await ReplyErrorLocalized("already_full", Format.Bold(targetUser.ToString())).ConfigureAwait(false); return; } //Payment~ @@ -270,14 +268,14 @@ namespace NadekoBot.Modules.Pokemon return; } - await ReplyConfirmLocalized("revive_other", targetUser, NadekoBot.BotConfig.CurrencySign).ConfigureAwait(false); + await ReplyConfirmLocalized("revive_other", Format.Bold(targetUser.ToString()), NadekoBot.BotConfig.CurrencySign).ConfigureAwait(false); } - await ReplyConfirmLocalized("healed", targetUser, NadekoBot.BotConfig.CurrencySign).ConfigureAwait(false); + await ReplyConfirmLocalized("healed", Format.Bold(targetUser.ToString()), NadekoBot.BotConfig.CurrencySign).ConfigureAwait(false); return; } else { - await ErrorLocalized("already_full", targetUser); + await ErrorLocalized("already_full", Format.Bold(targetUser.ToString())); } } @@ -288,7 +286,7 @@ namespace NadekoBot.Modules.Pokemon { targetUser = targetUser ?? (IGuildUser)Context.User; var pType = GetPokeType(targetUser.Id); - await ReplyConfirmLocalized("type_of_user", targetUser.Mention, pType.Name.ToLowerInvariant() + pType.Icon).ConfigureAwait(false); + await ReplyConfirmLocalized("type_of_user", Format.Bold(targetUser.ToString()), pType).ConfigureAwait(false); } @@ -310,7 +308,7 @@ namespace NadekoBot.Modules.Pokemon } if (targetType == GetPokeType(user.Id)) { - await ReplyErrorLocalized("already_that_type", targetType.Name.ToLowerInvariant() + targetType.Icon).ConfigureAwait(false); + await ReplyErrorLocalized("already_that_type", targetType).ConfigureAwait(false); return; } @@ -354,7 +352,7 @@ namespace NadekoBot.Modules.Pokemon //Now for the response await ReplyConfirmLocalized("settype_success", - typeTargeted + targetType.Icon, + targetType, NadekoBot.BotConfig.CurrencySign).ConfigureAwait(false); } } diff --git a/src/NadekoBot/Modules/Pokemon/PokemonType.cs b/src/NadekoBot/Modules/Pokemon/PokemonType.cs index b73dec6b..20d47df0 100644 --- a/src/NadekoBot/Modules/Pokemon/PokemonType.cs +++ b/src/NadekoBot/Modules/Pokemon/PokemonType.cs @@ -15,6 +15,9 @@ namespace NadekoBot.Modules.Pokemon public List Multipliers { get; set; } public string Icon { get; set; } public string[] Moves { get; set; } + + public override string ToString() => + Icon + "**" + Name.ToLowerInvariant() + "**" + Icon; } public class PokemonMultiplier { diff --git a/src/NadekoBot/Resources/ResponseStrings.Designer.cs b/src/NadekoBot/Resources/ResponseStrings.Designer.cs index 1e0c5ff4..337d3b62 100644 --- a/src/NadekoBot/Resources/ResponseStrings.Designer.cs +++ b/src/NadekoBot/Resources/ResponseStrings.Designer.cs @@ -69,7 +69,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to {1} already has full HP.. + /// Looks up a localized string similar to {0} already has full HP.. /// public static string pokemon_already_full { get { @@ -87,7 +87,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to used **{0}**{1} on {2}{3} for **{4}** damage.. + /// Looks up a localized string similar to used {0}{1} on {2}{3} for {4} damage.. /// public static string pokemon_attack { get { @@ -122,6 +122,15 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to healed {0} with one {1}. + /// + public static string pokemon_healed { + get { + return ResourceManager.GetString("pokemon_healed", resourceCulture); + } + } + /// /// Looks up a localized string similar to {0} has {1} HP remaining.. /// @@ -132,7 +141,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to You are not able to use **{0}**. Type {1}ml to see a list of moves you can use.. + /// Looks up a localized string similar to You can't use {0}. Type `{1}ml` to see a list of moves you can use.. /// public static string pokemon_invalid_move { get { @@ -141,7 +150,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to Movelist for "{0}" type. + /// Looks up a localized string similar to Movelist for {0} type. /// public static string pokemon_moves { get { @@ -222,7 +231,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to Type of {0} is **{1}**. + /// Looks up a localized string similar to Type of {0} is {1}. /// public static string pokemon_type_of_user { get { @@ -247,14 +256,5 @@ namespace NadekoBot.Resources { return ResourceManager.GetString("pokemon_you_fainted", resourceCulture); } } - - /// - /// Looks up a localized string similar to healed {0} with one {1}. - /// - public static string pokmeon_healed { - get { - return ResourceManager.GetString("pokmeon_healed", resourceCulture); - } - } } } diff --git a/src/NadekoBot/Resources/ResponseStrings.resx b/src/NadekoBot/Resources/ResponseStrings.resx index 1a349d0f..00fc702f 100644 --- a/src/NadekoBot/Resources/ResponseStrings.resx +++ b/src/NadekoBot/Resources/ResponseStrings.resx @@ -121,13 +121,13 @@ {0} has already fainted. - {1} already has full HP. + {0} already has full HP. Your type is already {0} - used **{0}**{1} on {2}{3} for **{4}** damage. + used {0}{1} on {2}{3} for {4} damage. Kwoth used punch:type_icon: on Sanity:type_icon: for 50 damage. @@ -139,6 +139,9 @@ {0} has fainted! + + healed {0} with one {1} + {0} has {1} HP remaining. @@ -146,7 +149,7 @@ You are not able to use **{0}**. Type {1}ml to see a list of moves you can use. - Movelist for "{0}" type + Movelist for {0} type It's not effective. @@ -173,7 +176,7 @@ You used too many moves in a row, so you can't move! - Type of {0} is **{1}** + Type of {0} is {1} User not found. @@ -181,7 +184,4 @@ You fainted, so you are not able to move! - - healed {0} with one {1} - \ No newline at end of file