add friseur

This commit is contained in:
michael.reiswich
2021-01-25 14:17:57 +01:00
parent fe1916c60a
commit b8815f79e9
14 changed files with 608 additions and 4 deletions

View File

@@ -234,7 +234,6 @@ namespace ReallifeGamemode.Server.Events
player.RemoveAllWeapons();
Medic.delReviveTasks(player);
NAPI.Player.SpawnPlayer(player, new Vector3(-495.45, -336.33, 34.5), -98.36f);
}
}
}

View File

@@ -203,6 +203,7 @@ namespace ReallifeGamemode.Server.Events
JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData<bool>("duty"));
ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3));
ClotheshopPoint nearestClotheShopPoint = PositionManager.clotheshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData<bool>("duty")));
FriseurPoint nearestFriseurPoint = PositionManager.friseurPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData<bool>("duty")));
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);
@@ -528,6 +529,10 @@ namespace ReallifeGamemode.Server.Events
{
nearestItemShopPoint.itemShop.LoadShopNUI(player);
}
if (nearestFriseurPoint != null)
{
nearestFriseurPoint.friseurShop.LoadShopNUI(player);
}
if (user.FactionLeader)
{
player.TriggerEvent("CLIENT:StartGangwar");

View File

@@ -285,5 +285,49 @@ namespace ReallifeGamemode.Server.Events
client.TriggerEvent("clothesMenu:updateLast", data[2], data[1], data[4], data[5], data[3]);
}
}
[RemoteEvent("SERVER:BuyHairColor")]
public void BuyHairColor(Player client, byte HairColor)
{
User user = client.GetUser();
if (user.Handmoney < 100)
{
client.SendNotification("~r~[FEHLER]~s~ Du hast nicht genug Geld auf der Hand($100)!", true);
return;
}
using (var dbContext = new DatabaseContext())
{
User payer = client.GetUser(dbContext);
payer.GetCharacter(dbContext);
payer.Handmoney -= 100;
payer.Character.HairColor = HairColor;
// client.TriggerEvent("SERVER:SET_HANDMONEY", payer.Handmoney);
dbContext.SaveChanges();
}
}
[RemoteEvent("SERVER:BuyHairlightColor")]
public void BuyHairlightColor(Player client, byte HairlightColor)
{
User user = client.GetUser();
if (user.Handmoney < 50)
{
client.SendNotification("~r~[FEHLER]~s~ Du hast nicht genug Geld auf der Hand($50)!", true);
return;
}
using (var dbContext = new DatabaseContext())
{
User payer = client.GetUser(dbContext);
payer.GetCharacter(dbContext);
payer.Handmoney -= 50;
payer.Character.HairHighlightColor = HairlightColor;
// client.TriggerEvent("SERVER:SET_HANDMONEY", payer.Handmoney);
dbContext.SaveChanges();
}
}
}
}

View File

@@ -65,11 +65,101 @@ namespace ReallifeGamemode.Server.Events
}
else if (sV is JobVehicle jV)
{
if (!jV.GetJob().GetUsersInJob().Contains(player) && !u.IsAdmin(AdminLevel.ADMIN3))
if (jV.JobId != player.GetUser().JobId && !state && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()))
{
player.SendNotification("~r~Du hast keinen Schlüssel.");
return;
}
else
{
if (!jV.GetJob().GetUsersInJob().Contains(player) && !player.IsAdminDuty())
{
player.SendNotification("~y~[JOB] ~w~Du musst den Job vorher starten!");
return;
}
else
{
/*if(player.IsAdminDuty())
{
player.SendChatMessage("");
}*/
if (jV.JobId == 3 && player.GetUser().JobId == 3 && jV.GetJob().GetUsersInJob().Contains(player))
{
Job.PilotJob c = new Job.PilotJob();
if ((VehicleHash)jV.Model == VehicleHash.Cuban800 && !state)
{
if (!player.HasData("HatRoute") || player.GetData<bool>("HatRoute") == false)
{
player.SetData("HatRoute", true);
c.StartPilotRoute(player, "RouteStart");
}
}
if ((VehicleHash)jV.Model == VehicleHash.Velum && !state || (VehicleHash)jV.Model == VehicleHash.Velum2 && !state)
{
if (player.GetUser().PilotSkill >= 300)
{
if (!player.HasData("HatRoute") || player.GetData<bool>("HatRoute") == false)
{
player.SetData("HatRoute", true);
c.StartPilotRoute(player, "RouteStart");
}
}
else
{
player.SendNotification("~y~[JOB] ~r~Du besitzt nicht das nötige Skilllevel(2) ");
return;
}
}
}
if (jV.JobId == 4 && player.GetUser().JobId == 4 && jV.GetJob().GetUsersInJob().Contains(player))
{
Job.BusDriverJob c = new Job.BusDriverJob();
if ((VehicleHash)jV.Model == VehicleHash.Bus && !state)
{
if (!player.HasData("HatRoute") || player.GetData<bool>("HatRoute") == false)
{
player.SetData("HatRoute", true);
c.StartBusRoute(player, "RouteStart");
player.TriggerEvent("CLIENT:PlaySound", "jobs/busfahrer/StartJob", "wav", 45);
}
}
if ((VehicleHash)jV.Model == VehicleHash.Coach && !state)
{
if (player.GetUser().BusSkill >= 300)
{
if (!player.HasData("HatRoute") || player.GetData<bool>("HatRoute") == false)
{
player.SetData("HatRoute", true);
c.StartBusRoute(player, "RouteStart");
player.TriggerEvent("CLIENT:PlaySound", "jobs/busfahrer/StartJob", "wav", 45);
}
}
else
{
player.SendNotification("~y~[JOB] ~r~Du besitzt nicht das nötige Skilllevel(2) ");
return;
}
}
if ((VehicleHash)jV.Model == VehicleHash.Tourbus && !state)
{
if (player.GetUser().BusSkill >= 800)
{
if (!player.HasData("HatRoute") || player.GetData<bool>("HatRoute") == false)
{
player.SetData("HatRoute", true);
c.StartBusRoute(player, "RouteStart");
player.TriggerEvent("CLIENT:PlaySound", "jobs/busfahrer/StartJob", "wav", 45);
}
}
else
{
player.SendNotification("~y~[JOB] ~r~Du besitzt nicht das nötige Skilllevel(3) ");
return;
}
}
}
}
}
}
else if (sV is UserVehicle uV)
{

View File

@@ -136,6 +136,6 @@ namespace ReallifeGamemode.Server.Factions.Medic
MedicTask task = ReviveTasks.FirstOrDefault(t => t.Victim == player.Name);
RemoveTaskFromList(task);
}
}
}

View File

@@ -111,6 +111,7 @@ namespace ReallifeGamemode.Server
InventoryManager.LoadItems();
ShopManager.LoadClotheShops();
ShopManager.LoadItemShops();
ShopManager.LoadFriseur();
TuningManager.LoadTuningGarages();
TimeManager.StartTimeManager();

View File

@@ -3,6 +3,7 @@ using System.Linq;
using GTANetworkAPI;
using ReallifeGamemode.Server.Shop.Clothing;
using ReallifeGamemode.Server.Shop.SevenEleven;
using ReallifeGamemode.Server.Shop.Friseur;
namespace ReallifeGamemode.Server.Managers
{
@@ -17,6 +18,8 @@ namespace ReallifeGamemode.Server.Managers
public static List<ElevatorPoint> ElevatorPoints = new List<ElevatorPoint>();
public static List<ClotheshopPoint> clotheshopPoints = new List<ClotheshopPoint>();
public static List<FriseurPoint> friseurPoints = new List<FriseurPoint>();
public static List<ItemshopPoint> itemshopPoints = new List<ItemshopPoint>();
@@ -233,6 +236,24 @@ namespace ReallifeGamemode.Server.Managers
NAPI.TextLabel.CreateTextLabel("Kleiderladen - Dr\u00fccke ~y~E", s.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
}
foreach (var shop in ShopManager.FriseurStores)
{
shop.LoadClothes();
FriseurPoint shopPoint = new FriseurPoint()
{
Position = shop.vector,
friseurShop = shop
};
friseurPoints.Add(shopPoint);
}
foreach (FriseurPoint s in friseurPoints)
{
NAPI.Marker.CreateMarker(1, new Vector3(s.Position.X, s.Position.Y, s.Position.Z - 2), new Vector3(s.Position.X, s.Position.Y, s.Position.Z + 1),
new Vector3(0, 0, 0), 2, new Color(255, 255, 255, 50), false, 0);
NAPI.TextLabel.CreateTextLabel("Friseur - Dr\u00fccke ~y~E", s.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
}
foreach (var shop in ShopManager.itemShops)
{
shop.LoadItems();
@@ -358,6 +379,12 @@ public class ItemshopPoint
public ItemShop itemShop { get; set; }
}
public class FriseurPoint
{
public Vector3 Position { get; set; }
public Friseur friseurShop { get; set; }
}
public class JobPoint
{
public Vector3 Position { get; set; }

View File

@@ -5,6 +5,7 @@ using ReallifeGamemode.Database.Entities.Saves;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Shop.Clothing;
using ReallifeGamemode.Server.Shop.SevenEleven;
using ReallifeGamemode.Server.Shop.Friseur;
namespace ReallifeGamemode.Server.Managers
{
@@ -12,6 +13,7 @@ namespace ReallifeGamemode.Server.Managers
{
public static List<ClotheShop> clotheStores = new List<ClotheShop>();
public static List<ItemShop> itemShops = new List<ItemShop>();
public static List<Friseur> FriseurStores = new List<Friseur>();
public static void LoadClotheShops()
{
@@ -61,5 +63,23 @@ namespace ReallifeGamemode.Server.Managers
NAPI.Util.ConsoleOutput($"Loaded {itemShops.Count}x 24/7");
}
}
public static void LoadFriseur()
{
using (var dbContext = new DatabaseContext())
{
List<SavedBlip> friseur = dbContext.Blips.ToList().FindAll(s => s.Name == "Friseur");
foreach (var store in friseur)
{
Vector3 pos = new Vector3(store.PositionX, store.PositionY, store.PositionZ);
Friseur newShop = new Friseur(10, pos);
FriseurStores.Add(newShop);
NAPI.Util.ConsoleOutput($"Loading Friseur {store.Name}");
}
}
}
}
}

View File

@@ -44,13 +44,15 @@ namespace ReallifeGamemode.Server.Shop.Clothing
List<ShopClothe> legs = clotheList.ToList().FindAll(c => c.Gender == gender && c.ComponentId == 4);
List<ShopClothe> shoes = clotheList.ToList().FindAll(c => c.Gender == gender && c.ComponentId == 6);
List<ShopClothe> accessoires = clotheList.ToList().FindAll(c => c.Gender == gender && c.ComponentId == 7);
List<ShopClothe> frisur = clotheList.ToList().FindAll(c => c.Gender == gender && c.ComponentId == 2);
List<Array> clothes = new List<Array>
{
tops.ToArray(),
legs.ToArray(),
shoes.ToArray(),
accessoires.ToArray()
accessoires.ToArray(),
frisur.ToArray()
};
client.TriggerEvent("clothesMenu:updateData", JsonConvert.SerializeObject(category), JsonConvert.SerializeObject(clothes.ToArray()), gender);

View File

@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using GTANetworkAPI;
using Newtonsoft.Json;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
namespace ReallifeGamemode.Server.Shop.Friseur
{
public class Friseur
{
public int category { get; set; }
public Vector3 vector { get; set; }
public List<ShopClothe> frisurList = new List<ShopClothe>();
public Friseur(int category, Vector3 vector)
{
this.category = category;
this.vector = vector;
LoadClothes();
}
public void LoadClothes()
{
using (var dbContext = new DatabaseContext())
{
frisurList = dbContext.ShopClothes.ToList().FindAll(c => c.Category == category);
}
}
public void LoadShopNUI(Player client)
{
User u = client.GetUser();
if (u == null)
{
return;
}
bool gender = u.GetCharacter().Gender;
List<ShopClothe> frisur = frisurList.ToList().FindAll(c => c.Gender == gender && c.ComponentId == 2);
List<Array> frisuren = new List<Array>
{
frisur.ToArray()
};
client.TriggerEvent("FriseurMenu:updateData", JsonConvert.SerializeObject(category), JsonConvert.SerializeObject(frisuren.ToArray()), gender);
}
}
}