Changed whole project structure (split client and server into separat projects)
This commit is contained in:
37
ReallifeGamemode.Server/Inventory/Items/FoodItem.cs
Normal file
37
ReallifeGamemode.Server/Inventory/Items/FoodItem.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using GTANetworkAPI;
|
||||
using reallife_gamemode.Server.Entities;
|
||||
using reallife_gamemode.Server.Extensions;
|
||||
using reallife_gamemode.Server.Inventory.Interfaces;
|
||||
using reallife_gamemode.Server.Managers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace reallife_gamemode.Server.Inventory.Items
|
||||
{
|
||||
public abstract class FoodItem : IUsableItem
|
||||
{
|
||||
public abstract int HpAmount { get; }
|
||||
public abstract int Id { get; }
|
||||
public abstract string Name { get; }
|
||||
public abstract string Description { get; }
|
||||
public abstract int Gewicht { get; }
|
||||
public abstract string Einheit { get; }
|
||||
public abstract uint Object { get; }
|
||||
|
||||
public void Use(UserItem uItem)
|
||||
{
|
||||
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