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) public Task<IUserMessage> ReplyErrorLocalized(string textKey, params object[] replacements)
{ {
var text = GetText(textKey); 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) 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]; return PokemonTypes[remainder];
} }
private PokemonType StringToPokemonType(string v) private PokemonType StringToPokemonType(string v)
{ {
var str = v?.ToUpperInvariant(); var str = v?.ToUpperInvariant();
@ -93,8 +91,7 @@ namespace NadekoBot.Modules.Pokemon
} }
return null; return null;
} }
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task Attack(string move, IGuildUser targetUser = null) public async Task Attack(string move, IGuildUser targetUser = null)
@ -156,7 +153,7 @@ namespace NadekoBot.Modules.Pokemon
var enabledMoves = userType.Moves; var enabledMoves = userType.Moves;
if (!enabledMoves.Contains(move.ToLowerInvariant())) if (!enabledMoves.Contains(move.ToLowerInvariant()))
{ {
await ReplyErrorLocalized("invalid_move", move, _prefix).ConfigureAwait(false); await ReplyErrorLocalized("invalid_move", Format.Bold(move), _prefix).ConfigureAwait(false);
return; return;
} }
@ -167,7 +164,7 @@ namespace NadekoBot.Modules.Pokemon
//apply damage to target //apply damage to target
targetStats.Hp -= damage; 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 //Damage type
if (damage < 40) if (damage < 40)
@ -187,11 +184,11 @@ namespace NadekoBot.Modules.Pokemon
if (targetStats.Hp <= 0) if (targetStats.Hp <= 0)
{ {
response += $"\n" + GetText("fainted", targetUser); response += $"\n" + GetText("fainted", Format.Bold(targetUser.ToString()));
} }
else else
{ {
response += $"\n" + GetText("hp_remaining", targetUser, targetStats.Hp); response += $"\n" + GetText("hp_remaining", Format.Bold(targetUser.ToString()), targetStats.Hp);
} }
//update other stats //update other stats
@ -232,7 +229,8 @@ namespace NadekoBot.Modules.Pokemon
{ {
IGuildUser user = (IGuildUser)Context.User; IGuildUser user = (IGuildUser)Context.User;
if (targetUser == null) { if (targetUser == null)
{
await ReplyErrorLocalized("user_not_found").ConfigureAwait(false); await ReplyErrorLocalized("user_not_found").ConfigureAwait(false);
return; return;
} }
@ -242,7 +240,7 @@ namespace NadekoBot.Modules.Pokemon
var targetStats = Stats[targetUser.Id]; var targetStats = Stats[targetUser.Id];
if (targetStats.Hp == targetStats.MaxHp) if (targetStats.Hp == targetStats.MaxHp)
{ {
await ReplyErrorLocalized("already_full", targetUser).ConfigureAwait(false); await ReplyErrorLocalized("already_full", Format.Bold(targetUser.ToString())).ConfigureAwait(false);
return; return;
} }
//Payment~ //Payment~
@ -270,14 +268,14 @@ namespace NadekoBot.Modules.Pokemon
return; 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; return;
} }
else 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; targetUser = targetUser ?? (IGuildUser)Context.User;
var pType = GetPokeType(targetUser.Id); 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)) 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; return;
} }
@ -354,7 +352,7 @@ namespace NadekoBot.Modules.Pokemon
//Now for the response //Now for the response
await ReplyConfirmLocalized("settype_success", await ReplyConfirmLocalized("settype_success",
typeTargeted + targetType.Icon, targetType,
NadekoBot.BotConfig.CurrencySign).ConfigureAwait(false); NadekoBot.BotConfig.CurrencySign).ConfigureAwait(false);
} }
} }

View File

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

View File

@ -69,7 +69,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <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> /// </summary>
public static string pokemon_already_full { public static string pokemon_already_full {
get { get {
@ -87,7 +87,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <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> /// </summary>
public static string pokemon_attack { public static string pokemon_attack {
get { 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> /// <summary>
/// Looks up a localized string similar to {0} has {1} HP remaining.. /// Looks up a localized string similar to {0} has {1} HP remaining..
/// </summary> /// </summary>
@ -132,7 +141,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <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> /// </summary>
public static string pokemon_invalid_move { public static string pokemon_invalid_move {
get { get {
@ -141,7 +150,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <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> /// </summary>
public static string pokemon_moves { public static string pokemon_moves {
get { get {
@ -222,7 +231,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <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> /// </summary>
public static string pokemon_type_of_user { public static string pokemon_type_of_user {
get { get {
@ -247,14 +256,5 @@ namespace NadekoBot.Resources {
return ResourceManager.GetString("pokemon_you_fainted", resourceCulture); 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> <value>{0} has already fainted.</value>
</data> </data>
<data name="pokemon_already_full" xml:space="preserve"> <data name="pokemon_already_full" xml:space="preserve">
<value>{1} already has full HP.</value> <value>{0} already has full HP.</value>
</data> </data>
<data name="pokemon_already_that_type" xml:space="preserve"> <data name="pokemon_already_that_type" xml:space="preserve">
<value>Your type is already {0}</value> <value>Your type is already {0}</value>
</data> </data>
<data name="pokemon_attack" xml:space="preserve"> <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> <comment>Kwoth used punch:type_icon: on Sanity:type_icon: for 50 damage.</comment>
</data> </data>
<data name="pokemon_cant_attack_again" xml:space="preserve"> <data name="pokemon_cant_attack_again" xml:space="preserve">
@ -139,6 +139,9 @@
<data name="pokemon_fainted" xml:space="preserve"> <data name="pokemon_fainted" xml:space="preserve">
<value>{0} has fainted!</value> <value>{0} has fainted!</value>
</data> </data>
<data name="pokemon_healed" xml:space="preserve">
<value>healed {0} with one {1}</value>
</data>
<data name="pokemon_hp_remaining" xml:space="preserve"> <data name="pokemon_hp_remaining" xml:space="preserve">
<value>{0} has {1} HP remaining.</value> <value>{0} has {1} HP remaining.</value>
</data> </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> <value>You are not able to use **{0}**. Type {1}ml to see a list of moves you can use.</value>
</data> </data>
<data name="pokemon_moves" xml:space="preserve"> <data name="pokemon_moves" xml:space="preserve">
<value>Movelist for "{0}" type</value> <value>Movelist for {0} type</value>
</data> </data>
<data name="pokemon_not_effective" xml:space="preserve"> <data name="pokemon_not_effective" xml:space="preserve">
<value>It's not effective.</value> <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> <value>You used too many moves in a row, so you can't move!</value>
</data> </data>
<data name="pokemon_type_of_user" xml:space="preserve"> <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>
<data name="pokemon_user_not_found" xml:space="preserve"> <data name="pokemon_user_not_found" xml:space="preserve">
<value>User not found.</value> <value>User not found.</value>
@ -181,7 +184,4 @@
<data name="pokemon_you_fainted" xml:space="preserve"> <data name="pokemon_you_fainted" xml:space="preserve">
<value>You fainted, so you are not able to move!</value> <value>You fainted, so you are not able to move!</value>
</data> </data>
<data name="pokmeon_healed" xml:space="preserve">
<value>healed {0} with one {1}</value>
</data>
</root> </root>