Locale strings + weekend detect for double bonus

This commit is contained in:
Vortrex
2022-03-29 21:07:03 -05:00
parent 798c1080ef
commit 9d56bd79a0

View File

@@ -36,6 +36,11 @@ function playerPayDay(client) {
// Payday bonus
grossIncome = grossIncome*getGlobalConfig().economy.grossIncomeMultiplier;
// Double bonus
if(isDoubleBonusActive()) {
grossIncome = grossIncome*2;
}
let incomeTaxAmount = calculateIncomeTax(wealth);
let netIncome = grossIncome-incomeTaxAmount;
@@ -49,11 +54,11 @@ function playerPayDay(client) {
let canPayNow = totalCash+netIncome;
if(incomeTaxAmount <= canPayNow) {
takePlayerCash(client, canPayNow);
messagePlayerInfo(client, `You covered the remaining taxes with {ALTCOLOUR}$${canPayNow} {MAINCOLOUR}in cash.`);
messagePlayerAlert(client, `{orange}You lost money since your taxes are more than your paycheck!`);
messagePlayerAlert(client, `{orange}If you don't have enough cash to cover taxes on next paycheck, you will lose stuff!`);
messagePlayerInfo(client, `{orange}${getLocaleString(client, "RemainingTaxPaidInCash", `{ALTCOLOUR}${canPayNow}{MAINCOLOUR}`)}`);
messagePlayerAlert(client, `{orange}${getLocaleString(client, "LostMoneyFromTaxes")}`);
messagePlayerAlert(client, `{orange}${getLocaleString(client, "NextPaycheckRepossessionWarning")}`);
} else {
messagePlayerInfo(client, `{orange}You don't have enough cash to pay your taxes!`);
messagePlayerInfo(client, `{orange}${getLocaleString(client, "NotEnoughCashForTax")}`);
takePlayerCash(client, canPayNow);
let vehicleCount = getAllVehiclesOwnedByPlayer(client).length;
@@ -65,7 +70,7 @@ function playerPayDay(client) {
let newVehicleCount = getAllVehiclesOwnedByPlayer(client).length;
let newHouseCount = getAllHousesOwnedByPlayer(client).length;
let newBusinessCount = getAllBusinessesOwnedByPlayer(client).length;
messagePlayerInfo(client, `{orange}You lost ${newVehicleCount-vehicleCount} vehicles, ${newHouseCount-houseCount} houses, and ${newBusinessCount-businessCount} businesses to cover the remaining tax.`);
messagePlayerInfo(client, `{orange}${getLocaleString(client, "AssetsRepossessedForTaxes", newVehicleCount-vehicleCount, newHouseCount-houseCount, newBusinessCount-businessCount)}`);
}
}
@@ -157,6 +162,8 @@ function attemptRepossession(client, totalToPay) {
return true;
}
// ===========================================================================
function repossessFirstAsset(client) {
let vehicles = getAllVehiclesOwnedByPlayer(client);
if(vehicles.length > 0) {
@@ -194,3 +201,15 @@ function getAllBusinessesOwnedByPlayer(client) {
function getAllHousesOwnedByPlayer(client) {
return getServerData().houses.filter((h) => h.ownerType == VRR_HOUSEOWNER_PLAYER && h.ownerId == getPlayerCurrentSubAccount(client).databaseId);
}
// ===========================================================================
function isDoubleBonusActive() {
if(isWeekend()) {
return true;
}
return false;
}
// ===========================================================================