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; namespace ReallifeGamemode.Server.Shop.Ammunation { public class Ammunation { public Vector3 vector { get; set; } public List weaponList = new List(); public Ammunation(Vector3 position) { this.vector = vector; LoadWeapons(); } public void LoadWeapons() { using (var dbContext = new DatabaseContext()) { weaponList = dbContext.Weapons.ToList(); } } public void LoadShopNUI(Player client) { User u = client.GetUser(); if (u == null) { return; } //List melee = weaponList.ToList().FindAll(w => w.Category == "Nahkampfwaffen"); //1 List handguns = weaponList.ToList().FindAll(w => w.CategoryId == 2); //2 //List smgs = weaponList.ToList().FindAll(w => w.Category == "Maschinenpistolen"); //3 //List shotguns = weaponList.ToList().FindAll(w => w.Category == "Schrotflinten"); //4 //List assaultrifles = weaponList.ToList().FindAll(w => w.Category == "Sturmgewehre"); //5 //List lmgs = weaponList.ToList().FindAll(w => w.Category == "Leichte Maschinengewehre"); //6 //List sniperrifles = weaponList.ToList().FindAll(w => w.Category == "Scharfschützengewehre"); //7 //List heavyweapons = weaponList.ToList().FindAll(w => w.Category == "Schwere Waffen"); //8 //List throwables = weaponList.ToList().FindAll(w => w.Category == "Werfbare Waffen"); //9 List shopWeapons = new List { handguns.ToArray(), }; client.TriggerEvent("AmmunationShop:LoadNativeUI", JsonConvert.SerializeObject(shopWeapons)); } } }