fix build errors and tests

This commit is contained in:
Toastie 2025-02-08 16:43:01 +13:00
parent 9f660431c2
commit 37601286f5
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7
2 changed files with 10 additions and 10 deletions
src
EllieBot.Tests
EllieBot/Modules/Xp

View file

@ -13,7 +13,7 @@ namespace EllieBot.Tests
{ {
private const string responsesPath = "../../../../EllieBot/strings/responses"; private const string responsesPath = "../../../../EllieBot/strings/responses";
private const string commandsPath = "../../../../EllieBot/strings/commands"; private const string commandsPath = "../../../../EllieBot/strings/commands";
private const string aliasesPath = "../../../../EllieBot/aliases.yml"; private const string aliasesPath = "../../../../EllieBot/strings/aliases.yml";
[Test] [Test]
public void AllCommandNamesHaveStrings() public void AllCommandNamesHaveStrings()

View file

@ -1010,7 +1010,7 @@ public class XpService : IEService, IReadyExecutor, IExecNoCommand
//club image //club image
if (template.Club.Icon.Show) if (template.Club.Icon.Show)
await DrawClubImage(img, stats); await DrawClubImage(template, img, stats);
await DrawFrame(img, stats.User.UserId); await DrawFrame(img, stats.User.UserId);
@ -1102,7 +1102,7 @@ public class XpService : IEService, IReadyExecutor, IExecNoCommand
new PointF(x2, y2))); 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)) if (!string.IsNullOrWhiteSpace(stats.User.Club?.ImageUrl))
{ {
@ -1122,9 +1122,9 @@ public class XpService : IEService, IReadyExecutor, IExecNoCommand
using (var tempDraw = Image.Load<Rgba32>(imgData)) using (var tempDraw = Image.Load<Rgba32>(imgData))
{ {
tempDraw.Mutate(x => x tempDraw.Mutate(x => x
.Resize(_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, .ApplyRoundedCorners(Math.Max(template.Club.Icon.Size.X,
_template.Club.Icon.Size.Y) template.Club.Icon.Size.Y)
/ 2.0f)); / 2.0f));
await using (var tds = await tempDraw.ToStreamAsync()) await using (var tds = await tempDraw.ToStreamAsync())
{ {
@ -1137,12 +1137,12 @@ public class XpService : IEService, IReadyExecutor, IExecNoCommand
} }
using var toDraw = Image.Load(data); using var toDraw = Image.Load(data);
if (toDraw.Size != new Size(_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)); toDraw.Mutate(x => x.Resize(template.Club.Icon.Size.X, template.Club.Icon.Size.Y));
img.Mutate(x => x.DrawImage( img.Mutate(x => x.DrawImage(
toDraw, 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)); 1));
} }
catch (Exception ex) 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"; private const string XP_TEMPLATE_PATH = "./data/xp_template.json";