- Fixed counting parameters which have formats in response strings

- Almost finished porting localized string keys as methods
- Compiles
This commit is contained in:
Kwoth
2021-07-27 13:07:23 +02:00
parent 0115d35247
commit 4484732f5d
29 changed files with 94 additions and 95 deletions

View File

@@ -77,8 +77,10 @@ namespace NadekoBot.Modules.Gambling
if (race.FinishedUsers[0].Bet > 0)
{
return SendConfirmAsync(GetText(strs.animal_race),
GetText(strs.animal_race_won_money(Format.Bold(winner.Username)),
winner.Animal.Icon, (race.FinishedUsers[0].Bet * (race.Users.Count - 1)) + CurrencySign));
GetText(strs.animal_race_won_money(
Format.Bold(winner.Username),
winner.Animal.Icon,
(race.FinishedUsers[0].Bet * (race.Users.Count - 1)) + CurrencySign)));
}
else
{
@@ -153,9 +155,9 @@ namespace NadekoBot.Modules.Gambling
var user = await ar.JoinRace(ctx.User.Id, ctx.User.ToString(), amount)
.ConfigureAwait(false);
if (amount > 0)
await SendConfirmAsync(GetText(strs.animal_race_join_bet(ctx.User.Mention, user.Animal.Icon, amount + CurrencySign)).ConfigureAwait(false));
await SendConfirmAsync(GetText(strs.animal_race_join_bet(ctx.User.Mention, user.Animal.Icon, amount + CurrencySign)));
else
await SendConfirmAsync(GetText(strs.animal_race_join(ctx.User.Mention, user.Animal.Icon)).ConfigureAwait(false));
await SendConfirmAsync(GetText(strs.animal_race_join(ctx.User.Mention, user.Animal.Icon)));
}
catch (ArgumentOutOfRangeException)
{
@@ -176,7 +178,7 @@ namespace NadekoBot.Modules.Gambling
}
catch (NotEnoughFundsException)
{
await SendErrorAsync(GetText(strs.not_enough(CurrencySign)).ConfigureAwait(false));
await SendErrorAsync(GetText(strs.not_enough(CurrencySign)));
}
}
}

View File

@@ -72,10 +72,10 @@ namespace NadekoBot.Modules.Gambling
string potSizeStr = Format.Bold(potSize == 0
? "∞" + CurrencySign
: potSize.ToString() + CurrencySign);
return GetText(strs.new_reaction_event,
CurrencySign,
Format.Bold(amount + CurrencySign),
potSizeStr);
return GetText(strs.new_reaction_event(
CurrencySign,
Format.Bold(amount + CurrencySign),
potSizeStr));
}
private string GetGameStatusDescription(long amount, long potSize)
@@ -83,10 +83,10 @@ namespace NadekoBot.Modules.Gambling
string potSizeStr = Format.Bold(potSize == 0
? "∞" + CurrencySign
: potSize.ToString() + CurrencySign);
return GetText(strs.new_gamestatus_event,
CurrencySign,
Format.Bold(amount + CurrencySign),
potSizeStr);
return GetText(strs.new_gamestatus_event(
CurrencySign,
Format.Bold(amount + CurrencySign),
potSizeStr));
}
}
}

View File

@@ -35,7 +35,7 @@ namespace NadekoBot.Modules.Gambling
return;
async Task OnEnded(IUser arg, long won)
{
await SendConfirmAsync(GetText(strs.rafflecur_ended(CurrencyName, Format.Bold(arg.ToString()), won + CurrencySign)).ConfigureAwait(false));
await SendConfirmAsync(GetText(strs.rafflecur_ended(CurrencyName, Format.Bold(arg.ToString()), won + CurrencySign)));
}
var res = await _service.JoinOrCreateGame(ctx.Channel.Id,
ctx.User, amount, mixed, OnEnded)
@@ -45,7 +45,7 @@ namespace NadekoBot.Modules.Gambling
{
await SendConfirmAsync(GetText(strs.rafflecur(res.Item1.GameType.ToString())),
string.Join("\n", res.Item1.Users.Select(x => $"{x.DiscordUser} ({x.Amount})")),
footer: GetText(strs.rafflecur_joined(ctx.User.ToString())).ConfigureAwait(false));
footer: GetText(strs.rafflecur_joined(ctx.User.ToString())));
}
else
{

View File

@@ -47,7 +47,7 @@ namespace NadekoBot.Modules.Gambling
{
await ctx.Channel.SendFileAsync(ms,
$"dice.{format.FileExtensions.First()}",
Format.Bold(ctx.User.ToString()) + " " + GetText(strs.dice_rolled(Format.Code(gen.ToString()))).ConfigureAwait(false));
Format.Bold(ctx.User.ToString()) + " " + GetText(strs.dice_rolled(Format.Code(gen.ToString()))));
}
}
@@ -129,9 +129,9 @@ namespace NadekoBot.Modules.Gambling
await ctx.Channel.SendFileAsync(ms, $"dice.{format.FileExtensions.First()}",
Format.Bold(ctx.User.ToString()) + " " +
GetText(strs.dice_rolled_num(Format.Bold(values.Count.ToString()))) +
" " + GetText(strs.total_average,
" " + GetText(strs.total_average(
Format.Bold(values.Sum().ToString()),
Format.Bold((values.Sum() / (1.0f * values.Count)).ToString("N2")))).ConfigureAwait(false);
Format.Bold((values.Sum() / (1.0f * values.Count)).ToString("N2")))));
}
}

View File

@@ -68,9 +68,9 @@ namespace NadekoBot.Modules.Gambling
}
var msg = count != 1
? Format.Bold(ctx.User.ToString()) + " " + GetText(strs.flip_results(count, headCount, tailCount))
: Format.Bold(ctx.User.ToString()) + " " + GetText(strs.flipped, headCount > 0
: Format.Bold(ctx.User.ToString()) + " " + GetText(strs.flipped(headCount > 0
? Format.Bold(GetText(strs.heads))
: Format.Bold(GetText(strs.tails)));
: Format.Bold(GetText(strs.tails))));
await ctx.Channel.SendFileAsync(stream, $"{count} coins.{format.FileExtensions.First()}", msg).ConfigureAwait(false);
}
}

View File

@@ -196,8 +196,8 @@ namespace NadekoBot.Modules.Gambling
}
var embed = _eb.Create()
.WithTitle(GetText(strs.transactions,
((SocketGuild)ctx.Guild)?.GetUser(userId)?.ToString() ?? $"{userId}"))
.WithTitle(GetText(strs.transactions(
((SocketGuild)ctx.Guild)?.GetUser(userId)?.ToString() ?? $"{userId}")))
.WithOkColor();
var desc = "";
@@ -480,9 +480,9 @@ namespace NadekoBot.Modules.Gambling
if (result.Multiplier > 0)
{
var win = (long)(amount * result.Multiplier);
str += GetText(strs.br_win,
str += GetText(strs.br_win(
n(win) + CurrencySign,
result.Threshold + (result.Roll == 100 ? " 👑" : ""));
result.Threshold + (result.Roll == 100 ? " 👑" : "")));
await _cs.AddAsync(ctx.User, "Betroll Gamble",
win, false, gamble: true).ConfigureAwait(false);
}
@@ -652,15 +652,13 @@ namespace NadekoBot.Modules.Gambling
"Rps-win", amount, gamble: true).ConfigureAwait(false);
embed.WithOkColor();
embed.AddField(GetText(strs.won), n(amount));
msg = GetText(strs.rps_win, ctx.User.Mention,
getRpsPick(pick), getRpsPick(nadekoPick));
msg = GetText(strs.rps_win(ctx.User.Mention, getRpsPick(pick), getRpsPick(nadekoPick)));
}
else
{
embed.WithErrorColor();
amount = 0;
msg = GetText(strs.rps_win(ctx.Client.CurrentUser.Mention, getRpsPick(nadekoPick)),
getRpsPick(pick));
msg = GetText(strs.rps_win(ctx.Client.CurrentUser.Mention, getRpsPick(nadekoPick), getRpsPick(pick)));
}
embed

View File

@@ -433,7 +433,7 @@ namespace NadekoBot.Modules.Gambling
var embed = _eb.Create().WithOkColor();
if (entry.Type == ShopEntryType.Role)
return embed.AddField(GetText(strs.name), GetText(strs.shop_role(Format.Bold(ctx.Guild.GetRole(entry.RoleId)?.Name ?? "MISSING_ROLE")), true))
return embed.AddField(GetText(strs.name), GetText(strs.shop_role(Format.Bold(ctx.Guild.GetRole(entry.RoleId)?.Name ?? "MISSING_ROLE"))), true)
.AddField(GetText(strs.price), entry.Price.ToString(), true)
.AddField(GetText(strs.type), entry.Type.ToString(), true);
else if (entry.Type == ShopEntryType.List)

View File

@@ -68,9 +68,9 @@ namespace NadekoBot.Modules.Gambling
await ReplyErrorLocalizedAsync("not_enough", CurrencySign);
return;
}
var msg = GetText(strs.waifu_claimed,
var msg = GetText(strs.waifu_claimed(
Format.Bold(target.ToString()),
amount + CurrencySign);
amount + CurrencySign));
if (w.Affinity?.UserId == ctx.User.Id)
msg += "\n" + GetText(strs.waifu_fulfilled(target, w.Price + CurrencySign));
else
@@ -292,7 +292,7 @@ namespace NadekoBot.Modules.Gambling
.AddField(GetText(strs.changes_of_heart), $"{wi.AffinityCount} - \"the {affInfo}\"", true)
.AddField(GetText(strs.divorces), wi.DivorceCount.ToString(), true)
.AddField("\u200B", "\u200B", true)
.AddField(GetText(strs.fans(wi.Fans.Count), fansStr, true))
.AddField(GetText(strs.fans(wi.Fans.Count)), fansStr, true)
.AddField($"Waifus ({wi.ClaimCount})", wi.ClaimCount == 0
? nobody
: string.Join("\n", wi.Claims.Shuffle().Take(30)), true)