Almost finish ClothSystem (Save/Load)
This commit is contained in:
@@ -19,12 +19,23 @@ var tops;
|
|||||||
var legs;
|
var legs;
|
||||||
var shoes;
|
var shoes;
|
||||||
|
|
||||||
|
var hat = -1;
|
||||||
|
var top;
|
||||||
|
var leg;
|
||||||
|
var shoe;
|
||||||
|
|
||||||
let screenRes = mp.game.graphics.getScreenResolution(0, 0);
|
let screenRes = mp.game.graphics.getScreenResolution(0, 0);
|
||||||
|
|
||||||
var dutyMenu;
|
var dutyMenu;
|
||||||
let saveItem = new UIMenuItem("Speichern", "Speichert deine Dienstkleidung");
|
let saveItem = new UIMenuItem("Speichern", "Speichert deine Dienstkleidung");
|
||||||
saveItem.BackColor = new Color(13, 71, 161);
|
saveItem.BackColor = new Color(13, 71, 161);
|
||||||
saveItem.HighlightedBackColor = new Color(25, 118, 210);
|
saveItem.HighlightedBackColor = new Color(25, 118, 210);
|
||||||
|
|
||||||
|
let cancelItem = new UIMenuItem("Abbrechen", "");
|
||||||
|
cancelItem.BackColor = new Color(213, 0, 0);
|
||||||
|
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
|
||||||
|
|
||||||
|
|
||||||
//Cloth Menu
|
//Cloth Menu
|
||||||
|
|
||||||
mp.events.add('showDutyClothMenu', (hatsArr, topsArr, legsArr, shoesArr) => {
|
mp.events.add('showDutyClothMenu', (hatsArr, topsArr, legsArr, shoesArr) => {
|
||||||
@@ -42,49 +53,49 @@ mp.events.add('showDutyClothMenu', (hatsArr, topsArr, legsArr, shoesArr) => {
|
|||||||
dutyMenu.AddItem(new UIMenuListItem("Hose", "", new ItemsCollection(legs)));
|
dutyMenu.AddItem(new UIMenuListItem("Hose", "", new ItemsCollection(legs)));
|
||||||
dutyMenu.AddItem(new UIMenuListItem("Schuhe", "", new ItemsCollection(shoes)));
|
dutyMenu.AddItem(new UIMenuListItem("Schuhe", "", new ItemsCollection(shoes)));
|
||||||
dutyMenu.AddItem(saveItem);
|
dutyMenu.AddItem(saveItem);
|
||||||
|
dutyMenu.AddItem(cancelItem);
|
||||||
dutyMenu.Visible = true;
|
dutyMenu.Visible = true;
|
||||||
|
|
||||||
dutyMenu.ListChange.on((item, index) => {
|
dutyMenu.ListChange.on((item, index) => {
|
||||||
switch (item.Text) {
|
switch (item.Text) {
|
||||||
case "Hut":
|
case "Hut":
|
||||||
if (item.SelectedItem.DisplayText === "Keinen") {
|
if (item.SelectedItem.DisplayText === "Keinen") {
|
||||||
|
hat = -1;
|
||||||
mp.events.callRemote("updateDutyProp", 0, -1);
|
mp.events.callRemote("updateDutyProp", 0, -1);
|
||||||
} else {
|
} else {
|
||||||
mp.events.callRemote("updateDutyProp", 0, parseInt(item.SelectedItem.DisplayText));
|
hat = parseInt(item.SelectedItem.DisplayText);
|
||||||
|
mp.events.callRemote("updateDutyProp", 0, hat);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "Top":
|
case "Top":
|
||||||
mp.events.callRemote("updateDutyCloth", 11, parseInt(item.SelectedItem.DisplayText));
|
top = parseInt(item.SelectedItem.DisplayText);
|
||||||
|
mp.events.callRemote("updateDutyCloth", 11, top);
|
||||||
break;
|
break;
|
||||||
case "Hose":
|
case "Hose":
|
||||||
mp.events.callRemote("updateDutyCloth", 4, parseInt(item.SelectedItem.DisplayText));
|
leg = parseInt(item.SelectedItem.DisplayText);
|
||||||
|
mp.events.callRemote("updateDutyCloth", 4, leg);
|
||||||
break;
|
break;
|
||||||
case "Schuhe":
|
case "Schuhe":
|
||||||
mp.events.callRemote("updateDutyCloth", 6, parseInt(item.SelectedItem.DisplayText));
|
shoe = parseInt(item.SelectedItem.DisplayText);
|
||||||
|
mp.events.callRemote("updateDutyCloth", 6, shoe);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//dutyMenu.ListChange.on((item, index) => {
|
dutyMenu.ItemSelect.on((item) => {
|
||||||
// switch (item) {
|
if (item.Text === "Speichern") {
|
||||||
// case "Hut":
|
var slotType = [1, 0, 0, 0];
|
||||||
// mp.events.callRemote("updateDutyProp", 0, parseInt(index));
|
var slotId = [0, 11, 4, 6];
|
||||||
// break;
|
var clothId = [hat, top, leg, shoe];
|
||||||
// case "Top":
|
mp.events.callRemote("saveCharacterCloth", JSON.stringify(slotType), JSON.stringify(slotId), JSON.stringify(clothId));
|
||||||
// mp.events.callRemote("updateDutyCloth", 11, parseInt(index));
|
dutyMenu.Visible = false;
|
||||||
// break;
|
mp.gui.chat.activate(true);
|
||||||
// case "Hose":
|
} else if (item.Text === "Abbrechen") {
|
||||||
// mp.events.callRemote("updateDutyCloth", 4, parseInt(index));
|
dutyMenu.Visible = false;
|
||||||
// break;
|
mp.gui.chat.activate(true);
|
||||||
// case "Schuhe":
|
mp.events.callRemote("defaultCharacterCloth");
|
||||||
// mp.events.callRemote("updateDutyCloth", 6, parseInt(index));
|
}
|
||||||
// break;
|
});
|
||||||
// }
|
|
||||||
//});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//dutyMenu.ItemSelect.on((item) => {
|
|
||||||
// switch
|
|
||||||
//});
|
|
||||||
@@ -34,7 +34,6 @@ namespace reallife_gamemode.Model
|
|||||||
public DbSet<Server.Entities.Ban> Bans { get; set; }
|
public DbSet<Server.Entities.Ban> Bans { get; set; }
|
||||||
public DbSet<Server.Entities.Character> Characters { get; set; }
|
public DbSet<Server.Entities.Character> Characters { get; set; }
|
||||||
public DbSet<Server.Entities.CharacterCloth> CharacterClothes { get; set; }
|
public DbSet<Server.Entities.CharacterCloth> CharacterClothes { get; set; }
|
||||||
public DbSet<Server.Entities.CharacterProp> CharacterProps { get; set; }
|
|
||||||
public DbSet<Server.Entities.DutyCloth> DutyClothes { get; set; }
|
public DbSet<Server.Entities.DutyCloth> DutyClothes { get; set; }
|
||||||
public DbSet<Server.Entities.DutyProp> DutyProps { get; set; }
|
public DbSet<Server.Entities.DutyProp> DutyProps { get; set; }
|
||||||
public DbSet<Server.Entities.MaleCombination> MaleCombinations { get; set; }
|
public DbSet<Server.Entities.MaleCombination> MaleCombinations { get; set; }
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ namespace reallife_gamemode.Server.Entities
|
|||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
public User User { get; set; }
|
public User User { get; set; }
|
||||||
|
|
||||||
public int ComponentId { get; set; }
|
public bool Duty { get; set; }
|
||||||
public int? Drawable { get; set; }
|
|
||||||
|
public byte SlotType { get; set; }
|
||||||
|
public int SlotId { get; set; }
|
||||||
|
public int ClothId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @overview Life of German Reallife - Entities CharacterProp CharacterProp.cs
|
|
||||||
* @author VegaZ
|
|
||||||
* @copyright (c) 2008 - 2018 Life of German
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace reallife_gamemode.Server.Entities
|
|
||||||
{
|
|
||||||
public class CharacterProp
|
|
||||||
{
|
|
||||||
[Key]
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
[ForeignKey("User")]
|
|
||||||
public int UserId { get; set; }
|
|
||||||
public User User { get; set; }
|
|
||||||
|
|
||||||
public int PropId { get; set; }
|
|
||||||
public int? Drawable { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using reallife_gamemode.Model;
|
||||||
|
using reallife_gamemode.Server.Entities;
|
||||||
using reallife_gamemode.Server.Extensions;
|
using reallife_gamemode.Server.Extensions;
|
||||||
using reallife_gamemode.Server.Managers;
|
using reallife_gamemode.Server.Managers;
|
||||||
using reallife_gamemode.Server.Saves;
|
using reallife_gamemode.Server.Saves;
|
||||||
@@ -58,6 +61,30 @@ namespace reallife_gamemode.Server.Events
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
player.NametagColor = nameTagColor;
|
player.NametagColor = nameTagColor;
|
||||||
|
using (var context = new DatabaseContext())
|
||||||
|
{
|
||||||
|
List<CharacterCloth> clothes = context.CharacterClothes.ToList().FindAll(u => u.UserId == user.Id);
|
||||||
|
|
||||||
|
foreach(var cloth in clothes)
|
||||||
|
{
|
||||||
|
if(cloth.SlotType == 0)
|
||||||
|
{
|
||||||
|
player.SetClothes(cloth.SlotId, cloth.ClothId, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(cloth.ClothId != -1)
|
||||||
|
{
|
||||||
|
player.SetAccessories(cloth.SlotId, cloth.ClothId, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.ClearAccessory(cloth.SlotId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -65,6 +92,11 @@ namespace reallife_gamemode.Server.Events
|
|||||||
player.SendNotification("Du bist nun ~r~außer Dienst.");
|
player.SendNotification("Du bist nun ~r~außer Dienst.");
|
||||||
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", false);
|
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", false);
|
||||||
player.NametagColor = new Color(255, 255, 255);
|
player.NametagColor = new Color(255, 255, 255);
|
||||||
|
|
||||||
|
player.ClearAccessory(0);
|
||||||
|
//Gespeicherte Props laden lassen
|
||||||
|
player.SetDefaultClothes();
|
||||||
|
//Gespeicherte Klamotten laden lassen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,6 +133,7 @@ namespace reallife_gamemode.Server.Events
|
|||||||
string[] legs;
|
string[] legs;
|
||||||
string[] shoes;
|
string[] shoes;
|
||||||
|
|
||||||
|
//TODO in Datenbank auslagern
|
||||||
if(user.GetCharacter().Gender == false) //Wenn männlich
|
if(user.GetCharacter().Gender == false) //Wenn männlich
|
||||||
{
|
{
|
||||||
hats = new string[] { "Keinen", "5", "12", "39", "46", "123", "124", "125"};
|
hats = new string[] { "Keinen", "5", "12", "39", "46", "123", "124", "125"};
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ namespace reallife_gamemode.Server.Events
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
CharacterCreator.ApplyCharacter(player);
|
CharacterCreator.ApplyCharacter(player);
|
||||||
|
UpdateCharacterCloth.LoadCharacterDefaults(player);
|
||||||
NAPI.Player.SpawnPlayer(player, new Vector3(user.PositionX, user.PositionY, user.PositionZ), 0);
|
NAPI.Player.SpawnPlayer(player, new Vector3(user.PositionX, user.PositionY, user.PositionZ), 0);
|
||||||
player.TriggerEvent("draw", player.Name, player.Handle.Value);
|
player.TriggerEvent("draw", player.Name, player.Handle.Value);
|
||||||
}
|
}
|
||||||
|
|||||||
199
Server/Events/UpdateCharacterCloth.cs
Normal file
199
Server/Events/UpdateCharacterCloth.cs
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using reallife_gamemode.Model;
|
||||||
|
using reallife_gamemode.Server.Entities;
|
||||||
|
using reallife_gamemode.Server.Extensions;
|
||||||
|
|
||||||
|
namespace reallife_gamemode.Server.Events
|
||||||
|
{
|
||||||
|
public class UpdateCharacterCloth : Script
|
||||||
|
{
|
||||||
|
[RemoteEvent("updateDutyProp")]
|
||||||
|
public void UpdateDutyProp(Client player, int componentId, int componentVariation)
|
||||||
|
{
|
||||||
|
if (componentId != -1)
|
||||||
|
{
|
||||||
|
player.SetAccessories(componentId, componentVariation, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.ClearAccessory(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("updateDutyCloth")]
|
||||||
|
public void UpdateDutyCloth(Client player, int componentId, int componentVariation)
|
||||||
|
{
|
||||||
|
if (componentId == 11)
|
||||||
|
{
|
||||||
|
//TODO Spezielle Duty Kleidung in Datenbank einpflegen (Ergibt bei Cop-Kleidung NULL)
|
||||||
|
using (var context = new DatabaseContext())
|
||||||
|
{
|
||||||
|
if (player.GetUser().GetCharacter().Gender == false)
|
||||||
|
{
|
||||||
|
var combination = context.MaleCombinations.FirstOrDefault(c => c.Top == componentVariation);
|
||||||
|
player.SetClothes(11, componentVariation, 0);
|
||||||
|
if (combination != null)
|
||||||
|
{
|
||||||
|
player.SetClothes(3, combination.Torso, 0);
|
||||||
|
player.SetClothes(8, combination.Undershirt, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var combination = context.FemaleCombinations.FirstOrDefault(c => c.Top == componentVariation);
|
||||||
|
player.SetClothes(11, componentVariation, 0);
|
||||||
|
if (combination != null)
|
||||||
|
{
|
||||||
|
player.SetClothes(3, combination.Torso, 0);
|
||||||
|
player.SetClothes(8, combination.Undershirt, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.SetClothes(componentId, componentVariation, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("saveCharacterCloth")]
|
||||||
|
public void SaveDutyCloth(Client client, string JSlotType, string JSlotId, string JClothId)
|
||||||
|
{
|
||||||
|
using (var context = new DatabaseContext())
|
||||||
|
{
|
||||||
|
int[] slotType = JsonConvert.DeserializeObject<int[]>(JSlotType);
|
||||||
|
int[] slotId = JsonConvert.DeserializeObject<int[]>(JSlotId);
|
||||||
|
int[] clothId = JsonConvert.DeserializeObject<int[]>(JClothId);
|
||||||
|
|
||||||
|
User user = client.GetUser();
|
||||||
|
user = context.Users.FirstOrDefault(u => u.Id == user.Id);
|
||||||
|
|
||||||
|
var charClothes = context.CharacterClothes.FirstOrDefault(c => c.UserId == user.Id);
|
||||||
|
if (charClothes == null)
|
||||||
|
{
|
||||||
|
for (var x = 0; x < slotType.Length; x++)
|
||||||
|
{
|
||||||
|
CharacterCloth newCloth = new CharacterCloth
|
||||||
|
{
|
||||||
|
UserId = user.Id,
|
||||||
|
|
||||||
|
Duty = true,
|
||||||
|
|
||||||
|
SlotType = (byte)slotType[x],
|
||||||
|
SlotId = slotId[x],
|
||||||
|
ClothId = clothId[x]
|
||||||
|
};
|
||||||
|
context.CharacterClothes.Add(newCloth);
|
||||||
|
}
|
||||||
|
if (user.GetCharacter().Gender == false)
|
||||||
|
{
|
||||||
|
CharacterCloth newTorso = new CharacterCloth
|
||||||
|
{
|
||||||
|
UserId = user.Id,
|
||||||
|
|
||||||
|
Duty = true,
|
||||||
|
|
||||||
|
SlotType = 0,
|
||||||
|
SlotId = 3,
|
||||||
|
ClothId = context.MaleCombinations.FirstOrDefault(c => c.Top == clothId[1]).Torso
|
||||||
|
};
|
||||||
|
CharacterCloth newUndershirt = new CharacterCloth
|
||||||
|
{
|
||||||
|
UserId = user.Id,
|
||||||
|
|
||||||
|
Duty = true,
|
||||||
|
|
||||||
|
SlotType = 0,
|
||||||
|
SlotId = 8,
|
||||||
|
ClothId = context.MaleCombinations.FirstOrDefault(c => c.Top == clothId[1]).Undershirt
|
||||||
|
};
|
||||||
|
context.CharacterClothes.Add(newTorso);
|
||||||
|
context.CharacterClothes.Add(newUndershirt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CharacterCloth newTorso = new CharacterCloth
|
||||||
|
{
|
||||||
|
UserId = user.Id,
|
||||||
|
|
||||||
|
Duty = true,
|
||||||
|
|
||||||
|
SlotType = 0,
|
||||||
|
SlotId = 3,
|
||||||
|
ClothId = context.FemaleCombinations.FirstOrDefault(c => c.Top == clothId[1]).Torso
|
||||||
|
};
|
||||||
|
CharacterCloth newUndershirt = new CharacterCloth
|
||||||
|
{
|
||||||
|
UserId = user.Id,
|
||||||
|
|
||||||
|
Duty = true,
|
||||||
|
|
||||||
|
SlotType = 0,
|
||||||
|
SlotId = 8,
|
||||||
|
ClothId = context.FemaleCombinations.FirstOrDefault(c => c.Top == clothId[1]).Undershirt
|
||||||
|
};
|
||||||
|
context.CharacterClothes.Add(newTorso);
|
||||||
|
context.CharacterClothes.Add(newUndershirt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (var x = 0; x < slotType.Length; x++)
|
||||||
|
{
|
||||||
|
var loopCloth = context.CharacterClothes.FirstOrDefault(u => u.UserId == user.Id && u.SlotType == slotType[x] && u.SlotId == slotId[x]);
|
||||||
|
loopCloth.ClothId = clothId[x];
|
||||||
|
}
|
||||||
|
CharacterCloth torso = context.CharacterClothes.FirstOrDefault(u => u.UserId == user.Id && u.SlotType == 0 && u.SlotId == 3);
|
||||||
|
CharacterCloth undershirt = context.CharacterClothes.FirstOrDefault(u => u.UserId == user.Id && u.SlotType == 0 && u.SlotId == 8);
|
||||||
|
if (user.GetCharacter().Gender == false)
|
||||||
|
{
|
||||||
|
torso.ClothId = context.MaleCombinations.FirstOrDefault(c => c.Top == clothId[1]).Torso;
|
||||||
|
undershirt.ClothId = context.MaleCombinations.FirstOrDefault(c => c.Top == clothId[1]).Undershirt;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
torso.ClothId = context.FemaleCombinations.FirstOrDefault(c => c.Top == clothId[1]).Torso;
|
||||||
|
undershirt.ClothId = context.FemaleCombinations.FirstOrDefault(c => c.Top == clothId[1]).Undershirt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
context.SaveChanges();
|
||||||
|
}
|
||||||
|
LoadCharacterDefaults(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("defaultCharacterCloth")]
|
||||||
|
public static void LoadCharacterDefaults(Client player)
|
||||||
|
{
|
||||||
|
User user = player.GetUser();
|
||||||
|
using (var context = new DatabaseContext())
|
||||||
|
{
|
||||||
|
List<CharacterCloth> charClothes = context.CharacterClothes.ToList().FindAll(c => c.UserId == user.Id && c.Duty == false);
|
||||||
|
|
||||||
|
foreach(var cloth in charClothes)
|
||||||
|
{
|
||||||
|
if(cloth.SlotType == 0)
|
||||||
|
{
|
||||||
|
if (cloth.ClothId == -1)
|
||||||
|
{
|
||||||
|
player.ClearAccessory(cloth.SlotId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.SetAccessories(cloth.SlotId, cloth.ClothId, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.SetClothes(cloth.SlotId, cloth.ClothId, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using GTANetworkAPI;
|
|
||||||
using reallife_gamemode.Model;
|
|
||||||
using reallife_gamemode.Server.Extensions;
|
|
||||||
|
|
||||||
namespace reallife_gamemode.Server.Events
|
|
||||||
{
|
|
||||||
public class UpdateCharacterComponent : Script
|
|
||||||
{
|
|
||||||
[RemoteEvent("updateDutyProp")]
|
|
||||||
public void UpdateDutyProp(Client player, int componentId, int componentVariation)
|
|
||||||
{
|
|
||||||
if(componentId != -1)
|
|
||||||
{
|
|
||||||
player.SetAccessories(componentId, componentVariation, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.ClearAccessory(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[RemoteEvent("updateDutyCloth")]
|
|
||||||
public void UpdateDutyCloth(Client player, int componentId, int componentVariation)
|
|
||||||
{
|
|
||||||
if(componentId == 11)
|
|
||||||
{
|
|
||||||
//TODO Spezielle Duty Kleidung in Datenbank einpflegen (Ergibt bei Cop-Kleidung NULL)
|
|
||||||
using (var context = new DatabaseContext())
|
|
||||||
{
|
|
||||||
if(player.GetUser().GetCharacter().Gender == false)
|
|
||||||
{
|
|
||||||
var combination = context.MaleCombinations.FirstOrDefault(c => c.Top == componentVariation);
|
|
||||||
player.SetClothes(11, componentVariation, 0);
|
|
||||||
if (combination != null)
|
|
||||||
{
|
|
||||||
player.SetClothes(3, combination.Torso, 0);
|
|
||||||
player.SetClothes(8, combination.Undershirt, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var combination = context.FemaleCombinations.FirstOrDefault(c => c.Top == componentVariation);
|
|
||||||
player.SetClothes(11, componentVariation, 0);
|
|
||||||
if (combination != null)
|
|
||||||
{
|
|
||||||
player.SetClothes(3, combination.Torso, 0);
|
|
||||||
player.SetClothes(8, combination.Undershirt, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.SetClothes(componentId, componentVariation, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user