Erweiterung Surgeon
This commit is contained in:
@@ -21,8 +21,8 @@ const localPlayer = mp.players.local;
|
||||
|
||||
export default function charSurgery(globalData: IGlobalData) {
|
||||
|
||||
var creatorHairMenu;
|
||||
|
||||
var creatorHairMenu: NativeUI.Menu;
|
||||
var characterData: PlayerCharacterData;
|
||||
function getRandomInt(min, max) {
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ export default function charSurgery(globalData: IGlobalData) {
|
||||
//creatorHairMenu.AddItem(hairHighlightItem);
|
||||
|
||||
eyebrowColorItem = new UIMenuListItem("Augenbrauen Farbe", "Farbe deiner Augenbrauen", new ItemsCollection(hairColors));
|
||||
creatorHairMenu.AddItem(eyebrowColorItem)
|
||||
creatorHairMenu.AddItem(eyebrowColorItem);
|
||||
|
||||
beardColorItem = new UIMenuListItem("Farbe der Gesichtsbehaarung", "Farbe deiner Gesichtsbehaarung", new ItemsCollection(hairColors));
|
||||
creatorHairMenu.AddItem(beardColorItem);
|
||||
@@ -151,44 +151,101 @@ export default function charSurgery(globalData: IGlobalData) {
|
||||
}
|
||||
|
||||
function resetParentsMenu(refresh = false) {
|
||||
fatherItem.Index = 0;
|
||||
motherItem.Index = 0;
|
||||
similarityItem.Index = (currentGender === 0) ? 100 : 0;
|
||||
skinSimilarityItem.Index = (currentGender === 0) ? 100 : 0;
|
||||
fatherItem.Index = characterData.Father;
|
||||
motherItem.Index = characterData.Mother;
|
||||
similarityItem.Index = characterData.Similarity;//(currentGender === 0) ? 100 : 0;
|
||||
skinSimilarityItem.Index = characterData.SkinSimilarity;//(currentGender === 0) ? 100 : 0;
|
||||
|
||||
updateParents();
|
||||
if (refresh) creatorParentsMenu.RefreshIndex();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function resetFeaturesMenu(refresh = false) {
|
||||
for (let i = 0; i < Data.featureNames.length; i++) {
|
||||
featureItems[i].Index = 100;
|
||||
featureItems[i].Index = loadedFeatures[i];
|
||||
updateFaceFeature(i);
|
||||
}
|
||||
|
||||
if (refresh) creatorFeaturesMenu.RefreshIndex();
|
||||
}
|
||||
|
||||
var loadedFeatures;
|
||||
var loadedAppearence;
|
||||
var loadedAppearenceOpacity;
|
||||
|
||||
function loadCharacterData() {
|
||||
loadedFeatures = [
|
||||
characterData.NoseWidth,
|
||||
characterData.NoseBottomHeight,
|
||||
characterData.NoseTipLength,
|
||||
characterData.NoseBridgeDepth,
|
||||
characterData.NoseTipHeight,
|
||||
characterData.NoseBroken,
|
||||
characterData.BrowHeight,
|
||||
characterData.BrowDepth,
|
||||
characterData.CheekboneHeight,
|
||||
characterData.CheekboneWidth,
|
||||
characterData.CheekDepth,
|
||||
characterData.EyeSize,
|
||||
characterData.LipThickness,
|
||||
characterData.JawWidth,
|
||||
characterData.JawShape,
|
||||
characterData.ChinHeight,
|
||||
characterData.ChinDepth,
|
||||
characterData.ChinWidth,
|
||||
characterData.ChinIndent,
|
||||
characterData.NeckWidth
|
||||
];
|
||||
loadedAppearence = [
|
||||
characterData.Blemishes,
|
||||
characterData.FacialHair,
|
||||
characterData.Eyebrows,
|
||||
characterData.Ageing,
|
||||
characterData.Makeup,
|
||||
characterData.Blush,
|
||||
characterData.Complexion,
|
||||
characterData.SunDamage,
|
||||
characterData.Lipstick,
|
||||
characterData.Freckles,
|
||||
characterData.ChestHair
|
||||
];
|
||||
loadedAppearenceOpacity = [
|
||||
characterData.BlemishesOpacity,
|
||||
characterData.FacialHairOpacity,
|
||||
characterData.EyebrowsOpacity,
|
||||
characterData.AgeingOpacity,
|
||||
characterData.MakeupOpacity,
|
||||
characterData.BlushOpacity,
|
||||
characterData.ComplexionOpacity,
|
||||
characterData.SunDamageOpacity,
|
||||
characterData.LipstickOpacity,
|
||||
characterData.FrecklesOpacity,
|
||||
characterData.ChestHairOpacity
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
function resetAppearanceMenu(refresh = false) {
|
||||
for (let i = 0; i < Data.appearanceNames.length; i++) {
|
||||
appearanceItems[i].Index = 0;
|
||||
appearanceOpacityItems[i].Index = 100;
|
||||
appearanceItems[i].Index = loadedAppearence[i];
|
||||
appearanceOpacityItems[i].Index = loadedAppearenceOpacity[i];
|
||||
updateAppearance(i);
|
||||
}
|
||||
|
||||
if (refresh) creatorAppearanceMenu.RefreshIndex();
|
||||
}
|
||||
|
||||
|
||||
function resetHairAndColorsMenu(refresh = false) {
|
||||
//hairItem.Index = 0;
|
||||
//hairColorItem.Index = 0;
|
||||
//hairHighlightItem.Index = 0;
|
||||
eyebrowColorItem.Index = 0;
|
||||
beardColorItem.Index = 0;
|
||||
eyeColorItem.Index = 0;
|
||||
blushColorItem.Index = 0;
|
||||
lipstickColorItem.Index = 0;
|
||||
chestHairColorItem.Index = 0;
|
||||
eyebrowColorItem.Index = characterData.EyebrowColor;
|
||||
beardColorItem.Index = characterData.BeardColor;
|
||||
eyeColorItem.Index = characterData.EyeColor;
|
||||
blushColorItem.Index = characterData.BlushColor;
|
||||
lipstickColorItem.Index = characterData.LipstickColor;
|
||||
chestHairColorItem.Index = characterData.ChestHairColor;
|
||||
updateHairAndColors();
|
||||
|
||||
if (refresh) creatorHairMenu.RefreshIndex();
|
||||
@@ -292,17 +349,17 @@ export default function charSurgery(globalData: IGlobalData) {
|
||||
let appearanceData = [];
|
||||
for (let i = 0; i < appearanceItems.length; i++) appearanceData.push({ Value: ((appearanceItems[i].Index === 0) ? 255 : appearanceItems[i].Index - 1), Opacity: appearanceOpacityItems[i].Index * 0.01 });
|
||||
|
||||
/*let hairAndColors = [
|
||||
Data.hairList[currentGender][hairItem.Index].ID,
|
||||
hairColorItem.Index,
|
||||
hairHighlightItem.Index,
|
||||
let hairAndColors = [
|
||||
//Data.hairList[currentGender][hairItem.Index].ID,
|
||||
//hairColorItem.Index,
|
||||
//hairHighlightItem.Index,
|
||||
eyebrowColorItem.Index,
|
||||
beardColorItem.Index,
|
||||
eyeColorItem.Index,
|
||||
blushColorItem.Index,
|
||||
lipstickColorItem.Index,
|
||||
chestHairColorItem.Index
|
||||
];*/
|
||||
];
|
||||
for (let i = 0; i < creatorMenus.length; i++) creatorMenus[i].Visible = false;
|
||||
mp.gui.chat.show(true);
|
||||
mp.game.ui.displayRadar(true);
|
||||
@@ -312,7 +369,7 @@ export default function charSurgery(globalData: IGlobalData) {
|
||||
localPlayer.setComponentVariation(2, Data.hairList[currentGender][hairItem.Index].ID, 0, 2);
|
||||
mp.game.cam.renderScriptCams(false, false, 0, true, false);
|
||||
creatorCamera.destroy(true);
|
||||
mp.events.callRemote("SaveSurgery", currentGender, JSON.stringify(parentData), JSON.stringify(featureData), JSON.stringify(appearanceData));
|
||||
mp.events.callRemote("SaveSurgery", currentGender, JSON.stringify(parentData), JSON.stringify(featureData), JSON.stringify(appearanceData), JSON.stringify(hairAndColors));
|
||||
globalData.InMenu = false;
|
||||
globalData.InMenu = false;
|
||||
break;
|
||||
@@ -328,6 +385,12 @@ export default function charSurgery(globalData: IGlobalData) {
|
||||
});
|
||||
|
||||
function leaveCreator() {
|
||||
|
||||
//resetParentsMenu();
|
||||
//resetFeaturesMenu();
|
||||
//resetAppearanceMenu();
|
||||
//resetHairAndColorsMenu();
|
||||
|
||||
mp.gui.chat.show(true);
|
||||
mp.game.ui.displayRadar(true);
|
||||
mp.game.ui.displayHud(true);
|
||||
@@ -480,12 +543,12 @@ export default function charSurgery(globalData: IGlobalData) {
|
||||
let hairItem;
|
||||
let hairColorItem;
|
||||
let hairHighlightItem;
|
||||
let eyebrowColorItem;
|
||||
let beardColorItem;
|
||||
let eyeColorItem;
|
||||
let blushColorItem;
|
||||
let lipstickColorItem;
|
||||
let chestHairColorItem;
|
||||
let eyebrowColorItem: NativeUI.UIMenuListItem;
|
||||
let beardColorItem: NativeUI.UIMenuListItem;
|
||||
let eyeColorItem: NativeUI.UIMenuListItem;
|
||||
let blushColorItem: NativeUI.UIMenuListItem;
|
||||
let lipstickColorItem: NativeUI.UIMenuListItem;
|
||||
let chestHairColorItem: NativeUI.UIMenuListItem;
|
||||
|
||||
creatorHairMenu = new Menu("Haar & Farben", "", new Point(0, screenRes.y / 3), null, null);
|
||||
fillHairMenu();
|
||||
@@ -557,10 +620,14 @@ export default function charSurgery(globalData: IGlobalData) {
|
||||
creatorHairMenu.Visible = false;
|
||||
creatorMenus.push(creatorHairMenu);
|
||||
// CREATOR HAIR & COLORS END
|
||||
|
||||
|
||||
var character;
|
||||
// EVENTS
|
||||
mp.events.add("toggleSurgery", () => {
|
||||
mp.events.add("toggleSurgery", (jsonCharacterData: string) => {
|
||||
if (!mp.cameras.exists(creatorCamera)) {
|
||||
|
||||
characterData = JSON.parse(jsonCharacterData);
|
||||
loadCharacterData();
|
||||
creatorCamera = mp.cameras.new("creatorCamera", creatorCoords.camera, new mp.Vector3(0, 0, 0), 45);
|
||||
creatorCamera.pointAtCoord(creatorCoords.cameraLookAt.x, creatorCoords.cameraLookAt.y, creatorCoords.cameraLookAt.z);
|
||||
creatorCamera.setActive(true);
|
||||
|
||||
62
ReallifeGamemode.Client/global.d.ts
vendored
62
ReallifeGamemode.Client/global.d.ts
vendored
@@ -89,4 +89,66 @@ declare type Weapon = {
|
||||
declare type WeaponCategory = {
|
||||
Category: number;
|
||||
Weapons: Weapon[];
|
||||
}
|
||||
|
||||
declare type PlayerCharacterData = {
|
||||
Gender: boolean;
|
||||
Father: number;
|
||||
Mother: number;
|
||||
Similarity: number;
|
||||
SkinSimilarity: number;
|
||||
|
||||
NoseWidth: number;
|
||||
NoseBottomHeight: number;
|
||||
NoseTipLength: number;
|
||||
NoseBridgeDepth: number;
|
||||
NoseTipHeight: number;
|
||||
NoseBroken: number;
|
||||
BrowHeight: number;
|
||||
BrowDepth: number;
|
||||
CheekboneHeight: number;
|
||||
CheekboneWidth: number;
|
||||
CheekDepth: number;
|
||||
EyeSize: number;
|
||||
LipThickness: number;
|
||||
JawWidth: number;
|
||||
JawShape: number;
|
||||
ChinHeight: number;
|
||||
ChinDepth: number;
|
||||
ChinWidth: number;
|
||||
ChinIndent: number;
|
||||
NeckWidth: number;
|
||||
|
||||
Blemishes: number;
|
||||
BlemishesOpacity: number;
|
||||
FacialHair: number;
|
||||
FacialHairOpacity: number;
|
||||
Eyebrows: number;
|
||||
EyebrowsOpacity: number;
|
||||
Ageing: number;
|
||||
AgeingOpacity: number;
|
||||
Makeup: number;
|
||||
MakeupOpacity: number;
|
||||
Blush: number;
|
||||
BlushOpacity: number;
|
||||
Complexion: number;
|
||||
ComplexionOpacity: number;
|
||||
SunDamage: number;
|
||||
SunDamageOpacity: number;
|
||||
Lipstick: number;
|
||||
LipstickOpacity: number;
|
||||
Freckles: number;
|
||||
FrecklesOpacity: number;
|
||||
ChestHair: number;
|
||||
ChestHairOpacity: number;
|
||||
|
||||
Hair: number;
|
||||
HairColor: number;
|
||||
HairHighlightColor: number;
|
||||
EyebrowColor: number;
|
||||
BeardColor: number;
|
||||
EyeColor: number;
|
||||
BlushColor: number;
|
||||
LipstickColor: number;
|
||||
ChestHairColor: number;
|
||||
}
|
||||
@@ -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