Removed cmd source generator. Commands are no longer partial methods. Compilations should be slightly faster now. Updated packages and adapted drawing code to the new apis. There may be some bugs.

This commit is contained in:
Kwoth
2022-07-18 04:33:50 +02:00
parent 3db194c186
commit 99c60459f8
98 changed files with 747 additions and 788 deletions

View File

@@ -35,7 +35,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[NadekoOptionsAttribute(typeof(RaceOptions))]
public partial Task Race(params string[] args)
public Task Race(params string[] args)
{
var (options, _) = OptionsParser.ParseFrom(new RaceOptions(), args);
@@ -135,7 +135,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task JoinRace(ShmartNumber amount = default)
public async Task JoinRace(ShmartNumber amount = default)
{
if (!await CheckBetOptional(amount))
return;

View File

@@ -19,7 +19,7 @@ public partial class Gambling
}
[Cmd]
public async partial Task BankDeposit(ShmartNumber amount)
public async Task BankDeposit(ShmartNumber amount)
{
if (amount <= 0)
return;
@@ -35,7 +35,7 @@ public partial class Gambling
}
[Cmd]
public async partial Task BankWithdraw(ShmartNumber amount)
public async Task BankWithdraw(ShmartNumber amount)
{
if (amount <= 0)
return;
@@ -51,7 +51,7 @@ public partial class Gambling
}
[Cmd]
public async partial Task BankBalance()
public async Task BankBalance()
{
var bal = await _bank.GetBalanceAsync(ctx.User.Id);

View File

@@ -30,7 +30,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task BlackJack(ShmartNumber amount)
public async Task BlackJack(ShmartNumber amount)
{
if (!await CheckBetMandatory(amount))
return;
@@ -149,17 +149,17 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public partial Task Hit()
public Task Hit()
=> InternalBlackJack(BjAction.Hit);
[Cmd]
[RequireContext(ContextType.Guild)]
public partial Task Stand()
public Task Stand()
=> InternalBlackJack(BjAction.Stand);
[Cmd]
[RequireContext(ContextType.Guild)]
public partial Task Double()
public Task Double()
=> InternalBlackJack(BjAction.Double);
private async Task InternalBlackJack(BjAction a)

View File

@@ -45,7 +45,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[NadekoOptionsAttribute(typeof(Connect4Game.Options))]
public async partial Task Connect4(params string[] args)
public async Task Connect4(params string[] args)
{
var (options, _) = OptionsParser.ParseFrom(new Connect4Game.Options(), args);
if (!await CheckBetOptional(options.Bet))

View File

@@ -23,7 +23,7 @@ public partial class Gambling
=> _images = images;
[Cmd]
public async partial Task Roll()
public async Task Roll()
{
var rng = new NadekoRandom();
var gen = rng.Next(1, 101);
@@ -51,23 +51,23 @@ public partial class Gambling
[Cmd]
[Priority(1)]
public async partial Task Roll(int num)
public async Task Roll(int num)
=> await InternalRoll(num, true);
[Cmd]
[Priority(1)]
public async partial Task Rolluo(int num = 1)
public async Task Rolluo(int num = 1)
=> await InternalRoll(num, false);
[Cmd]
[Priority(0)]
public async partial Task Roll(string arg)
public async Task Roll(string arg)
=> await InternallDndRoll(arg, true);
[Cmd]
[Priority(0)]
public async partial Task Rolluo(string arg)
public async Task Rolluo(string arg)
=> await InternallDndRoll(arg, false);
private async Task InternalRoll(int num, bool ordered)
@@ -186,7 +186,7 @@ public partial class Gambling
}
[Cmd]
public async partial Task NRoll([Leftover] string range)
public async Task NRoll([Leftover] string range)
{
int rolled;
if (range.Contains("-"))
@@ -213,12 +213,12 @@ public partial class Gambling
if (num == 10)
{
using var imgOne = Image.Load(await _images.GetDiceAsync(1));
using var imgZero = Image.Load(await _images.GetDiceAsync(0));
using var imgOne = Image.Load<Rgba32>(await _images.GetDiceAsync(1));
using var imgZero = Image.Load<Rgba32>(await _images.GetDiceAsync(0));
return new[] { imgOne, imgZero }.Merge();
}
return Image.Load(await _images.GetDiceAsync(num));
return Image.Load<Rgba32>(await _images.GetDiceAsync(num));
}
}
}

View File

@@ -81,12 +81,12 @@ public partial class Gambling
{
var cardName = currentCard.ToString().ToLowerInvariant().Replace(' ', '_');
var cardBytes = await File.ReadAllBytesAsync($"data/images/cards/{cardName}.jpg");
return Image.Load(cardBytes);
return Image.Load<Rgba32>(cardBytes);
}
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task Draw(int num = 1)
public async Task Draw(int num = 1)
{
if (num < 1)
return;
@@ -98,7 +98,7 @@ public partial class Gambling
}
[Cmd]
public async partial Task DrawNew(int num = 1)
public async Task DrawNew(int num = 1)
{
if (num < 1)
return;
@@ -111,7 +111,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task DeckShuffle()
public async Task DeckShuffle()
{
//var channel = (ITextChannel)ctx.Channel;
@@ -128,12 +128,12 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public partial Task BetDraw(ShmartNumber amount, InputValueGuess val, InputColorGuess? col = null)
public Task BetDraw(ShmartNumber amount, InputValueGuess val, InputColorGuess? col = null)
=> BetDrawInternal(amount, val, col);
[Cmd]
[RequireContext(ContextType.Guild)]
public partial Task BetDraw(ShmartNumber amount, InputColorGuess col, InputValueGuess? val = null)
public Task BetDraw(ShmartNumber amount, InputColorGuess col, InputValueGuess? val = null)
=> BetDrawInternal(amount, val, col);
public async Task BetDrawInternal(long amount, InputValueGuess? val, InputColorGuess? col)

View File

@@ -20,7 +20,7 @@ public partial class Gambling
[RequireContext(ContextType.Guild)]
[NadekoOptionsAttribute(typeof(EventOptions))]
[OwnerOnly]
public async partial Task EventStart(CurrencyEvent.Type ev, params string[] options)
public async Task EventStart(CurrencyEvent.Type ev, params string[] options)
{
var (opts, _) = OptionsParser.ParseFrom(new EventOptions(), options);
if (!await _service.TryCreateEventAsync(ctx.Guild.Id, ctx.Channel.Id, ev, opts, GetEmbed))

View File

@@ -13,7 +13,7 @@ public class CurrencyEventsService : INService
private readonly ConcurrentDictionary<ulong, ICurrencyEvent> _events = new();
// todo fix xp freeze
public CurrencyEventsService(DiscordSocketClient client, ICurrencyService cs, GamblingConfigService configService)
{
_client = client;
@@ -29,7 +29,7 @@ public class CurrencyEventsService : INService
Func<CurrencyEvent.Type, EventOptions, long, IEmbedBuilder> embed)
{
var g = _client.GetGuild(guildId);
if (g?.GetChannel(channelId) is not SocketTextChannel ch)
if (g?.GetChannel(channelId) is not ITextChannel ch)
return false;
ICurrencyEvent ce;

View File

@@ -41,7 +41,7 @@ public partial class Gambling
}
[Cmd]
public async partial Task Flip(int count = 1)
public async Task Flip(int count = 1)
{
if (count is > 10 or < 1)
{
@@ -61,12 +61,12 @@ public partial class Gambling
{
if (result[i].Side == 0)
{
imgs[i] = Image.Load(headsArr);
imgs[i] = Image.Load<Rgba32>(headsArr);
headCount++;
}
else
{
imgs[i] = Image.Load(tailsArr);
imgs[i] = Image.Load<Rgba32>(tailsArr);
tailCount++;
}
}
@@ -96,7 +96,7 @@ public partial class Gambling
}
[Cmd]
public async partial Task Betflip(ShmartNumber amount, BetFlipGuess guess)
public async Task Betflip(ShmartNumber amount, BetFlipGuess guess)
{
if (!await CheckBetMandatory(amount) || amount == 1)
return;

View File

@@ -66,7 +66,7 @@ public partial class Gambling : GamblingModule<GamblingService>
}
[Cmd]
public async partial Task Economy()
public async Task Economy()
{
var ec = await _service.GetEconomyAsync();
decimal onePercent = 0;
@@ -133,7 +133,7 @@ public partial class Gambling : GamblingModule<GamblingService>
};
[Cmd]
public async partial Task Timely()
public async Task Timely()
{
var val = Config.Timely.Amount;
var period = Config.Timely.Cooldown;
@@ -166,7 +166,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[OwnerOnly]
public async partial Task TimelyReset()
public async Task TimelyReset()
{
await _service.RemoveAllTimelyClaimsAsync();
await ReplyConfirmLocalizedAsync(strs.timely_reset);
@@ -174,7 +174,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[OwnerOnly]
public async partial Task TimelySet(int amount, int period = 24)
public async Task TimelySet(int amount, int period = 24)
{
if (amount < 0 || period < 0)
{
@@ -199,7 +199,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task Raffle([Leftover] IRole role = null)
public async Task Raffle([Leftover] IRole role = null)
{
role ??= ctx.Guild.EveryoneRole;
@@ -218,7 +218,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task RaffleAny([Leftover] IRole role = null)
public async Task RaffleAny([Leftover] IRole role = null)
{
role ??= ctx.Guild.EveryoneRole;
@@ -237,19 +237,19 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[Priority(2)]
public partial Task CurrencyTransactions(int page = 1)
public Task CurrencyTransactions(int page = 1)
=> InternalCurrencyTransactions(ctx.User.Id, page);
[Cmd]
[OwnerOnly]
[Priority(0)]
public partial Task CurrencyTransactions([Leftover] IUser usr)
public Task CurrencyTransactions([Leftover] IUser usr)
=> InternalCurrencyTransactions(usr.Id, 1);
[Cmd]
[OwnerOnly]
[Priority(1)]
public partial Task CurrencyTransactions(IUser usr, int page)
public Task CurrencyTransactions(IUser usr, int page)
=> InternalCurrencyTransactions(usr.Id, page);
private async Task InternalCurrencyTransactions(ulong userId, int page)
@@ -299,7 +299,7 @@ public partial class Gambling : GamblingModule<GamblingService>
=> $"{ct.DateAdded:HH:mm yyyy-MM-dd}";
[Cmd]
public async partial Task CurrencyTransaction(kwum id)
public async Task CurrencyTransaction(kwum id)
{
int intId = id;
await using var uow = _db.GetDbContext();
@@ -356,7 +356,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[Priority(0)]
public async partial Task Cash(ulong userId)
public async Task Cash(ulong userId)
{
var cur = await GetBalanceStringAsync(userId);
await ReplyConfirmLocalizedAsync(strs.has(Format.Code(userId.ToString()), cur));
@@ -377,7 +377,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[Priority(1)]
public async partial Task Cash([Leftover] IUser user = null)
public async Task Cash([Leftover] IUser user = null)
{
user ??= ctx.User;
var cur = await GetBalanceStringAsync(user.Id);
@@ -397,7 +397,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(0)]
public async partial Task Give(ShmartNumber amount, IGuildUser receiver, [Leftover] string msg)
public async Task Give(ShmartNumber amount, IGuildUser receiver, [Leftover] string msg)
{
if (amount <= 0 || ctx.User.Id == receiver.Id || receiver.IsBot)
{
@@ -416,27 +416,27 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(1)]
public partial Task Give(ShmartNumber amount, [Leftover] IGuildUser receiver)
public Task Give(ShmartNumber amount, [Leftover] IGuildUser receiver)
=> Give(amount, receiver, null);
[Cmd]
[RequireContext(ContextType.Guild)]
[OwnerOnly]
[Priority(0)]
public partial Task Award(long amount, IGuildUser usr, [Leftover] string msg)
public Task Award(long amount, IGuildUser usr, [Leftover] string msg)
=> Award(amount, usr.Id, msg);
[Cmd]
[RequireContext(ContextType.Guild)]
[OwnerOnly]
[Priority(1)]
public partial Task Award(long amount, [Leftover] IGuildUser usr)
public Task Award(long amount, [Leftover] IGuildUser usr)
=> Award(amount, usr.Id);
[Cmd]
[OwnerOnly]
[Priority(2)]
public async partial Task Award(long amount, ulong usrId, [Leftover] string msg = null)
public async Task Award(long amount, ulong usrId, [Leftover] string msg = null)
{
if (amount <= 0)
{
@@ -459,7 +459,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[RequireContext(ContextType.Guild)]
[OwnerOnly]
[Priority(3)]
public async partial Task Award(long amount, [Leftover] IRole role)
public async Task Award(long amount, [Leftover] IRole role)
{
var users = (await ctx.Guild.GetUsersAsync()).Where(u => u.GetRoles().Contains(role)).ToList();
@@ -476,7 +476,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[RequireContext(ContextType.Guild)]
[OwnerOnly]
[Priority(0)]
public async partial Task Take(long amount, [Leftover] IRole role)
public async Task Take(long amount, [Leftover] IRole role)
{
var users = (await role.GetMembersAsync()).ToList();
@@ -493,7 +493,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[RequireContext(ContextType.Guild)]
[OwnerOnly]
[Priority(1)]
public async partial Task Take(long amount, [Leftover] IGuildUser user)
public async Task Take(long amount, [Leftover] IGuildUser user)
{
if (amount <= 0)
{
@@ -514,7 +514,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[OwnerOnly]
public async partial Task Take(long amount, [Leftover] ulong usrId)
public async Task Take(long amount, [Leftover] ulong usrId)
{
if (amount <= 0)
{
@@ -535,7 +535,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task RollDuel(IUser u)
public async Task RollDuel(IUser u)
{
if (ctx.User.Id == u.Id)
{
@@ -552,7 +552,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task RollDuel(ShmartNumber amount, IUser u)
public async Task RollDuel(ShmartNumber amount, IUser u)
{
if (ctx.User.Id == u.Id)
{
@@ -643,7 +643,7 @@ public partial class Gambling : GamblingModule<GamblingService>
}
[Cmd]
public async partial Task BetRoll(ShmartNumber amount)
public async Task BetRoll(ShmartNumber amount)
{
if (!await CheckBetMandatory(amount))
{
@@ -682,13 +682,13 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[NadekoOptions(typeof(LbOpts))]
[Priority(0)]
public partial Task Leaderboard(params string[] args)
public Task Leaderboard(params string[] args)
=> Leaderboard(1, args);
[Cmd]
[NadekoOptions(typeof(LbOpts))]
[Priority(1)]
public async partial Task Leaderboard(int page = 1, params string[] args)
public async Task Leaderboard(int page = 1, params string[] args)
{
if (--page < 0)
{
@@ -774,7 +774,7 @@ public partial class Gambling : GamblingModule<GamblingService>
}
[Cmd]
public async partial Task Rps(InputRpsPick pick, ShmartNumber amount = default)
public async Task Rps(InputRpsPick pick, ShmartNumber amount = default)
{
static string GetRpsPick(InputRpsPick p)
{
@@ -834,7 +834,7 @@ public partial class Gambling : GamblingModule<GamblingService>
new[] { "⬆", "↖", "⬅", "↙", "⬇", "↘", "➡", "↗" }.ToImmutableArray();
[Cmd]
public async partial Task LuckyLadder(ShmartNumber amount)
public async Task LuckyLadder(ShmartNumber amount)
{
if (!await CheckBetMandatory(amount))
return;
@@ -887,7 +887,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[OwnerOnly]
public async partial Task BetTest()
public async Task BetTest()
{
await SendConfirmAsync(GetText(strs.available_tests),
Enum.GetValues<GambleTestTarget>()
@@ -897,7 +897,7 @@ public partial class Gambling : GamblingModule<GamblingService>
[Cmd]
[OwnerOnly]
public async partial Task BetTest(GambleTestTarget target, int tests = 1000)
public async Task BetTest(GambleTestTarget target, int tests = 1000)
{
if (tests <= 0)
return;

View File

@@ -18,7 +18,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task Pick(string pass = null)
public async Task Pick(string pass = null)
{
if (!string.IsNullOrWhiteSpace(pass) && !pass.IsAlphaNumeric())
return;
@@ -44,7 +44,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task Plant(ShmartNumber amount, string pass = null)
public async Task Plant(ShmartNumber amount, string pass = null)
{
if (amount < 1)
return;
@@ -75,7 +75,7 @@ public partial class Gambling
#if GLOBAL_NADEKO
[OwnerOnly]
#endif
public async partial Task GenCurrency()
public async Task GenCurrency()
{
var enabled = _service.ToggleCurrencyGeneration(ctx.Guild.Id, ctx.Channel.Id);
if (enabled)
@@ -88,7 +88,7 @@ public partial class Gambling
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageMessages)]
[OwnerOnly]
public partial Task GenCurList(int page = 1)
public Task GenCurList(int page = 1)
{
if (--page < 0)
return Task.CompletedTask;

View File

@@ -143,7 +143,10 @@ public class PlantPickService : INService, IExecNoCommand
img.Mutate(x =>
{
// measure the size of the text to be drawing
var size = TextMeasurer.Measure(pass, new(font, new PointF(0, 0)));
var size = TextMeasurer.Measure(pass, new TextOptions(font)
{
Origin = new PointF(0, 0)
});
// fill the background with black, add 5 pixels on each side to make it look better
x.FillPolygon(Color.ParseHex("00000080"),

View File

@@ -19,13 +19,13 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(0)]
public partial Task RaffleCur(Mixed _, ShmartNumber amount)
public Task RaffleCur(Mixed _, ShmartNumber amount)
=> RaffleCur(amount, true);
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(1)]
public async partial Task RaffleCur(ShmartNumber amount, bool mixed = false)
public async Task RaffleCur(ShmartNumber amount, bool mixed = false)
{
if (!await CheckBetMandatory(amount))
return;

View File

@@ -67,7 +67,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public partial Task Shop(int page = 1)
public Task Shop(int page = 1)
{
if (--page < 0)
return Task.CompletedTask;
@@ -77,7 +77,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task Buy(int index)
public async Task Buy(int index)
{
index -= 1;
if (index < 0)
@@ -206,7 +206,7 @@ public partial class Gambling
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
[BotPerm(GuildPerm.ManageRoles)]
public async partial Task ShopAdd(Role _, int price, [Leftover] IRole role)
public async Task ShopAdd(Role _, int price, [Leftover] IRole role)
{
if (price < 1)
return;
@@ -239,7 +239,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
public async partial Task ShopAdd(List _, int price, [Leftover] string name)
public async Task ShopAdd(List _, int price, [Leftover] string name)
{
if (price < 1)
return;
@@ -271,7 +271,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
public async partial Task ShopListAdd(int index, [Leftover] string itemText)
public async Task ShopListAdd(int index, [Leftover] string itemText)
{
index -= 1;
if (index < 0)
@@ -313,7 +313,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
public async partial Task ShopRemove(int index)
public async Task ShopRemove(int index)
{
index -= 1;
if (index < 0)
@@ -343,7 +343,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
public async partial Task ShopChangePrice(int index, int price)
public async Task ShopChangePrice(int index, int price)
{
if (--index < 0 || price <= 0)
return;
@@ -361,7 +361,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
public async partial Task ShopChangeName(int index, [Leftover] string newName)
public async Task ShopChangeName(int index, [Leftover] string newName)
{
if (--index < 0 || string.IsNullOrWhiteSpace(newName))
return;
@@ -379,7 +379,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
public async partial Task ShopSwap(int index1, int index2)
public async Task ShopSwap(int index1, int index2)
{
if (--index1 < 0 || --index2 < 0 || index1 == index2)
return;
@@ -397,7 +397,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
public async partial Task ShopMove(int fromIndex, int toIndex)
public async Task ShopMove(int fromIndex, int toIndex)
{
if (--fromIndex < 0 || --toIndex < 0 || fromIndex == toIndex)
return;

View File

@@ -55,7 +55,7 @@ public partial class Gambling
[Cmd]
[OwnerOnly]
public async partial Task SlotStats()
public async Task SlotStats()
{
//i remembered to not be a moron
var paid = totalPaidOut;
@@ -85,7 +85,7 @@ public partial class Gambling
}
[Cmd]
public async partial Task Slot(ShmartNumber amount)
public async Task Slot(ShmartNumber amount)
{
if (!await CheckBetMandatory(amount))
return;
@@ -230,49 +230,37 @@ public partial class Gambling
Color fontColor = Config.Slots.CurrencyFontColor;
bgImage.Mutate(x => x.DrawText(new()
bgImage.Mutate(x => x.DrawText(new TextOptions(_fonts.DottyFont.CreateFont(65))
{
TextOptions = new()
{
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
WrapTextWidth = 140
}
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
WrappingLength = 140,
Origin = new(227, 92)
},
((long)result.Won).ToString(),
_fonts.DottyFont.CreateFont(65),
fontColor,
new(227, 92)));
fontColor));
var bottomFont = _fonts.DottyFont.CreateFont(50);
bgImage.Mutate(x => x.DrawText(new()
bgImage.Mutate(x => x.DrawText(new TextOptions(bottomFont)
{
TextOptions = new()
{
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
WrapTextWidth = 135
}
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
WrappingLength = 135,
Origin = new(129, 472)
},
amount.ToString(),
bottomFont,
fontColor,
new(129, 472)));
fontColor));
bgImage.Mutate(x => x.DrawText(new()
bgImage.Mutate(x => x.DrawText(new(bottomFont)
{
TextOptions = new()
{
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
WrapTextWidth = 135
}
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
WrappingLength = 135,
Origin = new(325, 472)
},
ownedAmount.ToString(),
bottomFont,
fontColor,
new(325, 472)));
fontColor));
//sw.PrintLap("drew red text");
for (var i = 0; i < 3; i++)

View File

@@ -17,7 +17,7 @@ public partial class Gambling
}
[Cmd]
public async partial Task WaifuReset()
public async Task WaifuReset()
{
var price = _service.GetResetPrice(ctx.User);
var embed = _eb.Create()
@@ -38,7 +38,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task WaifuClaim(long amount, [Leftover] IUser target)
public async Task WaifuClaim(long amount, [Leftover] IUser target)
{
if (amount < Config.Waifu.MinPrice)
{
@@ -78,7 +78,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(0)]
public async partial Task WaifuTransfer(ulong waifuId, IUser newOwner)
public async Task WaifuTransfer(ulong waifuId, IUser newOwner)
{
if (!await _service.WaifuTransfer(ctx.User, waifuId, newOwner))
{
@@ -94,7 +94,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(1)]
public async partial Task WaifuTransfer(IUser waifu, IUser newOwner)
public async Task WaifuTransfer(IUser waifu, IUser newOwner)
{
if (!await _service.WaifuTransfer(ctx.User, waifu.Id, newOwner))
{
@@ -110,7 +110,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(-1)]
public partial Task Divorce([Leftover] string target)
public Task Divorce([Leftover] string target)
{
var waifuUserId = _service.GetWaifuUserId(ctx.User.Id, target);
if (waifuUserId == default)
@@ -122,13 +122,13 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(0)]
public partial Task Divorce([Leftover] IGuildUser target)
public Task Divorce([Leftover] IGuildUser target)
=> Divorce(target.Id);
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(1)]
public async partial Task Divorce([Leftover] ulong targetId)
public async Task Divorce([Leftover] ulong targetId)
{
if (targetId == ctx.User.Id)
return;
@@ -154,7 +154,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task Affinity([Leftover] IGuildUser user = null)
public async Task Affinity([Leftover] IGuildUser user = null)
{
if (user?.Id == ctx.User.Id)
{
@@ -190,7 +190,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task WaifuLb(int page = 1)
public async Task WaifuLb(int page = 1)
{
page--;
@@ -223,7 +223,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(1)]
public partial Task WaifuInfo([Leftover] IUser target = null)
public Task WaifuInfo([Leftover] IUser target = null)
{
if (target is null)
target = ctx.User;
@@ -234,7 +234,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(0)]
public partial Task WaifuInfo(ulong targetId)
public Task WaifuInfo(ulong targetId)
=> InternalWaifuInfo(targetId);
private async Task InternalWaifuInfo(ulong targetId, string name = null)
@@ -287,7 +287,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(1)]
public async partial Task WaifuGift(int page = 1)
public async Task WaifuGift(int page = 1)
{
if (--page < 0 || page > (Config.Waifu.Items.Count - 1) / 9)
return;
@@ -317,7 +317,7 @@ public partial class Gambling
[Cmd]
[RequireContext(ContextType.Guild)]
[Priority(0)]
public async partial Task WaifuGift(string itemName, [Leftover] IUser waifu)
public async Task WaifuGift(string itemName, [Leftover] IUser waifu)
{
if (waifu.Id == ctx.User.Id)
return;