INVENTAR LOGS

This commit is contained in:
hydrant
2021-06-01 23:37:24 +02:00
parent f076f9084a
commit 3b59731bd5
2 changed files with 8 additions and 1 deletions

View File

@@ -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<GroundItem>();
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;

View File

@@ -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();