fixed bank quest
.nc will now show instructions
This commit is contained in:
parent
6891869046
commit
53af8f940d
6 changed files with 48 additions and 38 deletions
src/EllieBot
Modules
data
strings
|
@ -100,6 +100,13 @@ public sealed class BankService(
|
||||||
if (rows > 0)
|
if (rows > 0)
|
||||||
{
|
{
|
||||||
await _cur.AddAsync(userId, amount, new("bank", "withdraw"));
|
await _cur.AddAsync(userId, amount, new("bank", "withdraw"));
|
||||||
|
await quests.ReportActionAsync(userId,
|
||||||
|
QuestEventType.BankAction,
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
{ "type", "withdraw" },
|
||||||
|
{ "amount", amount.ToString() }
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +121,13 @@ public sealed class BankService(
|
||||||
.FirstOrDefaultAsync(x => x.UserId == userId))
|
.FirstOrDefaultAsync(x => x.UserId == userId))
|
||||||
?.Balance
|
?.Balance
|
||||||
?? 0;
|
?? 0;
|
||||||
|
|
||||||
|
await quests.ReportActionAsync(userId,
|
||||||
|
QuestEventType.BankAction,
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
{ "type", "balance" }
|
||||||
|
});
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -60,6 +60,12 @@ public partial class Games
|
||||||
await Response()
|
await Response()
|
||||||
.File(stream, "ncanvas.png")
|
.File(stream, "ncanvas.png")
|
||||||
.Embed(CreateEmbed()
|
.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()
|
.WithOkColor()
|
||||||
#if GLOBAL_ELLIE
|
#if GLOBAL_ELLIE
|
||||||
.WithDescription("This is not available yet.")
|
.WithDescription("This is not available yet.")
|
||||||
|
|
|
@ -4,9 +4,8 @@ using LinqToDB.EntityFrameworkCore;
|
||||||
using EllieBot.Common.ModuleBehaviors;
|
using EllieBot.Common.ModuleBehaviors;
|
||||||
using EllieBot.Db.Models;
|
using EllieBot.Db.Models;
|
||||||
using EllieBot.Modules.Games.Quests;
|
using EllieBot.Modules.Games.Quests;
|
||||||
using SixLabors.ImageSharp.ColorSpaces;
|
|
||||||
using SixLabors.ImageSharp.ColorSpaces.Conversion;
|
|
||||||
using SixLabors.ImageSharp.PixelFormats;
|
using SixLabors.ImageSharp.PixelFormats;
|
||||||
|
using Color = SixLabors.ImageSharp.Color;
|
||||||
|
|
||||||
namespace EllieBot.Modules.Games;
|
namespace EllieBot.Modules.Games;
|
||||||
|
|
||||||
|
@ -20,8 +19,8 @@ public sealed class NCanvasService : INCanvasService, IReadyExecutor, IEService
|
||||||
private readonly ICurrencyService _cs;
|
private readonly ICurrencyService _cs;
|
||||||
private readonly QuestService _quests;
|
private readonly QuestService _quests;
|
||||||
|
|
||||||
public const int CANVAS_WIDTH = 250;
|
public const int CANVAS_WIDTH = 200;
|
||||||
public const int CANVAS_HEIGHT = 125;
|
public const int CANVAS_HEIGHT = 100;
|
||||||
public const int INITIAL_PRICE = 3;
|
public const int INITIAL_PRICE = 3;
|
||||||
|
|
||||||
public NCanvasService(
|
public NCanvasService(
|
||||||
|
@ -49,32 +48,6 @@ public sealed class NCanvasService : INCanvasService, IReadyExecutor, IEService
|
||||||
if (count == CANVAS_WIDTH * CANVAS_HEIGHT)
|
if (count == CANVAS_WIDTH * CANVAS_HEIGHT)
|
||||||
return;
|
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();
|
await ResetAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,12 +65,9 @@ public sealed class NCanvasService : INCanvasService, IReadyExecutor, IEService
|
||||||
await uow.GetTable<NCPixel>()
|
await uow.GetTable<NCPixel>()
|
||||||
.BulkCopyAsync(toAdd.Select(x =>
|
.BulkCopyAsync(toAdd.Select(x =>
|
||||||
{
|
{
|
||||||
var clr = ColorSpaceConverter.ToRgb(new Hsv(((float)Random.Shared.NextDouble() * 360),
|
var clr = Color.Black;
|
||||||
(float)(0.5 + (Random.Shared.NextDouble() * 0.49)),
|
|
||||||
(float)(0.4 + (Random.Shared.NextDouble() / 5 + (x % 100 * 0.2)))))
|
|
||||||
.ToVector3();
|
|
||||||
|
|
||||||
var packed = new Rgba32(clr).PackedValue;
|
var packed = ((Rgba32)clr).PackedValue;
|
||||||
return new NCPixel()
|
return new NCPixel()
|
||||||
{
|
{
|
||||||
Color = packed,
|
Color = packed,
|
||||||
|
|
|
@ -4285,7 +4285,9 @@
|
||||||
"Aliases": [
|
"Aliases": [
|
||||||
".ncanvas",
|
".ncanvas",
|
||||||
".nc",
|
".nc",
|
||||||
".ncanv"
|
".ncanv",
|
||||||
|
".pixel",
|
||||||
|
".pixels"
|
||||||
],
|
],
|
||||||
"Description": "Shows the current nCanvas.\nThe canvas allows users to set each pixel's color and text using currency.",
|
"Description": "Shows the current nCanvas.\nThe canvas allows users to set each pixel's color and text using currency.",
|
||||||
"Usage": [
|
"Usage": [
|
||||||
|
@ -7717,6 +7719,22 @@
|
||||||
"Options": null,
|
"Options": null,
|
||||||
"Requirements": []
|
"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": [
|
"Aliases": [
|
||||||
".quoteedit",
|
".quoteedit",
|
||||||
|
|
|
@ -4,7 +4,7 @@ version: 3
|
||||||
isEnabled: false
|
isEnabled: false
|
||||||
# Quotas for patron system
|
# Quotas for patron system
|
||||||
quotas:
|
quotas:
|
||||||
None:
|
None:
|
||||||
I:
|
I:
|
||||||
livechannels: 1
|
livechannels: 1
|
||||||
ai: 0
|
ai: 0
|
||||||
|
@ -22,4 +22,4 @@ quotas:
|
||||||
ai: 500
|
ai: 500
|
||||||
C:
|
C:
|
||||||
livechannels: 5
|
livechannels: 5
|
||||||
ai: -1
|
ai: -1
|
||||||
|
|
|
@ -1477,6 +1477,8 @@ ncanvas:
|
||||||
- ncanvas
|
- ncanvas
|
||||||
- nc
|
- nc
|
||||||
- ncanv
|
- ncanv
|
||||||
|
- pixel
|
||||||
|
- pixels
|
||||||
ncsetimg:
|
ncsetimg:
|
||||||
- ncsetimg
|
- ncsetimg
|
||||||
- ncsi
|
- ncsi
|
||||||
|
|
Loading…
Add table
Reference in a new issue