41 lines
1.0 KiB
C#
41 lines
1.0 KiB
C#
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.Extensions;
|
|
using ReallifeGamemode.Server.Managers;
|
|
using ReallifeGamemode.Server.Services;
|
|
|
|
namespace ReallifeGamemode.Server.Shop.Ammunation
|
|
{
|
|
public class Ammunation
|
|
{
|
|
public Vector3 vector { get; set; }
|
|
public List<Weapon> weaponList = new List<Weapon>();
|
|
|
|
public Ammunation(Vector3 position)
|
|
{
|
|
this.vector = position;
|
|
LoadWeapons();
|
|
}
|
|
|
|
public void LoadWeapons()
|
|
{
|
|
using (var dbContext = new DatabaseContext())
|
|
{
|
|
weaponList = dbContext.Weapons.ToList().FindAll(w => w.AmmunationActive == true);
|
|
}
|
|
}
|
|
public void LoadShopNUI(Player client)
|
|
{
|
|
|
|
List<Weapon> shopWeapons = weaponList.ToList();
|
|
client.TriggerEvent("AmmunationShop:LoadNativeUI", JsonConvert.SerializeObject(shopWeapons));
|
|
}
|
|
}
|
|
}
|