diff --git a/ReallifeGamemode.Client/Interaction/ammunation/ammunation.ts b/ReallifeGamemode.Client/Interaction/ammunation/ammunation.ts new file mode 100644 index 00000000..5f282702 --- /dev/null +++ b/ReallifeGamemode.Client/Interaction/ammunation/ammunation.ts @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index 92737c1e..8f489190 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -235,6 +235,7 @@ namespace ReallifeGamemode.Server.Events ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5); JobPoint nearestJobPoint = PositionManager.JobPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6); Player nearestCuffPlayer = PositionManager.cuffPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6 && user.GetData("duty")); + AmmunationPoint nearestAmmunationPoint = PositionManager.AmmunationPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5); if (user?.FactionId != null) { @@ -516,6 +517,10 @@ namespace ReallifeGamemode.Server.Events { nearestFriseurPoint.friseurShop.LoadShopNUI(player); } + if (nearestAmmunationPoint != null) + { + nearestAmmunationPoint.Ammunation.LoadShopNUI(player); + } if (user.FactionLeader) { player.TriggerEvent("CLIENT:StartGangwar"); diff --git a/ReallifeGamemode.Server/Shop/Ammunation/Ammunation.cs b/ReallifeGamemode.Server/Shop/Ammunation/Ammunation.cs index db46ed4e..5e3dde48 100644 --- a/ReallifeGamemode.Server/Shop/Ammunation/Ammunation.cs +++ b/ReallifeGamemode.Server/Shop/Ammunation/Ammunation.cs @@ -3,8 +3,10 @@ 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 { @@ -26,6 +28,30 @@ namespace ReallifeGamemode.Server.Shop.Ammunation 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 == "Pistol"); + List handguns = weaponList.ToList().FindAll(w => w.Category == "Handgun"); + //List smgs = weaponList.ToList().FindAll(w => w.Category == "SMG"); + //List shotguns = weaponList.ToList().FindAll(w => w.Category == "Shotgun"); + //List assaultrifles = weaponList.ToList().FindAll(w => w.Category == "AssaultRifle"); + //List lmgs = weaponList.ToList().FindAll(w => w.Category == "LMG"); + //List sniperrifles = weaponList.ToList().FindAll(w => w.Category == "SniperRifle"); + //List heavyweapons = weaponList.ToList().FindAll(w => w.Category == "HeavyWeapon"); + //List throwables = weaponList.ToList().FindAll(w => w.Category == "Throwables"); + + List shopWeapons = new List + { + handguns.ToArray(), + }; + client.TriggerEvent("AmmunationShop:LoadNativeUI", JsonConvert.SerializeObject(shopWeapons)); + } } }