Merge branch 'develop' of ssh://development.life-of-german.org:451/log-gtav/reallife-gamemode into develop

This commit is contained in:
Alex_qp
2021-05-04 19:58:30 +02:00
21 changed files with 3393 additions and 64 deletions

View File

@@ -132,6 +132,11 @@ namespace ReallifeGamemode.Server.Bank
using (var dbContext = new DatabaseContext())
{
if (player.GetUser().PlayedMinutes < 180)
{
player.SendNotification("~r~Du kannst Geld erst ab 3 Spielstunden vergeben");
return;
}
if (player.GetUser(dbContext) == target.GetUser(dbContext))
{
player.SendNotification($"~r~Du kannst dir selber kein Geld überweisen.");

View File

@@ -314,6 +314,12 @@ namespace ReallifeGamemode.Server.Commands
player.TriggerEvent("toggleTSupportMode", false);
player.SetData("SAdminduty", false);
ChatService.SendMessage(player, "!{#ee4d2e}** " + "Du befindest dich nicht mehr im T-Support");
if (user.GetData<bool>("adminUnshow") == true)
{
user.SetData("adminUnshow", false);
player.TriggerEvent("toggleAdminUnshowMode", false);
}
}
user.SetBlipAndNametagColor();
}

View File

@@ -371,22 +371,22 @@ namespace ReallifeGamemode.Server.Events
//Stadthalle
else if (player.Position.DistanceTo(PositionManager.rentcarPoints[1].Position) <= 1.5)
{
player.TriggerEvent("showRentcarMenu", JsonConvert.SerializeObject(Rentcar.stadthalleVehicleProperties), "stadthalle");
player.TriggerEvent("showRentcarMenu", JsonConvert.SerializeObject(Rentcar.stadthalleVehicleProperties), "lamesa");
}
//Knast
else if (player.Position.DistanceTo(PositionManager.rentcarPoints[2].Position) <= 1.5)
{
player.TriggerEvent("showRentcarMenu", JsonConvert.SerializeObject(Rentcar.knastVehicleProperties), "knast");
player.TriggerEvent("showRentcarMenu", JsonConvert.SerializeObject(Rentcar.knastVehicleProperties), "stadthalle");
}
//Paleto
else if (player.Position.DistanceTo(PositionManager.rentcarPoints[3].Position) <= 1.5)
{
player.TriggerEvent("showRentcarMenu", JsonConvert.SerializeObject(Rentcar.paletoVehicleProperties), "paleto");
player.TriggerEvent("showRentcarMenu", JsonConvert.SerializeObject(Rentcar.paletoVehicleProperties), "knast");
}
//Lamesa
else if (player.Position.DistanceTo(PositionManager.rentcarPoints[4].Position) <= 1.5)
{
player.TriggerEvent("showRentcarMenu", JsonConvert.SerializeObject(Rentcar.paletoVehicleProperties), "lamesa");
player.TriggerEvent("showRentcarMenu", JsonConvert.SerializeObject(Rentcar.paletoVehicleProperties), "paleto");
}
}
@@ -583,6 +583,34 @@ namespace ReallifeGamemode.Server.Events
nearestAmmunationPoint.Ammunation.LoadShopNUI(player);
}
}
if (CharacterCreator.surgeryPoint.DistanceTo(player.Position) <= 1.5)
{
var freeSurgery = player.GetUser().FreeSurgery;
if(freeSurgery == false && player.GetUser().BankAccount.Balance < 15000)
{
ChatService.ErrorMessage(player, "Du benötigst $15.000 auf dem Bankkonto um die Operation durchzuführen");
return;
}
ChatService.SendMessage(player, "~r~ACHTUNG! Dadurch wird dein alter Charakter gelöscht. Du kannst dir hiermit einen neuen erstellen.");
ChatService.SendMessage(player, "Beim Wechsel des Geschlechts verlierst du ebenfalls deine gekaufte Kleidung");
if (freeSurgery == true)
{
ChatService.SendMessage(player, "Du kannst deinen Charakter dieses mal kostenlos erstellen");
}
else
{
ChatService.SendMessage(player, "Die Änderung des Charakters kostet ~g~$15.000");
}
ChatService.SendMessage(player, "Du kannst die Charaktererstellung wieder verlassen und behältst deinen alten Charakter!");
ChatService.SendMessage(player, "Bitte starte mit ~g~J");
player.SetData<bool>("charSurgery", true);
NAPI.Task.Run(() =>
{
if (player.GetData<bool>("charSurgery") == true) player.ResetData("charSurgery");
player.SendNotification("~r~Chirurg-Angebot abgebrochen.");
}, 30000);
}
if (user.FactionLeader)
{
player.TriggerEvent("CLIENT:StartGangwar");
@@ -667,6 +695,12 @@ namespace ReallifeGamemode.Server.Events
return;
}
if(player.GetData<bool>("charSurgery") == true)
{
CharacterCreator.StartSurgery(player);
player.SetData("charSurgery",false);
}
User u = player.GetUser();
if (u.JobId == null) return;

View File

@@ -79,7 +79,7 @@ namespace ReallifeGamemode.Server.Events
currentPlayerCreatorDimension++;
NAPI.Data.SetWorldData("playerCreatorDimension", currentPlayerCreatorDimension);
player.Dimension = NAPI.Data.GetWorldData("playerCreatorDimension");
player.TriggerEvent("toggleCreator");
player.TriggerEvent("toggleCreator",false);
player.SafeTeleport(new Vector3(402.8664, -996.4108, -99.00027));
//player.Position = new Vector3(user.PositionX, user.PositionY, user.PositionZ);

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Services;
namespace ReallifeGamemode.Server.Events
{
class Waypoint : Script
{
[RemoteEvent("SERVER:waypointToDriver")]
public void setWaypointToDriver(Player player, float x, float y)
{
if (!player.IsInVehicle)
{
return;
}
if (player.VehicleSeat == 0)
{
return;
}
Entity entity = NAPI.Vehicle.GetVehicleDriver(player.Vehicle);
Player driver = PlayerService.GetPlayerByNameOrId(entity.Value.ToString());
if (driver == null || entity == null)
{
return;
}
driver.TriggerEvent("SERVER:Util_setWaypoint", x, y);
driver.SendNotification(player.Name + " hat dir eine Markierung auf der Karte gesetzt");
player.SendNotification("Du hast " + driver.Name + " eine Markierung auf der Karte gesetzt");
}
}
}

View File

@@ -1,13 +1,27 @@
using System.Linq;
using GTANetworkAPI;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Events;
using ReallifeGamemode.Server.Extensions;
namespace ReallifeGamemode.Server.Managers
{
public class CharacterCreator : Script
{
public static Vector3 surgeryPoint = new Vector3(258.581, -1345.1406, 24.5378);
public CharacterCreator()
{
var point = surgeryPoint;
NAPI.Marker.CreateMarker(1, new Vector3(point.X, point.Y, point.Z - 2), new Vector3(point.X, point.Y, point.Z + 1),
new Vector3(0, 0, 0), 2, new Color(255, 255, 255, 50), false, 0);
NAPI.TextLabel.CreateTextLabel("Chirurg - Dr\u00fccke ~y~E", point, 7, 1, 0, new Color(255, 255, 255), false, 0);
}
[RemoteEvent("creator_GenderChange")]
public void changeGender(Player player, int gender)
{
@@ -50,27 +64,27 @@ namespace ReallifeGamemode.Server.Managers
float neckWidth = jFeatureData.Value<float>(19);
byte blemishes = jAppearanceData[0].Value<byte>("Value");
float blemishesOpacity = jAppearanceData[0].Value<byte>("Opacity");
float blemishesOpacity = jAppearanceData[0].Value<float>("Opacity");
byte facialHair = jAppearanceData[1].Value<byte>("Value");
float facialHairOpacity = jAppearanceData[1].Value<byte>("Opacity");
float facialHairOpacity = jAppearanceData[1].Value<float>("Opacity");
byte eyebrows = jAppearanceData[2].Value<byte>("Value");
float eyebrowsOpacity = jAppearanceData[2].Value<byte>("Opacity");
float eyebrowsOpacity = jAppearanceData[2].Value<float>("Opacity");
byte ageing = jAppearanceData[3].Value<byte>("Value");
float ageingOpacity = jAppearanceData[3].Value<byte>("Opacity");
float ageingOpacity = jAppearanceData[3].Value<float>("Opacity");
byte makeup = jAppearanceData[4].Value<byte>("Value");
float makeupOpacity = jAppearanceData[4].Value<byte>("Opacity");
float makeupOpacity = jAppearanceData[4].Value<float>("Opacity");
byte blush = jAppearanceData[5].Value<byte>("Value");
float blushOpacity = jAppearanceData[5].Value<byte>("Opacity");
float blushOpacity = jAppearanceData[5].Value<float>("Opacity");
byte complexion = jAppearanceData[6].Value<byte>("Value");
float complexionOpacity = jAppearanceData[6].Value<byte>("Opacity");
float complexionOpacity = jAppearanceData[6].Value<float>("Opacity");
byte sunDamage = jAppearanceData[7].Value<byte>("Value");
float sunDamageOpacity = jAppearanceData[7].Value<byte>("Opacity");
float sunDamageOpacity = jAppearanceData[7].Value<float>("Opacity");
byte lipstick = jAppearanceData[8].Value<byte>("Value");
float lipstickOpacity = jAppearanceData[8].Value<byte>("Opacity");
float lipstickOpacity = jAppearanceData[8].Value<float>("Opacity");
byte freckles = jAppearanceData[9].Value<byte>("Value");
float frecklesOpacity = jAppearanceData[9].Value<byte>("Opacity");
float frecklesOpacity = jAppearanceData[9].Value<float>("Opacity");
byte chestHair = jAppearanceData[10].Value<byte>("Value");
float chestHairOpacity = jAppearanceData[10].Value<byte>("Opacity");
float chestHairOpacity = jAppearanceData[10].Value<float>("Opacity");
byte hair = jHairAndColorData.Value<byte>(0);
byte hairColor = jHairAndColorData.Value<byte>(1);
@@ -82,8 +96,26 @@ namespace ReallifeGamemode.Server.Managers
byte lipstickColor = jHairAndColorData.Value<byte>(7);
byte chestHairColor = jHairAndColorData.Value<byte>(8);
var charExists = false;
var genderSwap = false;
using (var saveCharacter = new DatabaseContext())
{
var userId = player.GetUser(saveCharacter).Id;
var user = saveCharacter.Users.SingleOrDefault(u => u.Id == userId);
var oldChar = saveCharacter.Characters.FirstOrDefault(c => c.UserId == user.Id);
if (user.CharacterId != null)
{
charExists = true;
if (oldChar.Gender != gender)
{
genderSwap = true;
}
}
var character = new Database.Entities.Character
{
UserId = player.GetUser().Id,
@@ -148,14 +180,21 @@ namespace ReallifeGamemode.Server.Managers
ChestHairColor = chestHairColor
};
saveCharacter.Characters.Add(character);
saveCharacter.SaveChanges();
var userId = player.GetUser().Id;
var user = saveCharacter.Users.SingleOrDefault(u => u.Id == userId);
user.CharacterId = character.Id;
if (genderSwap)
{
var charClothes = saveCharacter.CharacterClothes.Where(c => c.UserId == user.Id);
saveCharacter.RemoveRange(charClothes);
saveCharacter.SaveChanges();
}
for (var x = 1; x <= 11; x++)
{
var s = 0;
@@ -219,16 +258,19 @@ namespace ReallifeGamemode.Server.Managers
break;
};
}
var createClothes = new Database.Entities.CharacterCloth()
if (!charExists || genderSwap)
{
UserId = userId,
Duty = false,
SlotType = 1,
SlotId = x,
ClothId = y,
Texture = 0
};
saveCharacter.CharacterClothes.Add(createClothes);
var createClothes = new Database.Entities.CharacterCloth()
{
UserId = userId,
Duty = false,
SlotType = 1,
SlotId = x,
ClothId = y,
Texture = 0
};
saveCharacter.CharacterClothes.Add(createClothes);
}
}
else
{
@@ -236,6 +278,18 @@ namespace ReallifeGamemode.Server.Managers
}
}
if (charExists)
{
if (user.FreeSurgery == true)
{
user.FreeSurgery = false;
}
else
{
user.BankAccount.Balance -= 15000;
}
saveCharacter.Remove(oldChar);
}
saveCharacter.SaveChanges();
}
//HeadOverlay makeupHo = new HeadOverlay()
@@ -254,9 +308,16 @@ namespace ReallifeGamemode.Server.Managers
//};
//player.SetHeadOverlay(4, makeupHo);
//player.SetHeadOverlay(5, blushHo);
player.SafeTeleport(Main.DEFAULT_SPAWN_POSITION, Main.DEFAULT_SPAWN_HEADING, true);
player.TriggerEvent("draw", player.Name, player.Handle.Value);
player.Dimension = 0;
if (charExists)
{
LeaveSurgery(player);
}
else
{
player.SafeTeleport(Main.DEFAULT_SPAWN_POSITION, Main.DEFAULT_SPAWN_HEADING, true);
player.TriggerEvent("draw", player.Name, player.Handle.Value);
player.Dimension = 0;
}
}
/// <summary>
@@ -409,5 +470,224 @@ namespace ReallifeGamemode.Server.Managers
NAPI.Player.SetPlayerEyeColor(player, character.EyeColor);
}
}
public static void StartSurgery(Player player)
{
/*
Character c = player.GetUser().GetCharacter();
var PlayerCharacterData = new
{
Gender = c.Gender,
Father = c.Father,
Mother = c.Mother,
Similarity = c.Similarity,
SkinSimilarity = c.SkinSimilarity,
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,
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
};*/
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("toggleCreator", true);
}
[RemoteEvent("surgeryLeave")]
public static void LeaveSurgery(Player player)
{
player.Dimension = 0;
player.SafeTeleport(new Vector3(258.581, -1345.1406, 24.5378), Main.DEFAULT_SPAWN_HEADING, true);
ApplyCharacter(player);
UpdateCharacterCloth.LoadCharacterDefaults(player);
}
[RemoteEvent("SaveSurgery")]
public static void SaveSurgery(Player player, bool gender, string parentData, string featureData, string appearanceData, string hairAndColorData)
{
player.SafeTeleport(new Vector3(258.581, -1345.1406, 24.5378), Main.DEFAULT_SPAWN_HEADING, true);
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");
float similarity = jParentData.Value<float>("Similarity");
float skinSimilarity = jParentData.Value<float>("SkinSimilarity");
float noseWidth = jFeatureData.Value<float>(0);
float noseBottomHeight = jFeatureData.Value<float>(1);
float noseTipLength = jFeatureData.Value<float>(2);
float noseBridgeDepth = jFeatureData.Value<float>(3);
float noseTipHeight = jFeatureData.Value<float>(4);
float noseBroken = jFeatureData.Value<float>(5);
float browHeight = jFeatureData.Value<float>(6);
float browDepth = jFeatureData.Value<float>(7);
float cheekboneHeight = jFeatureData.Value<float>(8);
float cheekboneWidth = jFeatureData.Value<float>(9);
float cheekDepth = jFeatureData.Value<float>(10);
float eyeSize = jFeatureData.Value<float>(11);
float lipThickness = jFeatureData.Value<float>(12);
float jawWidth = jFeatureData.Value<float>(13);
float jawShape = jFeatureData.Value<float>(14);
float chinHeight = jFeatureData.Value<float>(15);
float chinDepth = jFeatureData.Value<float>(16);
float chinWidth = jFeatureData.Value<float>(17);
float chinIndent = jFeatureData.Value<float>(18);
float neckWidth = jFeatureData.Value<float>(19);
byte blemishes = jAppearanceData[0].Value<byte>("Value");
float blemishesOpacity = jAppearanceData[0].Value<byte>("Opacity");
byte facialHair = jAppearanceData[1].Value<byte>("Value");
float facialHairOpacity = jAppearanceData[1].Value<byte>("Opacity");
byte eyebrows = jAppearanceData[2].Value<byte>("Value");
float eyebrowsOpacity = jAppearanceData[2].Value<byte>("Opacity");
byte ageing = jAppearanceData[3].Value<byte>("Value");
float ageingOpacity = jAppearanceData[3].Value<byte>("Opacity");
byte makeup = jAppearanceData[4].Value<byte>("Value");
float makeupOpacity = jAppearanceData[4].Value<byte>("Opacity");
byte blush = jAppearanceData[5].Value<byte>("Value");
float blushOpacity = jAppearanceData[5].Value<byte>("Opacity");
byte complexion = jAppearanceData[6].Value<byte>("Value");
float complexionOpacity = jAppearanceData[6].Value<byte>("Opacity");
byte sunDamage = jAppearanceData[7].Value<byte>("Value");
float sunDamageOpacity = jAppearanceData[7].Value<byte>("Opacity");
byte lipstick = jAppearanceData[8].Value<byte>("Value");
float lipstickOpacity = jAppearanceData[8].Value<byte>("Opacity");
byte freckles = jAppearanceData[9].Value<byte>("Value");
float frecklesOpacity = jAppearanceData[9].Value<byte>("Opacity");
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);
}
}
}

View File

@@ -752,6 +752,12 @@ namespace ReallifeGamemode.Server.Managers
[RemoteEvent("CLIENT:InteractionMenu_Pay")]
public void InteractionMenu_Pay(Player player, string jsonNameOrId, string stringAmount)
{
if (player.GetUser().PlayedMinutes < 180)
{
player.SendNotification("~r~Du kannst Geld erst ab 3 Spielstunden vergeben");
return;
}
string nameOrId = (string)JsonConvert.DeserializeObject(jsonNameOrId);
int amount;
try

View File

@@ -776,6 +776,8 @@ namespace ReallifeGamemode.Server.Managers
"vicechee", //mod
"sheriffcoqm", //mod
"polcoquette", //mod
"pdrafter", //mod
"pdrafter2", //mod
};
private static readonly Dictionary<int, ushort> _serverVehicles = new Dictionary<int, ushort>();