Add ItemShop, fix ClotheShop Payment, fix Vehicle Respawn, Add Vehicle Lock from outside
This commit is contained in:
44
ReallifeGamemode.Server/Shop/SevenEleven/ItemShop.cs
Normal file
44
ReallifeGamemode.Server/Shop/SevenEleven/ItemShop.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Inventory.Interfaces;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
|
||||
namespace ReallifeGamemode.Server.Shop.SevenEleven
|
||||
{
|
||||
public class ItemShop
|
||||
{
|
||||
public Vector3 vector3;
|
||||
public int id;
|
||||
public List<ShopItem> shopItems = new List<ShopItem>();
|
||||
|
||||
public ItemShop(Vector3 vector3, int id)
|
||||
{
|
||||
this.vector3 = vector3;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void LoadItems()
|
||||
{
|
||||
using(var dbContext = new DatabaseContext())
|
||||
{
|
||||
shopItems = dbContext.ShopItems.ToList().FindAll(i => i.ShopId == id);
|
||||
}
|
||||
}
|
||||
public void LoadShopNUI(Client client)
|
||||
{
|
||||
List<ShopItem> itemList = shopItems.ToList().FindAll(s => s.Amount > 0);
|
||||
List<IItem> items = new List<IItem>();
|
||||
foreach(var item in itemList)
|
||||
{
|
||||
items.Add(InventoryManager.GetItemById(item.ItemId));
|
||||
}
|
||||
client.TriggerEvent("itemMenu:updateData", JsonConvert.SerializeObject(items.ToArray()));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user