diff --git a/ReallifeGamemode.Server/Finance/Economy.cs b/ReallifeGamemode.Server/Finance/Economy.cs index 3bed3a98..d95acda7 100644 --- a/ReallifeGamemode.Server/Finance/Economy.cs +++ b/ReallifeGamemode.Server/Finance/Economy.cs @@ -71,6 +71,7 @@ namespace ReallifeGamemode.Server.Finance public static void SetPaycheck(Player client, int wage) { + User user = client.GetUser(); (int bankAccount, float financialHelp, float financialInterest) = GetEconomyClass(client, wage); float propertyTax = GetPropertyTaxation(client); int vehicleTaxation = GetVehicleTaxation(client); @@ -78,8 +79,9 @@ namespace ReallifeGamemode.Server.Finance int amount = wage - (int)(wage * financialInterest) - vehicleTaxation - (int)propertyTax + (int)financialHelp - rentalFees; - Paycheck paycheck = new Paycheck(financialHelp, financialInterest, vehicleTaxation, propertyTax, wage, amount, rentalFees); - User user = client.GetUser(); + int healthInsurance = (int)(user.BankAccount.Balance * 0.001); + + Paycheck paycheck = new Paycheck(financialHelp, financialInterest, vehicleTaxation, propertyTax, wage, amount, rentalFees, healthInsurance); Paychecks[user.Id] = paycheck; ReleasePayDay(client, paycheck); } @@ -106,6 +108,8 @@ namespace ReallifeGamemode.Server.Finance .ThenInclude(h => h.BankAccount) .Where(hR => hR.UserId == u.Id); + dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 2).First().BankAccount.Balance += (int)(paycheck.HealthInsurance * 0.1); + foreach (var rental in rentals) { rental.House.BankAccount.Balance += (int)(rental.House.RentalFee * 0.7); diff --git a/ReallifeGamemode.Server/Finance/Paycheck.cs b/ReallifeGamemode.Server/Finance/Paycheck.cs index f0187789..d574e996 100644 --- a/ReallifeGamemode.Server/Finance/Paycheck.cs +++ b/ReallifeGamemode.Server/Finance/Paycheck.cs @@ -34,7 +34,10 @@ namespace ReallifeGamemode.Server.Finance [JsonProperty("rentalFees")] public int RentalFees { get; set; } = 0; - public Paycheck(float FinancialHelp, float FinancialInterest, int VehicleTaxation, float PropertyTaxation, int Wage, int Amount, int RentalFees) + [JsonProperty("healthInsurance")] + public int HealthInsurance { get; set; } = 0; + + public Paycheck(float FinancialHelp, float FinancialInterest, int VehicleTaxation, float PropertyTaxation, int Wage, int Amount, int RentalFees, int HealthInsurance) { this.FinancialHelp = FinancialHelp; this.FinancialInterest = FinancialInterest; @@ -43,6 +46,7 @@ namespace ReallifeGamemode.Server.Finance this.Wage = Wage; this.Amount = Amount; this.RentalFees = RentalFees; + this.HealthInsurance = HealthInsurance; } } }