added botcut setting to gambling.yml in which you can configure shopcut for now (how much money the bot takes when something is sold in the shop)

This commit is contained in:
Kwoth
2024-05-03 18:20:23 +00:00
parent 6327e242ca
commit 7637de8fed
9 changed files with 125 additions and 61 deletions

View File

@@ -42,6 +42,9 @@ public sealed partial class GamblingConfig : ICloneable<GamblingConfig>
[Comment("""How much will each user's owned currency decay over time.""")]
public DecayConfig Decay { get; set; }
[Comment("""What is the bot's cut on some transactions""")]
public BotCutConfig BotCuts { get; set; }
[Comment("""Settings for LuckyLadder command""")]
public LuckyLadderSettings LuckyLadder { get; set; }
@@ -75,6 +78,7 @@ public sealed partial class GamblingConfig : ICloneable<GamblingConfig>
Decay = new();
Slots = new();
LuckyLadder = new();
BotCuts = new();
}
}
@@ -384,4 +388,17 @@ public sealed partial class BetRollPair
{
public int WhenAbove { get; set; }
public float MultiplyBy { get; set; }
}
[Cloneable]
public sealed partial class BotCutConfig
{
[Comment("""
Shop sale cut percentage.
Whenever a user buys something from the shop, bot will take a cut equal to this percentage.
The rest goes to the user who posted the item/role/whatever to the shop.
This is a good way to reduce the amount of currency in circulation therefore keeping the inflation in check.
Default 0.1 (10%).
""")]
public decimal ShopSaleCut { get; set; } = 0.1m;
}

View File

@@ -182,5 +182,13 @@ public sealed class GamblingConfigService : ConfigServiceBase<GamblingConfig>
c.Version = 6;
});
}
if (data.Version < 7)
{
ModifyConfig(c =>
{
c.Version = 7;
});
}
}
}

View File

@@ -283,8 +283,8 @@ public partial class Gambling
}
}
private static long GetProfitAmount(int price)
=> (int)Math.Ceiling(0.90 * price);
private long GetProfitAmount(int price)
=> (int)Math.Ceiling((1.0m - Config.BotCuts.ShopSaleCut) * price);
[Cmd]
[RequireContext(ContextType.Guild)]