mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Removed redundant parenthesis
This commit is contained in:
@@ -78,7 +78,7 @@ public partial class Gambling
|
||||
GetText(strs.animal_race_won_money(
|
||||
Format.Bold(winner.Username),
|
||||
winner.Animal.Icon,
|
||||
(race.FinishedUsers[0].Bet * (race.Users.Count - 1)) + CurrencySign)));
|
||||
race.FinishedUsers[0].Bet * (race.Users.Count - 1) + CurrencySign)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -111,7 +111,7 @@ public partial class Gambling
|
||||
{String.Join("\n", race.Users.Select(p =>
|
||||
{
|
||||
var index = race.FinishedUsers.IndexOf(p);
|
||||
var extra = (index == -1 ? "" : $"#{index + 1} {(index == 0 ? "🏆" : "")}");
|
||||
var extra = index == -1 ? "" : $"#{index + 1} {(index == 0 ? "🏆" : "")}";
|
||||
return $"{(int)(p.Progress / 60f * 100),-2}%|{new string('‣', p.Progress) + p.Animal.Icon + extra}";
|
||||
}))}
|
||||
|🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🏁🔚|";
|
||||
|
@@ -179,7 +179,7 @@ public class Blackjack
|
||||
{
|
||||
var hw = Dealer.GetHandValue();
|
||||
while (hw < 17
|
||||
|| (hw == 17 && Dealer.Cards.Count(x => x.Number == 1) > (Dealer.GetRawHandValue() - 17) / 10))// hit on soft 17
|
||||
|| hw == 17 && Dealer.Cards.Count(x => x.Number == 1) > (Dealer.GetRawHandValue() - 17) / 10)// hit on soft 17
|
||||
{
|
||||
/* Dealer has
|
||||
A 6
|
||||
|
@@ -252,13 +252,13 @@ public class Deck
|
||||
{
|
||||
if (cards.GroupBy(card => card.Number).Count() != cards.Count())
|
||||
return false;
|
||||
var toReturn = (cards.Max(card => (int)card.Number)
|
||||
- cards.Min(card => (int)card.Number) == 4);
|
||||
var toReturn = cards.Max(card => (int)card.Number)
|
||||
- cards.Min(card => (int)card.Number) == 4;
|
||||
if (toReturn || cards.All(c => c.Number != 1)) return toReturn;
|
||||
|
||||
var newCards = cards.Select(c => c.Number == 1 ? new(c.Suit, 14) : c);
|
||||
return (newCards.Max(card => (int)card.Number)
|
||||
- newCards.Min(card => (int)card.Number) == 4);
|
||||
return newCards.Max(card => (int)card.Number)
|
||||
- newCards.Min(card => (int)card.Number) == 4;
|
||||
}
|
||||
|
||||
bool hasThreeOfKind(List<Card> cards) => cards.GroupBy(card => card.Number)
|
||||
|
@@ -167,8 +167,8 @@ public class ReactionEvent : ICurrencyEvent
|
||||
|| msg.Id != _msg.Id // same message
|
||||
|| gu.IsBot // no bots
|
||||
|| (DateTime.UtcNow - gu.CreatedAt).TotalDays <= 5 // no recently created accounts
|
||||
|| (_noRecentlyJoinedServer && // if specified, no users who joined the server in the last 24h
|
||||
(gu.JoinedAt is null || (DateTime.UtcNow - gu.JoinedAt.Value).TotalDays < 1))) // and no users for who we don't know when they joined
|
||||
|| _noRecentlyJoinedServer && // if specified, no users who joined the server in the last 24h
|
||||
(gu.JoinedAt is null || (DateTime.UtcNow - gu.JoinedAt.Value).TotalDays < 1)) // and no users for who we don't know when they joined
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -158,8 +158,8 @@ public sealed class Connect4Game : IDisposable
|
||||
if (CurrentPhase == Phase.Ended || CurrentPhase == Phase.Joining)
|
||||
return false;
|
||||
|
||||
if (!((_players[0].Value.UserId == userId && CurrentPhase == Phase.P1Move)
|
||||
|| (_players[1].Value.UserId == userId && CurrentPhase == Phase.P2Move)))
|
||||
if (!(_players[0].Value.UserId == userId && CurrentPhase == Phase.P1Move
|
||||
|| _players[1].Value.UserId == userId && CurrentPhase == Phase.P2Move))
|
||||
return false;
|
||||
|
||||
if (inputCol < 0 || inputCol > NumberOfColumns) //invalid input
|
||||
|
@@ -185,7 +185,7 @@ public partial class Gambling
|
||||
{
|
||||
for (var j = 0; j < Connect4Game.NumberOfColumns; j++)
|
||||
{
|
||||
var cur = game.GameState[i + (j * Connect4Game.NumberOfRows) - 1];
|
||||
var cur = game.GameState[i + j * Connect4Game.NumberOfRows - 1];
|
||||
|
||||
if (cur == Connect4Game.Field.Empty)
|
||||
sb.Append("⚫"); //black circle
|
||||
|
@@ -65,8 +65,8 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
.WithTitle(GetText(strs.economy_state))
|
||||
.AddField(GetText(strs.currency_owned), ((BigInteger)(ec.Cash - ec.Bot)).ToString("N", _enUsCulture) + CurrencySign)
|
||||
.AddField(GetText(strs.currency_one_percent), (onePercent * 100).ToString("F2") + "%")
|
||||
.AddField(GetText(strs.currency_planted), ((BigInteger)ec.Planted) + CurrencySign)
|
||||
.AddField(GetText(strs.owned_waifus_total), ((BigInteger)ec.Waifus) + CurrencySign)
|
||||
.AddField(GetText(strs.currency_planted), (BigInteger)ec.Planted + CurrencySign)
|
||||
.AddField(GetText(strs.owned_waifus_total), (BigInteger)ec.Waifus + CurrencySign)
|
||||
.AddField(GetText(strs.bot_currency), ec.Bot.ToString("N", _enUsCulture) + CurrencySign)
|
||||
.AddField(GetText(strs.total), ((BigInteger)(ec.Cash + ec.Planted + ec.Waifus)).ToString("N", _enUsCulture) + CurrencySign)
|
||||
.WithOkColor();
|
||||
@@ -146,7 +146,7 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
{
|
||||
role = role ?? ctx.Guild.EveryoneRole;
|
||||
|
||||
var members = (await role.GetMembersAsync().ConfigureAwait(false));
|
||||
var members = await role.GetMembersAsync().ConfigureAwait(false);
|
||||
var membersArray = members as IUser[] ?? members.ToArray();
|
||||
if (membersArray.Length == 0)
|
||||
{
|
||||
@@ -271,9 +271,9 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
}
|
||||
|
||||
await _cs.AddAsync(usr,
|
||||
$"Awarded by bot owner. ({ctx.User.Username}/{ctx.User.Id}) {(msg ?? "")}",
|
||||
$"Awarded by bot owner. ({ctx.User.Username}/{ctx.User.Id}) {msg ?? ""}",
|
||||
amount,
|
||||
gamble: (ctx.Client.CurrentUser.Id != usrId)).ConfigureAwait(false);
|
||||
gamble: ctx.Client.CurrentUser.Id != usrId).ConfigureAwait(false);
|
||||
await ReplyConfirmLocalizedAsync(strs.awarded(n(amount) + CurrencySign, $"<@{usrId}>"));
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
return;
|
||||
|
||||
if (await _cs.RemoveAsync(user, $"Taken by bot owner.({ctx.User.Username}/{ctx.User.Id})", amount,
|
||||
gamble: (ctx.Client.CurrentUser.Id != user.Id)).ConfigureAwait(false))
|
||||
gamble: ctx.Client.CurrentUser.Id != user.Id).ConfigureAwait(false))
|
||||
await ReplyConfirmLocalizedAsync(strs.take(n(amount) + CurrencySign, Format.Bold(user.ToString()))).ConfigureAwait(false);
|
||||
else
|
||||
await ReplyErrorLocalizedAsync(strs.take_fail(n(amount) + CurrencySign, Format.Bold(user.ToString()), CurrencySign));
|
||||
@@ -344,7 +344,7 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
return;
|
||||
|
||||
if (await _cs.RemoveAsync(usrId, $"Taken by bot owner.({ctx.User.Username}/{ctx.User.Id})", amount,
|
||||
gamble: (ctx.Client.CurrentUser.Id != usrId)).ConfigureAwait(false))
|
||||
gamble: ctx.Client.CurrentUser.Id != usrId).ConfigureAwait(false))
|
||||
await ReplyConfirmLocalizedAsync(strs.take(amount + CurrencySign, $"<@{usrId}>"));
|
||||
else
|
||||
await ReplyErrorLocalizedAsync(strs.take_fail(amount + CurrencySign, Format.Code(usrId.ToString()), CurrencySign));
|
||||
@@ -440,7 +440,7 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
var winner = rdGame.Winner == rdGame.P1
|
||||
? ctx.User
|
||||
: u;
|
||||
description += $"\n**{winner}** Won {n(((long)(rdGame.Amount * 2 * 0.98))) + CurrencySign}";
|
||||
description += $"\n**{winner}** Won {n((long)(rdGame.Amount * 2 * 0.98)) + CurrencySign}";
|
||||
|
||||
embed = embed.WithDescription(description);
|
||||
|
||||
@@ -609,7 +609,7 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
public async Task Rps(RpsPick pick, ShmartNumber amount = default)
|
||||
{
|
||||
long oldAmount = amount;
|
||||
if (!await CheckBetOptional(amount).ConfigureAwait(false) || (amount == 1))
|
||||
if (!await CheckBetOptional(amount).ConfigureAwait(false) || amount == 1)
|
||||
return;
|
||||
|
||||
string getRpsPick(RpsPick p)
|
||||
@@ -646,9 +646,9 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
embed.WithOkColor();
|
||||
msg = GetText(strs.rps_draw(getRpsPick(pick)));
|
||||
}
|
||||
else if ((pick == RpsPick.Paper && nadekoPick == RpsPick.Rock) ||
|
||||
(pick == RpsPick.Rock && nadekoPick == RpsPick.Scissors) ||
|
||||
(pick == RpsPick.Scissors && nadekoPick == RpsPick.Paper))
|
||||
else if (pick == RpsPick.Paper && nadekoPick == RpsPick.Rock ||
|
||||
pick == RpsPick.Rock && nadekoPick == RpsPick.Scissors ||
|
||||
pick == RpsPick.Scissors && nadekoPick == RpsPick.Paper)
|
||||
{
|
||||
amount = (long)(amount * base._config.BetFlip.Multiplier);
|
||||
await _cs.AddAsync(ctx.User.Id,
|
||||
|
@@ -110,7 +110,7 @@ public class WaifuService : INService
|
||||
.Count();
|
||||
|
||||
return (int) Math.Ceiling(waifu.Price * 1.25f) +
|
||||
((divorces + affs + 2) * settings.Waifu.Multipliers.WaifuReset);
|
||||
(divorces + affs + 2) * settings.Waifu.Multipliers.WaifuReset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public class WaifuService : INService
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
w = uow.WaifuInfo.ByWaifuUserId(target.Id);
|
||||
isAffinity = (w?.Affinity?.UserId == user.Id);
|
||||
isAffinity = w?.Affinity?.UserId == user.Id;
|
||||
if (w is null)
|
||||
{
|
||||
var claimer = uow.GetOrCreateUser(user);
|
||||
@@ -202,7 +202,7 @@ public class WaifuService : INService
|
||||
{
|
||||
var oldClaimer = w.Claimer;
|
||||
w.Claimer = uow.GetOrCreateUser(user);
|
||||
w.Price = amount + (amount / 4);
|
||||
w.Price = amount + amount / 4;
|
||||
result = WaifuClaimResult.Success;
|
||||
|
||||
uow.WaifuUpdates.Add(new()
|
||||
|
@@ -212,7 +212,7 @@ public partial class Gambling
|
||||
}
|
||||
|
||||
private static long GetProfitAmount(int price) =>
|
||||
(int)(Math.Ceiling(0.90 * price));
|
||||
(int)Math.Ceiling(0.90 * price);
|
||||
|
||||
[NadekoCommand, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
@@ -300,7 +300,7 @@ public partial class Gambling
|
||||
set => set.Include(x => x.ShopEntries)
|
||||
.ThenInclude(x => x.Items)).ShopEntries);
|
||||
entry = entries.ElementAtOrDefault(index);
|
||||
if (entry != null && (rightType = (entry.Type == ShopEntryType.List)))
|
||||
if (entry != null && (rightType = entry.Type == ShopEntryType.List))
|
||||
{
|
||||
if (added = entry.Items.Add(item))
|
||||
{
|
||||
|
@@ -227,7 +227,7 @@ public partial class Gambling
|
||||
foreach (var w in waifus)
|
||||
{
|
||||
var j = i++;
|
||||
embed.AddField("#" + ((page * 9) + j + 1) + " - " + w.Price + CurrencySign, w.ToString(), false);
|
||||
embed.AddField("#" + (page * 9 + j + 1) + " - " + w.Price + CurrencySign, w.ToString(), false);
|
||||
}
|
||||
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
|
Reference in New Issue
Block a user