From 5b9c08011e76503bc448471c505716d92c0c8df0 Mon Sep 17 00:00:00 2001 From: hydrant Date: Sun, 28 Jul 2019 20:43:23 +0200 Subject: [PATCH] Add House Menu --- ReallifeGamemode.Client/House/house.ts | 122 ++ ReallifeGamemode.Client/index.ts | 3 + .../Commands/AdminCommands.cs | 7 + ReallifeGamemode.Server/Entities/House.cs | 4 + .../Entities/HouseRentals.cs | 25 + .../Extensions/IntegerExtension.cs | 2 +- ReallifeGamemode.Server/Main.cs | 9 +- .../Managers/HouseManager.cs | 150 +- ...0190728142431_HouseEnhancments.Designer.cs | 1269 +++++++++++++++++ .../20190728142431_HouseEnhancments.cs | 73 + .../DatabaseContextModelSnapshot.cs | 33 + .../Models/DatabaseContext.cs | 1 + 12 files changed, 1686 insertions(+), 12 deletions(-) create mode 100644 ReallifeGamemode.Client/House/house.ts create mode 100644 ReallifeGamemode.Server/Entities/HouseRentals.cs create mode 100644 ReallifeGamemode.Server/Migrations/20190728142431_HouseEnhancments.Designer.cs create mode 100644 ReallifeGamemode.Server/Migrations/20190728142431_HouseEnhancments.cs diff --git a/ReallifeGamemode.Client/House/house.ts b/ReallifeGamemode.Client/House/house.ts new file mode 100644 index 00000000..31034570 --- /dev/null +++ b/ReallifeGamemode.Client/House/house.ts @@ -0,0 +1,122 @@ +import { Menu, Point, UIMenuItem, Color } from 'NativeUI'; +import moneyFormat from '../moneyformat'; +import InputHelper from '../inputhelper'; + +export default function house(globalData: GlobalData) { + + var houseMenu: Menu; + var houseData: any; + var houseState: number; + + var keyBound = false; + + mp.events.add("SERVER:ShowHouseMenu", (dataStr, state: number) => { + houseData = JSON.parse(dataStr); + houseState = state; + mp.gui.chat.push(state.toString()); + mp.gui.chat.push(dataStr); + + mp.game.ui.setTextComponentFormat('STRING'); + mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um das Hausmenü öffnen'); + mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1); + + + + mp.keys.bind(0x45, false, keyPressHandler); + keyBound = true; + }); + + function keyPressHandler() { + mp.gui.chat.push("open menu"); + mp.game.ui.clearHelp(true); + houseMenu = new Menu("Hausverwaltung", houseData.Type, new Point(50, 50), null, null); + + globalData.InMenu = true; + mp.gui.chat.push(houseState.toString()); + + var rentInItem: UIMenuItem; + + var buyHouseItem: UIMenuItem; + + var setRentalFeeItem: UIMenuItem; + var cancelRentalsItem: UIMenuItem; + + var houseRentals = 0; + + if (houseData.Rentals) houseRentals = houseData.Rentals.length; + + if (houseState === -1) { // Keine Beziehung zum Haus + mp.gui.chat.push("einmieten"); + rentInItem = new UIMenuItem("Einmieten", "Miete dich in das Haus ein"); + rentInItem.SetRightLabel(moneyFormat(houseData.RentalFee.toString(), 0)); + houseMenu.AddItem(rentInItem); + } else if (houseState === 0) { // Haus hat keinen Eigentümer + mp.gui.chat.push("kaufen"); + buyHouseItem = new UIMenuItem("Haus kaufen", "Kaufe das Haus"); + buyHouseItem.SetRightLabel(moneyFormat(houseData.Price, 0) + "$"); + houseMenu.AddItem(buyHouseItem); + } else if (houseState === 1) { // Hausbesitzer + mp.gui.chat.push("besitzer"); + setRentalFeeItem = new UIMenuItem("Miete setzen", "Setze den Mietpreis"); + setRentalFeeItem.SetRightLabel(moneyFormat(houseData.RentalFee, 0) + "$"); + houseMenu.AddItem(setRentalFeeItem); + + cancelRentalsItem = new UIMenuItem("Mieter", "Liste deine Mieter auf"); + cancelRentalsItem.SetRightLabel(houseRentals.toString()); + + if (houseRentals > 0) { + var cancelRentalsMenu = new Menu("Mieter", "Kündige einen Mieter", new Point(50, 50), null, null); + cancelRentalsMenu.Visible = false; + + houseData.Rentals.forEach(rental => { + var item = new UIMenuItem(rental.Name, ""); + item.SetRightLabel("Kündigen"); + cancelRentalsMenu.AddItem(item); + }); + + houseMenu.BindMenuToItem(cancelRentalsMenu, cancelRentalsItem); + } + } + + var cancelItem = new UIMenuItem("Abbrechen"); + cancelItem.BackColor = new Color(213, 0, 0); + cancelItem.HighlightedBackColor = new Color(229, 57, 53); + houseMenu.AddItem(cancelItem); + + houseMenu.Open(); + + houseMenu.ItemSelect.on((item, index) => { + if (item === cancelItem) { + mp.events.call("SERVER:CloseHouseMenu"); + } else if (item === buyHouseItem) { + mp.events.callRemote("CLIENT:House_BuyHouse"); + mp.events.call("SERVER:CloseHouseMenu"); + } else if (item === setRentalFeeItem) { + var rentalFeeInput = new InputHelper("Wie viel soll die Miete betragen?", globalData); + rentalFeeInput.getValue(data => { + if (isNaN(data)) { + return; + } + + var rentalFee = parseInt(data); + + mp.events.callRemote("CLIENT:House_SetRentalFee", rentalFee); + mp.events.call("SERVER:CloseHouseMenu"); + }); + } + }); + } + + mp.events.add("SERVER:CloseHouseMenu", () => { + mp.game.ui.clearHelp(true); + globalData.InMenu = false; + if (houseMenu != null) { + houseMenu.Close(); + } + + if (keyBound) { + keyBound = false; + mp.keys.unbind(0x45, false, keyPressHandler); + } + }); +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts index 88897968..e5b8af06 100644 --- a/ReallifeGamemode.Client/index.ts +++ b/ReallifeGamemode.Client/index.ts @@ -25,6 +25,9 @@ var inMenu = false; mp.game.vehicle.defaultEngineBehaviour = false; +import house from './house/house'; +house(globalData); + import vehicleEntering from './vehiclesync/entering'; vehicleEntering(globalData); diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index 052afbf8..2866137f 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -2499,6 +2499,13 @@ namespace ReallifeGamemode.Server.Commands return; } + if(nearHouse.OwnerId != null) + { + dbContext.Users.Where(u => u.Id == nearHouse.OwnerId).First().HouseId = null; + } + + dbContext.SaveChanges(); + dbContext.Houses.Remove(nearHouse); dbContext.SaveChanges(); diff --git a/ReallifeGamemode.Server/Entities/House.cs b/ReallifeGamemode.Server/Entities/House.cs index 9cf55faf..7113d984 100644 --- a/ReallifeGamemode.Server/Entities/House.cs +++ b/ReallifeGamemode.Server/Entities/House.cs @@ -23,6 +23,10 @@ namespace ReallifeGamemode.Server.Entities public float Y { get; set; } public float Z { get; set; } + public int RentalFee { get; set; } + + public bool CanRentIn { get; set; } + [NotMapped] public Vector3 Position => new Vector3(X, Y, Z); diff --git a/ReallifeGamemode.Server/Entities/HouseRentals.cs b/ReallifeGamemode.Server/Entities/HouseRentals.cs new file mode 100644 index 00000000..bc851178 --- /dev/null +++ b/ReallifeGamemode.Server/Entities/HouseRentals.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace ReallifeGamemode.Server.Entities +{ + public class HouseRentals + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; set; } + + [ForeignKey("House")] + public int? HouseId { get; set; } + + public House House { get; set; } + + [ForeignKey("User")] + public int? UserId { get; set; } + + public User User { get; set; } + } +} diff --git a/ReallifeGamemode.Server/Extensions/IntegerExtension.cs b/ReallifeGamemode.Server/Extensions/IntegerExtension.cs index 9d59b688..495853de 100644 --- a/ReallifeGamemode.Server/Extensions/IntegerExtension.cs +++ b/ReallifeGamemode.Server/Extensions/IntegerExtension.cs @@ -12,7 +12,7 @@ namespace ReallifeGamemode.Server.Extensions } public static string ToMoneyString(this int money) { - return "$" + string.Format(Main.SERVER_CULTURE, "{0:C0}", money).Replace("€", ""); + return "$" + string.Format(Main.SERVER_CULTURE, "{0:C0}", money).Replace("€", "").Trim(); } } } diff --git a/ReallifeGamemode.Server/Main.cs b/ReallifeGamemode.Server/Main.cs index 4fba2471..008914df 100644 --- a/ReallifeGamemode.Server/Main.cs +++ b/ReallifeGamemode.Server/Main.cs @@ -1,5 +1,6 @@ using System.Globalization; using GTANetworkAPI; +using Newtonsoft.Json; using ReallifeGamemode.Server.Classes; using ReallifeGamemode.Server.Finance; using ReallifeGamemode.Server.Managers; @@ -32,7 +33,13 @@ namespace ReallifeGamemode.Server NAPI.Server.SetAutoRespawnAfterDeath(false); NAPI.Data.SetWorldData("playerCreatorDimension", 0); - + JsonConvert.DefaultSettings = () => + { + return new JsonSerializerSettings() + { + NullValueHandling = NullValueHandling.Ignore + }; + }; InventoryManager.LoadItems(); diff --git a/ReallifeGamemode.Server/Managers/HouseManager.cs b/ReallifeGamemode.Server/Managers/HouseManager.cs index 66ad6780..4c6c5507 100644 --- a/ReallifeGamemode.Server/Managers/HouseManager.cs +++ b/ReallifeGamemode.Server/Managers/HouseManager.cs @@ -1,8 +1,10 @@ using GTANetworkAPI; using Microsoft.EntityFrameworkCore; +using Newtonsoft.Json; using ReallifeGamemode.Server.Entities; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Models; +using ReallifeGamemode.Server.Services; using System; using System.Collections.Generic; using System.Linq; @@ -10,24 +12,25 @@ using System.Text; namespace ReallifeGamemode.Server.Managers { - class HouseManager + class HouseManager : Script { private static readonly Dictionary houseMarkers = new Dictionary(); private static readonly Dictionary houseLabels = new Dictionary(); private static readonly Dictionary houseColShapes = new Dictionary(); - public static void LoadHouses() + public static async void LoadHouses() { using (var dbContext = new DatabaseContext()) { - foreach (House house in dbContext.Houses.Include(h => h.Owner)) + List houses = await dbContext.Houses.Include(h => h.Owner).ToListAsync(); + foreach (House house in houses) { - LoadHouse(house, false); + LoadHouse(house, true); } } } - public async static void ReloadAllHouses() + public static async void ReloadAllHouses() { using (var dbContext = new DatabaseContext()) { @@ -45,12 +48,12 @@ namespace ReallifeGamemode.Server.Managers { using (dbContext = new DatabaseContext()) { - return dbContext.Houses.Where(h => h.Position.DistanceTo(position) <= 5f).FirstOrDefault(); + return dbContext.Houses.Where(h => h.Position.DistanceTo(position) <= 5f).OrderBy(h => h.Position.DistanceTo(position)).FirstOrDefault(); } } else { - return dbContext.Houses.Where(h => h.Position.DistanceTo(position) <= 5f).FirstOrDefault(); + return dbContext.Houses.Where(h => h.Position.DistanceTo(position) <= 5f).OrderBy(h => h.Position.DistanceTo(position)).FirstOrDefault(); } } @@ -74,17 +77,80 @@ namespace ReallifeGamemode.Server.Managers } } + public static House GetHouseById(int id, DatabaseContext dbContext = null) + { + if (dbContext == null) + { + using (dbContext = new DatabaseContext()) + { + return dbContext.Houses.Where(h => h.Id == id).FirstOrDefault(); + } + } + else + { + return dbContext.Houses.Where(h => h.Id == id).FirstOrDefault(); + } + } + public static void LoadHouse(House house, bool loadUser = true) { if (loadUser) house = house.Refresh(); houseMarkers[house.Id] = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, house.Position.Subtract(new Vector3(0, 0, 1.7)), new Vector3(), new Vector3(), 1.6f, new Color(255, 255, 255)); - string text = $"~g~Zum Verkauf\n~s~{house.Type}\nPreis: ~y~{house.Price.ToMoneyString()}"; - if (house.User != null) + string text = $"~g~Zum Verkauf\n~s~{house.Type}\nPreis: ~y~{(house.Price == 0 ? "~r~Nicht verkäuflich" : house.Price.ToMoneyString())}"; + if (house.OwnerId != null) { - text = $"{house.Type}\n~s~Besitzer: ~y~{house.User.Name}"; + text = $"{house.Type}\n~s~Besitzer: ~y~{house.Owner.Name}\n~s~Mietpreis: ~g~{house.RentalFee.ToMoneyString()}"; } houseLabels[house.Id] = NAPI.TextLabel.CreateTextLabel(text, house.Position, 10f, 1f, 0, new Color(255, 255, 255)); + + if (house.Price != 0) + { + houseColShapes[house.Id] = NAPI.ColShape.CreateCylinderColShape(house.Position.Subtract(new Vector3(0, 0, 2)), 2.0f, 5f); + + houseColShapes[house.Id].Entity().OnEntityEnterColShape += HouseManager_OnEntityEnterColShape; + houseColShapes[house.Id].Entity().OnEntityExitColShape += HouseManager_OnEntityExitColShape; + } + } + + private static void HouseManager_OnEntityExitColShape(ColShape colShape, Client client) + { + client.TriggerEvent("SERVER:CloseHouseMenu"); + } + + private static void HouseManager_OnEntityEnterColShape(ColShape colShape, Client client) + { + if (!client.IsLoggedIn()) return; + if (!houseColShapes.ContainsValue(colShape.Handle)) + { + return; + } + int houseId = houseColShapes.Where(p => p.Value.Value == colShape.Handle.Value).FirstOrDefault().Key; + House house = GetHouseById(houseId); + User user = client.GetUser(); + + var userHouseStatus = -1; + + + using (var dbContext = new DatabaseContext()) + { + if (house.OwnerId == null) userHouseStatus = 0; + else if (house.OwnerId == user?.Id) userHouseStatus = 1; + else if (dbContext.HouseRentals.Where(h => h.HouseId == houseId && h.UserId == user.Id).Count() == 1) userHouseStatus = 2; + + var newHouse = new + { + house.RentalFee, + house.Price, + house.Type, + Rentals = dbContext.HouseRentals.Where(h => h.Id == houseId).Include(h => h.UserId).Select(h => new + { + h.User.Name + }).ToList() + }; + + client.TriggerEvent("SERVER:ShowHouseMenu", JsonConvert.SerializeObject(newHouse), userHouseStatus); + } } public static void RemoveHouse(House house) @@ -100,6 +166,70 @@ namespace ReallifeGamemode.Server.Managers houseLabels[house.Id].Entity().Delete(); houseLabels.Remove(house.Id); } + + if (houseColShapes.ContainsKey(house.Id)) + { + houseColShapes[house.Id].Entity().Delete(); + houseColShapes.Remove(house.Id); + } + } + + [RemoteEvent("CLIENT:House_BuyHouse")] + public void HouseManagerBuyHouseEvent(Client player) + { + using (var dbContext = new DatabaseContext()) + { + User user = player.GetUser(dbContext); + + if(user.HouseId != null) + { + ChatService.ErrorMessage(player, "Du kann nicht mehrere Häuser besitzen"); + return; + } + + House house = GetNearHouse(player.Position, dbContext); + + var userBank = user.GetBankAccount(dbContext); + + if (userBank.Balance < house.Price) + { + ChatService.ErrorMessage(player, $"Du hast nicht genug Geld für das Haus ({house.Price.ToMoneyString()})"); + return; + } + + house.Owner = user; + user.House = house; + + userBank.Balance -= house.Price; + + dbContext.SaveChanges(); + + RemoveHouse(house); + LoadHouse(house); + } + } + + [RemoteEvent("CLIENT:House_SetRentalFee")] + public void HouseManagerSetRentalFeeEvent(Client player, int rentalFee) + { + using (var dbContext = new DatabaseContext()) + { + User user = player.GetUser(dbContext); + + if (user.HouseId == null) + { + ChatService.ErrorMessage(player, "Du besitzt kein Haus"); + return; + } + + House house = GetHouseById(user.HouseId.Value, dbContext); + + house.RentalFee = rentalFee; + + player.SendNotification($"Der Mietpreis wurde auf ~g~{rentalFee.ToMoneyString()}~s~ gesetzt"); + + dbContext.SaveChanges(); + } } } } diff --git a/ReallifeGamemode.Server/Migrations/20190728142431_HouseEnhancments.Designer.cs b/ReallifeGamemode.Server/Migrations/20190728142431_HouseEnhancments.Designer.cs new file mode 100644 index 00000000..850b24c4 --- /dev/null +++ b/ReallifeGamemode.Server/Migrations/20190728142431_HouseEnhancments.Designer.cs @@ -0,0 +1,1269 @@ +// +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("20190728142431_HouseEnhancments")] + partial class HouseEnhancments + { + 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.BusRoute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.HasKey("Id"); + + b.ToTable("BusRoutes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.BusRoutePoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BusRouteId"); + + b.Property("Description"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.HasIndex("BusRouteId"); + + b.ToTable("BusRoutesPoints"); + }); + + 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("Texture"); + + 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.FactionWeapon", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("FactionId"); + + b.Property("Rank"); + + b.Property("SlotID"); + + b.Property("WeaponModel"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionWeapons"); + }); + + 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.Group", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.HasKey("Id"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Balance"); + + b.Property("GroupId"); + + b.HasKey("Id"); + + b.HasIndex("GroupId"); + + b.ToTable("GroupBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.House", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CanRentIn"); + + b.Property("OwnerId"); + + b.Property("Price"); + + b.Property("RentalFee"); + + b.Property("Type"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.ToTable("Houses"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.HouseRentals", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("HouseId"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("HouseId"); + + b.HasIndex("UserId"); + + b.ToTable("HouseRentals"); + }); + + 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("Livery"); + + 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.Property("TankAmount"); + + b.HasKey("Id"); + + b.ToTable("ServerVehicles"); + + b.HasDiscriminator("Discriminator").HasValue("ServerVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.TuningGarage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("TuningGarages"); + }); + + 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("GroupId"); + + b.Property("GroupRank"); + + b.Property("Handmoney"); + + b.Property("HouseId"); + + b.Property("JailTime"); + + b.Property("JobId"); + + b.Property("LogUserId"); + + b.Property("Name") + .HasMaxLength(32); + + b.Property("Password") + .HasMaxLength(64); + + b.Property("PaydayTimer"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("RegistrationDate") + .ValueGeneratedOnAdd(); + + b.Property("SocialClubName") + .HasMaxLength(32); + + b.Property("Wage"); + + b.Property("Wanteds"); + + b.HasKey("Id"); + + b.HasIndex("BanId"); + + b.HasIndex("BusinessId") + .IsUnique(); + + b.HasIndex("CharacterId"); + + b.HasIndex("FactionId"); + + b.HasIndex("FactionRankId"); + + b.HasIndex("GroupId"); + + b.HasIndex("HouseId"); + + 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.GroupVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle"); + + b.Property("GroupId"); + + b.HasIndex("GroupId"); + + b.HasDiscriminator().HasValue("GroupVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.JobVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle"); + + b.Property("JobId"); + + b.HasDiscriminator().HasValue("JobVehicle"); + }); + + 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.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.BusRoutePoint", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.BusRoute", "BusRoute") + .WithMany("RoutePoints") + .HasForeignKey("BusRouteId"); + }); + + 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.FactionWeapon", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupBankAccount", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.House", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.HouseRentals", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.House", "House") + .WithMany() + .HasForeignKey("HouseId"); + + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + 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"); + + b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + + b.HasOne("ReallifeGamemode.Server.Entities.House", "House") + .WithMany() + .HasForeignKey("HouseId"); + }); + + 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.GroupVehicle", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + }); + + 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/20190728142431_HouseEnhancments.cs b/ReallifeGamemode.Server/Migrations/20190728142431_HouseEnhancments.cs new file mode 100644 index 00000000..24be80d3 --- /dev/null +++ b/ReallifeGamemode.Server/Migrations/20190728142431_HouseEnhancments.cs @@ -0,0 +1,73 @@ +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace ReallifeGamemode.Migrations +{ + public partial class HouseEnhancments : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CanRentIn", + table: "Houses", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "RentalFee", + table: "Houses", + nullable: false, + defaultValue: 0); + + migrationBuilder.CreateTable( + name: "HouseRentals", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + HouseId = table.Column(nullable: true), + UserId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_HouseRentals", x => x.Id); + table.ForeignKey( + name: "FK_HouseRentals_Houses_HouseId", + column: x => x.HouseId, + principalTable: "Houses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_HouseRentals_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_HouseRentals_HouseId", + table: "HouseRentals", + column: "HouseId"); + + migrationBuilder.CreateIndex( + name: "IX_HouseRentals_UserId", + table: "HouseRentals", + column: "UserId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "HouseRentals"); + + migrationBuilder.DropColumn( + name: "CanRentIn", + table: "Houses"); + + migrationBuilder.DropColumn( + name: "RentalFee", + table: "Houses"); + } + } +} diff --git a/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs b/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs index 18234cc8..97f30add 100644 --- a/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs +++ b/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs @@ -463,10 +463,14 @@ namespace ReallifeGamemode.Migrations b.Property("Id") .ValueGeneratedOnAdd(); + b.Property("CanRentIn"); + b.Property("OwnerId"); b.Property("Price"); + b.Property("RentalFee"); + b.Property("Type"); b.Property("X"); @@ -482,6 +486,24 @@ namespace ReallifeGamemode.Migrations b.ToTable("Houses"); }); + modelBuilder.Entity("ReallifeGamemode.Server.Entities.HouseRentals", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("HouseId"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("HouseId"); + + b.HasIndex("UserId"); + + b.ToTable("HouseRentals"); + }); + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Interior", b => { b.Property("Id") @@ -1137,6 +1159,17 @@ namespace ReallifeGamemode.Migrations .HasForeignKey("OwnerId"); }); + modelBuilder.Entity("ReallifeGamemode.Server.Entities.HouseRentals", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.House", "House") + .WithMany() + .HasForeignKey("HouseId"); + + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.Death", b => { b.HasOne("ReallifeGamemode.Server.Entities.User", "Killer") diff --git a/ReallifeGamemode.Server/Models/DatabaseContext.cs b/ReallifeGamemode.Server/Models/DatabaseContext.cs index 290ef78d..8a2ab48d 100644 --- a/ReallifeGamemode.Server/Models/DatabaseContext.cs +++ b/ReallifeGamemode.Server/Models/DatabaseContext.cs @@ -106,6 +106,7 @@ namespace ReallifeGamemode.Server.Models // Houses public DbSet Houses { get; set; } + public DbSet HouseRentals { get; set; } // Bus Routes public DbSet BusRoutes { get; set; }