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