This commit is contained in:
michael.reiswich
2021-05-21 21:33:53 +02:00
parent 89f06a4ea6
commit 82c7a0cb8e
4 changed files with 30 additions and 3 deletions

View File

@@ -127,6 +127,10 @@ export default function (globalData: IGlobalData) {
item.SetRightLabel("~r~- $" + moneyFormat(Number(p.healthInsurance.toFixed(2)))); item.SetRightLabel("~r~- $" + moneyFormat(Number(p.healthInsurance.toFixed(2))));
paycheckMenu.AddItem(item); paycheckMenu.AddItem(item);
item = new UIMenuItem("Rundfunkbeitrag");
item.SetRightLabel("~r~- $" + moneyFormat(Number(p.gez.toFixed(2))));
paycheckMenu.AddItem(item);
item = new UIMenuItem("Einkommensteuer"); item = new UIMenuItem("Einkommensteuer");
item.SetRightLabel(moneyFormat(Number((p.financialInterest * 100).toFixed(3))) + "%"); item.SetRightLabel(moneyFormat(Number((p.financialInterest * 100).toFixed(3))) + "%");

View File

@@ -48,6 +48,7 @@ declare type Paycheck = {
amount: number; amount: number;
rentalFees: number; rentalFees: number;
healthInsurance: number; healthInsurance: number;
gez: number;
factionMoney: number; factionMoney: number;
otheramount: number; otheramount: number;
} }

View File

@@ -110,6 +110,19 @@ namespace ReallifeGamemode.Server.Finance
healthInsurance = 150; healthInsurance = 150;
} }
int gez = (int)((bankAccount + user.Handmoney) * 0.001);
if (gez < 0)
{
gez = 0;
}
if (gez > 150)
{
gez = 150;
}
int? factionMoney = null; int? factionMoney = null;
if (user.Faction != null && user.FactionRank != null) if (user.Faction != null && user.FactionRank != null)
@@ -127,9 +140,9 @@ namespace ReallifeGamemode.Server.Finance
factionMoney = factionWage; factionMoney = factionWage;
} }
int otheramount = user.otheramount; int otheramount = user.otheramount;
int amount = wage - (int)(wage * financialInterest) - vehicleTaxation - (int)propertyTax + (int)financialHelp - rentalFees - healthInsurance + (factionMoney ?? 0) + otheramount; int amount = wage - (int)(wage * financialInterest) - vehicleTaxation - (int)propertyTax + (int)financialHelp - rentalFees - healthInsurance + gez + (factionMoney ?? 0) + otheramount;
Paycheck paycheck = new Paycheck(financialHelp, financialInterest, vehicleTaxation, propertyTax, wage, amount, rentalFees, healthInsurance, factionMoney, otheramount); Paycheck paycheck = new Paycheck(financialHelp, financialInterest, vehicleTaxation, propertyTax, wage, amount, rentalFees, healthInsurance, gez, factionMoney, otheramount);
Paychecks[user.Id] = paycheck; Paychecks[user.Id] = paycheck;
ReleasePayDay(client, paycheck, minusJail); ReleasePayDay(client, paycheck, minusJail);
} }
@@ -178,6 +191,7 @@ namespace ReallifeGamemode.Server.Finance
u.BankAccount.Balance + paycheck.Amount, u.BankAccount.Balance + paycheck.Amount,
paycheck.Wage, paycheck.Wage,
paycheck.FinancialInterest, paycheck.FinancialInterest,
paycheck.gez,
paycheck.otheramount); paycheck.otheramount);
u.BankAccount.Balance += paycheck.Amount; u.BankAccount.Balance += paycheck.Amount;
@@ -192,6 +206,10 @@ namespace ReallifeGamemode.Server.Finance
dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 2).First().BankAccount.Balance += (int)(paycheck.HealthInsurance); dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 2).First().BankAccount.Balance += (int)(paycheck.HealthInsurance);
logger.LogInformation("Medic faction got a health insurance payment of {0} dollars from player {1}", paycheck.HealthInsurance, client.Name); logger.LogInformation("Medic faction got a health insurance payment of {0} dollars from player {1}", paycheck.HealthInsurance, client.Name);
dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 9).First().BankAccount.Balance += (int)(paycheck.gez);
logger.LogInformation("Medic faction got a gez payment of {0} dollars from player {1}", paycheck.gez, client.Name);
if (rentals.Any()) if (rentals.Any())
{ {
foreach (var rental in rentals) foreach (var rental in rentals)

View File

@@ -28,13 +28,16 @@ namespace ReallifeGamemode.Server.Finance
[JsonProperty("healthInsurance")] [JsonProperty("healthInsurance")]
public int HealthInsurance { get; set; } = 0; public int HealthInsurance { get; set; } = 0;
[JsonProperty("gez")]
public int gez { get; set; } = 0;
[JsonProperty("factionMoney")] [JsonProperty("factionMoney")]
public int? FactionMoney { get; set; } = 0; public int? FactionMoney { get; set; } = 0;
[JsonProperty("otheramount")] [JsonProperty("otheramount")]
public int? otheramount { get; set; } = 0; public int? otheramount { get; set; } = 0;
public Paycheck(float FinancialHelp, float FinancialInterest, int VehicleTaxation, float PropertyTaxation, int Wage, int Amount, int RentalFees, int HealthInsurance, int? FactionMoney, int? otheramount) public Paycheck(float FinancialHelp, float FinancialInterest, int VehicleTaxation, float PropertyTaxation, int Wage, int Amount, int RentalFees, int HealthInsurance, int gez, int? FactionMoney, int? otheramount)
{ {
this.FinancialHelp = FinancialHelp; this.FinancialHelp = FinancialHelp;
this.FinancialInterest = FinancialInterest; this.FinancialInterest = FinancialInterest;
@@ -44,6 +47,7 @@ namespace ReallifeGamemode.Server.Finance
this.Amount = Amount; this.Amount = Amount;
this.RentalFees = RentalFees; this.RentalFees = RentalFees;
this.HealthInsurance = HealthInsurance; this.HealthInsurance = HealthInsurance;
this.gez = gez;
this.FactionMoney = FactionMoney; this.FactionMoney = FactionMoney;
this.otheramount = otheramount; this.otheramount = otheramount;
} }