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
{