Refactored inventory system

This commit is contained in:
hydrant
2018-12-19 21:14:36 +01:00
parent 98d6ecb01a
commit b16ed270c2
11 changed files with 43 additions and 29 deletions

View File

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