mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-06-28 06:55:17 -04:00
Cecil and shop update (#121)
* Implement FromToken method for Skew configuration Added a method to parse a serialized configuration token for Skew profiles. Tokens can be generated and viewed using the updated cecil helper tool. * Add Difficulty property to KasinoShop profile Add Difficulty property to KasinoShop profile * Add HOUSE_EDGE variable and custom difficulties Add HOUSE_EDGE variable and custom difficulties * Implement ShopSetDifficultyCommand for difficulty settings Added ShopSetDifficultyCommand to manage player difficulty settings in casino games, including validation for input parameters. * adds return to default difficulty setting adds return to default difficulty setting
This commit is contained in:
@@ -28,6 +28,8 @@ public class CecilCommand : ICommand
|
||||
};
|
||||
public bool WhisperCanInvoke => true;
|
||||
|
||||
public decimal HOUSE_EDGE = 0.98m;
|
||||
|
||||
public async Task RunCommand(ChatBot botInstance, BotCommandMessageModel message, UserDbModel user,
|
||||
GroupCollection arguments,
|
||||
CancellationToken ctx)
|
||||
@@ -71,17 +73,34 @@ public class CecilCommand : ICommand
|
||||
return;
|
||||
}
|
||||
|
||||
var difficulty = 1.0;
|
||||
|
||||
bool shopActive = botInstance.BotServices.KasinoShop != null;
|
||||
if (shopActive)
|
||||
{
|
||||
await GlobalShopFunctions.CheckProfile(botInstance, user, gambler);
|
||||
HOUSE_EDGE += botInstance.BotServices.KasinoShop!.Gambler_Profiles[user.KfId].HouseEdgeModifier;
|
||||
}
|
||||
|
||||
var difficulty = 1.0;
|
||||
bool customDiff = false;
|
||||
double result;
|
||||
if (arguments.TryGetValue("difficulty", out var diff))
|
||||
{
|
||||
difficulty = Convert.ToDouble(diff.Value);
|
||||
customDiff = true;
|
||||
}
|
||||
|
||||
if (!arguments.TryGetValue("maxwin", out var maxWin))
|
||||
if (!customDiff && shopActive &&
|
||||
botInstance.BotServices.KasinoShop!.Gambler_Profiles[user.KfId].Difficulty != "")
|
||||
{
|
||||
var skew = Skew.FromToken(botInstance.BotServices.KasinoShop!.Gambler_Profiles[user.KfId].Difficulty);
|
||||
skew.Rig((double)HOUSE_EDGE, 0);
|
||||
result = Cecil.Consult(skew);
|
||||
}
|
||||
else if (!arguments.TryGetValue("maxwin", out var maxWin))
|
||||
{
|
||||
var skew = new GammaSkew(difficulty, 0);
|
||||
skew.Rig((double)HOUSE_EDGE, 0);
|
||||
result = Cecil.Consult(skew, 0);
|
||||
}
|
||||
else
|
||||
@@ -93,8 +112,10 @@ public class CecilCommand : ICommand
|
||||
return;
|
||||
}
|
||||
var skew = new BetaSkew(difficulty, mWin, 0);
|
||||
skew.Rig((double)HOUSE_EDGE, 0);
|
||||
result = Cecil.Consult(skew);
|
||||
}
|
||||
|
||||
|
||||
var payout = wager * Convert.ToDecimal(result);
|
||||
var net = payout - wager;
|
||||
|
||||
Reference in New Issue
Block a user