From 467e0a4248629076b6d95ba57e0d419efa024bfd Mon Sep 17 00:00:00 2001 From: hydrant Date: Thu, 20 May 2021 11:58:15 +0200 Subject: [PATCH] Add legal option to items --- .../Inventory/Interfaces/IItem.cs | 2 ++ .../Inventory/Items/BaseItem.cs | 18 ++++++++++++++++++ .../Inventory/Items/Cannabis.cs | 15 +++------------ .../Inventory/Items/ConsumableItem.cs | 16 ++++++++-------- .../Inventory/Items/DropItem.cs | 14 +++++++------- .../Inventory/Items/UseItem.cs | 14 +++++++------- .../Inventory/Items/WeaponDealItem.cs | 14 +++++++------- 7 files changed, 52 insertions(+), 41 deletions(-) create mode 100644 ReallifeGamemode.Server/Inventory/Items/BaseItem.cs diff --git a/ReallifeGamemode.Server/Inventory/Interfaces/IItem.cs b/ReallifeGamemode.Server/Inventory/Interfaces/IItem.cs index dd364314..4605aed4 100644 --- a/ReallifeGamemode.Server/Inventory/Interfaces/IItem.cs +++ b/ReallifeGamemode.Server/Inventory/Interfaces/IItem.cs @@ -14,5 +14,7 @@ namespace ReallifeGamemode.Server.Inventory.Interfaces int Gewicht { get; } string Einheit { get; } int Price { get; } + + bool Legal { get; } } } diff --git a/ReallifeGamemode.Server/Inventory/Items/BaseItem.cs b/ReallifeGamemode.Server/Inventory/Items/BaseItem.cs new file mode 100644 index 00000000..a47fdb82 --- /dev/null +++ b/ReallifeGamemode.Server/Inventory/Items/BaseItem.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; +using ReallifeGamemode.Server.Inventory.Interfaces; + +namespace ReallifeGamemode.Server.Inventory.Items +{ + public abstract class BaseItem : IItem + { + 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 int Price { get; } + public virtual bool Legal => true; + } +} diff --git a/ReallifeGamemode.Server/Inventory/Items/Cannabis.cs b/ReallifeGamemode.Server/Inventory/Items/Cannabis.cs index a0845bd6..bd82e7af 100644 --- a/ReallifeGamemode.Server/Inventory/Items/Cannabis.cs +++ b/ReallifeGamemode.Server/Inventory/Items/Cannabis.cs @@ -9,13 +9,13 @@ using ReallifeGamemode.Server.Inventory.Interfaces; namespace ReallifeGamemode.Server.Inventory.Items { - public class Cannabis : ConsumableItem + public class Cannabis : DropItem { public override int Id => 108; - public override string Name => "Grünes Gift"; + public override string Name => "Cannabis"; - public override string Description => "puff puff and pass"; + public override string Description => "kein brokkoli"; public override int Gewicht => 2; @@ -24,14 +24,5 @@ namespace ReallifeGamemode.Server.Inventory.Items public override uint Object => 3076948544; public override int Price => 0; - - public override int HpAmount => -5; - - public override float Cooldown => 20000; - - public override void Consume(UserItem uItem) - { - //nothing - } } } diff --git a/ReallifeGamemode.Server/Inventory/Items/ConsumableItem.cs b/ReallifeGamemode.Server/Inventory/Items/ConsumableItem.cs index d5a96232..abfaa298 100644 --- a/ReallifeGamemode.Server/Inventory/Items/ConsumableItem.cs +++ b/ReallifeGamemode.Server/Inventory/Items/ConsumableItem.cs @@ -8,17 +8,17 @@ using ReallifeGamemode.Server.Util; namespace ReallifeGamemode.Server.Inventory.Items { - public abstract class ConsumableItem : IUsableItem + public abstract class ConsumableItem : BaseItem, 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 override int Id { get; } + public override string Name { get; } + public override string Description { get; } + public override int Gewicht { get; } + public override string Einheit { get; } + public override int Price { get; } public abstract float Cooldown { get; } + public abstract uint Object { get; } public abstract void Consume(UserItem uItem); diff --git a/ReallifeGamemode.Server/Inventory/Items/DropItem.cs b/ReallifeGamemode.Server/Inventory/Items/DropItem.cs index 52bf1fc2..e41f034a 100644 --- a/ReallifeGamemode.Server/Inventory/Items/DropItem.cs +++ b/ReallifeGamemode.Server/Inventory/Items/DropItem.cs @@ -6,15 +6,15 @@ using ReallifeGamemode.Server.Managers; namespace ReallifeGamemode.Server.Inventory.Items { - public abstract class DropItem : IDroppableItem + public abstract class DropItem : BaseItem, IDroppableItem { - 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 override int Id { get; } + public override string Name { get; } + public override string Description { get; } + public override int Gewicht { get; } + public override string Einheit { get; } public abstract uint Object { get; } - public abstract int Price { get; } + public override int Price { get; } public void Drop(UserItem uItem, Player player, int amount) { diff --git a/ReallifeGamemode.Server/Inventory/Items/UseItem.cs b/ReallifeGamemode.Server/Inventory/Items/UseItem.cs index 7da16564..9674fb70 100644 --- a/ReallifeGamemode.Server/Inventory/Items/UseItem.cs +++ b/ReallifeGamemode.Server/Inventory/Items/UseItem.cs @@ -10,15 +10,15 @@ using ReallifeGamemode.Server.Managers; namespace ReallifeGamemode.Server.Inventory.Items { - public abstract class UseItem : IUsableItem + public abstract class UseItem : BaseItem, IUsableItem { - 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 override int Id { get; } + public override string Name { get; } + public override string Description { get; } + public override int Gewicht { get; } + public override string Einheit { get; } + public override int Price { get; } public abstract uint Object { get; } - public abstract int Price { get; } public abstract bool Use(UserItem uItem); diff --git a/ReallifeGamemode.Server/Inventory/Items/WeaponDealItem.cs b/ReallifeGamemode.Server/Inventory/Items/WeaponDealItem.cs index d36904d7..b38a907a 100644 --- a/ReallifeGamemode.Server/Inventory/Items/WeaponDealItem.cs +++ b/ReallifeGamemode.Server/Inventory/Items/WeaponDealItem.cs @@ -6,15 +6,15 @@ using ReallifeGamemode.Server.WeaponDeal; namespace ReallifeGamemode.Server.Inventory.Items { - public abstract class WeaponDealItem : IWeaponDealItem + public abstract class WeaponDealItem : BaseItem, IWeaponDealItem { - 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 override int Id { get; } + public override string Name { get; } + public override string Description { get; } + public override int Gewicht { get; } + public override string Einheit { get; } + public override int Price { get; } public abstract uint Object { get; } - public abstract int Price { get; } public bool noTransfer(Player client, UserItem uItem, FactionVehicle fVeh) {