diff --git a/ReallifeGamemode.Client/Interaction/worldinteraction.js b/ReallifeGamemode.Client/Interaction/worldinteraction.js new file mode 100644 index 00000000..92de52f2 --- /dev/null +++ b/ReallifeGamemode.Client/Interaction/worldinteraction.js @@ -0,0 +1,10 @@ + + +mp.events.add("SERVER:ShowAtmUi", (atmId, atmBalance) => { + mp.gui.cursor.show(true, true); + mp.gui.chat.show(false); + mp.game.ui.displayHud(false); + mp.game.ui.displayRadar(false); + + atmBrowser = mp.browsers.new("package://assets/html/atm/index.html"); +}); \ No newline at end of file diff --git a/ReallifeGamemode.Client/Player/keys.js b/ReallifeGamemode.Client/Player/keys.js index c11e34f6..24a0ab5b 100644 --- a/ReallifeGamemode.Client/Player/keys.js +++ b/ReallifeGamemode.Client/Player/keys.js @@ -26,21 +26,21 @@ mp.keys.bind(0x25, false, function () { } }); -//UP ARROW (Interaktion mit anderen Spielern) -mp.keys.bind(0x26, false, function () { - if (!globalData.InChat && !showInv && !globalData.Interaction) { - mp.events.callRemote("keyPress:UP_ARROW"); - } -}); +//UP ARROW (Interaktion mit Spielwelt) +//mp.keys.bind(0x26, false, function () { +// if (!globalData.InChat && !showInv && !globalData.Interaction) { +// mp.events.callRemote("keyPress:UP_ARROW"); +// } +//}); -//RIGHT ARROW (Interaktion mit anderen Spielern) +//RIGHT ARROW (Fraktionsinteraktion) mp.keys.bind(0x27, false, function () { if (!globalData.InChat && !showInv && !globalData.Interaction) { mp.events.callRemote("keyPress:RIGHT_ARROW"); } }); -//DOWN ARROW (Interaktion mit anderen Spielern) +//DOWN ARROW (Eigeninteraktion) mp.keys.bind(0x28, false, function () { if (!globalData.InChat && !showInv && !globalData.Interaction) { mp.events.callRemote("keyPress:DOWN_ARROW"); diff --git a/ReallifeGamemode.Client/ReallifeGamemode.Client.csproj b/ReallifeGamemode.Client/ReallifeGamemode.Client.csproj index b4cab92d..449d6d05 100644 --- a/ReallifeGamemode.Client/ReallifeGamemode.Client.csproj +++ b/ReallifeGamemode.Client/ReallifeGamemode.Client.csproj @@ -13,6 +13,8 @@ + + diff --git a/ReallifeGamemode.Client/assets/html/atm/index.html b/ReallifeGamemode.Client/assets/html/atm/index.html new file mode 100644 index 00000000..81415447 --- /dev/null +++ b/ReallifeGamemode.Client/assets/html/atm/index.html @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/ReallifeGamemode.Server/Commands/Admin.cs b/ReallifeGamemode.Server/Commands/Admin.cs index 94c7ae6e..f965971e 100644 --- a/ReallifeGamemode.Server/Commands/Admin.cs +++ b/ReallifeGamemode.Server/Commands/Admin.cs @@ -25,6 +25,7 @@ namespace ReallifeGamemode.Server.Commands { public class Admin : Script { + #region Test [Command("eat", "~m~Benutzung: ~s~/eat [Item]")] public void CmdAdminEat(Client player, string item) { @@ -57,6 +58,58 @@ namespace ReallifeGamemode.Server.Commands } } + [Command("myvehicles")] + public void CmdAdminMyVehicles(Client player) + { + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + player.SendChatMessage("Deine Fahrzeuge: "); + + int userID = player.GetUser().Id; + using (var loadData = new DatabaseContext()) + { + foreach (UserVehicle v in loadData.UserVehicles) + { + if (v.UserId == userID) + { + player.SendChatMessage("~b~" + v.Model); + } + } + } + } + + //TODO + [Command("fpay")] + public void FPay(Client player, string receiver, int amount) + { + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + using (var getFaction = new DatabaseContext()) + { + Entities.Faction receiverUser = getFaction.Factions.FirstOrDefault(u => u.Name == receiver); + + if (receiverUser == null) + { + player.SendChatMessage("~r~[FEHLER]~s~ Diese Fraktion existiert nicht."); + return; + } + + BankManager.TransferMoney(player.GetUser(), receiverUser, amount, "/FPAY"); + } + } + + [Command("saveall")] + public void SaveAll(Client player) + { + SaveManager.SaveAllOnSave(); + } + #endregion #region Support [Command("o", "~m~Benutzung: ~s~/o [Nachricht]", GreedyArg = true)] public void CmdAdminO(Client player, string message) @@ -221,8 +274,6 @@ namespace ReallifeGamemode.Server.Commands } } #endregion - - #region ALevel1 [Command("a", "~m~Benutzung: ~s~/a [Nachricht]", GreedyArg = true)] public void CmdAdminA(Client player, string message) @@ -734,8 +785,6 @@ namespace ReallifeGamemode.Server.Commands player.Position = player.Position.Add(new Vector3(0, 0, 2)); } #endregion - - #region ALevel2 [Command("sethp", "~m~Benutzung: ~s~/sethp [Spieler] (Hp)")] public void CmdAdminSetHp(Client player, string name, int hp = 100) @@ -808,8 +857,6 @@ namespace ReallifeGamemode.Server.Commands else player.Position = new Vector3(x, y, z); } #endregion - - #region ALevel3 [Command("veh", "~m~Benutzung: ~s~/veh [Fahrzeug] (Farbe 1) (Farbe 2)")] @@ -1026,10 +1073,19 @@ namespace ReallifeGamemode.Server.Commands player.SendChatMessage("~b~Du hast die Rüstung von " + target.Name + " auf " + armor + " gesetzt."); } #endregion - - #region ALevel1337 + [Command("quicksavemode", "~m~Benutzung: ~s~/quicksavemode [Modus]\nModi (klein schreiben): ~g~blip, ~r~atm")] + public void CmdAdminSetQuickSaveMode(Client player, string mode) + { + if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + player.SetData("quicksavemode", mode); + } + [Command("giveitem", "~m~Benutzung: ~s~/giveitem [Target] [Item ID] [Anzahl]")] public void CmdAdminGiveItem(Client player, string targetname, int itemId, int amount) { @@ -2225,7 +2281,6 @@ namespace ReallifeGamemode.Server.Commands } #endregion - #region ALevel1338 [Command("whitelist", "~m~Benutzung: ~s~/whitelist [Add / Remove] [Socialclub Name]")] @@ -2311,60 +2366,5 @@ namespace ReallifeGamemode.Server.Commands #endregion - - /* ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// */ - - //TEST COMMAND - [Command("myvehicles")] - public void CmdAdminMyVehicles(Client player) - { - if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) - { - ChatService.NotAuthorized(player); - return; - } - player.SendChatMessage("Deine Fahrzeuge: "); - - int userID = player.GetUser().Id; - using (var loadData = new DatabaseContext()) - { - foreach (UserVehicle v in loadData.UserVehicles) - { - if (v.UserId == userID) - { - player.SendChatMessage("~b~" + v.Model); - } - } - } - } - - //TODO - [Command("fpay")] - public void FPay(Client player, string receiver, int amount) - { - if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) - { - ChatService.NotAuthorized(player); - return; - } - using (var getFaction = new DatabaseContext()) - { - Entities.Faction receiverUser = getFaction.Factions.FirstOrDefault(u => u.Name == receiver); - - if(receiverUser == null) - { - player.SendChatMessage("~r~[FEHLER]~s~ Diese Fraktion existiert nicht."); - return; - } - - BankManager.TransferMoney(player.GetUser(), receiverUser, amount, "/FPAY"); - } - } - - [Command("saveall")] - public void SaveAll(Client player) - { - SaveManager.SaveAllOnSave(); - } } } diff --git a/ReallifeGamemode.Server/Entities/ATM.cs b/ReallifeGamemode.Server/Entities/ATM.cs new file mode 100644 index 00000000..b98cc4a9 --- /dev/null +++ b/ReallifeGamemode.Server/Entities/ATM.cs @@ -0,0 +1,32 @@ +using GTANetworkAPI; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +/** +* @overview Life of German Reallife - Entities ATM (ATM.cs) +* @author VegaZ +* @copyright (c) 2008 - 2018 Life of German +*/ + +namespace ReallifeGamemode.Server.Entities +{ + public class ATM + { + [Key] + public int Id { get; set; } + public int Balance { get; set; } + public float X { get; set; } + public float Y { get; set; } + public float Z { get; set; } + + [NotMapped] + public Vector3 Position => new Vector3(X, Y, Z); + + public bool Faulty { get; set; } = false; + public bool Active { get; set; } = true; + + } +} diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index c6c22644..e1b45eff 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -26,14 +26,35 @@ namespace ReallifeGamemode.Server.Events if (!player.IsLoggedIn()) return; if (player.GetData("editmode") == true && player.GetUser().IsAdmin(AdminLevel.HEADADMIN) == true) { - TempBlip tempBlip = NAPI.Data.GetWorldData("blipTemplate"); - SaveManager.OnSaveBlipData(player, tempBlip.Sprite.ToString(), tempBlip.Name, tempBlip.Scale.ToString(), tempBlip.Color.ToString(), - tempBlip.Transparency.ToString(), 200.ToString(), tempBlip.ShortRange.ToString(), 0.ToString(), 0.ToString()); - player.SendNotification("~y~Blip~s~ erstellt!", false); + var saveMode = player.GetData("quicksavemode"); + switch (saveMode) + { + case "none": + player.SendChatMessage("~r~Keinen Modus ausgewählt! ~y~/quicksavemode ~r~für mehr Infos!"); + break; + + case "blip": + TempBlip tempBlip = NAPI.Data.GetWorldData("blipTemplate"); + SaveManager.OnSaveBlipData(player, tempBlip.Sprite.ToString(), tempBlip.Name, tempBlip.Scale.ToString(), tempBlip.Color.ToString(), + tempBlip.Transparency.ToString(), 200.ToString(), tempBlip.ShortRange.ToString(), 0.ToString(), 0.ToString()); + player.SendNotification("~y~Blip~s~ erstellt!", false); + break; + + } + } GroundItem.PickUpGroundItem(player); } + [RemoteEvent("keyPress:UP_ARROW")] + public void KeyPressUpArrow(Client player) + { + if (!player.IsLoggedIn()) return; + if (player.HasData("nearATM")) + { + ATMManager.ShowAtmUi(player, player.GetData("nearATM")); + } + } [RemoteEvent("keyPress:LEFT_ARROW")] public void KeyPressLeftArrow(Client player) { diff --git a/ReallifeGamemode.Server/Events/Login.cs b/ReallifeGamemode.Server/Events/Login.cs index 86bd4930..9d0bda6a 100644 --- a/ReallifeGamemode.Server/Events/Login.cs +++ b/ReallifeGamemode.Server/Events/Login.cs @@ -48,6 +48,7 @@ namespace ReallifeGamemode.Server.Events if (user.IsAdmin(AdminLevel.HEADADMIN) == true) { player.SetData("editmode", false); + player.SetData("quicksavemode", "none"); } var userBankAccount = loginUser.UserBankAccounts.SingleOrDefault(u => u.UserId == user.Id); diff --git a/ReallifeGamemode.Server/Main.cs b/ReallifeGamemode.Server/Main.cs index 582bfa91..aa97822c 100644 --- a/ReallifeGamemode.Server/Main.cs +++ b/ReallifeGamemode.Server/Main.cs @@ -46,6 +46,7 @@ namespace ReallifeGamemode.Server BusinessManager.LoadBusinesses(); InteriorManager.LoadInteriors(); DoorManager.LoadDoors(); + ATMManager.InitATMs(); TempBlip tempBlip = new TempBlip() diff --git a/ReallifeGamemode.Server/Managers/ATMManager.cs b/ReallifeGamemode.Server/Managers/ATMManager.cs new file mode 100644 index 00000000..b1ecbfa0 --- /dev/null +++ b/ReallifeGamemode.Server/Managers/ATMManager.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using GTANetworkAPI; +using ReallifeGamemode.Server.Entities; +using ReallifeGamemode.Server.Models; + +/** +* @overview Life of German Reallife - Managers ATMManager (ATMManager.cs) +* @author VegaZ +* @copyright (c) 2008 - 2018 Life of German +*/ + +namespace ReallifeGamemode.Server.Managers +{ + public class ATMManager : Script + { + public static List ATMColShapes = new List(); + + public static void InitATMs() + { + using (var dbContext = new DatabaseContext()) + { + foreach (var currentATM in dbContext.Blips) + { + if (currentATM.Sprite == 500) + { + if(dbContext.ATMs.FirstOrDefault(a => a.X == currentATM.PositionX && a.Y == currentATM.PositionY && a.Z == currentATM.PositionZ) == null) + { + var dataSet = new ATM + { + X = currentATM.PositionX, + Y = currentATM.PositionY, + Z = currentATM.PositionZ + }; + dbContext.Add(dataSet); + } + else + { + continue; + } + } + } + dbContext.SaveChanges(); + LoadATMs(); + } + } + public static void LoadATMs() + { + using (var dbContext = new DatabaseContext()) + { + foreach (var currentATM in dbContext.ATMs) + { + var currentColShape = NAPI.ColShape.CreateCylinderColShape(new Vector3(currentATM.X, currentATM.Y, currentATM.Z), 2.5f, 3, 0); + currentColShape.OnEntityEnterColShape += EnterATMRange; + currentColShape.OnEntityExitColShape += ExitATMRange; + ATMColShapes.Add(currentColShape); + } + } + } + public static void EnterATMRange(ColShape colShape, Client client) + { + using (var dbContext = new DatabaseContext()) + { + var nearATM = dbContext.ATMs.FirstOrDefault(a => a.X == colShape.Position.X && a.Y == colShape.Position.Y && a.Z == colShape.Position.Z); + client.SetData("nearATM", nearATM.Id); + } + } + public static void ExitATMRange(ColShape colShape, Client client) + { + client.ResetData("nearATM"); + } + public static void ShowAtmUi(Client player, int atmId) + { + using (var dbContext = new DatabaseContext()) + { + var atmBalance = dbContext.ATMs.FirstOrDefault(a => a.Id == atmId); + player.TriggerEvent("SERVER:ShowAtmUi", atmId, atmBalance.Balance); + } + } + } +} diff --git a/ReallifeGamemode.Server/Managers/SaveManager.cs b/ReallifeGamemode.Server/Managers/SaveManager.cs index d127a65c..5764ec24 100644 --- a/ReallifeGamemode.Server/Managers/SaveManager.cs +++ b/ReallifeGamemode.Server/Managers/SaveManager.cs @@ -10,6 +10,7 @@ namespace ReallifeGamemode.Server.Managers { public class SaveManager : Script { + [RemoteEvent("OnSaveBlipData")] public static void OnSaveBlipData(Client player, string blipSprite, string blipName, string blipScale, string blipColor, string blipAlpha, string blipDrawDistance, string blipShortRange, string blipRotation, string blipDimension) @@ -148,16 +149,6 @@ namespace ReallifeGamemode.Server.Managers // Alle Fahrzeuge using (var saveAll = new DatabaseContext()) { - foreach(ServerVehicle veh in saveAll.ServerVehicles) - { - Vehicle v = VehicleManager.GetVehicleFromServerVehicle(veh); - - veh.PositionX = v.Position.X; - veh.PositionY = v.Position.Y; - veh.PositionZ = v.Position.Z; - veh.Heading = v.Heading; - } - //Alle Spieler foreach (Client player in NAPI.Pools.GetAllPlayers()) { @@ -168,6 +159,16 @@ namespace ReallifeGamemode.Server.Managers user.PositionZ = pos.Z; } + foreach (ServerVehicle veh in saveAll.ServerVehicles) + { + Vehicle v = VehicleManager.GetVehicleFromServerVehicle(veh); + + veh.PositionX = v.Position.X; + veh.PositionY = v.Position.Y; + veh.PositionZ = v.Position.Z; + veh.Heading = v.Heading; + } + saveAll.SaveChanges(); } } diff --git a/ReallifeGamemode.Server/Migrations/20190309184251_ATM.Designer.cs b/ReallifeGamemode.Server/Migrations/20190309184251_ATM.Designer.cs new file mode 100644 index 00000000..03f89742 --- /dev/null +++ b/ReallifeGamemode.Server/Migrations/20190309184251_ATM.Designer.cs @@ -0,0 +1,1024 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using ReallifeGamemode.Server.Models; + +namespace ReallifeGamemode.Migrations +{ + [DbContext(typeof(DatabaseContext))] + [Migration("20190309184251_ATM")] + partial class ATM + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.2.0-rtm-35687") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.ATM", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Balance"); + + b.Property("Faulty"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("ATMs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Ban", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Applied"); + + b.Property("BannedBy"); + + b.Property("Reason"); + + b.Property("UntilDateTime"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Bans"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.BusinessBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Balance"); + + b.Property("BusinessId"); + + b.HasKey("Id"); + + b.HasIndex("BusinessId") + .IsUnique(); + + b.ToTable("BusinessBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Character", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Ageing"); + + b.Property("AgeingOpacity"); + + b.Property("BeardColor"); + + b.Property("Blemishes"); + + b.Property("BlemishesOpacity"); + + b.Property("Blush"); + + b.Property("BlushColor"); + + b.Property("BlushOpacity"); + + b.Property("BrowDepth"); + + b.Property("BrowHeight"); + + b.Property("CheekDepth"); + + b.Property("CheekboneHeight"); + + b.Property("CheekboneWidth"); + + b.Property("ChestHair"); + + b.Property("ChestHairColor"); + + b.Property("ChestHairOpacity"); + + b.Property("ChinDepth"); + + b.Property("ChinHeight"); + + b.Property("ChinIndent"); + + b.Property("ChinWidth"); + + b.Property("Complexion"); + + b.Property("ComplexionOpacity"); + + b.Property("EyeColor"); + + b.Property("EyeSize"); + + b.Property("EyebrowColor"); + + b.Property("Eyebrows"); + + b.Property("EyebrowsOpacity"); + + b.Property("FacialHair"); + + b.Property("FacialHairOpacity"); + + b.Property("Father"); + + b.Property("Freckles"); + + b.Property("FrecklesOpacity"); + + b.Property("Gender"); + + b.Property("Hair"); + + b.Property("HairColor"); + + b.Property("HairHighlightColor"); + + b.Property("JawShape"); + + b.Property("JawWidth"); + + b.Property("LipThickness"); + + b.Property("Lipstick"); + + b.Property("LipstickColor"); + + b.Property("LipstickOpacity"); + + b.Property("Makeup"); + + b.Property("MakeupOpacity"); + + b.Property("Mother"); + + b.Property("NeckWidth"); + + b.Property("NoseBottomHeight"); + + b.Property("NoseBridgeDepth"); + + b.Property("NoseBroken"); + + b.Property("NoseTipHeight"); + + b.Property("NoseTipLength"); + + b.Property("NoseWidth"); + + b.Property("Similarity"); + + b.Property("SkinSimilarity"); + + b.Property("SunDamage"); + + b.Property("SunDamageOpacity"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.CharacterCloth", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClothId"); + + b.Property("Duty"); + + b.Property("SlotId"); + + b.Property("SlotType"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("CharacterClothes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.ClothCombination", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Gender"); + + b.Property("Top"); + + b.Property("Torso"); + + b.Property("Undershirt"); + + b.HasKey("Id"); + + b.ToTable("ClothCombinations"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Door", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Category"); + + b.Property("FactionId"); + + b.Property("Locked"); + + b.Property("Model"); + + b.Property("Name"); + + b.Property("Radius"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("Doors"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.DutyCloth", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClothId"); + + b.Property("FactionId"); + + b.Property("Gender"); + + b.Property("SlotId"); + + b.Property("SlotType"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("DutyClothes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Faction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .HasMaxLength(32); + + b.Property("StateOwned"); + + b.HasKey("Id"); + + b.ToTable("Factions"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Balance"); + + b.Property("Bic") + .HasMaxLength(12); + + b.Property("FactionId"); + + b.Property("Iban") + .HasMaxLength(32); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("FactionId"); + + b.Property("Order"); + + b.Property("RankName"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionRanks"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.GotoPoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Description") + .HasMaxLength(32); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("GotoPoints"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Interior", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("EnterPositionStr") + .HasColumnName("EnterPosition"); + + b.Property("ExitPositionStr") + .HasColumnName("ExitPosition"); + + b.Property("Name"); + + b.HasKey("Id"); + + b.ToTable("Interiors"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.BankAccountTransactionHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Fee"); + + b.Property("MoneySent"); + + b.Property("NewReceiverBalance"); + + b.Property("NewSenderBalance"); + + b.Property("Origin") + .HasMaxLength(32); + + b.Property("Receiver") + .HasMaxLength(32); + + b.Property("ReceiverBalance"); + + b.Property("Sender") + .HasMaxLength(32); + + b.Property("SenderBalance"); + + b.Property("Timestamp") + .ValueGeneratedOnAdd(); + + b.HasKey("Id"); + + b.ToTable("BankAccountTransactionLogs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.Death", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CauseOfDeath") + .HasMaxLength(64); + + b.Property("KillerHeading"); + + b.Property("KillerId"); + + b.Property("KillerPositionX"); + + b.Property("KillerPositionY"); + + b.Property("KillerPositionZ"); + + b.Property("Timestamp") + .ValueGeneratedOnAdd(); + + b.Property("VictimHeading"); + + b.Property("VictimId"); + + b.Property("VictimPositionX"); + + b.Property("VictimPositionY"); + + b.Property("VictimPositionZ"); + + b.HasKey("Id"); + + b.HasIndex("KillerId"); + + b.HasIndex("VictimId"); + + b.ToTable("DeathLogs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.News", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Caption"); + + b.Property("Content"); + + b.Property("Timestamp"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("News"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedBlip", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Alpha"); + + b.Property("Color"); + + b.Property("Dimension"); + + b.Property("DrawDistance"); + + b.Property("Name"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("Rotation"); + + b.Property("Scale"); + + b.Property("ShortRange"); + + b.Property("Sprite"); + + b.HasKey("Id"); + + b.ToTable("Blips"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedMarker", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("ColorA"); + + b.Property("ColorB"); + + b.Property("ColorG"); + + b.Property("ColorR"); + + b.Property("Dimension"); + + b.Property("DirectionX"); + + b.Property("DirectionY"); + + b.Property("DirectionZ"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("RotationX"); + + b.Property("RotationY"); + + b.Property("RotationZ"); + + b.Property("Scale"); + + b.Property("Type"); + + b.Property("Visible"); + + b.HasKey("Id"); + + b.ToTable("Markers"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedPed", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Dimension"); + + b.Property("HashModel"); + + b.Property("Heading"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.HasKey("Id"); + + b.ToTable("Peds"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedPickup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Dimension"); + + b.Property("PositionX") + .HasMaxLength(128); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("RespawnTime"); + + b.Property("RotationX"); + + b.Property("RotationY"); + + b.Property("RotationZ"); + + b.Property("Vehicle"); + + b.HasKey("Id"); + + b.ToTable("Pickups"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedTextLabel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("ColorA"); + + b.Property("ColorB"); + + b.Property("ColorG"); + + b.Property("ColorR"); + + b.Property("Dimension"); + + b.Property("DrawDistance"); + + b.Property("Font"); + + b.Property("LOS"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("Text") + .IsRequired(); + + b.HasKey("Id"); + + b.ToTable("TextLabels"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.ServerVehicle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active") + .ValueGeneratedOnAdd() + .HasDefaultValue(true); + + b.Property("Discriminator") + .IsRequired(); + + b.Property("DistanceDriven"); + + b.Property("Heading"); + + b.Property("Locked"); + + b.Property("Model"); + + b.Property("NumberPlate") + .HasMaxLength(8); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("PrimaryColor"); + + b.Property("SecondaryColor"); + + b.HasKey("Id"); + + b.ToTable("ServerVehicles"); + + b.HasDiscriminator("Discriminator").HasValue("ServerVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AdminLevel"); + + b.Property("BanId"); + + b.Property("BusinessId"); + + b.Property("CharacterId"); + + b.Property("Dead"); + + b.Property("Email") + .HasMaxLength(64); + + b.Property("FactionId"); + + b.Property("FactionLeader"); + + b.Property("FactionRankId"); + + b.Property("LogUserId"); + + b.Property("Name") + .HasMaxLength(32); + + b.Property("Password") + .HasMaxLength(64); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("RegistrationDate") + .ValueGeneratedOnAdd(); + + b.Property("SocialClubName") + .HasMaxLength(32); + + b.HasKey("Id"); + + b.HasIndex("BanId"); + + b.HasIndex("BusinessId") + .IsUnique(); + + b.HasIndex("CharacterId"); + + b.HasIndex("FactionId"); + + b.HasIndex("FactionRankId"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Balance"); + + b.Property("Bic") + .HasMaxLength(12); + + b.Property("Iban") + .HasMaxLength(32); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Amount"); + + b.Property("ItemId"); + + b.Property("Slot"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserItems"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.VehicleMod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ModId"); + + b.Property("ServerVehicleId"); + + b.Property("Slot"); + + b.HasKey("Id"); + + b.HasIndex("ServerVehicleId", "Slot") + .IsUnique(); + + b.ToTable("VehicleMods"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Whitelist", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("SocialClubName"); + + b.HasKey("Id"); + + b.ToTable("WhitelistEntries"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle"); + + b.Property("FactionId"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionVehicles"); + + b.HasDiscriminator().HasValue("FactionVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle"); + + b.HasDiscriminator().HasValue("SavedVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.ShopVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle"); + + b.Property("BusinessId"); + + b.Property("Price"); + + b.Property("ShopId"); + + b.ToTable("ShopVehicles"); + + b.HasDiscriminator().HasValue("ShopVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle"); + + b.Property("UserId"); + + b.HasIndex("UserId"); + + b.ToTable("UserVehicles"); + + b.HasDiscriminator().HasValue("UserVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Ban", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Character", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.CharacterCloth", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Door", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.DutyCloth", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionBankAccount", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionRank", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.Death", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "Killer") + .WithMany() + .HasForeignKey("KillerId"); + + b.HasOne("ReallifeGamemode.Server.Entities.User", "Victim") + .WithMany() + .HasForeignKey("VictimId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.News", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.User", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Ban", "Ban") + .WithMany() + .HasForeignKey("BanId"); + + b.HasOne("ReallifeGamemode.Server.Entities.Character", "Character") + .WithMany() + .HasForeignKey("CharacterId"); + + b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + + b.HasOne("ReallifeGamemode.Server.Entities.FactionRank", "FactionRank") + .WithMany() + .HasForeignKey("FactionRankId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserBankAccount", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserItem", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.VehicleMod", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.ServerVehicle", "Vehicle") + .WithMany() + .HasForeignKey("ServerVehicleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionVehicle", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserVehicle", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/ReallifeGamemode.Server/Migrations/20190309184251_ATM.cs b/ReallifeGamemode.Server/Migrations/20190309184251_ATM.cs new file mode 100644 index 00000000..724816d6 --- /dev/null +++ b/ReallifeGamemode.Server/Migrations/20190309184251_ATM.cs @@ -0,0 +1,35 @@ +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace ReallifeGamemode.Migrations +{ + public partial class ATM : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "ATMs", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Balance = table.Column(nullable: false), + X = table.Column(nullable: false), + Y = table.Column(nullable: false), + Z = table.Column(nullable: false), + Faulty = table.Column(nullable: false), + Active = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ATMs", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ATMs"); + } + } +} diff --git a/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs b/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs index 52160aa4..4a66fda1 100644 --- a/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs +++ b/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs @@ -17,6 +17,28 @@ namespace ReallifeGamemode.Migrations .HasAnnotation("ProductVersion", "2.2.0-rtm-35687") .HasAnnotation("Relational:MaxIdentifierLength", 64); + modelBuilder.Entity("ReallifeGamemode.Server.Entities.ATM", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Balance"); + + b.Property("Faulty"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("ATMs"); + }); + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Ban", b => { b.Property("Id") diff --git a/ReallifeGamemode.Server/Models/DatabaseContext.cs b/ReallifeGamemode.Server/Models/DatabaseContext.cs index f50f9982..cebe6c9e 100644 --- a/ReallifeGamemode.Server/Models/DatabaseContext.cs +++ b/ReallifeGamemode.Server/Models/DatabaseContext.cs @@ -64,6 +64,7 @@ namespace ReallifeGamemode.Server.Models public DbSet DeathLogs { get; set; } //Saves + public DbSet ATMs { get; set; } public DbSet Blips { get; set; } public DbSet Doors { get; set; } public DbSet GotoPoints { get; set; } @@ -74,6 +75,7 @@ namespace ReallifeGamemode.Server.Models public DbSet Vehicles { get; set; } public DbSet ShopVehicles { get; set; } + // Business public DbSet BusinessBankAccounts { get; set; }