Calculate wealth and tax on payday
This commit is contained in:
@@ -28,19 +28,19 @@ function applyServerInflationMultiplier(value) {
|
|||||||
|
|
||||||
function playerPayDay(client) {
|
function playerPayDay(client) {
|
||||||
let wealth = calculateWealth(client);
|
let wealth = calculateWealth(client);
|
||||||
let taxAmount = calculateTax(wealth);
|
|
||||||
let grossIncome = getPlayerData(client).payDayAmount;
|
let grossIncome = getPlayerData(client).payDayAmount;
|
||||||
|
|
||||||
// Public Beta Bonus
|
// Public Beta Bonus
|
||||||
taxAmount = 0;
|
grossIncome = grossIncome + getGlobalConfig().economy.passiveIncomePerPayDay;
|
||||||
grossIncome = grossIncome*2;
|
grossIncome = grossIncome*getGlobalConfig().economy.grossIncomeMultiplier;
|
||||||
grossIncome = grossIncome + 2000;
|
|
||||||
|
incomeTaxAmount = calculateIncomeTax(wealth);
|
||||||
|
|
||||||
let netIncome = grossIncome-taxAmount;
|
let netIncome = grossIncome-taxAmount;
|
||||||
|
|
||||||
messagePlayerAlert(client, "== Payday! =============================");
|
messagePlayerAlert(client, "== Payday! =============================");
|
||||||
messagePlayerInfo(client, `Paycheck: {ALTCOLOUR}$${grossIncome}`);
|
messagePlayerInfo(client, `Paycheck: {ALTCOLOUR}$${grossIncome}`);
|
||||||
messagePlayerInfo(client, `Taxes: {ALTCOLOUR}$${taxAmount}`);
|
messagePlayerInfo(client, `Taxes: {ALTCOLOUR}$${incomeTaxAmount}`);
|
||||||
messagePlayerInfo(client, `You receive: {ALTCOLOUR}$${netIncome}`);
|
messagePlayerInfo(client, `You receive: {ALTCOLOUR}$${netIncome}`);
|
||||||
|
|
||||||
givePlayerCash(client, netIncome);
|
givePlayerCash(client, netIncome);
|
||||||
@@ -49,15 +49,21 @@ function playerPayDay(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function calculateWealth(client) {
|
function calculateWealth(client) {
|
||||||
// To-do
|
let vehicles = getAllVehiclesOwnedByPlayer(client);
|
||||||
return 0;
|
let houses = getAllHousesOwnedByPlayer(client);
|
||||||
|
let businesses = getAllBusinessesOwnedByPlayer(client);
|
||||||
|
|
||||||
|
let vehicleUpKeep = applyServerInflationMultiplier(vehicles.length*getGlobalConfig().economy.upKeepCosts.upKeepPerVehicle);
|
||||||
|
let houseUpKeep = applyServerInflationMultiplier(houses.length*getGlobalConfig().economy.upKeepCosts.upKeepPerHouse);
|
||||||
|
let businessUpKeep = applyServerInflationMultiplier(businesses.length*getGlobalConfig().economy.upKeepCosts.upKeepPerBusiness);
|
||||||
|
|
||||||
|
return vehicleUpKeep+houseUpKeep+businessUpKeep;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function calculateTax(client) {
|
function calculateIncomeTax(amount) {
|
||||||
// To-do
|
return amount*getGlobalConfig().economy.incomeTaxRate;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user