GELD LOGS

This commit is contained in:
hydrant
2021-05-15 03:14:37 +02:00
parent 3c2d56f2ad
commit a2db770316
22 changed files with 448 additions and 306 deletions

View File

@@ -2287,6 +2287,7 @@ namespace ReallifeGamemode.Server.Commands
{
var user = target.GetUser(context);
user.Handmoney = amount;
logger.LogInformation("Admin {0} set the handmoney of player {1} to {2} dollars", admin.Name, target.Name, amount);
context.SaveChanges();
//target.TriggerEvent("SERVER:SET_HANDMONEY", amount);
}
@@ -2313,6 +2314,7 @@ namespace ReallifeGamemode.Server.Commands
{
var user = target.GetUser(context);
user.Handmoney += amount;
logger.LogInformation("Admin {0} added {2} dollarsto the handmoney of player {1}", admin.Name, target.Name, amount);
context.SaveChanges();
//target.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney);
}
@@ -3356,6 +3358,7 @@ namespace ReallifeGamemode.Server.Commands
using (var dbContext = new DatabaseContext())
{
logger.LogInformation("Admin {0} set the bank account of {1} to {2} dollars", player.Name, target.Name, amount);
target.GetUser(dbContext).BankAccount.Balance = amount;
dbContext.SaveChanges();
}
@@ -3381,6 +3384,7 @@ namespace ReallifeGamemode.Server.Commands
using (var dbContext = new DatabaseContext())
{
logger.LogInformation("Admin {0} added {2} dollars to the bank account of {1}", player.Name, target.Name, amount);
target.GetUser(dbContext).BankAccount.Balance += amount;
dbContext.SaveChanges();
}

View File

@@ -1,9 +1,10 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using GTANetworkAPI;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Entities.Logs.Chat;
using ReallifeGamemode.Database.Models;
@@ -15,6 +16,7 @@ using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Types;
using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Services;
using ReallifeGamemode.Server.Log;
/**
* @overview Life of German Reallife - Faction Commands (Faction.cs)
@@ -26,6 +28,8 @@ namespace ReallifeGamemode.Server.Commands
{
internal class FactionCommands : Script
{
private static readonly ILogger logger = LogManager.GetLogger<FactionCommands>();
#region Chat Commands
[Command("f", "~m~Benutzung: ~s~/f [Nachricht]", GreedyArg = true)]
@@ -413,17 +417,19 @@ namespace ReallifeGamemode.Server.Commands
return;
}
if (deadPlayerUser.Handmoney >= 100)
if (deadPlayerUser.Handmoney >= Medic.ReviveIncome)
{
deadPlayerUser.Handmoney -= 100;
deadPlayerUser.Handmoney -= Medic.ReviveIncome;
}
else
{
int bankMoney = 100 - deadPlayerUser.Handmoney;
int bankMoney = Medic.ReviveIncome - deadPlayerUser.Handmoney;
deadPlayerUser.Handmoney = 0;
deadPlayerUser.BankAccount.Balance -= bankMoney;
}
logger.LogInformation("Player {0} has been revived by {1} for {2} dollars", deadPlayer.Name, player.Name, Medic.ReviveIncome);
player.PlayAnimation("amb@medic@standing@kneel@enter", "enter", 0);
deadPlayer.TriggerEvent("onPlayerRevived");

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using GTANetworkAPI;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
@@ -13,11 +14,16 @@ using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Types;
using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Services;
using ReallifeGamemode.Server.Log;
namespace ReallifeGamemode.Server.Commands
{
internal class UserCommands : Script
{
private static readonly ILogger logger = LogManager.GetLogger<UserCommands>();
private const int SMS_PRICE = 5;
[Command("rent", "~m~rent stop")]
public void CmdUserStopRent(Player player, String option = "")
{
@@ -113,13 +119,15 @@ namespace ReallifeGamemode.Server.Commands
using (var dbContext = new DatabaseContext())
{
User user = player.GetUser(dbContext);
if (user.BankAccount.Balance < 5)
if (user.BankAccount.Balance < SMS_PRICE)
{
ChatService.ErrorMessage(player, "Dafür hast du nicht genug Geld auf deinem Bankkonto");
return;
}
user.BankAccount.Balance -= 5;
logger.LogInformation("Player {0} sent a sms to {1} for {2} dollars", player.Name, target.Name, SMS_PRICE);
user.BankAccount.Balance -= SMS_PRICE;
dbContext.SaveChanges();
}