Add Dynamic Cloth Changing
This commit is contained in:
24
Server/Entities/FemaleCombination.cs
Normal file
24
Server/Entities/FemaleCombination.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Entities FemaleCombination (FemaleCombination.cs)
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
namespace reallife_gamemode.Server.Entities
|
||||
{
|
||||
public class FemaleCombination
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public int Top { get; set; }
|
||||
public int Torso { get; set; }
|
||||
public int Undershirt { get; set; }
|
||||
}
|
||||
}
|
||||
24
Server/Entities/MaleCombination.cs
Normal file
24
Server/Entities/MaleCombination.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Entities MaleCombination (MaleCombination.cs)
|
||||
* @author VegaZ
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
namespace reallife_gamemode.Server.Entities
|
||||
{
|
||||
public class MaleCombination
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public int Top { get; set; }
|
||||
public int Torso { get; set; }
|
||||
public int Undershirt { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -96,24 +96,24 @@ namespace reallife_gamemode.Server.Events
|
||||
if (nearest == null) return;
|
||||
if (player.Position.DistanceTo(nearest.Position) <= 1.5 && nearest.FactionId == user.FactionId)
|
||||
{
|
||||
int[] hats;
|
||||
int[] tops;
|
||||
int[] legs;
|
||||
int[] shoes;
|
||||
string[] hats;
|
||||
string[] tops;
|
||||
string[] legs;
|
||||
string[] shoes;
|
||||
|
||||
if(user.GetCharacter().Gender == false) //Wenn männlich
|
||||
{
|
||||
hats = new int[] { -1, 5, 12, 39, 46, 123, 124, 125};
|
||||
tops = new int[] { -1, 55, 26};
|
||||
legs = new int[] { -1, 24, 28 };
|
||||
shoes = new int[] { -1, 24, 25};
|
||||
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
|
||||
{
|
||||
hats = new int[] { -1, 12, 38, 45, 122, 123, 124 };
|
||||
tops = new int[] { -1, 48, 43 };
|
||||
legs = new int[] { -1, 34, 37, 102 };
|
||||
shoes = new int[] { -1, 24, 25 };
|
||||
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" };
|
||||
}
|
||||
|
||||
player.TriggerEvent("showDutyClothMenu", hats, tops, legs, shoes);
|
||||
|
||||
63
Server/Events/UpdateCharacterComponent.cs
Normal file
63
Server/Events/UpdateCharacterComponent.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
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