Miese Corona Zeiten push für Lenhardt
This commit is contained in:
@@ -1,207 +1,204 @@
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Server.Business;
|
||||
using System;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Entities.Saves;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Server.Business;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
|
||||
namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
public class SaveManager : Script
|
||||
{
|
||||
|
||||
[RemoteEvent("OnSaveBlipData")]
|
||||
public static void OnSaveBlipData(Player player, string blipSprite, string blipName, string blipScale, string blipColor,
|
||||
string blipAlpha, string blipDrawDistance, string blipShortRange, string blipRotation, string blipDimension)
|
||||
{
|
||||
float x = player.Position.X;
|
||||
float y = player.Position.Y;
|
||||
float z = player.Position.Z;
|
||||
short sprite = short.Parse(blipSprite);
|
||||
string name = blipName;
|
||||
float scale = float.Parse(blipScale);
|
||||
byte color = Convert.ToByte(blipColor);
|
||||
byte alpha = Convert.ToByte(blipAlpha);
|
||||
float drawDistance = float.Parse(blipDrawDistance);
|
||||
bool shortRange = bool.Parse(blipShortRange);
|
||||
float rotation = float.Parse(blipRotation);
|
||||
byte dimension = Convert.ToByte(blipDimension);
|
||||
|
||||
NAPI.Blip.CreateBlip(uint.Parse(blipSprite), new Vector3(x, y, z), scale, color, name, alpha, drawDistance, shortRange, short.Parse(blipRotation), dimension);
|
||||
|
||||
using (var saveData = new DatabaseContext())
|
||||
{
|
||||
var dataSet = new SavedBlip
|
||||
[RemoteEvent("OnSaveBlipData")]
|
||||
public static void OnSaveBlipData(Player player, string blipSprite, string blipName, string blipScale, string blipColor,
|
||||
string blipAlpha, string blipDrawDistance, string blipShortRange, string blipRotation, string blipDimension)
|
||||
{
|
||||
Sprite = sprite,
|
||||
PositionX = x,
|
||||
PositionY = y,
|
||||
PositionZ = z,
|
||||
Name = blipName,
|
||||
Scale = scale,
|
||||
Color = color,
|
||||
Alpha = alpha,
|
||||
DrawDistance = drawDistance,
|
||||
ShortRange = shortRange,
|
||||
Rotation = rotation,
|
||||
Dimension = dimension,
|
||||
Active = true
|
||||
};
|
||||
saveData.Blips.Add(dataSet);
|
||||
saveData.SaveChanges();
|
||||
}
|
||||
}
|
||||
float x = player.Position.X;
|
||||
float y = player.Position.Y;
|
||||
float z = player.Position.Z;
|
||||
short sprite = short.Parse(blipSprite);
|
||||
string name = blipName;
|
||||
float scale = float.Parse(blipScale);
|
||||
byte color = Convert.ToByte(blipColor);
|
||||
byte alpha = Convert.ToByte(blipAlpha);
|
||||
float drawDistance = float.Parse(blipDrawDistance);
|
||||
bool shortRange = bool.Parse(blipShortRange);
|
||||
float rotation = float.Parse(blipRotation);
|
||||
byte dimension = Convert.ToByte(blipDimension);
|
||||
|
||||
public static Vehicle SaveVehicleData(Vehicle veh, VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading,
|
||||
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked)
|
||||
{
|
||||
using (var saveData = new DatabaseContext())
|
||||
{
|
||||
var dataSet = new SavedVehicle
|
||||
NAPI.Blip.CreateBlip(uint.Parse(blipSprite), new Vector3(x, y, z), scale, color, name, alpha, drawDistance, shortRange, short.Parse(blipRotation), dimension);
|
||||
|
||||
using (var saveData = new DatabaseContext())
|
||||
{
|
||||
var dataSet = new SavedBlip
|
||||
{
|
||||
Sprite = sprite,
|
||||
PositionX = x,
|
||||
PositionY = y,
|
||||
PositionZ = z,
|
||||
Name = blipName,
|
||||
Scale = scale,
|
||||
Color = color,
|
||||
Alpha = alpha,
|
||||
DrawDistance = drawDistance,
|
||||
ShortRange = shortRange,
|
||||
Rotation = rotation,
|
||||
Dimension = dimension,
|
||||
Active = true
|
||||
};
|
||||
saveData.Blips.Add(dataSet);
|
||||
saveData.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public static Vehicle SaveVehicleData(Vehicle veh, VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading,
|
||||
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked)
|
||||
{
|
||||
Model = vehicleModel,
|
||||
PositionX = vehiclePosition.X,
|
||||
PositionY = vehiclePosition.Y,
|
||||
PositionZ = vehiclePosition.Z,
|
||||
Heading = vehicleHeading,
|
||||
NumberPlate = vehicleNumberPlate,
|
||||
PrimaryColor = vehiclePrimaryColor,
|
||||
SecondaryColor = vehicleSecondaryColor,
|
||||
Locked = vehicleLocked,
|
||||
Active = true
|
||||
};
|
||||
saveData.Vehicles.Add(dataSet);
|
||||
saveData.SaveChanges();
|
||||
using (var saveData = new DatabaseContext())
|
||||
{
|
||||
var dataSet = new SavedVehicle
|
||||
{
|
||||
Model = vehicleModel,
|
||||
PositionX = vehiclePosition.X,
|
||||
PositionY = vehiclePosition.Y,
|
||||
PositionZ = vehiclePosition.Z,
|
||||
Heading = vehicleHeading,
|
||||
NumberPlate = vehicleNumberPlate,
|
||||
PrimaryColor = vehiclePrimaryColor,
|
||||
SecondaryColor = vehicleSecondaryColor,
|
||||
Locked = vehicleLocked,
|
||||
Active = true
|
||||
};
|
||||
saveData.Vehicles.Add(dataSet);
|
||||
saveData.SaveChanges();
|
||||
|
||||
return dataSet.Spawn(veh);
|
||||
}
|
||||
}
|
||||
return dataSet.Spawn(veh);
|
||||
}
|
||||
}
|
||||
|
||||
public static Vehicle SaveJobVehicleData(Vehicle veh, VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading,
|
||||
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, int jobId)
|
||||
{
|
||||
using (var saveData = new DatabaseContext())
|
||||
{
|
||||
var dataSet = new JobVehicle
|
||||
public static Vehicle SaveJobVehicleData(Vehicle veh, VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading,
|
||||
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, int jobId)
|
||||
{
|
||||
Model = vehicleModel,
|
||||
JobId = jobId,
|
||||
PositionX = vehiclePosition.X,
|
||||
PositionY = vehiclePosition.Y,
|
||||
PositionZ = vehiclePosition.Z,
|
||||
Heading = vehicleHeading,
|
||||
NumberPlate = vehicleNumberPlate,
|
||||
PrimaryColor = vehiclePrimaryColor,
|
||||
SecondaryColor = vehicleSecondaryColor,
|
||||
Locked = vehicleLocked,
|
||||
Active = true
|
||||
};
|
||||
saveData.JobVehicles.Add(dataSet);
|
||||
saveData.SaveChanges();
|
||||
using (var saveData = new DatabaseContext())
|
||||
{
|
||||
var dataSet = new JobVehicle
|
||||
{
|
||||
Model = vehicleModel,
|
||||
JobId = jobId,
|
||||
PositionX = vehiclePosition.X,
|
||||
PositionY = vehiclePosition.Y,
|
||||
PositionZ = vehiclePosition.Z,
|
||||
Heading = vehicleHeading,
|
||||
NumberPlate = vehicleNumberPlate,
|
||||
PrimaryColor = vehiclePrimaryColor,
|
||||
SecondaryColor = vehicleSecondaryColor,
|
||||
Locked = vehicleLocked,
|
||||
Active = true
|
||||
};
|
||||
saveData.JobVehicles.Add(dataSet);
|
||||
saveData.SaveChanges();
|
||||
|
||||
return dataSet.Spawn(veh);
|
||||
}
|
||||
}
|
||||
return dataSet.Spawn(veh);
|
||||
}
|
||||
}
|
||||
|
||||
public static Vehicle SaveSchoolVehicleData(Vehicle veh, VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading,
|
||||
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, int schoolId)
|
||||
{
|
||||
using (var saveData = new DatabaseContext())
|
||||
{
|
||||
var dataSet = new SchoolVehicle
|
||||
public static Vehicle SaveSchoolVehicleData(Vehicle veh, VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading,
|
||||
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, int schoolId)
|
||||
{
|
||||
Model = vehicleModel,
|
||||
SchoolId = schoolId,
|
||||
PositionX = vehiclePosition.X,
|
||||
PositionY = vehiclePosition.Y,
|
||||
PositionZ = vehiclePosition.Z,
|
||||
Heading = vehicleHeading,
|
||||
NumberPlate = vehicleNumberPlate,
|
||||
PrimaryColor = vehiclePrimaryColor,
|
||||
SecondaryColor = vehicleSecondaryColor,
|
||||
Locked = vehicleLocked,
|
||||
Active = true
|
||||
};
|
||||
saveData.SchoolVehicles.Add(dataSet);
|
||||
saveData.SaveChanges();
|
||||
using (var saveData = new DatabaseContext())
|
||||
{
|
||||
var dataSet = new SchoolVehicle
|
||||
{
|
||||
Model = vehicleModel,
|
||||
SchoolId = schoolId,
|
||||
PositionX = vehiclePosition.X,
|
||||
PositionY = vehiclePosition.Y,
|
||||
PositionZ = vehiclePosition.Z,
|
||||
Heading = vehicleHeading,
|
||||
NumberPlate = vehicleNumberPlate,
|
||||
PrimaryColor = vehiclePrimaryColor,
|
||||
SecondaryColor = vehicleSecondaryColor,
|
||||
Locked = vehicleLocked,
|
||||
Active = true
|
||||
};
|
||||
saveData.SchoolVehicles.Add(dataSet);
|
||||
saveData.SaveChanges();
|
||||
|
||||
return dataSet.Spawn(veh);
|
||||
}
|
||||
}
|
||||
return dataSet.Spawn(veh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Vehicle SaveFactionVehicleData(Vehicle veh, VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading,
|
||||
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, int[] factionId, int livery)
|
||||
{
|
||||
using (var saveData = new DatabaseContext())
|
||||
{
|
||||
var dataSet = new FactionVehicle
|
||||
public static Vehicle SaveFactionVehicleData(Vehicle veh, VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading,
|
||||
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, int[] factionId, int livery)
|
||||
{
|
||||
Model = vehicleModel,
|
||||
Owners = JsonConvert.SerializeObject(factionId),
|
||||
PositionX = vehiclePosition.X,
|
||||
PositionY = vehiclePosition.Y,
|
||||
PositionZ = vehiclePosition.Z,
|
||||
Heading = vehicleHeading,
|
||||
NumberPlate = vehicleNumberPlate,
|
||||
PrimaryColor = vehiclePrimaryColor,
|
||||
SecondaryColor = vehicleSecondaryColor,
|
||||
Locked = vehicleLocked,
|
||||
Active = true,
|
||||
Livery = livery
|
||||
};
|
||||
saveData.FactionVehicles.Add(dataSet);
|
||||
saveData.SaveChanges();
|
||||
using (var saveData = new DatabaseContext())
|
||||
{
|
||||
var dataSet = new FactionVehicle
|
||||
{
|
||||
Model = vehicleModel,
|
||||
Owners = JsonConvert.SerializeObject(factionId),
|
||||
PositionX = vehiclePosition.X,
|
||||
PositionY = vehiclePosition.Y,
|
||||
PositionZ = vehiclePosition.Z,
|
||||
Heading = vehicleHeading,
|
||||
NumberPlate = vehicleNumberPlate,
|
||||
PrimaryColor = vehiclePrimaryColor,
|
||||
SecondaryColor = vehicleSecondaryColor,
|
||||
Locked = vehicleLocked,
|
||||
Active = true,
|
||||
Livery = livery
|
||||
};
|
||||
saveData.FactionVehicles.Add(dataSet);
|
||||
saveData.SaveChanges();
|
||||
|
||||
return dataSet.Spawn(veh);
|
||||
}
|
||||
}
|
||||
return dataSet.Spawn(veh);
|
||||
}
|
||||
}
|
||||
|
||||
public static Vehicle SaveShopVehicleData(Vehicle veh, VehicleHash vehicleModel, string vehicleModelName, Vector3 vehiclePosition, float vehicleHeading,
|
||||
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, BusinessBase business, int price)
|
||||
{
|
||||
using (var saveData = new DatabaseContext())
|
||||
{
|
||||
var dataSet = new ShopVehicle
|
||||
public static Vehicle SaveShopVehicleData(Vehicle veh, VehicleHash vehicleModel, string vehicleModelName, Vector3 vehiclePosition, float vehicleHeading,
|
||||
string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, BusinessBase business, int price)
|
||||
{
|
||||
Model = vehicleModel,
|
||||
PositionX = vehiclePosition.X,
|
||||
PositionY = vehiclePosition.Y,
|
||||
PositionZ = vehiclePosition.Z,
|
||||
Heading = vehicleHeading,
|
||||
NumberPlate = vehicleNumberPlate,
|
||||
PrimaryColor = vehiclePrimaryColor,
|
||||
SecondaryColor = vehicleSecondaryColor,
|
||||
Active = true,
|
||||
BusinessId = business.Id,
|
||||
Price = price
|
||||
};
|
||||
saveData.ShopVehicles.Add(dataSet);
|
||||
saveData.SaveChanges();
|
||||
using (var saveData = new DatabaseContext())
|
||||
{
|
||||
var dataSet = new ShopVehicle
|
||||
{
|
||||
Model = vehicleModel,
|
||||
PositionX = vehiclePosition.X,
|
||||
PositionY = vehiclePosition.Y,
|
||||
PositionZ = vehiclePosition.Z,
|
||||
Heading = vehicleHeading,
|
||||
NumberPlate = vehicleNumberPlate,
|
||||
PrimaryColor = vehiclePrimaryColor,
|
||||
SecondaryColor = vehicleSecondaryColor,
|
||||
Active = true,
|
||||
BusinessId = business.Id,
|
||||
Price = price
|
||||
};
|
||||
saveData.ShopVehicles.Add(dataSet);
|
||||
saveData.SaveChanges();
|
||||
|
||||
return dataSet.Spawn(veh);
|
||||
}
|
||||
}
|
||||
return dataSet.Spawn(veh);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveGotoPoint(Player player, string description)
|
||||
{
|
||||
using (var saveData = new DatabaseContext())
|
||||
{
|
||||
var dataSet = new GotoPoint
|
||||
public static void SaveGotoPoint(Player player, string description)
|
||||
{
|
||||
Description = description,
|
||||
X = player.Position.X,
|
||||
Y = player.Position.Y,
|
||||
Z = player.Position.Z,
|
||||
Active = true
|
||||
};
|
||||
saveData.GotoPoints.Add(dataSet);
|
||||
saveData.SaveChanges();
|
||||
}
|
||||
}
|
||||
using (var saveData = new DatabaseContext())
|
||||
{
|
||||
var dataSet = new GotoPoint
|
||||
{
|
||||
Description = description,
|
||||
X = player.Position.X,
|
||||
Y = player.Position.Y,
|
||||
Z = player.Position.Z,
|
||||
Active = true
|
||||
};
|
||||
saveData.GotoPoints.Add(dataSet);
|
||||
saveData.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveAllOnSave()
|
||||
{
|
||||
@@ -222,8 +219,8 @@ namespace ReallifeGamemode.Server.Managers
|
||||
user.PositionZ = pos.Z;
|
||||
}
|
||||
|
||||
saveAll.SaveChanges();
|
||||
}
|
||||
saveAll.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user