diff --git a/ReallifeGamemode.Client/Interaction/drivingschool.ts b/ReallifeGamemode.Client/Interaction/drivingschool.ts new file mode 100644 index 00000000..05e2610c --- /dev/null +++ b/ReallifeGamemode.Client/Interaction/drivingschool.ts @@ -0,0 +1,71 @@ +import * as NativeUI from 'NativeUI'; + +const Menu = NativeUI.Menu; +const UIMenuItem = NativeUI.UIMenuItem; +const UIMenuListItem = NativeUI.UIMenuListItem; +const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem; +const BadgeStyle = NativeUI.BadgeStyle; +const Point = NativeUI.Point; +const ItemsCollection = NativeUI.ItemsCollection; +const Color = NativeUI.Color; + +let screenRes = mp.game.graphics.getScreenResolution(0, 0); +let saveItem = new UIMenuItem("Bestätigen", ""); +saveItem.BackColor = new Color(13, 71, 161); +saveItem.HighlightedBackColor = new Color(25, 118, 210); + +let cancelItem = new UIMenuItem("Abbrechen", ""); +cancelItem.BackColor = new Color(213, 0, 0); +cancelItem.HighlightedBackColor = new Color(229, 57, 53); + +export default function drivingSchoolList(globalData: GlobalData) { + + var drivingMenu: NativeUI.Menu; + + var stages; + + var stage = ""; + + + //Weapon Menu + + mp.events.add('showDrivingSchoolSelector', () => { + if (!globalData.InMenu) { + + globalData.InMenu = true; + + drivingMenu = new Menu("Fahrschule", "", new Point(50, 50), null, null); + + + drivingMenu.AddItem(new UIMenuListItem("Prüfung", "", new ItemsCollection(["Auto", "Motorrad"]))); + + drivingMenu.AddItem(saveItem); + drivingMenu.AddItem(cancelItem); + drivingMenu.Visible = true; + + drivingMenu.ListChange.on((item, index) => { + switch (item.Text) { + case "Prüfung": + stage = String(item.SelectedItem.DisplayText); + break; + } + }); + + drivingMenu.ItemSelect.on((item) => { + if (item.Text === "Auto") { + mp.events.callRemote("startDrivingSchool"); + drivingMenu.Close(); + globalData.InMenu = false; + } else if (item.Text === "Motorrad") { + mp.events.callRemote("startBikeSchool"); + drivingMenu.Close(); + globalData.InMenu = false; + } + }); + + drivingMenu.MenuClose.on(() => { + globalData.InMenu = false; + }); + } + }); +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts index 9ab178a5..1fadef44 100644 --- a/ReallifeGamemode.Client/index.ts +++ b/ReallifeGamemode.Client/index.ts @@ -93,6 +93,9 @@ interiors(globalData); import factionInteraction from './Interaction/factioninteraction'; factionInteraction(globalData); +import drivingSchoolList from './Interaction/drivingschool'; +drivingSchoolList(globalData); + import elevatorList from './Interaction/elevator'; elevatorList(globalData); diff --git a/ReallifeGamemode.Client/util/drivingschool.ts b/ReallifeGamemode.Client/util/drivingschool.ts index f94e316b..a51d572e 100644 --- a/ReallifeGamemode.Client/util/drivingschool.ts +++ b/ReallifeGamemode.Client/util/drivingschool.ts @@ -69,7 +69,7 @@ export default function drivingSchoolHandle(globalData: GlobalData) { timerCheckpoint = setInterval(timerWaitHere, 100); }); - + mp.events.add('checkWait', () => { if (waitFinished == false) { mp.gui.chat.push("Du hast an der letzten Kreuzung nicht gewartet"); @@ -114,7 +114,7 @@ export default function drivingSchoolHandle(globalData: GlobalData) { } }; - + function timerPlayerInVehicle() { if (timerSet) { mp.events.callRemote('timerCheckVehicle'); @@ -125,6 +125,6 @@ export default function drivingSchoolHandle(globalData: GlobalData) { if (globalData.InChat || globalData.InInput || globalData.InMenu) return; mp.events.call('removeDrivingSchoolMenu', false); - mp.events.callRemote('startDrivingSchool'); + mp.events.call('showDrivingSchoolSelector'); } } \ No newline at end of file diff --git a/ReallifeGamemode.Database/Entities/User.cs b/ReallifeGamemode.Database/Entities/User.cs index 5da3eb1c..7b1213b0 100644 --- a/ReallifeGamemode.Database/Entities/User.cs +++ b/ReallifeGamemode.Database/Entities/User.cs @@ -94,6 +94,8 @@ namespace ReallifeGamemode.Database.Entities public bool FlyingLicensePlane { get; set; } = false; + public bool DriverLicenseBike { get; set; } = false; + public bool IsAdmin(AdminLevel level) => AdminLevel >= level; public IBankAccount GetBankAccount(DatabaseContext databaseContext = null) diff --git a/ReallifeGamemode.Database/Migrations/20191101204247_DriverLicenseBike.Designer.cs b/ReallifeGamemode.Database/Migrations/20191101204247_DriverLicenseBike.Designer.cs new file mode 100644 index 00000000..c19516e0 --- /dev/null +++ b/ReallifeGamemode.Database/Migrations/20191101204247_DriverLicenseBike.Designer.cs @@ -0,0 +1,1358 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using ReallifeGamemode.Database.Models; + +namespace ReallifeGamemode.Database.Migrations +{ + [DbContext(typeof(DatabaseContext))] + [Migration("20191101204247_DriverLicenseBike")] + partial class DriverLicenseBike + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.1.11-servicing-32099") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("ReallifeGamemode.Database.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.Database.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.Database.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.Database.Entities.BusinessData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BusinessId"); + + b.Property("Price"); + + b.HasKey("Id"); + + b.ToTable("BusinessData"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusRoute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.HasKey("Id"); + + b.ToTable("BusRoutes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.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.Database.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.Database.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.Database.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.Database.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.Database.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.Database.Entities.Faction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .HasMaxLength(32); + + b.Property("StateOwned"); + + b.Property("WeaponDealTime"); + + b.HasKey("Id"); + + b.ToTable("Factions"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.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.Database.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.Database.Entities.FactionWeapon", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Ammount"); + + b.Property("FactionId"); + + b.Property("Rank"); + + b.Property("SlotID"); + + b.Property("WeaponModel"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionWeapons"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.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.Database.Entities.Group", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.HasKey("Id"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.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.Database.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.Database.Entities.HouseRental", 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.Database.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.Database.Entities.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("Heading"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("Locations"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.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.Database.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.Database.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.Database.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.Database.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.Database.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.Database.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.Database.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.Database.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.Database.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.Database.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AdminLevel"); + + b.Property("BanId"); + + b.Property("BusinessId"); + + b.Property("CharacterId"); + + b.Property("Dead"); + + b.Property("DriverLicenseBike"); + + b.Property("DriverLicenseVehicle"); + + b.Property("Email") + .HasMaxLength(64); + + b.Property("FactionId"); + + b.Property("FactionLeader"); + + b.Property("FactionRankId"); + + b.Property("FlyingLicensePlane"); + + 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.Database.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.Database.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.Database.Entities.VehicleItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Amount"); + + b.Property("ItemId"); + + b.Property("Slot"); + + b.Property("VehicleId"); + + b.HasKey("Id"); + + b.HasIndex("VehicleId"); + + b.ToTable("VehicleItems"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.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.Database.Entities.Whitelist", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("SocialClubName"); + + b.HasKey("Id"); + + b.ToTable("WhitelistEntries"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("FactionId"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionVehicles"); + + b.HasDiscriminator().HasValue("FactionVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("GroupId"); + + b.HasIndex("GroupId"); + + b.ToTable("GroupVehicle"); + + b.HasDiscriminator().HasValue("GroupVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.JobVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("JobId"); + + b.ToTable("JobVehicle"); + + b.HasDiscriminator().HasValue("JobVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + + b.ToTable("SavedVehicle"); + + b.HasDiscriminator().HasValue("SavedVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.SchoolVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("SchoolId"); + + b.ToTable("SchoolVehicle"); + + b.HasDiscriminator().HasValue("SchoolVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ShopVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("BusinessId"); + + b.Property("Price"); + + b.ToTable("ShopVehicles"); + + b.HasDiscriminator().HasValue("ShopVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("UserId"); + + b.HasIndex("UserId"); + + b.ToTable("UserVehicles"); + + b.HasDiscriminator().HasValue("UserVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Ban", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusRoutePoint", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.BusRoute", "BusRoute") + .WithMany("RoutePoints") + .HasForeignKey("BusRouteId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Character", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.CharacterCloth", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Door", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.DutyCloth", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionBankAccount", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionRank", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionWeapon", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupBankAccount", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.House", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.HouseRental", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.House", "House") + .WithMany() + .HasForeignKey("HouseId"); + + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Death", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "Killer") + .WithMany() + .HasForeignKey("KillerId"); + + b.HasOne("ReallifeGamemode.Database.Entities.User", "Victim") + .WithMany() + .HasForeignKey("VictimId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.News", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.User", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Ban", "Ban") + .WithMany() + .HasForeignKey("BanId"); + + b.HasOne("ReallifeGamemode.Database.Entities.Character", "Character") + .WithMany() + .HasForeignKey("CharacterId"); + + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + + b.HasOne("ReallifeGamemode.Database.Entities.FactionRank", "FactionRank") + .WithMany() + .HasForeignKey("FactionRankId"); + + b.HasOne("ReallifeGamemode.Database.Entities.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + + b.HasOne("ReallifeGamemode.Database.Entities.House", "House") + .WithMany() + .HasForeignKey("HouseId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserBankAccount", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserItem", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleItem", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.ServerVehicle", "Vehicle") + .WithMany() + .HasForeignKey("VehicleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleMod", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.ServerVehicle", "Vehicle") + .WithMany() + .HasForeignKey("ServerVehicleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionVehicle", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupVehicle", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserVehicle", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/ReallifeGamemode.Database/Migrations/20191101204247_DriverLicenseBike.cs b/ReallifeGamemode.Database/Migrations/20191101204247_DriverLicenseBike.cs new file mode 100644 index 00000000..d8dd80d7 --- /dev/null +++ b/ReallifeGamemode.Database/Migrations/20191101204247_DriverLicenseBike.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace ReallifeGamemode.Database.Migrations +{ + public partial class DriverLicenseBike : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "DriverLicenseBike", + table: "Users", + nullable: false, + defaultValue: false); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "DriverLicenseBike", + table: "Users"); + } + } +} diff --git a/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs b/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs index b912ce2b..f001f8c8 100644 --- a/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs +++ b/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs @@ -905,6 +905,8 @@ namespace ReallifeGamemode.Database.Migrations b.Property("Dead"); + b.Property("DriverLicenseBike"); + b.Property("DriverLicenseVehicle"); b.Property("Email") diff --git a/ReallifeGamemode.Server/DrivingSchool/DrivingSchool.cs b/ReallifeGamemode.Server/DrivingSchool/DrivingSchool.cs index 126106be..4e22a58f 100644 --- a/ReallifeGamemode.Server/DrivingSchool/DrivingSchool.cs +++ b/ReallifeGamemode.Server/DrivingSchool/DrivingSchool.cs @@ -19,6 +19,28 @@ namespace ReallifeGamemode.Server.DrivingSchool private static ColShape _colShape; public static Vector3 Position { get; } + private readonly IReadOnlyCollection BikeRoute = new List + { + new Vector3(-741.98, -1283.46, 4.17), + new Vector3(-702.49, -1246.57, 8.89), + new Vector3(-659.88, -1506.23, 9.94), + new Vector3(-423.72, -1770.7, 19.13), + new Vector3(-265.74, -1453.66, 29.74), + new Vector3(51.22, -1370.96, 27.84), + new Vector3(161.51, -1246.64, 36.5), + new Vector3(702.39, -1247.82, 33.98), + new Vector3(779.54, -1245.7, 25.08), + new Vector3(719.58, -1153.01, 31.75), + new Vector3(-233.65, -1133.09, 21.52), + new Vector3(-511.5, -1079.99, 21.37), + new Vector3(-707.52, -1239.48, 8.91), + new Vector3(-788.42, -1318.54, 3.49), + }.AsReadOnly(); + + private readonly IReadOnlyCollection StopBike = new List + { + new Vector3(-813.57, -1290.37, 4.59), + }.AsReadOnly(); private readonly IReadOnlyCollection DrivingRoute = new List { //BEGIN @@ -59,15 +81,15 @@ namespace ReallifeGamemode.Server.DrivingSchool new Vector3(-617.66, -1259.34, 9.82), new Vector3(-758.35, -1285.03, 3.48), }.AsReadOnly(); - private readonly IReadOnlyCollection Stop = new List + private readonly IReadOnlyCollection StopCar = new List { - new Vector3(-788.66, -1278.75, 5), + new Vector3(-788.66, -1278.75, 4), }.AsReadOnly(); public static void Setup() { - informationLabel = NAPI.TextLabel.CreateTextLabel("Fahrschule", new Vector3(-813.17, -1354.5, 5.14), 20.0f, 1.3f, 0, new Color(255, 255, 255)); + informationLabel = NAPI.TextLabel.CreateTextLabel("Fahrschule\n~y~Auto ~s~- $~g~2500\n~y~Motorrad ~s~- $~g~3500", new Vector3(-813.17, -1354.5, 5.14), 20.0f, 1.3f, 0, new Color(255, 255, 255)); marker = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, new Vector3(-813.17, -1354.5, 4.14), new Vector3(), new Vector3(), 1f, new Color(255, 255, 255)); _colShape = NAPI.ColShape.CreateSphereColShape(new Vector3(-813.17, -1354.5, 5.14), 3f); @@ -127,6 +149,12 @@ namespace ReallifeGamemode.Server.DrivingSchool user.TriggerEvent("stopTimer"); CheckPointHandle.StartCheckPointRoute(user, DrivingRoute, 0, 1, 7, "drivingSchoolEvent"); } + if(schoolVehicle.SchoolId == 2) + { + user.TriggerEvent("renderTextOnScreen", "Gut nun kann die Prüfung losgehen."); + user.TriggerEvent("stopTimer"); + CheckPointHandle.StartCheckPointRoute(user, BikeRoute, 0, 1, 7, "drivingSchoolEvent"); + } } } @@ -174,10 +202,77 @@ namespace ReallifeGamemode.Server.DrivingSchool else if (checkpoint == 32) { user.TriggerEvent("renderTextOnScreen", "Parke nun das Auto an der markierten Stelle."); - CheckPointHandle.StartCheckPointRoute(user, Stop, 5000, 1, 7, "drivingSchoolEventEnd"); + CheckPointHandle.StartCheckPointRoute(user, StopCar, 5000, 1, 7, "drivingSchoolEventEnd"); } } - + + + [RemoteEvent("startBikeSchool")] + public void StartBikeSchool(Client client) + { + User user = client.GetUser(); + if (user.DriverLicenseVehicle || client.HasData("ActiveSchool")) + return; + + if (user.Handmoney < 3500) + { + client.SendNotification("~r~Du brauchst ~g~$3500~r~ auf der Hand um die Prüfung zu starten.", true); + return; + } + + using (var dbContext = new DatabaseContext()) + { + User payer = client.GetUser(dbContext); + payer.Handmoney -= 3500; + client.TriggerEvent("SERVER:SET_HANDMONEY", payer.Handmoney); + dbContext.SaveChanges(); + } + + client.SetData("ActiveSchool", 0); + client.TriggerEvent("renderTextOnScreen", "Sie haben die Führerscheinprüfung gestartet. Steigen Sie in eines der Fahrschulmotorräder ein."); + client.TriggerEvent("waitPlayerEntersVehicle"); + } + + + [RemoteEvent("bikeSchoolEventEnd")] + public void bikeSchoolEventEnd(Client user, int checkpoint) + { + user.TriggerEvent("renderTextOnScreen", "Du hast den Führerschein bestanden. Glückwunsch!"); + user.ResetData("ActiveSchool"); + using (var dbContext = new DatabaseContext()) + { + User drivingUser = user.GetUser(dbContext); + drivingUser.DriverLicenseBike = true; + dbContext.SaveChanges(); + } + + Vehicle veh = user.Vehicle; + user.WarpOutOfVehicle(); + ServerVehicle sVeh = VehicleManager.GetServerVehicleFromVehicle(veh); + VehicleStreaming.SetEngineState(veh, false); + VehicleStreaming.SetLockStatus(veh, false); + NAPI.Entity.SetEntityVelocity(veh.Handle, new Vector3(0, 0, 0)); + veh.Position = sVeh.Position; + veh.Rotation = new Vector3(0, 0, sVeh.Heading); + + user.Position = new Vector3(-813.17, -1354.5, 4.14); + } + + + [RemoteEvent("bikeSchoolEvent")] + public void bikeSchoolEvent(Client user, int checkpoint) + { + if (checkpoint == 0) + { + user.TriggerEvent("renderTextOnScreen", "Sollten Sie aus dem Fahrzeug aussteigen fallen Sie durch."); + } + else if (checkpoint == 13) + { + user.TriggerEvent("renderTextOnScreen", "Parke nun das Auto an der markierten Stelle."); + CheckPointHandle.StartCheckPointRoute(user, StopBike, 5000, 1, 7, "bikeSchoolEventEnd"); + } + } + } } diff --git a/ReallifeGamemode.Server/DrivingSchool/PlaneSchool.cs b/ReallifeGamemode.Server/DrivingSchool/PlaneSchool.cs index a1b903ba..fb3a1573 100644 --- a/ReallifeGamemode.Server/DrivingSchool/PlaneSchool.cs +++ b/ReallifeGamemode.Server/DrivingSchool/PlaneSchool.cs @@ -48,7 +48,7 @@ namespace ReallifeGamemode.Server.DrivingSchool public static void Setup() { - informationLabel1 = NAPI.TextLabel.CreateTextLabel("Flugschule", new Vector3(-1083.96, -2476.96, 14.07), 20.0f, 1.3f, 0, new Color(255, 255, 255)); + informationLabel1 = NAPI.TextLabel.CreateTextLabel("Flugschule\n~y~Flugschein ~s~- $~g~5000", new Vector3(-1083.96, -2476.96, 14.07), 20.0f, 1.3f, 0, new Color(255, 255, 255)); marker1 = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, new Vector3(-1083.96, -2476.96, 13.07), new Vector3(), new Vector3(), 1f, new Color(255, 255, 255)); _colShape1 = NAPI.ColShape.CreateSphereColShape(new Vector3(-1083.96, -2476.96, 14.07), 3f);