wip strings rework, experimenting, nothing works

This commit is contained in:
Kwoth
2021-07-25 19:25:48 +02:00
parent 70288f7670
commit 9d375dccee
53 changed files with 211 additions and 187 deletions

View File

@@ -77,13 +77,13 @@ namespace NadekoBot.Modules.Gambling
if (race.FinishedUsers[0].Bet > 0)
{
return SendConfirmAsync(GetText(strs.animal_race),
GetText("animal_race_won_money", Format.Bold(winner.Username),
GetText(strs.animal_race_won_money, Format.Bold(winner.Username),
winner.Animal.Icon, (race.FinishedUsers[0].Bet * (race.Users.Count - 1)) + CurrencySign));
}
else
{
return SendConfirmAsync(GetText(strs.animal_race),
GetText("animal_race_won", Format.Bold(winner.Username), winner.Animal.Icon));
GetText(strs.animal_race_won, Format.Bold(winner.Username), winner.Animal.Icon));
}
}
@@ -93,8 +93,8 @@ namespace NadekoBot.Modules.Gambling
ar.OnStarted += Ar_OnStarted;
_client.MessageReceived += _client_MessageReceived;
return SendConfirmAsync(GetText(strs.animal_race), GetText("animal_race_starting", options.StartTime),
footer: GetText("animal_race_join_instr", Prefix));
return SendConfirmAsync(GetText(strs.animal_race), GetText(strs.animal_race_starting, options.StartTime),
footer: GetText(strs.animal_race_join_instr, Prefix));
}
private Task Ar_OnStarted(AnimalRace race)
@@ -102,7 +102,7 @@ namespace NadekoBot.Modules.Gambling
if (race.Users.Count == race.MaxUsers)
return SendConfirmAsync(GetText(strs.animal_race), GetText(strs.animal_race_full));
else
return SendConfirmAsync(GetText(strs.animal_race), GetText("animal_race_starting_with_x", race.Users.Count));
return SendConfirmAsync(GetText(strs.animal_race), GetText(strs.animal_race_starting_with_x, race.Users.Count));
}
private async Task Ar_OnStateUpdate(AnimalRace race)
@@ -153,9 +153,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("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)).ConfigureAwait(false);
else
await SendConfirmAsync(GetText("animal_race_join", ctx.User.Mention, user.Animal.Icon)).ConfigureAwait(false);
await SendConfirmAsync(GetText(strs.animal_race_join, ctx.User.Mention, user.Animal.Icon)).ConfigureAwait(false);
}
catch (ArgumentOutOfRangeException)
{
@@ -176,7 +176,7 @@ namespace NadekoBot.Modules.Gambling
}
catch (NotEnoughFundsException)
{
await SendErrorAsync(GetText("not_enough", CurrencySign)).ConfigureAwait(false);
await SendErrorAsync(GetText(strs.not_enough, CurrencySign)).ConfigureAwait(false);
}
}
}

View File

@@ -129,11 +129,11 @@ namespace NadekoBot.Modules.Gambling
string title;
if (result == Connect4Game.Result.CurrentPlayerWon)
{
title = GetText("connect4_won", Format.Bold(arg.CurrentPlayer.Username), Format.Bold(arg.OtherPlayer.Username));
title = GetText(strs.connect4_won, Format.Bold(arg.CurrentPlayer.Username), Format.Bold(arg.OtherPlayer.Username));
}
else if (result == Connect4Game.Result.OtherPlayerWon)
{
title = GetText("connect4_won", Format.Bold(arg.OtherPlayer.Username), Format.Bold(arg.CurrentPlayer.Username));
title = GetText(strs.connect4_won, Format.Bold(arg.OtherPlayer.Username), Format.Bold(arg.CurrentPlayer.Username));
}
else
title = GetText(strs.connect4_draw);
@@ -180,7 +180,7 @@ namespace NadekoBot.Modules.Gambling
if (game.CurrentPhase == Connect4Game.Phase.P1Move ||
game.CurrentPhase == Connect4Game.Phase.P2Move)
sb.AppendLine(GetText("connect4_player_to_move", Format.Bold(game.CurrentPlayer.Username)));
sb.AppendLine(GetText(strs.connect4_player_to_move, Format.Bold(game.CurrentPlayer.Username)));
for (int i = Connect4Game.NumberOfRows; i > 0; i--)
{

View File

@@ -52,15 +52,15 @@ namespace NadekoBot.Modules.Gambling
case CurrencyEvent.Type.Reaction:
return _eb.Create()
.WithOkColor()
.WithTitle(GetText("event_title", type.ToString()))
.WithTitle(GetText(strs.event_title, type.ToString()))
.WithDescription(GetReactionDescription(opts.Amount, currentPot))
.WithFooter(GetText("event_duration_footer", opts.Hours));
.WithFooter(GetText(strs.event_duration_footer, opts.Hours));
case CurrencyEvent.Type.GameStatus:
return _eb.Create()
.WithOkColor()
.WithTitle(GetText("event_title", type.ToString()))
.WithTitle(GetText(strs.event_title, type.ToString()))
.WithDescription(GetGameStatusDescription(opts.Amount, currentPot))
.WithFooter(GetText("event_duration_footer", opts.Hours));
.WithFooter(GetText(strs.event_duration_footer, opts.Hours));
default:
break;
}
@@ -72,7 +72,7 @@ namespace NadekoBot.Modules.Gambling
string potSizeStr = Format.Bold(potSize == 0
? "∞" + CurrencySign
: potSize.ToString() + CurrencySign);
return GetText("new_reaction_event",
return GetText(strs.new_reaction_event,
CurrencySign,
Format.Bold(amount + CurrencySign),
potSizeStr);
@@ -83,7 +83,7 @@ namespace NadekoBot.Modules.Gambling
string potSizeStr = Format.Bold(potSize == 0
? "∞" + CurrencySign
: potSize.ToString() + CurrencySign);
return GetText("new_gamestatus_event",
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("rafflecur_ended", CurrencyName, Format.Bold(arg.ToString()), won + CurrencySign)).ConfigureAwait(false);
await SendConfirmAsync(GetText(strs.rafflecur_ended, CurrencyName, Format.Bold(arg.ToString()), won + CurrencySign)).ConfigureAwait(false);
}
var res = await _service.JoinOrCreateGame(ctx.Channel.Id,
ctx.User, amount, mixed, OnEnded)
@@ -43,9 +43,9 @@ namespace NadekoBot.Modules.Gambling
if (res.Item1 != null)
{
await SendConfirmAsync(GetText("rafflecur", res.Item1.GameType.ToString()),
await SendConfirmAsync(GetText(strs.rafflecur, res.Item1.GameType.ToString()),
string.Join("\n", res.Item1.Users.Select(x => $"{x.DiscordUser} ({x.Amount})")),
footer: GetText("rafflecur_joined", ctx.User.ToString())).ConfigureAwait(false);
footer: GetText(strs.rafflecur_joined, ctx.User.ToString())).ConfigureAwait(false);
}
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("dice_rolled", Format.Code(gen.ToString()))).ConfigureAwait(false);
Format.Bold(ctx.User.ToString()) + " " + GetText(strs.dice_rolled, Format.Code(gen.ToString()))).ConfigureAwait(false);
}
}
@@ -128,8 +128,8 @@ namespace NadekoBot.Modules.Gambling
await ctx.Channel.SendFileAsync(ms, $"dice.{format.FileExtensions.First()}",
Format.Bold(ctx.User.ToString()) + " " +
GetText("dice_rolled_num", Format.Bold(values.Count.ToString())) +
" " + GetText("total_average",
GetText(strs.dice_rolled_num, Format.Bold(values.Count.ToString())) +
" " + GetText(strs.total_average,
Format.Bold(values.Sum().ToString()),
Format.Bold((values.Sum() / (1.0f * values.Count)).ToString("N2")))).ConfigureAwait(false);
}
@@ -152,7 +152,7 @@ namespace NadekoBot.Modules.Gambling
}
var embed = _eb.Create()
.WithOkColor()
.WithDescription(ctx.User.Mention + " " + GetText("dice_rolled_num", Format.Bold(n1.ToString())))
.WithDescription(ctx.User.Mention + " " + GetText(strs.dice_rolled_num, Format.Bold(n1.ToString())))
.AddField(Format.Bold("Result"), string.Join(" ", rolls.Select(c => Format.Code($"[{c}]"))));
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
@@ -177,7 +177,7 @@ namespace NadekoBot.Modules.Gambling
var sum = arr.Sum();
var embed = _eb.Create().WithOkColor()
.WithDescription(ctx.User.Mention + " " + GetText("dice_rolled_num", n1) + $"`1 - {n2}`")
.WithDescription(ctx.User.Mention + " " + GetText(strs.dice_rolled_num, n1) + $"`1 - {n2}`")
.AddField(Format.Bold("Rolls"), string.Join(" ",
(ordered ? arr.OrderBy(x => x).AsEnumerable() : arr).Select(x =>
Format.Code(x.ToString()))))

View File

@@ -66,7 +66,7 @@ namespace NadekoBot.Modules.Gambling
toSend += $" drew `{Deck.GetHandValue(cardObjects)}`";
if (guildId != null)
toSend += "\n" + GetText("cards_left", Format.Bold(cards.CardPool.Count.ToString()));
toSend += "\n" + GetText(strs.cards_left, Format.Bold(cards.CardPool.Count.ToString()));
return (img.ToStream(), toSend);
}

View File

@@ -67,8 +67,8 @@ namespace NadekoBot.Modules.Gambling
i.Dispose();
}
var msg = count != 1
? Format.Bold(ctx.User.ToString()) + " " + GetText("flip_results", count, headCount, tailCount)
: Format.Bold(ctx.User.ToString()) + " " + GetText("flipped", headCount > 0
? Format.Bold(ctx.User.ToString()) + " " + GetText(strs.flip_results, count, headCount, tailCount)
: Format.Bold(ctx.User.ToString()) + " " + GetText(strs.flipped, headCount > 0
? Format.Bold(GetText(strs.heads))
: Format.Bold(GetText(strs.tails)));
await ctx.Channel.SendFileAsync(stream, $"{count} coins.{format.FileExtensions.First()}", msg).ConfigureAwait(false);
@@ -115,7 +115,7 @@ namespace NadekoBot.Modules.Gambling
if (guess == result)
{
var toWin = (long)(amount * _config.BetFlip.Multiplier);
str = Format.Bold(ctx.User.ToString()) + " " + GetText("flip_guess", toWin + CurrencySign);
str = Format.Bold(ctx.User.ToString()) + " " + GetText(strs.flip_guess, toWin + CurrencySign);
await _cs.AddAsync(ctx.User, "Betflip Gamble", toWin, false, gamble: true).ConfigureAwait(false);
}
else

View File

@@ -196,7 +196,7 @@ namespace NadekoBot.Modules.Gambling
}
var embed = _eb.Create()
.WithTitle(GetText("transactions",
.WithTitle(GetText(strs.transactions,
((SocketGuild)ctx.Guild)?.GetUser(userId)?.ToString() ?? $"{userId}"))
.WithOkColor();
@@ -209,7 +209,7 @@ namespace NadekoBot.Modules.Gambling
}
embed.WithDescription(desc);
embed.WithFooter(GetText("page", page + 1));
embed.WithFooter(GetText(strs.page, page + 1));
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
}
@@ -476,11 +476,11 @@ namespace NadekoBot.Modules.Gambling
var result = br.Roll();
var str = Format.Bold(ctx.User.ToString()) + Format.Code(GetText("roll", result.Roll));
var str = Format.Bold(ctx.User.ToString()) + Format.Code(GetText(strs.roll, result.Roll));
if (result.Multiplier > 0)
{
var win = (long)(amount * result.Multiplier);
str += GetText("br_win",
str += GetText(strs.br_win,
n(win) + CurrencySign,
result.Threshold + (result.Roll == 100 ? " 👑" : ""));
await _cs.AddAsync(ctx.User, "Betroll Gamble",
@@ -641,7 +641,7 @@ namespace NadekoBot.Modules.Gambling
await _cs.AddAsync(ctx.User.Id,
"Rps-draw", amount, gamble: true).ConfigureAwait(false);
embed.WithOkColor();
msg = GetText("rps_draw", getRpsPick(pick));
msg = GetText(strs.rps_draw, getRpsPick(pick));
}
else if ((pick == RpsPick.Paper && nadekoPick == RpsPick.Rock) ||
(pick == RpsPick.Rock && nadekoPick == RpsPick.Scissors) ||
@@ -652,14 +652,14 @@ namespace NadekoBot.Modules.Gambling
"Rps-win", amount, gamble: true).ConfigureAwait(false);
embed.WithOkColor();
embed.AddField(GetText(strs.won), n(amount));
msg = GetText("rps_win", ctx.User.Mention,
msg = GetText(strs.rps_win, ctx.User.Mention,
getRpsPick(pick), getRpsPick(nadekoPick));
}
else
{
embed.WithErrorColor();
amount = 0;
msg = GetText("rps_win", ctx.Client.CurrentUser.Mention, getRpsPick(nadekoPick),
msg = GetText(strs.rps_win, ctx.Client.CurrentUser.Mention, getRpsPick(nadekoPick),
getRpsPick(pick));
}

View File

@@ -62,7 +62,7 @@ namespace NadekoBot.Modules.Gambling
return _eb.Create().WithErrorColor()
.WithDescription(GetText(strs.shop_none));
var embed = _eb.Create().WithOkColor()
.WithTitle(GetText("shop", CurrencySign));
.WithTitle(GetText(strs.shop));
for (int i = 0; i < theseEntries.Length; i++)
{
@@ -173,7 +173,7 @@ namespace NadekoBot.Modules.Gambling
{
await (await ctx.User.GetOrCreateDMChannelAsync().ConfigureAwait(false))
.EmbedAsync(_eb.Create().WithOkColor()
.WithTitle(GetText("shop_purchase", ctx.Guild.Name))
.WithTitle(GetText(strs.shop_purchase, ctx.Guild.Name))
.AddField(GetText(strs.item), item.Text, false)
.AddField(GetText(strs.price), entry.Price.ToString(), true)
.AddField(GetText(strs.name), entry.Name, true))
@@ -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("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)
@@ -441,7 +441,7 @@ namespace NadekoBot.Modules.Gambling
.AddField(GetText(strs.price), entry.Price.ToString(), true)
.AddField(GetText(strs.type), GetText(strs.random_unique_item), true);
//else if (entry.Type == ShopEntryType.Infinite_List)
// return embed.AddField(GetText(strs.name), GetText("shop_role", Format.Bold(entry.RoleName)), true)
// return embed.AddField(GetText(strs.name), GetText(strs.shop_role, Format.Bold(entry.RoleName)), true)
// .AddField(GetText(strs.price), entry.Price.ToString(), true)
// .AddField(GetText(strs.type), entry.Type.ToString(), true);
else return null;
@@ -451,11 +451,11 @@ namespace NadekoBot.Modules.Gambling
{
if (entry.Type == ShopEntryType.Role)
{
return GetText("shop_role", Format.Bold(ctx.Guild.GetRole(entry.RoleId)?.Name ?? "MISSING_ROLE"));
return GetText(strs.shop_role, Format.Bold(ctx.Guild.GetRole(entry.RoleId)?.Name ?? "MISSING_ROLE"));
}
else if (entry.Type == ShopEntryType.List)
{
return GetText("unique_items_left", entry.Items.Count) + "\n" + entry.Name;
return GetText(strs.unique_items_left, entry.Items.Count) + "\n" + entry.Name;
}
//else if (entry.Type == ShopEntryType.Infinite_List)
//{

View File

@@ -203,13 +203,13 @@ namespace NadekoBot.Modules.Gambling
await _cs.AddAsync(ctx.User, $"Slot Machine x{result.Multiplier}", amount * result.Multiplier, false, gamble: true).ConfigureAwait(false);
Interlocked.Add(ref _totalPaidOut, amount * result.Multiplier);
if (result.Multiplier == 1)
msg = GetText("slot_single", CurrencySign, 1);
msg = GetText(strs.slot_single, CurrencySign, 1);
else if (result.Multiplier == 4)
msg = GetText("slot_two", CurrencySign, 4);
msg = GetText(strs.slot_two, CurrencySign, 4);
else if (result.Multiplier == 10)
msg = GetText("slot_three", 10);
msg = GetText(strs.slot_three, 10);
else if (result.Multiplier == 30)
msg = GetText("slot_jackpot", 30);
msg = GetText(strs.slot_jackpot, 30);
}
using (var imgStream = bgImage.ToStream())

View File

@@ -27,7 +27,7 @@ namespace NadekoBot.Modules.Gambling
var price = _service.GetResetPrice(ctx.User);
var embed = _eb.Create()
.WithTitle(GetText(strs.waifu_reset_confirm))
.WithDescription(GetText("waifu_reset_price", Format.Bold(price + CurrencySign)));
.WithDescription(GetText(strs.waifu_reset_price, Format.Bold(price + CurrencySign)));
if (!await PromptUserConfirmAsync(embed))
return;
@@ -68,11 +68,11 @@ namespace NadekoBot.Modules.Gambling
await ReplyErrorLocalizedAsync("not_enough", CurrencySign);
return;
}
var msg = GetText("waifu_claimed",
var msg = GetText(strs.waifu_claimed,
Format.Bold(target.ToString()),
amount + CurrencySign);
if (w.Affinity?.UserId == ctx.User.Id)
msg += "\n" + GetText("waifu_fulfilled", target, w.Price + CurrencySign);
msg += "\n" + GetText(strs.waifu_fulfilled, target, w.Price + CurrencySign);
else
msg = " " + msg;
await SendConfirmAsync(ctx.User.Mention + msg);
@@ -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("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)