change stuff with objects

This commit is contained in:
2021-04-13 17:57:33 +02:00
parent 2a82f72f14
commit 61da1edcb9
15 changed files with 200 additions and 108 deletions

View File

@@ -1,18 +1,38 @@
using System;
using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Managers;
namespace ReallifeGamemode.Server.Inventory.Items
{
class Apfel : FoodItem
internal class Apfel : ConsumableItem
{
public override int Id => 101;
public override string Name => "Apfel";
public override string Description => "Ein Apfel";
public override int Gewicht => 10;
public override int Gewicht => 200;
public override string Einheit => "g";
public override int HpAmount => 10;
public override uint Object => 2240524752;
public override int Price => 20;
public override float Cooldown => 5000;
public override void Consume(UserItem uItem)
{
Player player = uItem.GetUser().Player;
int amountToAdd = HpAmount;
if (player.Health + amountToAdd > 100)
{
amountToAdd = 100 - player.Health;
}
player.SafeSetHealth(player.Health + amountToAdd);
player.SendNotification("Du hast einen ~y~" + Name + " ~s~gegessen.", false);
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
}
}
}