From 3b59731bd5fef0e387050a711ba2bbaafb0a8e3f Mon Sep 17 00:00:00 2001 From: hydrant Date: Tue, 1 Jun 2021 23:37:24 +0200 Subject: [PATCH] INVENTAR LOGS --- ReallifeGamemode.Server/Inventory/GroundItem.cs | 7 +++++++ ReallifeGamemode.Server/Managers/InventoryManager.cs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ReallifeGamemode.Server/Inventory/GroundItem.cs b/ReallifeGamemode.Server/Inventory/GroundItem.cs index 0f059a5f..c83399be 100644 --- a/ReallifeGamemode.Server/Inventory/GroundItem.cs +++ b/ReallifeGamemode.Server/Inventory/GroundItem.cs @@ -1,10 +1,12 @@ using System.Collections.Generic; using System.Linq; using GTANetworkAPI; +using Microsoft.Extensions.Logging; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Inventory.Interfaces; +using ReallifeGamemode.Server.Log; using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Util; @@ -12,6 +14,8 @@ namespace ReallifeGamemode.Server.Inventory { public class GroundItem : Script { + private static readonly ILogger logger = LogManager.GetLogger(); + public int ItemId { get; set; } public int Amount { get; set; } public Vector3 Position { get; set; } @@ -77,6 +81,7 @@ namespace ReallifeGamemode.Server.Inventory nearest.Amount -= itemsToAdd; nearestTextLabel.Text = nearestItem.Name + " ~s~(~y~" + nearest.Amount + "~s~)"; player.SendNotification("Du hast nur ~g~" + itemsToAdd + " ~y~" + nearestItem.Name + "~s~ aufgehoben."); + logger.LogInformation("Player {0} picked up the item {1} ({2}, amount: {3})", player.Name, nearestItem.Name, nearestItem.Id, itemsToAdd); } } else @@ -97,6 +102,7 @@ namespace ReallifeGamemode.Server.Inventory } RemoveGroundItem(nearest, nearestObject, nearestTextLabel); player.SendNotification("Du hast ~g~" + nearest.Amount + " ~y~" + nearestItem.Name + " ~s~aufgehoben."); + logger.LogInformation("Player {0} picked up the item {1} ({2}, amount: {3})", player.Name, nearestItem.Name, nearestItem.Id, nearest.Amount); } if (nearestItem is IWeaponDealItem obj) { @@ -105,6 +111,7 @@ namespace ReallifeGamemode.Server.Inventory player.SyncAnimation("carryBox"); player.AddAttachment("ammobox", false); NAPI.Player.SetPlayerCurrentWeapon(player, WeaponHash.Unarmed); + logger.LogInformation("Player {0} picked up the item {1} ({2}, amount: {3})", player.Name, nearestItem.Name, nearestItem.Id, itemsToAdd); } } return true; diff --git a/ReallifeGamemode.Server/Managers/InventoryManager.cs b/ReallifeGamemode.Server/Managers/InventoryManager.cs index 841f3eb6..c4c4d0a2 100644 --- a/ReallifeGamemode.Server/Managers/InventoryManager.cs +++ b/ReallifeGamemode.Server/Managers/InventoryManager.cs @@ -628,7 +628,7 @@ namespace ReallifeGamemode.Server.Managers if (iItem is IDroppableItem usableItemObj2) { - logger.LogInformation("Player {0} dropped the item {1} ({2})", player.Name, iItem.Name, iItem.Id); + logger.LogInformation("Player {0} dropped the item {1} ({2}, amount: {3})", player.Name, iItem.Name, iItem.Id, amount); Vector3 dropPosition = PlayerExtension.GetPositionFromPlayer(player, 0.6f, 0); //new Vector3(player.Position.X, player.Position.Y, player.Position.Z - 0.8f); Random r = new Random();