Finish Duty-System (Clothing)

This commit is contained in:
VegaZ
2018-11-21 17:20:53 +01:00
parent 5e7a8ac0ae
commit 8919e76b75
5 changed files with 44 additions and 59 deletions

View File

@@ -63,7 +63,7 @@ namespace reallife_gamemode.Server.Events
player.NametagColor = nameTagColor;
using (var context = new DatabaseContext())
{
List<CharacterCloth> clothes = context.CharacterClothes.ToList().FindAll(u => u.UserId == user.Id);
List<CharacterCloth> clothes = context.CharacterClothes.ToList().FindAll(u => u.UserId == user.Id && u.Duty == true);
foreach(var cloth in clothes)
{
@@ -80,8 +80,7 @@ namespace reallife_gamemode.Server.Events
else
{
player.ClearAccessory(cloth.SlotId);
}
}
}
}
}
@@ -92,11 +91,7 @@ namespace reallife_gamemode.Server.Events
player.SendNotification("Du bist nun ~r~außer Dienst.");
NAPI.ClientEvent.TriggerClientEventForAll("updateDutyMedics", false);
player.NametagColor = new Color(255, 255, 255);
player.ClearAccessory(0);
//Gespeicherte Props laden lassen
player.SetDefaultClothes();
//Gespeicherte Klamotten laden lassen
UpdateCharacterCloth.LoadCharacterDefaults(player);
}
}
}
@@ -128,28 +123,44 @@ namespace reallife_gamemode.Server.Events
if (nearest == null) return;
if (player.Position.DistanceTo(nearest.Position) <= 1.5 && nearest.FactionId == user.FactionId)
{
string[] hats;
string[] tops;
string[] legs;
string[] shoes;
List<string> hats = new List<string>();
List<string> tops = new List<string>();
List<string> legs = new List<string>();
List<string> shoes = new List<string>();
//TODO in Datenbank auslagern
if(user.GetCharacter().Gender == false) //Wenn männlich
{
hats = new string[] { "Keinen", "5", "12", "39", "46", "123", "124", "125"};
tops = new string[] { "55", "26"};
legs = new string[] { "24", "28" };
shoes = new string[] { "24", "25"};
}
else
using (var context = new DatabaseContext())
{
hats = new string[] { "Keinen", "12", "38", "45", "122", "123", "124" };
tops = new string[] { "48", "43" };
legs = new string[] { "34", "37", "102" };
shoes = new string[] { "24", "25" };
}
List<DutyCloth> clothes = context.DutyClothes.ToList().FindAll(c => c.FactionId == user.FactionId && c.Gender == user.GetCharacter().Gender);
foreach(var cloth in clothes)
{
if(cloth.SlotType == 1)
{
if (cloth.ClothId != -1)
{
hats.Add(cloth.ClothId.ToString());
}
else
{
hats.Add("Keinen");
}
continue;
}
player.TriggerEvent("showDutyClothMenu", hats, tops, legs, shoes);
switch (cloth.SlotId)
{
case 11:
tops.Add(cloth.ClothId.ToString());
break;
case 4:
legs.Add(cloth.ClothId.ToString());
break;
case 6:
shoes.Add(cloth.ClothId.ToString());
break;
}
}
}
player.TriggerEvent("showDutyClothMenu", hats.ToArray(), tops.ToArray(), legs.ToArray(), shoes.ToArray());
}
}