diff --git a/src/EllieBot/Modules/Gambling/Gambling.cs b/src/EllieBot/Modules/Gambling/Gambling.cs index dafdfe1..7d0459b 100644 --- a/src/EllieBot/Modules/Gambling/Gambling.cs +++ b/src/EllieBot/Modules/Gambling/Gambling.cs @@ -162,7 +162,7 @@ public partial class Gambling : GamblingModule if (password is not null) { - var img = GetPasswordImage(password); + var img = _captchaService.GetPasswordImage(password); await using var stream = await img.ToStreamAsync(); var toSend = Response() .File(stream, "timely.png"); @@ -194,39 +194,6 @@ public partial class Gambling : GamblingModule await ClaimTimely(); } - private Image GetPasswordImage(string password) - { - var img = new Image(50, 24); - - var font = _fonts.NotoSans.CreateFont(22); - var outlinePen = new SolidPen(Color.Black, 0.5f); - var strikeoutRun = new RichTextRun - { - Start = 0, - End = password.GetGraphemeCount(), - Font = font, - StrikeoutPen = new SolidPen(Color.White, 4), - TextDecorations = TextDecorations.Strikeout - }; - // draw password on the image - img.Mutate(x => - { - x.DrawText(new RichTextOptions(font) - { - HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center, - FallbackFontFamilies = _fonts.FallBackFonts, - Origin = new(25, 12), - TextRuns = [strikeoutRun] - }, - password, - Brushes.Solid(Color.White), - outlinePen); - }); - - return img; - } - private async Task ClaimTimely() { var period = Config.Timely.Cooldown; diff --git a/src/EllieBot/Modules/Games/Fish/CaptchaService.cs b/src/EllieBot/Modules/Games/Fish/CaptchaService.cs index 6ec1ed5..cecf6cb 100644 --- a/src/EllieBot/Modules/Games/Fish/CaptchaService.cs +++ b/src/EllieBot/Modules/Games/Fish/CaptchaService.cs @@ -16,7 +16,7 @@ public sealed class CaptchaService(FontProvider fonts, IBotCache cache, IPatrona public Image GetPasswordImage(string password) { - var img = new Image(50, 24); + var img = new Image(60, 34); var font = fonts.NotoSans.CreateFont(22); var outlinePen = new SolidPen(Color.Black, 0.5f); @@ -38,7 +38,7 @@ public sealed class CaptchaService(FontProvider fonts, IBotCache cache, IPatrona HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, FallbackFontFamilies = fonts.FallBackFonts, - Origin = new(25, 12), + Origin = new(30, 15), TextRuns = [strikeoutRun] }, password,