Add Radial Menu to Inventory / Item Interaction

This commit is contained in:
VegaZ
2018-12-18 22:15:17 +01:00
parent e9dbfabad0
commit a4845a9cc5
4 changed files with 213 additions and 39 deletions

View File

@@ -1046,8 +1046,28 @@ namespace reallife_gamemode.Server.Commands
return;
}
UserItem item = new UserItem() { ItemId = itemId, UserId = target.GetUser().Id, Amount = amount };
InventoryManager.AddItemToInventory(target, item);
var invWeight = 0;
using (var context = new DatabaseContext())
{
List<UserItem> userItems = context.UserItems.ToList().FindAll(i => i.UserId == target.GetUser().Id);
foreach(var uItem in userItems)
{
invWeight += uItem.Amount * InventoryManager.GetItemById(itemId).Gewicht;
}
}
invWeight += amount * InventoryManager.GetItemById(itemId).Gewicht;
if (invWeight > 40000)
{
player.SendChatMessage("~y~" + targetname + " ~s~hat nicht mehr genug Platz in seinem Inventar.");
}
else
{
UserItem item = new UserItem() { ItemId = itemId, UserId = target.GetUser().Id, Amount = amount };
InventoryManager.AddItemToInventory(target, item);
}
}
[Command("inventory", "~m~Benutzung: ~s~/inventory [Spieler]")]

View File

@@ -220,5 +220,16 @@ namespace reallife_gamemode.Server.Managers
context.SaveChanges();
}
}
[RemoteEvent("itemInteract")]
public void ItemInteract(Client player, string type, string itemId, int amount)
{
switch (type)
{
case "use":
break;
case "drop":
break;
}
}
}
}