Cleaned up around xp.yml. Fixed a typo, added an error to .xpshop if the feature is disabled.

This commit is contained in:
Kwoth
2022-07-27 03:56:10 +02:00
parent 25fce1bd75
commit 22bff7838a
6 changed files with 75 additions and 5 deletions

View File

@@ -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 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 <true/false>`
- 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 ## [4.2.15] - 12.07.2022
### Fixed ### Fixed

View File

@@ -347,6 +347,12 @@ public partial class Xp : NadekoModule<XpService>
[Cmd] [Cmd]
public async Task XpShop() public async Task XpShop()
{ {
if (!_service.IsShopEnabled())
{
await ReplyErrorLocalizedAsync(strs.xp_shop_disabled);
return;
}
await SendConfirmAsync(GetText(strs.available_commands), $@"`{prefix}xpshop bgs` await SendConfirmAsync(GetText(strs.available_commands), $@"`{prefix}xpshop bgs`
`{prefix}xpshop frames`"); `{prefix}xpshop frames`");
} }

View File

@@ -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. [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) 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")] To remove an item from the shop, but keep previous purchases, set the price to -1")]
public Dictionary<string, ShopItemInfo>? Frames { get; set; } = new() public Dictionary<string, ShopItemInfo>? 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. [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) 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")] To remove an item from the shop, but keep previous purchases, set the price to -1")]
public Dictionary<string, ShopItemInfo>? Bgs { get; set; } = new() public Dictionary<string, ShopItemInfo>? Bgs { get; set; } = new()
{ {

View File

@@ -33,6 +33,11 @@ public sealed class XpConfigService : ConfigServiceBase<XpConfig>
ConfigPrinters.ToString, ConfigPrinters.ToString,
x => x > 0); x => x > 0);
AddParsedProp("shop.is_enabled",
conf => conf.Shop.IsEnabled,
bool.TryParse,
ConfigPrinters.ToString);
Migrate(); Migrate();
} }

View File

@@ -1470,6 +1470,9 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand
public PatronTier GetXpShopTierRequirement() public PatronTier GetXpShopTierRequirement()
=> _xpConfig.Data.Shop.TierRequirement; => _xpConfig.Data.Shop.TierRequirement;
public bool IsShopEnabled()
=> _xpConfig.Data.Shop.IsEnabled;
} }
public enum BuyResult public enum BuyResult

View File

@@ -15,13 +15,13 @@ shop:
# Whether the xp shop is enabled # Whether the xp shop is enabled
# True -> Users can access the xp shop using .xpshop command # True -> Users can access the xp shop using .xpshop command
# False -> Users can't access the xp shop # 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 # 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 # Leave at 'None' if patron system is disabled or you don't want any restrictions
tierRequirement: None tierRequirement: None
# Frames available for sale. Keys are unique IDs. # Frames available for sale. Keys are unique IDs.
# Do not change keys as they are not publicly visible. Only change properties (name, price, id) # 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 # To remove an item from the shop, but keep previous purchases, set the price to -1
frames: frames:
default: default:
@@ -35,7 +35,7 @@ shop:
desc: desc:
# Backgrounds available for sale. Keys are unique IDs. # Backgrounds available for sale. Keys are unique IDs.
# Do not change keys as they are not publicly visible. Only change properties (name, price, id) # 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 # To remove an item from the shop, but keep previous purchases, set the price to -1
bgs: bgs:
default: default: