Refactored inventory system
This commit is contained in:
@@ -19,9 +19,17 @@ namespace reallife_gamemode.Server.Inventory.Items
|
||||
public abstract string Einheit { get; }
|
||||
public abstract uint Object { get; }
|
||||
|
||||
public void Use(UserItem uItem, Client player)
|
||||
public void Use(UserItem uItem)
|
||||
{
|
||||
player.Health += HpAmount;
|
||||
Client player = uItem.GetUser().GetClient();
|
||||
|
||||
int amountToAdd = HpAmount;
|
||||
if(player.Health + amountToAdd > 100)
|
||||
{
|
||||
amountToAdd = 100 - player.Health;
|
||||
}
|
||||
|
||||
player.Health += amountToAdd;
|
||||
player.SendNotification("Du hast ein/einen ~y~" + InventoryManager.GetItemById(uItem.ItemId).Name + " ~s~gegessen.", false);
|
||||
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user