From 37601286f5d2df657f5bab61e3ae5c3d7d9a4d32 Mon Sep 17 00:00:00 2001 From: Toastie <toastie@toastiet0ast.com> Date: Sat, 8 Feb 2025 16:43:01 +1300 Subject: [PATCH] fix build errors and tests --- src/EllieBot.Tests/BotStringsTests.cs | 2 +- src/EllieBot/Modules/Xp/XpService.cs | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/EllieBot.Tests/BotStringsTests.cs b/src/EllieBot.Tests/BotStringsTests.cs index d295c5a..696e6e9 100644 --- a/src/EllieBot.Tests/BotStringsTests.cs +++ b/src/EllieBot.Tests/BotStringsTests.cs @@ -13,7 +13,7 @@ namespace EllieBot.Tests { private const string responsesPath = "../../../../EllieBot/strings/responses"; private const string commandsPath = "../../../../EllieBot/strings/commands"; - private const string aliasesPath = "../../../../EllieBot/aliases.yml"; + private const string aliasesPath = "../../../../EllieBot/strings/aliases.yml"; [Test] public void AllCommandNamesHaveStrings() diff --git a/src/EllieBot/Modules/Xp/XpService.cs b/src/EllieBot/Modules/Xp/XpService.cs index cc5cf84..3e4a574 100644 --- a/src/EllieBot/Modules/Xp/XpService.cs +++ b/src/EllieBot/Modules/Xp/XpService.cs @@ -1010,7 +1010,7 @@ public class XpService : IEService, IReadyExecutor, IExecNoCommand //club image if (template.Club.Icon.Show) - await DrawClubImage(img, stats); + await DrawClubImage(template, img, stats); await DrawFrame(img, stats.User.UserId); @@ -1102,7 +1102,7 @@ public class XpService : IEService, IReadyExecutor, IExecNoCommand new PointF(x2, y2))); } - private async Task DrawClubImage(Image<Rgba32> img, FullUserStats stats) + private async Task DrawClubImage(XpTemplate template, Image<Rgba32> img, FullUserStats stats) { if (!string.IsNullOrWhiteSpace(stats.User.Club?.ImageUrl)) { @@ -1122,9 +1122,9 @@ public class XpService : IEService, IReadyExecutor, IExecNoCommand using (var tempDraw = Image.Load<Rgba32>(imgData)) { tempDraw.Mutate(x => x - .Resize(_template.Club.Icon.Size.X, _template.Club.Icon.Size.Y) - .ApplyRoundedCorners(Math.Max(_template.Club.Icon.Size.X, - _template.Club.Icon.Size.Y) + .Resize(template.Club.Icon.Size.X, template.Club.Icon.Size.Y) + .ApplyRoundedCorners(Math.Max(template.Club.Icon.Size.X, + template.Club.Icon.Size.Y) / 2.0f)); await using (var tds = await tempDraw.ToStreamAsync()) { @@ -1137,12 +1137,12 @@ public class XpService : IEService, IReadyExecutor, IExecNoCommand } using var toDraw = Image.Load(data); - if (toDraw.Size != new Size(_template.Club.Icon.Size.X, _template.Club.Icon.Size.Y)) - toDraw.Mutate(x => x.Resize(_template.Club.Icon.Size.X, _template.Club.Icon.Size.Y)); + if (toDraw.Size != new Size(template.Club.Icon.Size.X, template.Club.Icon.Size.Y)) + toDraw.Mutate(x => x.Resize(template.Club.Icon.Size.X, template.Club.Icon.Size.Y)); img.Mutate(x => x.DrawImage( toDraw, - new Point(_template.Club.Icon.Pos.X, _template.Club.Icon.Pos.Y), + new Point(template.Club.Icon.Pos.X, template.Club.Icon.Pos.Y), 1)); } catch (Exception ex) @@ -1383,7 +1383,7 @@ public class XpService : IEService, IReadyExecutor, IExecNoCommand } } -public sealed class XpTemplateService : INService, IReadyExecutor +public sealed class XpTemplateService : IEService, IReadyExecutor { private const string XP_TEMPLATE_PATH = "./data/xp_template.json";