Unite Male/Female-Combinations to ClothCombination
This commit is contained in:
@@ -34,25 +34,14 @@ namespace reallife_gamemode.Server.Events
|
||||
//TODO Spezielle Duty Kleidung in Datenbank einpflegen (Ergibt bei Cop-Kleidung NULL)
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
if (player.GetUser().GetCharacter().Gender == false)
|
||||
var character = player.GetUser().GetCharacter();
|
||||
|
||||
var combination = context.ClothCombinations.FirstOrDefault(c => c.Top == componentVariation && c.Gender == character.Gender);
|
||||
player.SetClothes(11, componentVariation, 0);
|
||||
if (combination != null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
player.SetClothes(3, combination.Torso, 0);
|
||||
player.SetClothes(8, combination.Undershirt, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,6 +63,8 @@ namespace reallife_gamemode.Server.Events
|
||||
User user = client.GetUser();
|
||||
user = context.Users.FirstOrDefault(u => u.Id == user.Id);
|
||||
|
||||
var character = client.GetUser().GetCharacter();
|
||||
|
||||
var charClothes = context.CharacterClothes.FirstOrDefault(c => c.UserId == user.Id);
|
||||
if (charClothes == null)
|
||||
{
|
||||
@@ -101,7 +92,7 @@ namespace reallife_gamemode.Server.Events
|
||||
|
||||
SlotType = 0,
|
||||
SlotId = 3,
|
||||
ClothId = context.MaleCombinations.FirstOrDefault(c => c.Top == clothId[1]).Torso
|
||||
ClothId = context.ClothCombinations.FirstOrDefault(c => c.Top == clothId[1] && c.Gender == character.Gender).Torso
|
||||
};
|
||||
CharacterCloth newUndershirt = new CharacterCloth
|
||||
{
|
||||
@@ -111,32 +102,7 @@ namespace reallife_gamemode.Server.Events
|
||||
|
||||
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
|
||||
ClothId = context.ClothCombinations.FirstOrDefault(c => c.Top == clothId[1] && c.Gender == character.Gender).Undershirt
|
||||
};
|
||||
context.CharacterClothes.Add(newTorso);
|
||||
context.CharacterClothes.Add(newUndershirt);
|
||||
@@ -151,16 +117,9 @@ namespace reallife_gamemode.Server.Events
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
torso.ClothId = context.ClothCombinations.FirstOrDefault(c => c.Top == clothId[1] && c.Gender == character.Gender).Torso;
|
||||
undershirt.ClothId = context.ClothCombinations.FirstOrDefault(c => c.Top == clothId[1] && c.Gender == character.Gender).Undershirt;
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user