FIB/LSPD: Fix Ticketpreis Verteilung
This commit is contained in:
@@ -703,16 +703,22 @@ namespace ReallifeGamemode.Server.Managers
|
||||
player.SendNotification($"~y~{targetname} ~g~hat das Ticket über ~b~{ticket_amount}$ ~g~angenommen und bezahlt.", true);
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
target.GetUser(dbContext).BankAccount.Balance -= ticket_amount;
|
||||
if (player.GetUser().FactionId == 1)
|
||||
User user = player.GetUser(dbContext);
|
||||
User targetUser = target.GetUser(dbContext);
|
||||
targetUser.BankAccount.Balance -= ticket_amount;
|
||||
|
||||
FactionBankAccount lspdBankAccount = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 1).First().BankAccount;
|
||||
FactionBankAccount fibBankAccount = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 3).First().BankAccount;
|
||||
|
||||
if (user.FactionId == 1)
|
||||
{
|
||||
dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 1).First().BankAccount.Balance += (int)(ticket_amount / 100 * 70);
|
||||
dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 3).First().BankAccount.Balance += (int)(ticket_amount / 100 * 30);
|
||||
lspdBankAccount.Balance += (int)(ticket_amount / 100 * 60);
|
||||
fibBankAccount.Balance += (int)(ticket_amount / 100 * 40);
|
||||
}
|
||||
if (player.GetUser().FactionId == 1)
|
||||
else if (user.FactionId == 3)
|
||||
{
|
||||
dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 3).First().BankAccount.Balance += (int)(ticket_amount / 100 * 70);
|
||||
dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 1).First().BankAccount.Balance += (int)(ticket_amount / 100 * 30);
|
||||
fibBankAccount.Balance += (int)(ticket_amount / 100 * 60);
|
||||
lspdBankAccount.Balance += (int)(ticket_amount / 100 * 40);
|
||||
}
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user