paar debugs
This commit is contained in:
@@ -15,6 +15,7 @@ using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ReallifeGamemode.Server.Finance
|
||||
{
|
||||
@@ -98,34 +99,47 @@ namespace ReallifeGamemode.Server.Finance
|
||||
|
||||
public static void ReleasePayDay(Player client, Paycheck paycheck)
|
||||
{
|
||||
|
||||
NAPI.Util.ConsoleOutput("in release payday");
|
||||
if (client == null || paycheck == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NAPI.Util.ConsoleOutput($"client = {client.Name}, paycheck = {JsonConvert.SerializeObject(paycheck)}");
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User u = client.GetUser(dbContext);
|
||||
NAPI.Util.ConsoleOutput("get user");
|
||||
u.BankAccount.Balance += paycheck.Amount;
|
||||
u.Wage = 0;
|
||||
|
||||
u.PaydayTimer = 60;
|
||||
|
||||
|
||||
NAPI.Util.ConsoleOutput("set sachen");
|
||||
|
||||
var rentals = dbContext.HouseRentals
|
||||
.Include(hR => hR.House)
|
||||
.ThenInclude(h => h.BankAccount)
|
||||
.Where(hR => hR.UserId == u.Id);
|
||||
|
||||
|
||||
NAPI.Util.ConsoleOutput("get rentals");
|
||||
|
||||
dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 2).First().BankAccount.Balance += (int)(paycheck.HealthInsurance * 0.1);
|
||||
|
||||
if (rentals.Any())
|
||||
{
|
||||
NAPI.Util.ConsoleOutput("hat rentals");
|
||||
foreach (var rental in rentals)
|
||||
{
|
||||
if (rental?.House?.BankAccount != null)
|
||||
{
|
||||
rental.House.BankAccount.Balance += (int)(rental.House.RentalFee * 0.7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user