From 22bff7838aeff56933402d46f34e2eb8bb89bac2 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Wed, 27 Jul 2022 03:56:10 +0200 Subject: [PATCH] Cleaned up around xp.yml. Fixed a typo, added an error to .xpshop if the feature is disabled. --- CHANGELOG.md | 56 +++++++++++++++++++++ src/NadekoBot/Modules/Xp/Xp.cs | 6 +++ src/NadekoBot/Modules/Xp/XpConfig.cs | 4 +- src/NadekoBot/Modules/Xp/XpConfigService.cs | 5 ++ src/NadekoBot/Modules/Xp/XpService.cs | 3 ++ src/NadekoBot/data/xp.yml | 6 +-- 6 files changed, 75 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b65e7a91..e8f7d8b91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,62 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o +## [4.3.0] - 27.07.2022 + +### Added + +- Added `.bettest` command which lets you test many gambling commands + - Better than .slottest + - Counts win/loss streaks too + - Doesn't count 1x returns as neither wins nor losses + - multipliers < 1 are considered losses, > 1 considered wins +- Added `.betdraw` command which lets you guess red/black and/or high/low for a random card + - They payouts are very good, but seven always loses +- Added `.lula` command. Plays the same as `.wof` but looks much nicer, and is easily customizable from gambling.yml without any changes to the sourcecode needed. +- Added `.repeatskip` command which makes the next repeat trigger not post anything +- Added `.imageonly` which will make the bot only allow link posts in the channel. Exclusive with `.imageonly` +- Added release notifications. Bot owners will now receive new release notifications in dms if they have `checkForUpdates` set to `true` in data/bot.yml + - You can also configure it via `.conf bot checkforupdates ` +- Added `.xpshop` which lets bot owners add xp backgrounds and xp frames for sale by configuring `data/xp.yml` + - You can also toggle xpshop feature via `.conf xp shop.is_enabled` + +### Changed + +- `.t` Trivia code cleaned up, added ALL pokemon generations + +- `.xpadd` will now work on roles too. It will add the specified xp to each user (visible to the bot) in the role +- Improved / cleaned up / modernized how most gambling commands look + - `.roll` + - `.rolluo` + - `.draw` + - `.flip` + - `.slot` + - `.betroll` + - `.betflip` + - Try them out! +- `.draw`, `.betdraw` and some other card commands (not all) will use the new, rewritten deck system +- Error will be printed to the console if there's a problem in `.plant` +- [dev] Split Nadeko.Common into a separate project + - [dev] It will contain classes/utilities which can be shared across different nadeko related projects +- [dev] Split Nadeko.Econ into a separate project + - [dev] It should be home for the backend any gambling/currency/economy feature + - [dev] It will contain most gambling games and any shared logic +- [dev] Compliation should take less time and RAM + - [dev] No longer using generator and partial methods for commands + +### Fixed + +- `.slot` will now show correct multipliers if they've been modified +- Fix patron errors showing up even with permissions disabling the command +- Fixed an issue with voice xp breaking xp gain. + +### Removed + +- Removed `.slottest`, replaced by `.bettest` +- Removed `.wof`, replaced by `.lula` +- [dev] Removed a lot of unused methods +- [dev] Removed several unused response strings + ## [4.2.15] - 12.07.2022 ### Fixed diff --git a/src/NadekoBot/Modules/Xp/Xp.cs b/src/NadekoBot/Modules/Xp/Xp.cs index 57c0f19c6..1e89b67df 100644 --- a/src/NadekoBot/Modules/Xp/Xp.cs +++ b/src/NadekoBot/Modules/Xp/Xp.cs @@ -347,6 +347,12 @@ public partial class Xp : NadekoModule [Cmd] public async Task XpShop() { + if (!_service.IsShopEnabled()) + { + await ReplyErrorLocalizedAsync(strs.xp_shop_disabled); + return; + } + await SendConfirmAsync(GetText(strs.available_commands), $@"`{prefix}xpshop bgs` `{prefix}xpshop frames`"); } diff --git a/src/NadekoBot/Modules/Xp/XpConfig.cs b/src/NadekoBot/Modules/Xp/XpConfig.cs index 6a128d472..df6a49e33 100644 --- a/src/NadekoBot/Modules/Xp/XpConfig.cs +++ b/src/NadekoBot/Modules/Xp/XpConfig.cs @@ -43,7 +43,7 @@ Leave at 'None' if patron system is disabled or you don't want any restrictions" [Comment(@"Frames available for sale. Keys are unique IDs. Do not change keys as they are not publicly visible. Only change properties (name, price, id) -Removing a key compeltely means all previous purchases will also be unusable. +Removing a key which previously existed means that all previous purchases will also be unusable. To remove an item from the shop, but keep previous purchases, set the price to -1")] public Dictionary? Frames { get; set; } = new() { @@ -52,7 +52,7 @@ To remove an item from the shop, but keep previous purchases, set the price to - [Comment(@"Backgrounds available for sale. Keys are unique IDs. Do not change keys as they are not publicly visible. Only change properties (name, price, id) -Removing a key compeltely means all previous purchases will also be unusable. +Removing a key which previously existed means that all previous purchases will also be unusable. To remove an item from the shop, but keep previous purchases, set the price to -1")] public Dictionary? Bgs { get; set; } = new() { diff --git a/src/NadekoBot/Modules/Xp/XpConfigService.cs b/src/NadekoBot/Modules/Xp/XpConfigService.cs index 61fcb639a..54dccd69b 100644 --- a/src/NadekoBot/Modules/Xp/XpConfigService.cs +++ b/src/NadekoBot/Modules/Xp/XpConfigService.cs @@ -33,6 +33,11 @@ public sealed class XpConfigService : ConfigServiceBase ConfigPrinters.ToString, x => x > 0); + AddParsedProp("shop.is_enabled", + conf => conf.Shop.IsEnabled, + bool.TryParse, + ConfigPrinters.ToString); + Migrate(); } diff --git a/src/NadekoBot/Modules/Xp/XpService.cs b/src/NadekoBot/Modules/Xp/XpService.cs index 406ce40cc..349e299a1 100644 --- a/src/NadekoBot/Modules/Xp/XpService.cs +++ b/src/NadekoBot/Modules/Xp/XpService.cs @@ -1470,6 +1470,9 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand public PatronTier GetXpShopTierRequirement() => _xpConfig.Data.Shop.TierRequirement; + + public bool IsShopEnabled() + => _xpConfig.Data.Shop.IsEnabled; } public enum BuyResult diff --git a/src/NadekoBot/data/xp.yml b/src/NadekoBot/data/xp.yml index f527a10d3..97c017f6c 100644 --- a/src/NadekoBot/data/xp.yml +++ b/src/NadekoBot/data/xp.yml @@ -15,13 +15,13 @@ shop: # Whether the xp shop is enabled # True -> Users can access the xp shop using .xpshop command # False -> Users can't access the xp shop - isEnabled: true + isEnabled: false # Which patron tier do users need in order to use the .xpshop command # Leave at 'None' if patron system is disabled or you don't want any restrictions tierRequirement: None # Frames available for sale. Keys are unique IDs. # Do not change keys as they are not publicly visible. Only change properties (name, price, id) - # Removing a key completely means all previous purchases will also be unusable. + # Removing a key which previously existed means that all previous purchases will also be unusable. # To remove an item from the shop, but keep previous purchases, set the price to -1 frames: default: @@ -35,7 +35,7 @@ shop: desc: # Backgrounds available for sale. Keys are unique IDs. # Do not change keys as they are not publicly visible. Only change properties (name, price, id) - # Removing a key completely means all previous purchases will also be unusable. + # Removing a key which previously existed means that all previous purchases will also be unusable. # To remove an item from the shop, but keep previous purchases, set the price to -1 bgs: default: