From 02eb6e172b8ade638c2be977693472a237836dc8 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Thu, 9 Dec 2021 20:53:44 +0100 Subject: [PATCH] added slots.currencyFontColor to gambling.yml --- CHANGELOG.md | 1 + .../Modules/Gambling/Common/GamblingConfig.cs | 11 +++++++++++ .../Gambling/Services/GamblingConfigService.cs | 8 ++++++++ src/NadekoBot/Modules/Gambling/SlotCommands.cs | 11 ++++++++--- src/NadekoBot/data/gambling.yml | 6 +++++- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3be1af6a7..aac19e806 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog. ### Added - `.remindl` and `.remindrm` commands now supports optional 'server' parameter for Administrators which allows them to delete any reminder created on the server +- Added slots.currencyFontColor to gambling.yml ### Fixed - `.crypto` now supports top 5000 coins diff --git a/src/NadekoBot/Modules/Gambling/Common/GamblingConfig.cs b/src/NadekoBot/Modules/Gambling/Common/GamblingConfig.cs index 31b02b17c..e938e941a 100644 --- a/src/NadekoBot/Modules/Gambling/Common/GamblingConfig.cs +++ b/src/NadekoBot/Modules/Gambling/Common/GamblingConfig.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using Cloneable; using NadekoBot.Common; using NadekoBot.Common.Yml; +using SixLabors.ImageSharp.PixelFormats; using YamlDotNet.Serialization; namespace NadekoBot.Modules.Gambling.Common @@ -20,6 +21,7 @@ namespace NadekoBot.Modules.Gambling.Common Generation = new GenerationConfig(); Timely = new TimelyConfig(); Decay = new DecayConfig(); + Slots = new SlotsConfig(); } [Comment(@"DO NOT CHANGE")] @@ -64,6 +66,9 @@ Set 0 for unlimited")] [Comment(@"Currency reward per vote. This will work only if you've set up VotesApi and correct credentials for topgg and/or discords voting")] public long VoteReward { get; set; } = 100; + + [Comment(@"Slot config")] + public SlotsConfig Slots { get; set; } } public class CurrencyConfig @@ -273,6 +278,12 @@ Example: If a waifu is worth 1000, and she receives a negative gift worth 100, h public decimal NegativeGiftEffect { get; set; } = 0.50M; } + public sealed partial class SlotsConfig + { + [Comment(@"Hex value of the color which the numbers on the slot image will have.")] + public Rgba32 CurrencyFontColor { get; set; } = SixLabors.ImageSharp.Color.Red; + } + [Cloneable] public sealed partial class WaifuItemModel { diff --git a/src/NadekoBot/Modules/Gambling/Services/GamblingConfigService.cs b/src/NadekoBot/Modules/Gambling/Services/GamblingConfigService.cs index 844d4d053..7b728f2d9 100644 --- a/src/NadekoBot/Modules/Gambling/Services/GamblingConfigService.cs +++ b/src/NadekoBot/Modules/Gambling/Services/GamblingConfigService.cs @@ -72,6 +72,14 @@ namespace NadekoBot.Modules.Gambling.Services c.VoteReward = 100; }); } + + if (_data.Version < 4) + { + ModifyConfig(c => + { + c.Version = 4; + }); + } } } } \ No newline at end of file diff --git a/src/NadekoBot/Modules/Gambling/SlotCommands.cs b/src/NadekoBot/Modules/Gambling/SlotCommands.cs index cf525f7c8..75784d801 100644 --- a/src/NadekoBot/Modules/Gambling/SlotCommands.cs +++ b/src/NadekoBot/Modules/Gambling/SlotCommands.cs @@ -19,6 +19,7 @@ using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp; using SixLabors.ImageSharp.Drawing.Processing; using SixLabors.ImageSharp.PixelFormats; +using Color = SixLabors.ImageSharp.Color; namespace NadekoBot.Modules.Gambling { @@ -186,6 +187,8 @@ namespace NadekoBot.Modules.Gambling var numbers = new int[3]; result.Rolls.CopyTo(numbers, 0); + Color fontColor = _config.Slots.CurrencyFontColor; + bgImage.Mutate(x => x.DrawText(new TextGraphicsOptions { TextOptions = new TextOptions() @@ -194,9 +197,11 @@ namespace NadekoBot.Modules.Gambling VerticalAlignment = VerticalAlignment.Center, WrapTextWidth = 140, } - }, result.Won.ToString(), _fonts.DottyFont.CreateFont(65), SixLabors.ImageSharp.Color.Red, + }, result.Won.ToString(), _fonts.DottyFont.CreateFont(65), fontColor, new PointF(227, 92))); + var bottomFont = _fonts.DottyFont.CreateFont(50); + bgImage.Mutate(x => x.DrawText(new TextGraphicsOptions { TextOptions = new TextOptions() @@ -205,7 +210,7 @@ namespace NadekoBot.Modules.Gambling VerticalAlignment = VerticalAlignment.Center, WrapTextWidth = 135, } - }, amount.ToString(), _fonts.DottyFont.CreateFont(50), SixLabors.ImageSharp.Color.Red, + }, amount.ToString(), bottomFont, fontColor, new PointF(129, 472))); bgImage.Mutate(x => x.DrawText(new TextGraphicsOptions @@ -216,7 +221,7 @@ namespace NadekoBot.Modules.Gambling VerticalAlignment = VerticalAlignment.Center, WrapTextWidth = 135, } - }, ownedAmount.ToString(), _fonts.DottyFont.CreateFont(50), SixLabors.ImageSharp.Color.Red, + }, ownedAmount.ToString(), bottomFont, fontColor, new PointF(325, 472))); //sw.PrintLap("drew red text"); diff --git a/src/NadekoBot/data/gambling.yml b/src/NadekoBot/data/gambling.yml index 9cb1712b5..c3303485b 100644 --- a/src/NadekoBot/data/gambling.yml +++ b/src/NadekoBot/data/gambling.yml @@ -1,5 +1,5 @@ # DO NOT CHANGE -version: 3 +version: 4 # Currency settings currency: # What is the emoji/character which represents the currency @@ -240,3 +240,7 @@ patreonCurrencyPerCent: 1 # Currency reward per vote. # This will work only if you've set up VotesApi and correct credentials for topgg and/or discords voting voteReward: 100 +# Slot config +slots: +# Hex value of the color which the numbers on the slot image will have. + currencyFontColor: ff0000