@@ -9,9 +9,11 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Log;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using ReallifeGamemode.Server.Wanted;
|
||||
|
||||
@@ -19,6 +21,8 @@ namespace ReallifeGamemode.Server.Finance
|
||||
{
|
||||
public class Economy
|
||||
{
|
||||
private static readonly ILogger logger = LogManager.GetLogger<Economy>();
|
||||
|
||||
public static Dictionary<int, Paycheck> Paychecks { get; set; } = new Dictionary<int, Paycheck>();
|
||||
|
||||
public static (int, float, float) GetEconomyClass(Player client, int wage)
|
||||
@@ -162,6 +166,8 @@ namespace ReallifeGamemode.Server.Finance
|
||||
}
|
||||
}
|
||||
|
||||
logger.LogInformation("Player {0} has a payday of {1} dollars. old balance: {2}, new balance: {3}", client.Name, paycheck.Amount, u.BankAccount.Balance, u.BankAccount.Balance + paycheck.Amount);
|
||||
|
||||
u.BankAccount.Balance += paycheck.Amount;
|
||||
u.Wage = 0;
|
||||
u.otheramount = 0;
|
||||
@@ -173,7 +179,7 @@ namespace ReallifeGamemode.Server.Finance
|
||||
.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);
|
||||
|
||||
logger.LogInformation("Medic faction got a health insurance payment of {0} dollars from player {1}", paycheck.HealthInsurance * 0.1, client.Name);
|
||||
if (rentals.Any())
|
||||
{
|
||||
foreach (var rental in rentals)
|
||||
@@ -181,6 +187,7 @@ namespace ReallifeGamemode.Server.Finance
|
||||
if (rental?.House?.BankAccount != null)
|
||||
{
|
||||
rental.House.BankAccount.Balance += (int)(rental.House.RentalFee * 0.7);
|
||||
logger.LogInformation("House {0} got a rentalfee of {1} from paycheck from user {2}", rental.House.Id, rental.House.RentalFee * 0.7, u.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user