From 4eaf6c74d9fe5f829da3cd69d3ad44247b779857 Mon Sep 17 00:00:00 2001 From: hydrant Date: Thu, 10 Jun 2021 09:56:26 +0200 Subject: [PATCH] policet ab jetzt asservatentruck --- ReallifeGamemode.Server/Events/Key.cs | 24 +++++++++---------- .../Managers/HanfManager.cs | 4 +++- .../Managers/InventoryManager.cs | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index cf94f60c..80799ba2 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -224,10 +224,10 @@ namespace ReallifeGamemode.Server.Events if (player.IsInVehicle && player.VehicleSeat == 0 - && player.Vehicle.Model == (uint)VehicleHash.Riot + && player.Vehicle.Model == (uint)HanfManager.ASSERVATENTRUCK_VEHICLE && (user.FactionId == 1 || user.FactionId == 3) && player.Position.DistanceTo(HanfManager.ASSERVATENKAMMER_POSITION) <= 3 - /*&& player.IsDuty()*/) + && player.IsDuty()) { using var dbContext = new DatabaseContext(); GTANetworkAPI.Vehicle veh = player.Vehicle; @@ -236,7 +236,7 @@ namespace ReallifeGamemode.Server.Events List items = InventoryManager.GetVehicleItems(veh); if (items.Count() == 0) { - player.SendNotification("Der Riot ist leer"); + player.SendNotification("Der Asservatentruck ist leer"); return; } @@ -254,7 +254,7 @@ namespace ReallifeGamemode.Server.Events var price = cannabisSeedAmount * cannabisSeedItem.PriceForConfiscation + cannabisAmount * cannabisItem.PriceForConfiscation; - logger.LogInformation("Player {0} unloaded the riot truck with {1} cannabis and {2} cannabis seed and the faction got {3}", player.Name, cannabisAmount, cannabisSeedAmount, price); + logger.LogInformation("Player {0} unloaded the asservatentruck with {1} cannabis and {2} cannabis seed and the faction got {3}", player.Name, cannabisAmount, cannabisSeedAmount, price); var factions = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 1 || f.Id == 3); foreach (var faction in factions) @@ -262,7 +262,7 @@ namespace ReallifeGamemode.Server.Events faction.BankAccount.Balance += price; } - player.SendNotification("~g~Der Riot wurde erfolgreich entladen"); + player.SendNotification("~g~Der Asservatentruck wurde erfolgreich entladen"); ChatService.HQMessage($"{player.Name} hat den Asservatentruck entladen"); @@ -805,13 +805,13 @@ namespace ReallifeGamemode.Server.Events if (player.HasData("IsCarryingPlant") || player.GetData("IsCarryingPlant") && (user.FactionId == 3 || user.FactionId == 1) && player.IsDuty()) { using var dbContext = new DatabaseContext(); - FactionVehicle riot = dbContext.FactionVehicles.Where(f => f.Model == VehicleHash.Riot).ToList().Where(f => f.GetOwners().Contains(3)).FirstOrDefault(); - if (riot == null) + FactionVehicle asservatentruckVehicle = dbContext.FactionVehicles.Where(f => f.Model == HanfManager.ASSERVATENTRUCK_VEHICLE).ToList().Where(f => f.GetOwners().Contains(3)).FirstOrDefault(); + if (asservatentruckVehicle == null) { return; } - GTANetworkAPI.Vehicle riotVehicle = VehicleManager.GetVehicleFromServerVehicle(riot); - if (riotVehicle.Position.DistanceTo(player.Position) > 3) + GTANetworkAPI.Vehicle asservatentruckServerVehicle = VehicleManager.GetVehicleFromServerVehicle(asservatentruckVehicle); + if (asservatentruckServerVehicle.Position.DistanceTo(player.Position) > 3) { return; } @@ -828,11 +828,11 @@ namespace ReallifeGamemode.Server.Events IItem itemToGive = currentModel == 3 ? (IItem)cannabisItem : cannabisSeedsItem; - logger.LogInformation("Cop {0} put the item {1} ({2}, amount: {3}) in the riot", player.Name, itemToGive.Name, itemToGive.Id, amountToGive); + logger.LogInformation("Cop {0} put the item {1} ({2}, amount: {3}) in the asservatentruck", player.Name, itemToGive.Name, itemToGive.Id, amountToGive); - player.SendNotification($"Du hast {(currentModel == 3 ? "das Cannabis" : "die Samen")} in den Riot geladen"); + player.SendNotification($"Du hast {(currentModel == 3 ? "das Cannabis" : "die Samen")} in den Asservatentruck geladen"); - InventoryManager.AddItemToVehicleInventory(riotVehicle, itemIdToGive, amountToGive); + InventoryManager.AddItemToVehicleInventory(asservatentruckServerVehicle, itemIdToGive, amountToGive); } } diff --git a/ReallifeGamemode.Server/Managers/HanfManager.cs b/ReallifeGamemode.Server/Managers/HanfManager.cs index 426c712e..faa4fc20 100644 --- a/ReallifeGamemode.Server/Managers/HanfManager.cs +++ b/ReallifeGamemode.Server/Managers/HanfManager.cs @@ -120,6 +120,8 @@ namespace ReallifeGamemode.Server.Managers private static List _currentCannabisData = new List(); public static readonly Vector3 ASSERVATENKAMMER_POSITION = new Vector3(-5.45, -670.03, 32.33); + public const VehicleHash ASSERVATENTRUCK_VEHICLE = VehicleHash.Policet; + static HanfManager() { _manufacturerDoneTimer.Elapsed += ManufacturerDoneTimerCallback; @@ -178,7 +180,7 @@ namespace ReallifeGamemode.Server.Managers RegeneratePrices(); NAPI.Marker.CreateMarker(GTANetworkAPI.MarkerType.VerticalCylinder, ASSERVATENKAMMER_POSITION.Subtract(new Vector3(0, 0, 3.0)), new Vector3(), new Vector3(), 3.0f, Colors.White); - NAPI.TextLabel.CreateTextLabel("Asservatenkammer~n~Drücke ~y~E~s~, um den ~y~Riot~s~ zu entladen", ASSERVATENKAMMER_POSITION, 10.0f, 10.0f, 0, Colors.White); + NAPI.TextLabel.CreateTextLabel("Asservatenkammer~n~Drücke ~y~E~s~, um den ~y~Asservatentruck~s~ zu entladen", ASSERVATENKAMMER_POSITION, 10.0f, 10.0f, 0, Colors.White); using var dbContext = new DatabaseContext(); HarvestRottenPlants(dbContext); diff --git a/ReallifeGamemode.Server/Managers/InventoryManager.cs b/ReallifeGamemode.Server/Managers/InventoryManager.cs index 97f97bbd..93a73945 100644 --- a/ReallifeGamemode.Server/Managers/InventoryManager.cs +++ b/ReallifeGamemode.Server/Managers/InventoryManager.cs @@ -359,7 +359,7 @@ namespace ReallifeGamemode.Server.Managers if (serverVehicle is FactionVehicle factionVehicle) { - if (factionVehicle.Model == VehicleHash.Riot && user.Faction?.StateOwned == true) + if (factionVehicle.Model == HanfManager.ASSERVATENTRUCK_VEHICLE && user.Faction?.StateOwned == true) { player.TriggerEvent("Error", "Transfer nicht möglich."); return;