Erweiterung Surgeon
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
@@ -423,34 +424,78 @@ namespace ReallifeGamemode.Server.Managers
|
||||
}
|
||||
public static void StartSurgery(Player player)
|
||||
{
|
||||
/*
|
||||
var gender;
|
||||
var featureData;
|
||||
var parentData;
|
||||
var appearanceData;
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
Character c = player.GetUser().GetCharacter();
|
||||
|
||||
var PlayerCharacterData = new
|
||||
{
|
||||
User user = player.GetUser();
|
||||
Gender = c.Gender,
|
||||
Father = c.Father,
|
||||
Mother = c.Mother,
|
||||
Similarity = c.Similarity,
|
||||
SkinSimilarity = c.SkinSimilarity,
|
||||
|
||||
var character = dbContext.Characters.SingleOrDefault(c => c.Id == user.CharacterId);
|
||||
NoseWidth = c.NoseWidth,
|
||||
NoseBottomHeight = c.NoseBottomHeight,
|
||||
NoseTipLength = c.NoseTipLength,
|
||||
NoseBridgeDepth = c.NoseBridgeDepth,
|
||||
NoseTipHeight = c.NoseTipHeight,
|
||||
NoseBroken = c.NoseBroken,
|
||||
BrowHeight = c.BrowHeight,
|
||||
BrowDepth = c.BrowDepth,
|
||||
CheekboneHeight = c.CheekboneHeight,
|
||||
CheekboneWidth = c.CheekboneWidth,
|
||||
CheekDepth = c.CheekDepth,
|
||||
EyeSize = c.EyeSize,
|
||||
LipThickness = c.LipThickness,
|
||||
JawWidth = c.JawWidth,
|
||||
JawShape = c.JawShape,
|
||||
ChinHeight = c.ChinHeight,
|
||||
ChinDepth = c.ChinDepth,
|
||||
ChinWidth = c.ChinWidth,
|
||||
ChinIndent = c.ChinIndent,
|
||||
NeckWidth = c.NeckWidth,
|
||||
|
||||
if (character == null) return;
|
||||
Blemishes = c.Blemishes,
|
||||
BlemishesOpacity = c.BlemishesOpacity,
|
||||
FacialHair = c.FacialHair,
|
||||
FacialHairOpacity = c.FacialHairOpacity,
|
||||
Eyebrows = c.Eyebrows,
|
||||
EyebrowsOpacity = c.EyebrowsOpacity,
|
||||
Ageing = c.Ageing,
|
||||
AgeingOpacity = c.AgeingOpacity,
|
||||
Makeup = c.Makeup,
|
||||
MakeupOpacity = c.MakeupOpacity,
|
||||
Blush = c.Blush,
|
||||
BlushOpacity = c.BlushOpacity,
|
||||
Complexion = c.Complexion,
|
||||
ComplexionOpacity = c.ComplexionOpacity,
|
||||
SunDamage = c.SunDamage,
|
||||
SunDamageOpacity = c.SunDamageOpacity,
|
||||
Lipstick = c.Lipstick,
|
||||
LipstickOpacity = c.LipstickOpacity,
|
||||
Freckles = c.Freckles,
|
||||
FrecklesOpacity = c.FrecklesOpacity,
|
||||
ChestHair = c.ChestHair,
|
||||
ChestHairOpacity = c.ChestHairOpacity,
|
||||
|
||||
Hair = c.Hair,
|
||||
HairColor = c.HairColor,
|
||||
HairHighlightColor = c.HairHighlightColor,
|
||||
EyebrowColor = c.EyebrowColor,
|
||||
BeardColor = c.BeardColor,
|
||||
EyeColor = c.EyeColor,
|
||||
BlushColor = c.BlushColor,
|
||||
LipstickColor = c.LipstickColor,
|
||||
ChestHairColor = c.ChestHairColor
|
||||
};
|
||||
|
||||
float[] faceFeatures = new float[] { character.NoseWidth, character.NoseBottomHeight, character.NoseTipLength, character.NoseBridgeDepth, character.NoseTipHeight,
|
||||
character.NoseBroken, character.BrowHeight, character.BrowDepth, character.CheekboneHeight, character.CheekboneWidth,
|
||||
character.CheekboneWidth, character.CheekDepth, character.EyeSize, character.LipThickness, character.JawWidth,
|
||||
character.JawShape, character.ChinHeight, character.ChinDepth, character.ChinWidth, character.ChinIndent, character.NeckWidth };
|
||||
}*/
|
||||
var currentPlayerCreatorDimension = (uint)NAPI.Data.GetWorldData("playerCreatorDimension");
|
||||
currentPlayerCreatorDimension++;
|
||||
NAPI.Data.SetWorldData("playerCreatorDimension", currentPlayerCreatorDimension);
|
||||
player.Dimension = NAPI.Data.GetWorldData("playerCreatorDimension");
|
||||
player.SafeTeleport(new Vector3(266.472, -1339.1357, 24.5378));
|
||||
player.Heading = 146.35101f;
|
||||
player.TriggerEvent("toggleSurgery");
|
||||
|
||||
//player.TriggerEvent("toggleSurgery", bool gender, string parentData, string featureData, string appearanceData)
|
||||
player.TriggerEvent("toggleSurgery", JsonConvert.SerializeObject(PlayerCharacterData));
|
||||
}
|
||||
|
||||
[RemoteEvent("surgeryLeave")]
|
||||
@@ -467,6 +512,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
var jParentData = JObject.Parse(parentData);
|
||||
var jFeatureData = JArray.Parse(featureData);
|
||||
var jAppearanceData = JArray.Parse(appearanceData);
|
||||
var jHairAndColorData = JArray.Parse(hairAndColorData);
|
||||
|
||||
byte father = jParentData.Value<byte>("Father");
|
||||
byte mother = jParentData.Value<byte>("Mother");
|
||||
@@ -517,7 +563,79 @@ namespace ReallifeGamemode.Server.Managers
|
||||
byte chestHair = jAppearanceData[10].Value<byte>("Value");
|
||||
float chestHairOpacity = jAppearanceData[10].Value<byte>("Opacity");
|
||||
|
||||
//byte hair = jHairAndColorData.Value<byte>(0);
|
||||
//byte hairColor = jHairAndColorData.Value<byte>(1);
|
||||
//byte hairHighlightColor = jHairAndColorData.Value<byte>(2);
|
||||
byte eyebrowColor = jHairAndColorData.Value<byte>(0);
|
||||
byte beardColor = jHairAndColorData.Value<byte>(1);
|
||||
byte eyeColor = jHairAndColorData.Value<byte>(2);
|
||||
byte blushColor = jHairAndColorData.Value<byte>(3);
|
||||
byte lipstickColor = jHairAndColorData.Value<byte>(4);
|
||||
byte chestHairColor = jHairAndColorData.Value<byte>(5);
|
||||
|
||||
using (var saveCharacter = new DatabaseContext())
|
||||
{
|
||||
var character = new Database.Entities.Character
|
||||
{
|
||||
UserId = player.GetUser().Id,
|
||||
Gender = gender,
|
||||
Father = father,
|
||||
Mother = mother,
|
||||
Similarity = similarity,
|
||||
SkinSimilarity = skinSimilarity,
|
||||
|
||||
NoseWidth = noseWidth,
|
||||
NoseBottomHeight = noseBottomHeight,
|
||||
NoseTipLength = noseTipLength,
|
||||
NoseBridgeDepth = noseBridgeDepth,
|
||||
NoseTipHeight = noseTipHeight,
|
||||
NoseBroken = noseBroken,
|
||||
BrowHeight = browHeight,
|
||||
BrowDepth = browDepth,
|
||||
CheekboneHeight = cheekboneHeight,
|
||||
CheekboneWidth = cheekboneWidth,
|
||||
CheekDepth = cheekDepth,
|
||||
EyeSize = eyeSize,
|
||||
LipThickness = lipThickness,
|
||||
JawWidth = jawWidth,
|
||||
JawShape = jawShape,
|
||||
ChinHeight = chinHeight,
|
||||
ChinDepth = chinDepth,
|
||||
ChinWidth = chinWidth,
|
||||
ChinIndent = chinIndent,
|
||||
NeckWidth = neckWidth,
|
||||
|
||||
Blemishes = blemishes,
|
||||
BlemishesOpacity = blemishesOpacity,
|
||||
FacialHair = facialHair,
|
||||
FacialHairOpacity = facialHairOpacity,
|
||||
Eyebrows = eyebrows,
|
||||
EyebrowsOpacity = eyebrowsOpacity,
|
||||
Ageing = ageing,
|
||||
AgeingOpacity = ageingOpacity,
|
||||
Makeup = makeup,
|
||||
MakeupOpacity = makeupOpacity,
|
||||
Blush = blush,
|
||||
BlushOpacity = blushOpacity,
|
||||
Complexion = complexion,
|
||||
ComplexionOpacity = complexionOpacity,
|
||||
SunDamage = sunDamage,
|
||||
SunDamageOpacity = sunDamageOpacity,
|
||||
Lipstick = lipstick,
|
||||
LipstickOpacity = lipstickOpacity,
|
||||
Freckles = freckles,
|
||||
FrecklesOpacity = frecklesOpacity,
|
||||
ChestHair = chestHair,
|
||||
ChestHairOpacity = chestHairOpacity,
|
||||
|
||||
EyebrowColor = eyebrowColor,
|
||||
BeardColor = beardColor,
|
||||
EyeColor = eyeColor,
|
||||
BlushColor = blushColor,
|
||||
LipstickColor = lipstickColor,
|
||||
ChestHairColor = chestHairColor
|
||||
};
|
||||
}
|
||||
|
||||
ApplyCharacter(player);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user