a lot of fixes and improvements to pokemon localization

This commit is contained in:
Kwoth 2017-02-13 15:03:39 +01:00
parent 1da9c0ae5a
commit 995b05e1f7
5 changed files with 41 additions and 40 deletions

View File

@ -74,7 +74,7 @@ namespace NadekoBot.Modules
public Task<IUserMessage> 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<IUserMessage> ConfirmLocalized(string textKey, params object[] replacements)
@ -96,4 +96,4 @@ namespace NadekoBot.Modules
{
}
}
}
}

View File

@ -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);
}
}

View File

@ -15,6 +15,9 @@ namespace NadekoBot.Modules.Pokemon
public List<PokemonMultiplier> Multipliers { get; set; }
public string Icon { get; set; }
public string[] Moves { get; set; }
public override string ToString() =>
Icon + "**" + Name.ToLowerInvariant() + "**" + Icon;
}
public class PokemonMultiplier
{

View File

@ -69,7 +69,7 @@ namespace NadekoBot.Resources {
}
/// <summary>
/// Looks up a localized string similar to {1} already has full HP..
/// Looks up a localized string similar to {0} already has full HP..
/// </summary>
public static string pokemon_already_full {
get {
@ -87,7 +87,7 @@ namespace NadekoBot.Resources {
}
/// <summary>
/// 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..
/// </summary>
public static string pokemon_attack {
get {
@ -122,6 +122,15 @@ namespace NadekoBot.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to healed {0} with one {1}.
/// </summary>
public static string pokemon_healed {
get {
return ResourceManager.GetString("pokemon_healed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} has {1} HP remaining..
/// </summary>
@ -132,7 +141,7 @@ namespace NadekoBot.Resources {
}
/// <summary>
/// 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&apos;t use {0}. Type `{1}ml` to see a list of moves you can use..
/// </summary>
public static string pokemon_invalid_move {
get {
@ -141,7 +150,7 @@ namespace NadekoBot.Resources {
}
/// <summary>
/// Looks up a localized string similar to Movelist for &quot;{0}&quot; type.
/// Looks up a localized string similar to Movelist for {0} type.
/// </summary>
public static string pokemon_moves {
get {
@ -222,7 +231,7 @@ namespace NadekoBot.Resources {
}
/// <summary>
/// Looks up a localized string similar to Type of {0} is **{1}**.
/// Looks up a localized string similar to Type of {0} is {1}.
/// </summary>
public static string pokemon_type_of_user {
get {
@ -247,14 +256,5 @@ namespace NadekoBot.Resources {
return ResourceManager.GetString("pokemon_you_fainted", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to healed {0} with one {1}.
/// </summary>
public static string pokmeon_healed {
get {
return ResourceManager.GetString("pokmeon_healed", resourceCulture);
}
}
}
}

View File

@ -121,13 +121,13 @@
<value>{0} has already fainted.</value>
</data>
<data name="pokemon_already_full" xml:space="preserve">
<value>{1} already has full HP.</value>
<value>{0} already has full HP.</value>
</data>
<data name="pokemon_already_that_type" xml:space="preserve">
<value>Your type is already {0}</value>
</data>
<data name="pokemon_attack" xml:space="preserve">
<value>used **{0}**{1} on {2}{3} for **{4}** damage.</value>
<value>used {0}{1} on {2}{3} for {4} damage.</value>
<comment>Kwoth used punch:type_icon: on Sanity:type_icon: for 50 damage.</comment>
</data>
<data name="pokemon_cant_attack_again" xml:space="preserve">
@ -139,6 +139,9 @@
<data name="pokemon_fainted" xml:space="preserve">
<value>{0} has fainted!</value>
</data>
<data name="pokemon_healed" xml:space="preserve">
<value>healed {0} with one {1}</value>
</data>
<data name="pokemon_hp_remaining" xml:space="preserve">
<value>{0} has {1} HP remaining.</value>
</data>
@ -146,7 +149,7 @@
<value>You are not able to use **{0}**. Type {1}ml to see a list of moves you can use.</value>
</data>
<data name="pokemon_moves" xml:space="preserve">
<value>Movelist for "{0}" type</value>
<value>Movelist for {0} type</value>
</data>
<data name="pokemon_not_effective" xml:space="preserve">
<value>It's not effective.</value>
@ -173,7 +176,7 @@
<value>You used too many moves in a row, so you can't move!</value>
</data>
<data name="pokemon_type_of_user" xml:space="preserve">
<value>Type of {0} is **{1}**</value>
<value>Type of {0} is {1}</value>
</data>
<data name="pokemon_user_not_found" xml:space="preserve">
<value>User not found.</value>
@ -181,7 +184,4 @@
<data name="pokemon_you_fainted" xml:space="preserve">
<value>You fainted, so you are not able to move!</value>
</data>
<data name="pokmeon_healed" xml:space="preserve">
<value>healed {0} with one {1}</value>
</data>
</root>