From f81e9e5ec046903b5582c756271f3f0f7da3f285 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Sun, 6 Feb 2022 14:08:35 -0600 Subject: [PATCH] Add payday bonus multiplier --- scripts/server/economy.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/scripts/server/economy.js b/scripts/server/economy.js index 51d36c5f..0a90b279 100644 --- a/scripts/server/economy.js +++ b/scripts/server/economy.js @@ -30,8 +30,10 @@ function playerPayDay(client) { let wealth = calculateWealth(client); let grossIncome = getPlayerData(client).payDayAmount; - // Public Beta Bonus + // Passive income grossIncome = grossIncome + getGlobalConfig().economy.passiveIncomePerPayDay; + + // Payday bonus grossIncome = grossIncome*getGlobalConfig().economy.grossIncomeMultiplier; let incomeTaxAmount = calculateIncomeTax(wealth); @@ -110,6 +112,26 @@ function forcePlayerPayDayCommand(command, params, client) { // =========================================================================== +function setPayDayBonusMultiplier(command, params, client) { + if(areParamsEmpty(params)) { + messagePlayerSyntax(client, getCommandSyntaxText(command)); + return false; + } + + let newMultiplier = params; + + if(isNaN(newMultiplier)) { + messagePlayerError(client, getLocaleString(client, "AmountNotNumber")); + return false; + } + + getGlobalConfig().economy.grossIncomeMultiplier = newMultiplier; + + messageAdminAction(`${client.name} set payday bonus to ${newMultiplier*100}%`); +} + +// =========================================================================== + function taxInfoCommand(command, params, client) { let wealth = calculateWealth(client); let tax = calculateIncomeTax(wealth);