change stuff with objects
This commit is contained in:
36
ReallifeGamemode.Server/Inventory/Items/ConsumableItem.cs
Normal file
36
ReallifeGamemode.Server/Inventory/Items/ConsumableItem.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Inventory.Interfaces;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
|
||||
namespace ReallifeGamemode.Server.Inventory.Items
|
||||
{
|
||||
public abstract class ConsumableItem : 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 abstract int Price { get; }
|
||||
public abstract float Cooldown { get; }
|
||||
|
||||
public abstract void Consume(UserItem uItem);
|
||||
|
||||
public bool Use(UserItem uItem)
|
||||
{
|
||||
User user = uItem.GetUser();
|
||||
if (user.Player.IsLoggedIn() && InventoryManager.itemCooldown.ContainsKey(user.Player))
|
||||
{
|
||||
uItem.GetUser().Player.TriggerEvent("Error", "Du kannst dieses Item nicht benutzen.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Consume(uItem);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user