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

@@ -110,6 +110,19 @@ namespace ReallifeGamemode.Server.Finance
healthInsurance = 150;
}
int gez = (int)((bankAccount + user.Handmoney) * 0.001);
if (gez < 0)
{
gez = 0;
}
if (gez > 150)
{
gez = 150;
}
int? factionMoney = null;
if (user.Faction != null && user.FactionRank != null)
@@ -127,9 +140,9 @@ namespace ReallifeGamemode.Server.Finance
factionMoney = factionWage;
}
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;
ReleasePayDay(client, paycheck, minusJail);
}
@@ -178,6 +191,7 @@ namespace ReallifeGamemode.Server.Finance
u.BankAccount.Balance + paycheck.Amount,
paycheck.Wage,
paycheck.FinancialInterest,
paycheck.gez,
paycheck.otheramount);
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);
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())
{
foreach (var rental in rentals)

View File

@@ -28,13 +28,16 @@ namespace ReallifeGamemode.Server.Finance
[JsonProperty("healthInsurance")]
public int HealthInsurance { get; set; } = 0;
[JsonProperty("gez")]
public int gez { get; set; } = 0;
[JsonProperty("factionMoney")]
public int? FactionMoney { get; set; } = 0;
[JsonProperty("otheramount")]
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.FinancialInterest = FinancialInterest;
@@ -44,6 +47,7 @@ namespace ReallifeGamemode.Server.Finance
this.Amount = Amount;
this.RentalFees = RentalFees;
this.HealthInsurance = HealthInsurance;
this.gez = gez;
this.FactionMoney = FactionMoney;
this.otheramount = otheramount;
}