diff --git a/src/EllieBot/Modules/Gambling/Bank/BankService.cs b/src/EllieBot/Modules/Gambling/Bank/BankService.cs index 00225fe..64960d3 100644 --- a/src/EllieBot/Modules/Gambling/Bank/BankService.cs +++ b/src/EllieBot/Modules/Gambling/Bank/BankService.cs @@ -100,6 +100,13 @@ public sealed class BankService( if (rows > 0) { await _cur.AddAsync(userId, amount, new("bank", "withdraw")); + await quests.ReportActionAsync(userId, + QuestEventType.BankAction, + new() + { + { "type", "withdraw" }, + { "amount", amount.ToString() } + }); return true; } @@ -114,6 +121,13 @@ public sealed class BankService( .FirstOrDefaultAsync(x => x.UserId == userId)) ?.Balance ?? 0; + + await quests.ReportActionAsync(userId, + QuestEventType.BankAction, + new() + { + { "type", "balance" } + }); return res; } } \ No newline at end of file diff --git a/src/EllieBot/Modules/Games/NCanvas/NCanvasCommands.cs b/src/EllieBot/Modules/Games/NCanvas/NCanvasCommands.cs index bf0e589..85b849a 100644 --- a/src/EllieBot/Modules/Games/NCanvas/NCanvasCommands.cs +++ b/src/EllieBot/Modules/Games/NCanvas/NCanvasCommands.cs @@ -60,6 +60,12 @@ public partial class Games await Response() .File(stream, "ncanvas.png") .Embed(CreateEmbed() + .WithDescription(""" + Draw pixels on the canvas! + `.ncz x y` to zoom to a particular coordinates + `.ncs CODE color` to set color + `.nc` to see the whole canvas + """) .WithOkColor() #if GLOBAL_ELLIE .WithDescription("This is not available yet.") diff --git a/src/EllieBot/Modules/Games/NCanvas/NCanvasService.cs b/src/EllieBot/Modules/Games/NCanvas/NCanvasService.cs index fb48ca1..e73645c 100644 --- a/src/EllieBot/Modules/Games/NCanvas/NCanvasService.cs +++ b/src/EllieBot/Modules/Games/NCanvas/NCanvasService.cs @@ -4,9 +4,8 @@ using LinqToDB.EntityFrameworkCore; using EllieBot.Common.ModuleBehaviors; using EllieBot.Db.Models; using EllieBot.Modules.Games.Quests; -using SixLabors.ImageSharp.ColorSpaces; -using SixLabors.ImageSharp.ColorSpaces.Conversion; using SixLabors.ImageSharp.PixelFormats; +using Color = SixLabors.ImageSharp.Color; namespace EllieBot.Modules.Games; @@ -20,8 +19,8 @@ public sealed class NCanvasService : INCanvasService, IReadyExecutor, IEService private readonly ICurrencyService _cs; private readonly QuestService _quests; - public const int CANVAS_WIDTH = 250; - public const int CANVAS_HEIGHT = 125; + public const int CANVAS_WIDTH = 200; + public const int CANVAS_HEIGHT = 100; public const int INITIAL_PRICE = 3; public NCanvasService( @@ -49,32 +48,6 @@ public sealed class NCanvasService : INCanvasService, IReadyExecutor, IEService if (count == CANVAS_WIDTH * CANVAS_HEIGHT) return; - var oldWidth = 500; - var oldHeight = 250; - if (count == oldWidth * oldHeight) - { - await uow.GetTable<NCPixel>() - .Where(x => x.Position % (oldWidth * 2) % 2 != 0 // x is odd - || (x.Position / oldWidth) % 2 != 0) // or y is odd - .DeleteAsync(); - - await uow.GetTable<NCPixel>() - .Where(x => x.Position % (oldWidth * 2) % 2 == 0 - && (x.Position / oldWidth) % 2 == 0) - .UpdateAsync(old => new() - { - Position = (old.Position % oldWidth) / 2 - + ((old.Position / oldWidth) / 2) * CANVAS_WIDTH, - Price = INITIAL_PRICE, - Text = old.Text, - OwnerId = old.OwnerId, - Color = old.Color, - }); - - return; - } - - await ResetAsync(); } @@ -92,12 +65,9 @@ public sealed class NCanvasService : INCanvasService, IReadyExecutor, IEService await uow.GetTable<NCPixel>() .BulkCopyAsync(toAdd.Select(x => { - var clr = ColorSpaceConverter.ToRgb(new Hsv(((float)Random.Shared.NextDouble() * 360), - (float)(0.5 + (Random.Shared.NextDouble() * 0.49)), - (float)(0.4 + (Random.Shared.NextDouble() / 5 + (x % 100 * 0.2))))) - .ToVector3(); + var clr = Color.Black; - var packed = new Rgba32(clr).PackedValue; + var packed = ((Rgba32)clr).PackedValue; return new NCPixel() { Color = packed, diff --git a/src/EllieBot/data/commandlist.json b/src/EllieBot/data/commandlist.json index d72493b..3b1e8f7 100644 --- a/src/EllieBot/data/commandlist.json +++ b/src/EllieBot/data/commandlist.json @@ -4285,7 +4285,9 @@ "Aliases": [ ".ncanvas", ".nc", - ".ncanv" + ".ncanv", + ".pixel", + ".pixels" ], "Description": "Shows the current nCanvas.\nThe canvas allows users to set each pixel's color and text using currency.", "Usage": [ @@ -7717,6 +7719,22 @@ "Options": null, "Requirements": [] }, + { + "Aliases": [ + ".quoteadd", + ".qa", + ".qadd", + ".quadd" + ], + "Description": "Adds a new quote with the specified name and message.", + "Usage": [ + ".quoteadd sayhi Hi" + ], + "Submodule": "QuoteCommands", + "Module": "Utility", + "Options": null, + "Requirements": [] + }, { "Aliases": [ ".quoteedit", diff --git a/src/EllieBot/data/patron.yml b/src/EllieBot/data/patron.yml index f7a101a..f8e2234 100644 --- a/src/EllieBot/data/patron.yml +++ b/src/EllieBot/data/patron.yml @@ -4,7 +4,7 @@ version: 3 isEnabled: false # Quotas for patron system quotas: - None: + None: I: livechannels: 1 ai: 0 @@ -22,4 +22,4 @@ quotas: ai: 500 C: livechannels: 5 - ai: -1 \ No newline at end of file + ai: -1 diff --git a/src/EllieBot/strings/aliases.yml b/src/EllieBot/strings/aliases.yml index 3fc6067..3531748 100644 --- a/src/EllieBot/strings/aliases.yml +++ b/src/EllieBot/strings/aliases.yml @@ -1477,6 +1477,8 @@ ncanvas: - ncanvas - nc - ncanv + - pixel + - pixels ncsetimg: - ncsetimg - ncsi