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

@@ -1,9 +1,11 @@
using System.Linq;
using GTANetworkAPI;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Log;
using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Types;
@@ -11,8 +13,11 @@ namespace ReallifeGamemode.Server.Managers
{
internal class CityHallManager : Script
{
private const int GROUP_PRICE = 50000;
private static readonly Vector3 _cityHallPosition = new Vector3(273.22, -278.14, 53.9);
private static readonly ILogger logger = LogManager.GetLogger<CityHallManager>();
public static void LoadCityHall()
{
NAPI.Marker.CreateMarker(GTANetworkAPI.MarkerType.VerticalCylinder, _cityHallPosition.Subtract(new Vector3(0, 0, 1.7)), new Vector3(), new Vector3(), 1.0f, new Color(255, 255, 255));
@@ -57,13 +62,14 @@ namespace ReallifeGamemode.Server.Managers
u.Group = group;
u.GroupRank = GroupRank.OWNER;
if (player.GetUser(dbContext).BankAccount.Balance < 50000)
if (u.BankAccount.Balance < GROUP_PRICE)
{
ChatService.ErrorMessage(player, "Du hast nicht genug Geld");
return;
}
player.GetUser(dbContext).BankAccount.Balance -= 50000;
logger.LogInformation("Player {0} created a group for {1} dollars", player.Name, GROUP_PRICE);
u.BankAccount.Balance -= GROUP_PRICE;
dbContext.SaveChanges();
ChatService.BroadcastGroup($"Die Gruppe \"{name}\" wurde erfolgreich erstellt.", group);