Change Items , add Cooldown

This commit is contained in:
2021-04-13 20:30:02 +02:00
parent 182accea22
commit 5e4d5b1ece
29 changed files with 263 additions and 75 deletions

View File

@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 55.108 55.108" style="enable-background:new 0 0 55.108 55.108;" xml:space="preserve">
<g>
<g>
<path style="fill:#FBD490;" d="M23.554,29.603c0-1.915,0.301-3.584,0.817-5.043c-0.492-1.279-0.817-2.179-0.817-2.442
c0-9.858-7.93-13.269-12.625-14.425c-0.194-0.048-0.375,0.104-0.375,0.304v27.652c3.706,1.14,7.525,1.782,11.358,1.924
C22.906,35.545,23.554,32.958,23.554,29.603z"/>
</g>
<g>
<path style="fill:#F4C076;" d="M28.486,18.818c-0.201-1.172-0.907-2.169-1.888-2.758c0.588-0.696,0.956-1.584,0.956-2.566
c0-0.509-0.104-0.991-0.277-1.438c0.471,0.049,0.925-0.215,1.021-0.701c0.062-0.312,0.157-0.613,0.255-0.876
c0.257-0.684,1.178-0.778,1.596-0.179c0.016,0.023,0.032,0.046,0.047,0.07c0.123,0.184,0.3,0.284,0.49,0.342
c-0.021-0.601,0.101-1.113,0.271-1.508c0.275-0.642,1.131-0.74,1.573-0.199c0.071,0.087,0.139,0.177,0.205,0.27
c0.465,0.658,1.395,0.662,1.89,0.026c0.252-0.323,0.53-0.556,0.759-0.691c-2.05-3.927-6.585-6.007-11.83-6.007
c-1.301,0-2.557-0.046-3.743-0.078c0.047,0.166,0.089,0.337,0.12,0.514c0.099,0.574,0.699,0.882,1.251,0.696
c0.441-0.148,0.921-0.178,1.341,0.094c0.082,0.053,0.13,0.152,0.121,0.249c-0.025,0.268-0.186,0.701-0.504,1.131
c-0.48,0.648-0.228,1.542,0.531,1.814c0.107,0.038,0.213,0.08,0.315,0.125c0.639,0.281,0.774,1.132,0.229,1.569
c-0.492,0.395-1.782,2.579-3.216,3.885c2.067,2.191,3.556,5.247,3.556,9.515c0,0.263,0.325,1.164,0.817,2.442
c0.887-2.507,2.42-4.378,4.175-5.786C28.527,18.789,28.506,18.802,28.486,18.818z"/>
</g>
<g>
<path style="fill:#EEAF4B;" d="M36.554,35.648v-20.56c-4.632,1.065-13,4.389-13,14.515c0,3.357-0.649,5.943-1.645,7.969
C26.837,37.756,31.789,37.114,36.554,35.648z"/>
</g>
<path style="fill:#659C35;" d="M10.93,7.692c2.662,0.656,6.362,2.04,9.069,4.91c1.434-1.306,2.724-3.49,3.216-3.885
c0.545-0.437,0.41-1.288-0.229-1.569c-0.102-0.045-0.208-0.086-0.315-0.125c-0.759-0.272-1.011-1.167-0.531-1.814
c0.319-0.43,0.48-0.863,0.504-1.131c0.009-0.098-0.039-0.196-0.121-0.249c-0.42-0.272-0.9-0.242-1.341-0.094
c-0.552,0.185-1.152-0.123-1.251-0.696c-0.054-0.313-0.142-0.617-0.234-0.882c-0.24-0.689-1.159-0.807-1.591-0.218
c-0.017,0.023-0.033,0.045-0.049,0.069c-0.127,0.18-0.307,0.276-0.498,0.33c0.036-0.6-0.074-1.115-0.234-1.514
c-0.26-0.648-1.113-0.768-1.567-0.238c-0.073,0.085-0.143,0.174-0.211,0.265c-0.481,0.647-1.41,0.627-1.89-0.02
c-0.319-0.43-0.686-0.71-0.935-0.812C12.629-0.018,12.522,0,12.447,0.063c-0.382,0.323-0.494,0.79-0.48,1.256
c0.017,0.582-0.452,1.066-1.03,0.994c-0.315-0.04-0.632-0.044-0.912-0.033c-0.729,0.03-1.109,0.874-0.672,1.459
c0.017,0.022,0.034,0.045,0.051,0.067c0.361,0.462,0.192,1.117-0.321,1.403C8.877,5.323,8.724,5.459,8.625,5.563
C8.54,5.653,8.529,5.796,8.606,5.894c0.447,0.567,1.229,1.313,1.976,1.979C10.638,7.74,10.778,7.655,10.93,7.692z"/>
<path style="fill:#A46F3E;" d="M23.554,9.495c-0.388,0-0.759,0.066-1.113,0.169c-0.632,0.859-1.504,2.083-2.443,2.938
c-0.058-0.061-0.122-0.112-0.18-0.172c1.213,1.241,2.229,2.776,2.896,4.656c-0.113-0.316-0.224-0.634-0.356-0.931
c0.631-0.416,1.384-0.661,2.196-0.661c0.748,0,1.439,0.218,2.037,0.575c0.592-0.698,0.963-1.589,0.963-2.575
C27.554,11.285,25.763,9.495,23.554,9.495z"/>
<path style="fill:#6A3311;" d="M23.947,23.434c0.199,0.03,0.399,0.061,0.607,0.061c0.094,0,0.181-0.021,0.274-0.028
c0.898-1.941,2.194-3.462,3.658-4.649c-0.323-1.885-1.954-3.324-3.932-3.324c-0.812,0-1.565,0.245-2.196,0.661
c0.741,1.667,1.196,3.628,1.196,5.962C23.554,22.294,23.703,22.762,23.947,23.434z"/>
<g>
<path style="fill:#A4E869;" d="M39.539,14.153c-0.096-0.106-0.246-0.246-0.449-0.366c-0.505-0.298-0.658-0.957-0.286-1.41
c0.018-0.022,0.036-0.044,0.053-0.066c0.451-0.574,0.093-1.427-0.636-1.475c-0.28-0.018-0.596-0.021-0.913,0.01
c-0.579,0.058-1.036-0.438-1.005-1.019c0.025-0.465-0.075-0.935-0.45-1.267c-0.073-0.065-0.181-0.085-0.272-0.05
c-0.251,0.096-0.625,0.366-0.955,0.789c-0.496,0.635-1.425,0.632-1.89-0.026c-0.066-0.093-0.134-0.183-0.205-0.27
c-0.441-0.541-1.297-0.443-1.573,0.199c-0.17,0.395-0.292,0.907-0.271,1.508c-0.19-0.058-0.367-0.158-0.49-0.342
c-0.016-0.023-0.031-0.047-0.047-0.07c-0.418-0.599-1.339-0.504-1.596,0.179c-0.099,0.263-0.194,0.564-0.255,0.876
c-0.096,0.486-0.551,0.75-1.021,0.701c0.173,0.448,0.277,0.93,0.277,1.438c0,0.982-0.368,1.87-0.956,2.566
c0.98,0.588,1.687,1.586,1.888,2.758c2.639-2.138,5.8-3.209,8.068-3.73v1.291c0.212-0.052,0.428-0.109,0.629-0.153
c0.152-0.034,0.291,0.055,0.343,0.19c0.763-0.647,1.563-1.374,2.024-1.931C39.629,14.389,39.622,14.246,39.539,14.153z"/>
</g>
<path style="fill:#FFFFFF;" d="M26.554,7.495c-1.654,0-3-1.346-3-3c0-0.553,0.447-1,1-1s1,0.447,1,1c0,0.552,0.448,1,1,1
c0.553,0,1,0.447,1,1S27.107,7.495,26.554,7.495z"/>
<path style="fill:#FFFFFF;" d="M27.554,9.495c-0.553,0-1-0.447-1-1s0.447-1,1-1c0.552,0,1-0.448,1-1c0-0.553,0.447-1,1-1
s1,0.447,1,1C30.554,8.149,29.208,9.495,27.554,9.495z"/>
<path style="fill:#E6E6E6;" d="M37.554,48.784c0,3.478-2.846,6.325-6.324,6.325H15.879c-3.478,0-6.324-2.846-6.324-6.324l0-12.85
c0-0.391,0.369-0.667,0.745-0.56c8.116,2.312,18.394,2.312,26.51,0c0.376-0.107,0.745,0.169,0.745,0.56L37.554,48.784z"/>
<path style="fill:#D2D5D7;" d="M37.554,49.221l8.982-3.527c0.023-0.017,0.023-0.042,0-0.059l-8.982-3.527V49.221z"/>
<path style="fill:#FFFFFF;" d="M15.554,51.108c-0.553,0-1-0.447-1-1s0.447-1,1-1c9.757,0,18-4.121,18-9c0-0.553,0.447-1,1-1
s1,0.447,1,1C35.554,46.276,26.769,51.108,15.554,51.108z"/>
<path style="fill:#A5A5A5;" d="M43.536,39.108c0.023-0.017,0.023-0.042,0-0.059l-5.982-0.941v4l2.201,0.864L43.536,39.108z"/>
<circle style="fill:#E0BB80;" cx="18.585" cy="27.969" r="2.031"/>
<circle style="fill:#E0BB80;" cx="14.585" cy="14.969" r="2.031"/>
<circle style="fill:#DC9628;" cx="32.523" cy="32.969" r="2.031"/>
<circle style="fill:#DC9628;" cx="28.554" cy="24" r="2.031"/>
<circle style="fill:#FBD490;" cx="22.867" cy="24.438" r="0.813"/>
<circle style="fill:#DC9628;" cx="26.742" cy="31.188" r="0.813"/>
<circle style="fill:#DC9628;" cx="33.742" cy="26.813" r="0.813"/>
<circle style="fill:#DC9628;" cx="33.742" cy="18.813" r="0.813"/>
<circle style="fill:#DC9628;" cx="27.367" cy="35.188" r="0.813"/>
<circle style="fill:#C6A473;" cx="15.742" cy="33.188" r="0.813"/>
<circle style="fill:#C6A473;" cx="20.367" cy="34.188" r="0.813"/>
<circle style="fill:#C6A473;" cx="13.742" cy="22.813" r="0.813"/>
<circle style="fill:#FBD490;" cx="18.367" cy="19.813" r="0.813"/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6c1a845cfe60c75b75dd72add91c3bb7e6890c4df6cb10649be3740416b34d17
size 3076608

View File

@@ -105,11 +105,11 @@ namespace ReallifeGamemode.Server.Events
string addInfoStr = " (IP: " + player.Address + ")"; string addInfoStr = " (IP: " + player.Address + ")";
if(!string.IsNullOrEmpty(message)) if (!string.IsNullOrEmpty(message))
{ {
ChatService.BroadcastAdmin(message, AdminLevel.MAPPING, admin => ChatService.BroadcastAdmin(message, AdminLevel.MAPPING, admin =>
{ {
if(admin.HasData("togip")) if (admin.HasData("togip"))
{ {
return addInfoStr; return addInfoStr;
} }
@@ -170,7 +170,7 @@ namespace ReallifeGamemode.Server.Events
} }
}, delayTime: 1000); }, delayTime: 1000);
if(GlobalHelper.CountdownUntil > DateTime.Now) if (GlobalHelper.CountdownUntil > DateTime.Now)
{ {
player.TriggerEvent("countdown", (GlobalHelper.CountdownUntil - DateTime.Now).TotalSeconds, GlobalHelper.CountdownText); player.TriggerEvent("countdown", (GlobalHelper.CountdownUntil - DateTime.Now).TotalSeconds, GlobalHelper.CountdownText);
} }

View File

@@ -13,7 +13,6 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override string Description => "Ein Fisch"; public override string Description => "Ein Fisch";
public override int Gewicht => 3600; public override int Gewicht => 3600;
public override string Einheit => "g"; public override string Einheit => "g";
public override int HpAmount => 20;
public override uint Object => 786272259; public override uint Object => 786272259;
public override int Price => 0; public override int Price => 0;
} }

View File

@@ -17,8 +17,8 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override string Einheit => "g"; public override string Einheit => "g";
public override int HpAmount => 10; public override int HpAmount => 10;
public override uint Object => 2240524752; public override uint Object => 2240524752;
public override int Price => 20; public override int Price => 200;
public override float Cooldown => 5000; public override float Cooldown => 10000;
public override void Consume(UserItem uItem) public override void Consume(UserItem uItem)
{ {

View File

@@ -4,15 +4,14 @@ using System.Text;
namespace ReallifeGamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
class AssaultRifle : WeaponDealItem internal class AssaultRifle : WeaponDealItem
{ {
public override int Id => 13; public override int Id => 13;
public override string Name => "AssaultRifle"; public override string Name => "AssaultRifle";
public override string Description => "Waffe"; public override string Description => "Waffe";
public override int Gewicht => 500; public override int Gewicht => 4780;
public override string Einheit => "g"; public override string Einheit => "g";
public override uint Object => 3666746839; //3061944032 public override uint Object => 3666746839; //3061944032
public override int Price => 0; public override int Price => 0;
} }
} }

View File

@@ -4,15 +4,14 @@ using System.Text;
namespace ReallifeGamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
class AssaultSmg : WeaponDealItem internal class AssaultSmg : WeaponDealItem
{ {
public override int Id => 14; public override int Id => 14;
public override string Name => "AssaultSmg"; public override string Name => "AssaultSmg";
public override string Description => "Waffe"; public override string Description => "Waffe";
public override int Gewicht => 500; public override int Gewicht => 2300;
public override string Einheit => "g"; public override string Einheit => "g";
public override uint Object => 3666746839; //3061944032 public override uint Object => 3666746839; //3061944032
public override int Price => 0; public override int Price => 0;
} }
} }

View File

@@ -10,7 +10,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
{ {
internal class Baklava : ConsumableItem internal class Baklava : ConsumableItem
{ {
public override int Id => 104; public override int Id => 105;
public override string Name => "Baklava"; public override string Name => "Baklava";
public override string Description => "Dessert für dannach."; public override string Description => "Dessert für dannach.";
public override int Gewicht => 100; public override int Gewicht => 100;
@@ -19,7 +19,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override uint Object => 2240524752; public override uint Object => 2240524752;
public override int Price => 300; public override int Price => 300;
public override float Cooldown => 10000; public override float Cooldown => 20000;
public override void Consume(UserItem uItem) public override void Consume(UserItem uItem)
{ {

View File

@@ -13,7 +13,6 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override string Description => "Ein Fisch"; public override string Description => "Ein Fisch";
public override int Gewicht => 2600; public override int Gewicht => 2600;
public override string Einheit => "g"; public override string Einheit => "g";
public override int HpAmount => 20;
public override uint Object => 786272259; public override uint Object => 786272259;
public override int Price => 0; public override int Price => 0;
} }

View File

@@ -9,12 +9,12 @@ namespace ReallifeGamemode.Server.Inventory.Items
{ {
public override int Id => 102; public override int Id => 102;
public override string Name => "Bier"; public override string Name => "Bier";
public override string Description => "Ein Bier"; public override string Description => "Ein Kolben";
public override int Gewicht => 10; public override int Gewicht => 500;
public override string Einheit => "g"; public override string Einheit => "g";
public override int HpAmount => 10; public override int HpAmount => 10;
public override uint Object => 2240524752; public override uint Object => 2240524752;
public override int Price => 20; public override int Price => 50;
public override float Cooldown => 1000; public override float Cooldown => 1000;

View File

@@ -1,4 +1,5 @@
using ReallifeGamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Server.Inventory.Interfaces;
/** /**
* @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs) * @overview Life of German Reallife - Inventory Items Hamburger (Hamburger.cs)
@@ -8,14 +9,29 @@
namespace ReallifeGamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
public class Cannabis : IDroppableItem public class Cannabis : ConsumableItem
{ {
public int Id => 30; public override int Id => 108;
public string Name => "Grünes Gift";
public string Description => "puff puff and pass"; public override string Name => "Grünes Gift";
public int Gewicht => 50;
public string Einheit => "g"; public override string Description => "puff puff and pass";
public uint Object => 3076948544;
public int Price => 0; public override int Gewicht => 2;
public override string Einheit => "g";
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
}
} }
} }

View File

@@ -11,7 +11,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override int Id => 6; public override int Id => 6;
public override string Name => "CarbineRifle"; public override string Name => "CarbineRifle";
public override string Description => "Waffe"; public override string Description => "Waffe";
public override int Gewicht => 500; public override int Gewicht => 3200;
public override string Einheit => "g"; public override string Einheit => "g";
public override uint Object => 3666746839; //3061944032 public override uint Object => 3666746839; //3061944032
public override int Price => 0; public override int Price => 0;

View File

@@ -21,7 +21,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override int HpAmount => 20; public override int HpAmount => 20;
public override uint Object => 2240524752; public override uint Object => 2240524752;
public override int Price => 150; public override int Price => 150;
public override float Cooldown => 4000; public override float Cooldown => 7000;
public override void Consume(UserItem uItem) public override void Consume(UserItem uItem)
{ {

View File

@@ -19,7 +19,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override uint Object => 2240524752; public override uint Object => 2240524752;
public override int Price => 5; public override int Price => 5;
public override float Cooldown => 3500; public override float Cooldown => 5500;
public override void Consume(UserItem uItem) public override void Consume(UserItem uItem)
{ {

View File

@@ -10,7 +10,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
{ {
public class Cocain : ConsumableItem public class Cocain : ConsumableItem
{ {
public override int Id => 31; public override int Id => 107;
public override string Name => "Koks"; public override string Name => "Koks";
public override string Description => "Rave"; public override string Description => "Rave";
public override int Gewicht => 2; public override int Gewicht => 2;
@@ -19,7 +19,7 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override uint Object => 2240524752; public override uint Object => 2240524752;
public override int Price => 0; public override int Price => 0;
public override float Cooldown => throw new System.NotImplementedException(); public override float Cooldown => 20000;
public override void Consume(UserItem uItem) public override void Consume(UserItem uItem)
{ {

View File

@@ -4,15 +4,14 @@ using System.Text;
namespace ReallifeGamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
class CombatPDW : WeaponDealItem internal class CombatPDW : WeaponDealItem
{ {
public override int Id => 12; public override int Id => 12;
public override string Name => "CombatPDW"; public override string Name => "CombatPDW";
public override string Description => "Waffe"; public override string Description => "Waffe";
public override int Gewicht => 500; public override int Gewicht => 2300;
public override string Einheit => "g"; public override string Einheit => "g";
public override uint Object => 3666746839; //3061944032 public override uint Object => 3666746839; //3061944032
public override int Price => 0; public override int Price => 0;
} }
} }

View File

@@ -4,12 +4,12 @@ using System.Text;
namespace ReallifeGamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
class Combatpstiol : WeaponDealItem internal class Combatpstiol : WeaponDealItem
{ {
public override int Id => 4; public override int Id => 4;
public override string Name => "Combatpistol"; public override string Name => "Combatpistol";
public override string Description => "Waffe"; public override string Description => "Waffe";
public override int Gewicht => 500; public override int Gewicht => 950;
public override string Einheit => "g"; public override string Einheit => "g";
public override uint Object => 3666746839; //3061944032 public override uint Object => 3666746839; //3061944032
public override int Price => 0; public override int Price => 0;

View File

@@ -1,8 +1,10 @@
using GTANetworkAPI; using System;
using GTANetworkAPI;
using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Inventory.Interfaces;
using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Util;
namespace ReallifeGamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
@@ -23,14 +25,36 @@ namespace ReallifeGamemode.Server.Inventory.Items
public bool Use(UserItem uItem) public bool Use(UserItem uItem)
{ {
User user = uItem.GetUser(); User user = uItem.GetUser();
if (user.Player.IsLoggedIn() && InventoryManager.itemCooldown.ContainsKey(user.Player)) if (user.Player == null || !user.Player.IsLoggedIn())
return false;
if (InventoryManager.itemCooldown.ContainsKey(user.Player))
{ {
uItem.GetUser().Player.TriggerEvent("Error", "Du kannst dieses Item nicht benutzen."); PlayerTimer timer = InventoryManager.itemCooldown[user.Player];
int timeToNextUse = (int)(timer.startTime - DateTime.Now).TotalSeconds;
uItem.GetUser().Player.TriggerEvent("Error", $"Versuche es nach {timeToNextUse} Sekunden erneut.");
return false; return false;
} }
PlayerTimer playerTimer = new PlayerTimer(user.Player, this, Cooldown);
playerTimer.Elapsed += _CooldownElapse;
InventoryManager.itemCooldown.Add(user.Player, playerTimer);
Consume(uItem); Consume(uItem);
return true; return true;
} }
private void _CooldownElapse(Player player, dynamic usableItem)
{
NAPI.Task.Run(() =>
{
if (player == null || !player.IsLoggedIn())
return;
if (!InventoryManager.itemCooldown.ContainsKey(player))
return;
InventoryManager.itemCooldown[player].Stop();
InventoryManager.itemCooldown.Remove(player);
});
}
} }
} }

View File

@@ -8,7 +8,6 @@ namespace ReallifeGamemode.Server.Inventory.Items
{ {
public abstract class DropItem : IDroppableItem public abstract class DropItem : IDroppableItem
{ {
public abstract int HpAmount { get; }
public abstract int Id { get; } public abstract int Id { get; }
public abstract string Name { get; } public abstract string Name { get; }
public abstract string Description { get; } public abstract string Description { get; }

View File

@@ -0,0 +1,39 @@
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
{
internal class Döner : ConsumableItem
{
public override int Id => 106;
public override string Name => "Döner";
public override string Description => "Von Emre selbst gemacht.";
public override int Gewicht => 500;
public override string Einheit => "g";
public override int HpAmount => 80;
public override uint Object => 2240524752;
public override int Price => 50000;
public override float Cooldown => 15000;
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 ein ~y~" + Name + " ~s~gegessen.", false);
InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1);
}
}
}

View File

@@ -13,7 +13,6 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override string Description => "Ein Fisch"; public override string Description => "Ein Fisch";
public override int Gewicht => 7700; public override int Gewicht => 7700;
public override string Einheit => "g"; public override string Einheit => "g";
public override int HpAmount => 20;
public override uint Object => 786272259; public override uint Object => 786272259;
public override int Price => 0; public override int Price => 0;
} }

View File

@@ -8,14 +8,18 @@
namespace ReallifeGamemode.Server.Inventory.Items namespace ReallifeGamemode.Server.Inventory.Items
{ {
public class Holz : IDroppableItem public class Holz : DropItem
{ {
public int Id => 32; public override int Id => 20;
public string Name => "Holz";
public string Description => "Ich und mein Holz."; public override string Name => "Holz";
public int Gewicht => 650;
public string Einheit => "g"; public override string Description => "Ich und mein Holz.";
public uint Object => 1805779401; public override int Gewicht => 650;
public int Price => 0; public override string Einheit => "g";
public override uint Object => 1805779401;
public override int Price => 0;
} }
} }

View File

@@ -13,7 +13,6 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override string Description => "Du Lachs"; public override string Description => "Du Lachs";
public override int Gewicht => 4200; public override int Gewicht => 4200;
public override string Einheit => "g"; public override string Einheit => "g";
public override int HpAmount => 20;
public override uint Object => 786272259; public override uint Object => 786272259;
public override int Price => 0; public override int Price => 0;
} }

View File

@@ -13,7 +13,6 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override string Description => "Ein Fisch"; public override string Description => "Ein Fisch";
public override int Gewicht => 11000; public override int Gewicht => 11000;
public override string Einheit => "g"; public override string Einheit => "g";
public override int HpAmount => 20;
public override uint Object => 786272259; public override uint Object => 786272259;
public override int Price => 0; public override int Price => 0;
} }

View File

@@ -13,7 +13,6 @@ namespace ReallifeGamemode.Server.Inventory.Items
public override string Description => "Ein Fisch"; public override string Description => "Ein Fisch";
public override int Gewicht => 5000; public override int Gewicht => 5000;
public override string Einheit => "g"; public override string Einheit => "g";
public override int HpAmount => 20;
public override uint Object => 786272259; public override uint Object => 786272259;
public override int Price => 0; public override int Price => 0;
} }

View File

@@ -582,7 +582,7 @@ namespace ReallifeGamemode.Server.Job
player.SendChatMessage("~y~[JOB] ~w~Bist du nicht in 30 Sekunden zurück, ~r~wird der Job beendet!"); player.SendChatMessage("~y~[JOB] ~w~Bist du nicht in 30 Sekunden zurück, ~r~wird der Job beendet!");
} }
private void JobTimerElapsed(Player player, Vehicle vehicle) private void JobTimerElapsed(Player player, dynamic vehicle)
{ {
NAPI.Task.Run(() => NAPI.Task.Run(() =>
{ {

View File

@@ -292,7 +292,6 @@ namespace ReallifeGamemode.Server.Job
_CHANGING_VEHICLE.Remove(player); _CHANGING_VEHICLE.Remove(player);
return; return;
} }
if (JobManager.playerTimersJobVehicleRespawn.ContainsKey(player)) if (JobManager.playerTimersJobVehicleRespawn.ContainsKey(player))
{ {
@@ -310,7 +309,7 @@ namespace ReallifeGamemode.Server.Job
player.SendChatMessage("~y~[JOB] ~w~Bist du nicht in 30 Sekunden zurück, ~r~wird der Job beendet!"); player.SendChatMessage("~y~[JOB] ~w~Bist du nicht in 30 Sekunden zurück, ~r~wird der Job beendet!");
} }
private void JobTimerElapsed(Player player, Vehicle vehicle) private void JobTimerElapsed(Player player, dynamic vehicle)
{ {
NAPI.Task.Run(() => NAPI.Task.Run(() =>
{ {

View File

@@ -180,7 +180,7 @@ namespace ReallifeGamemode.Server.Job
public void MuellmannJobBeenden(Player player) public void MuellmannJobBeenden(Player player)
{ {
if(player == null || !player.IsLoggedIn()) if (player == null || !player.IsLoggedIn())
{ {
return; return;
} }
@@ -440,7 +440,7 @@ namespace ReallifeGamemode.Server.Job
JobManager.playerTimersJobVehicleRespawn[player] = playerTimer; JobManager.playerTimersJobVehicleRespawn[player] = playerTimer;
} }
private void JobTimerElapsed(Player player, Vehicle vehicle) private void JobTimerElapsed(Player player, dynamic vehicle)
{ {
NAPI.Task.Run(() => NAPI.Task.Run(() =>
{ {

View File

@@ -15,7 +15,7 @@ namespace ReallifeGamemode.Server.Util
private readonly Timer timer; private readonly Timer timer;
public readonly DateTime startTime; public readonly DateTime startTime;
public delegate void PlayerTimerElapsed(Player player, Vehicle veh); public delegate void PlayerTimerElapsed(Player player, dynamic dynamic);
public event PlayerTimerElapsed Elapsed; public event PlayerTimerElapsed Elapsed;
@@ -29,11 +29,11 @@ namespace ReallifeGamemode.Server.Util
this.timer.Start(); this.timer.Start();
} }
public PlayerTimer(Player player, IUsableItem usableItem, int milliseconds = 1000) public PlayerTimer(Player player, IUsableItem usableItem, float milliseconds = 1000)
{ {
this.player = player; this.player = player;
this.usableItem = usableItem; this.usableItem = usableItem;
this.startTime = DateTime.Now; this.startTime = DateTime.Now.AddMilliseconds(milliseconds);
this.timer = new Timer(milliseconds); this.timer = new Timer(milliseconds);
this.timer.Elapsed += Timer_Elapsed; this.timer.Elapsed += Timer_Elapsed;
@@ -42,7 +42,10 @@ namespace ReallifeGamemode.Server.Util
private void Timer_Elapsed(object sender, ElapsedEventArgs e) private void Timer_Elapsed(object sender, ElapsedEventArgs e)
{ {
Elapsed?.Invoke(player, veh); if (veh != null)
Elapsed?.Invoke(player, veh);
else
Elapsed?.Invoke(player, usableItem);
} }
public void Stop() public void Stop()