From db4780ee5d65fedd663cf9d9730b7f91ce6cfbaf Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 18 Oct 2019 22:17:27 +0200 Subject: [PATCH] add Flugschule and Change Pilotjob --- .../Jobs/PilotRouteSelect.ts | 67 + ReallifeGamemode.Client/index.ts | 8 +- ReallifeGamemode.Client/util/planeschool.ts | 71 + .../20191017200636_gtavdev-db.Designer.cs | 1337 +++++++++++++++++ .../Migrations/20191017200636_gtavdev-db.cs | 17 + .../DrivingSchool/PlaneSchool.cs | 95 ++ ReallifeGamemode.Server/Job/BusDriverJob.cs | 8 +- ReallifeGamemode.Server/Job/PilotJob.cs | 75 +- ReallifeGamemode.Server/Main.cs | 2 +- 9 files changed, 1666 insertions(+), 14 deletions(-) create mode 100644 ReallifeGamemode.Client/Jobs/PilotRouteSelect.ts create mode 100644 ReallifeGamemode.Client/util/planeschool.ts create mode 100644 ReallifeGamemode.Database/Migrations/20191017200636_gtavdev-db.Designer.cs create mode 100644 ReallifeGamemode.Database/Migrations/20191017200636_gtavdev-db.cs create mode 100644 ReallifeGamemode.Server/DrivingSchool/PlaneSchool.cs diff --git a/ReallifeGamemode.Client/Jobs/PilotRouteSelect.ts b/ReallifeGamemode.Client/Jobs/PilotRouteSelect.ts new file mode 100644 index 00000000..9f09ddcc --- /dev/null +++ b/ReallifeGamemode.Client/Jobs/PilotRouteSelect.ts @@ -0,0 +1,67 @@ +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 sendItem = new UIMenuItem("Starten", "Route starten"); +sendItem.BackColor = new Color(13, 71, 161); +sendItem.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 PilotRouteList(globalData: GlobalData) { + + var routeMenu: NativeUI.Menu; + var routeTexts; + var routeText; + + mp.events.add('showPilotRouteMenu', (listRoutes) => { + if (!globalData.InMenu) { + + globalData.InMenu = true; + routeTexts = JSON.parse(listRoutes); + + routeMenu = new Menu("Pilot Job", "", new Point(50, 50), null, null); + routeMenu.AddItem(new UIMenuListItem("Route", "", new ItemsCollection(routeTexts))); + + routeMenu.AddItem(sendItem); + routeMenu.AddItem(cancelItem); + routeMenu.Visible = true; + routeText = "Kurz 1"; + + routeMenu.ListChange.on((item, index) => { + switch (item.Text) { + case "Route": + routeText = String(item.SelectedItem.DisplayText); + break; + } + }); + + routeMenu.ItemSelect.on((item) => { + if (item.Text === "Starten") { + mp.events.callRemote("startPilotRoute", routeText); + routeMenu.Close(); + globalData.InMenu = false; + } else if (item.Text === "Abbrechen") { + routeMenu.Close(); + globalData.InMenu = false; + } + }); + + routeMenu.MenuClose.on(() => { + globalData.InMenu = false; + }); + } + }); +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts index 2bca67b4..5eb64c94 100644 --- a/ReallifeGamemode.Client/index.ts +++ b/ReallifeGamemode.Client/index.ts @@ -169,4 +169,10 @@ import drivingSchoolHandle from './util/drivingschool'; drivingSchoolHandle(globalData); import notificationUtil from './util/notification'; -notificationUtil(); \ No newline at end of file +notificationUtil(); + +import planeSchoolHandle from './util/planeschool'; +planeSchoolHandle(globalData); + +import PilotRouteList from './Jobs/PilotRouteSelect'; +PilotRouteList(globalData); \ No newline at end of file diff --git a/ReallifeGamemode.Client/util/planeschool.ts b/ReallifeGamemode.Client/util/planeschool.ts new file mode 100644 index 00000000..cbbfb43d --- /dev/null +++ b/ReallifeGamemode.Client/util/planeschool.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 UIMenuSliderItem = NativeUI.UIMenuSliderItem; +const BadgeStyle = NativeUI.BadgeStyle; +const Point = NativeUI.Point; +const ItemsCollection = NativeUI.ItemsCollection; +const Color = NativeUI.Color; +const ListItem = NativeUI.ListItem; + +export default function planeSchoolHandle(globalData: GlobalData) { + + var keyBound = false; + var mainMenu: NativeUI.Menu; + let send = new UIMenuItem("Pruefung starten", ""); + var timer; + var timerCheckpoint; + var timerSet = false; + var Player; + var timeToWait = 0; + var checkPoint; + var counter = 0; + var waitFinished = false; + + mp.events.add('planeSchoolMenu', () => { + mp.game.ui.setTextComponentFormat('STRING'); + mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um das Flugschulmenü zu öffnen'); + mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1); + + mp.keys.bind(0x45, false, keyPressHandler); + keyBound = true; + }); + + mp.events.add('removeplaneSchoolMenu', (unbind) => { + mp.game.ui.clearHelp(true); + mp.gui.chat.show(true); + + if (keyBound && unbind) { + if (mainMenu) mainMenu.Close(); + + mp.keys.unbind(0x45, false, keyPressHandler); + keyBound = false; + } + }); + + mp.events.add('waitPlayerEntersVehicle1', () => { + mp.game.ui.setNewWaypoint(-1114.39, -2333.09); + timerSet = true; + timer = setInterval(timerPlayerInVehicle1, 3000); + }); + + + mp.events.add('stopTimer', () => { + timerSet = false; + clearInterval(timer); + }); + function timerPlayerInVehicle1() { + if (timerSet) { + mp.events.callRemote('timerCheckVehicle1'); + } + }; + + function keyPressHandler() { + if (globalData.InChat || globalData.InInput || globalData.InMenu) return; + + mp.events.call('removeplaneSchoolMenu', false); + mp.events.callRemote('startplaneSchool'); + } +} \ No newline at end of file diff --git a/ReallifeGamemode.Database/Migrations/20191017200636_gtavdev-db.Designer.cs b/ReallifeGamemode.Database/Migrations/20191017200636_gtavdev-db.Designer.cs new file mode 100644 index 00000000..58229947 --- /dev/null +++ b/ReallifeGamemode.Database/Migrations/20191017200636_gtavdev-db.Designer.cs @@ -0,0 +1,1337 @@ +// +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("20191017200636_gtavdev-db")] + partial class gtavdevdb + { + 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.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("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("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.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.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/20191017200636_gtavdev-db.cs b/ReallifeGamemode.Database/Migrations/20191017200636_gtavdev-db.cs new file mode 100644 index 00000000..90b739f7 --- /dev/null +++ b/ReallifeGamemode.Database/Migrations/20191017200636_gtavdev-db.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace ReallifeGamemode.Database.Migrations +{ + public partial class gtavdevdb : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/ReallifeGamemode.Server/DrivingSchool/PlaneSchool.cs b/ReallifeGamemode.Server/DrivingSchool/PlaneSchool.cs new file mode 100644 index 00000000..94822fae --- /dev/null +++ b/ReallifeGamemode.Server/DrivingSchool/PlaneSchool.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Text; +using ReallifeGamemode.Server.Extensions; +using ReallifeGamemode.Server.Util; +using ReallifeGamemode.Server.Services; +using System.Linq; +using GTANetworkAPI; + +namespace ReallifeGamemode.Server.DrivingSchool +{ + class PlaneSchool : Script + { + private static TextLabel informationLabel1; + private static Marker marker1; + private static ColShape _colShape1; + public static Vector3 Position { get; } + + private readonly IReadOnlyCollection planeRoute = new List + { + new Vector3(-1114.39, -2333.09, 14.87), + new Vector3(-1133.06, -2287.62, 14.89), + new Vector3(-1185.63, -2303.45, 14.86), + new Vector3(-1168.78, -2349.79, 14.88), + new Vector3(-1118.74, -2340.85, 14.87), + new Vector3(-1219.9, -2239.5, 14.87), + new Vector3(-1355.84, -2245.06, 14.87), + new Vector3(-1427.14, -2368.96, 14.87), + new Vector3(-872.5, -1820.64, 172.57), + new Vector3(786.55, 2309.85, 426.1), + new Vector3(1261.85, 3950.07, 301.3), + new Vector3(2133.83, 4803.55, 41.99), + new Vector3(2134.13, 4782.7, 41.9), + new Vector3(2098.9, 4792.94, 41.98), + new Vector3(-869.77, -1424.05, 133), + new Vector3(-1164.29, -2351.52, 14.88), + }.AsReadOnly(); + + 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)); + marker1 = NAPI.Marker.CreateMarker(434, new Vector3(-1083.96, -2476.96, 14.07), new Vector3(), new Vector3(), 1f, new Color(111, 111, 111)); + + _colShape1 = NAPI.ColShape.CreateSphereColShape(new Vector3(-1083.96, -2476.96, 14.07), 3f); + _colShape1.OnEntityEnterColShape += EntityEnterBusinessColShape; + _colShape1.OnEntityExitColShape += EntityExitBusinessColShape; + } + private static void EntityEnterBusinessColShape(ColShape colShape, Client client) + { + if (client.IsInVehicle || !client.IsLoggedIn()) return; + + client.TriggerEvent("planeSchoolMenu"); + } + + private static void EntityExitBusinessColShape(ColShape colShape, Client client) + { + client.TriggerEvent("removeplaneSchoolMenu"); + } + + [RemoteEvent("startplaneSchool")] + public void StartplaneSchool(Client user) + { + ChatService.SendMessage(user, "Du hast die Führerscheinprüfung gestartet."); + ChatService.SendMessage(user, "Steige nun in eines der Flugzeuge ein."); + + user.TriggerEvent("waitPlayerEntersVehicle1"); + } + + [RemoteEvent("timerCheckVehicle1")] + public void TimerCheckVehicle1(Client user) + { + Vehicle veh = user.Vehicle; + + if (veh == null || veh.DisplayName != "Velum") + { + return; + } + else + { + ChatService.SendMessage(user, "Gut nun kann die Prüfung losgehen"); + user.TriggerEvent("stopTimer"); + + CheckPointHandle.StartCheckPointRoute(user, planeRoute, 0, 6, "planeSchoolEvent"); + } + } + + [RemoteEvent("planeSchoolEvent")] + public void planeSchoolEvent(Client user, int checkpoint) + { + ChatService.Broadcast("CP " + checkpoint); + float width = 22f; + } + } +} diff --git a/ReallifeGamemode.Server/Job/BusDriverJob.cs b/ReallifeGamemode.Server/Job/BusDriverJob.cs index 8601e015..eb3715e3 100644 --- a/ReallifeGamemode.Server/Job/BusDriverJob.cs +++ b/ReallifeGamemode.Server/Job/BusDriverJob.cs @@ -73,7 +73,7 @@ namespace ReallifeGamemode.Server.Job private readonly IReadOnlyCollection RouteVeryLong = new List { - new Vector3(-571.7844, -2067.18, 6.177974), + new Vector3(-562.68, -2203.85, 6.72), new Vector3(-889.0892, -2190.34, 8.100273), new Vector3(-695.8978, -1197.1, 10.07723), new Vector3(-1025.791, -788.746, 16.95118), @@ -85,7 +85,7 @@ namespace ReallifeGamemode.Server.Job new Vector3(-2448.411, 3736.997, 16.20646), new Vector3(-2206.853, 4257.991, 47.13944), new Vector3(-1545.054, 4934.076, 61.29264), - new Vector3(153.21, 6209.93, 32.03), + new Vector3(-152.66, 6209.62, 32.03), new Vector3(2707.136, 3309.894, 55.37453), new Vector3(2554.981, 292.5191, 108.036), new Vector3(-740.3124, -1645.125, 26.10983), @@ -104,7 +104,7 @@ namespace ReallifeGamemode.Server.Job listRouteTexts.Add("Kurz 2"); listRouteTexts.Add("Mittel 1"); listRouteTexts.Add("Lang 1"); - listRouteTexts.Add("Lang wie mein Lümmel"); + listRouteTexts.Add("Lang 2"); player.TriggerEvent("showBusRouteMenu", JsonConvert.SerializeObject(listRouteTexts)); } @@ -128,7 +128,7 @@ namespace ReallifeGamemode.Server.Job { CheckPointHandle.StartCheckPointRoute(player, RouteLong, 3000, 1, ""); } - else if (type == "Lang wie mein Lümmel") + else if (type == "Lang 2") { CheckPointHandle.StartCheckPointRoute(player, RouteVeryLong, 3000, 1, ""); } diff --git a/ReallifeGamemode.Server/Job/PilotJob.cs b/ReallifeGamemode.Server/Job/PilotJob.cs index 2e01bfcf..38255f53 100644 --- a/ReallifeGamemode.Server/Job/PilotJob.cs +++ b/ReallifeGamemode.Server/Job/PilotJob.cs @@ -1,7 +1,8 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using GTANetworkAPI; using ReallifeGamemode.Server.Util; - +using Newtonsoft.Json; namespace ReallifeGamemode.Server.Job { class PilotJob : JobBase @@ -14,13 +15,50 @@ namespace ReallifeGamemode.Server.Job private readonly IReadOnlyCollection Route1 = new List { - new Vector3(-1059.862, -3100.353, 13.94444), - new Vector3(1690.651, 3246.769, 40.87084), - new Vector3(-2376.512, 3063.054, 32.82592), - new Vector3(2056.1, 4774.556, 4106039), - new Vector3(-1059.862, -3100.353, 13.94444), + new Vector3(-322.61, 2613.05, 327.87), + new Vector3(-81.03, 3685.12, 337.44), + new Vector3(964.75, 4304.75, 322.26), + new Vector3(1865.4, 4786.56, 265.71), + new Vector3(2228.51, 5999.19, 264.56), + new Vector3(1603.63, 6452.82, 224.97), + new Vector3(515.21, 6555.43, 289.65), + new Vector3( 9.61, 6409.95, 301.73), + new Vector3(-558.94, 5571.06, 352.2), + new Vector3(-1029.6, 4943.04, 398.4), + new Vector3(-1030.29, 4446.83, 392.74), + new Vector3(-219.31, 3689.86, 380.81), + new Vector3(212.74, 3061.88, 395.36), }.AsReadOnly(); + private readonly IReadOnlyCollection Route2 = new List + { + new Vector3(2760.91, 3606.83, 459.27), + new Vector3(2663.72, 2532.03, 502.4), + new Vector3(2513.93, 1096.15, 507.45), + new Vector3(2532.33, 75.23, 491.21), + new Vector3(2627.95, -1030.54, 395.27), + new Vector3(1672.97, -1743.65, 421.86), + new Vector3(637.9, -2011.36, 386.82), + new Vector3(208.09, -1629.12, 322.08), + new Vector3(-258.94, -930.23, 342.11), + new Vector3(-610.22, 157.79, 350.23), + new Vector3(-1275.95, 342.97, 326.71), + }.AsReadOnly(); + + private readonly IReadOnlyCollection Route3 = new List + { + new Vector3(-850.61, 2181.98, 429.67), + new Vector3(-675.89, 1709.52, 462.85), + new Vector3(-1295.41, 1184.66, 489.47), + new Vector3(-2452.89, 1760.76, 466.53), + new Vector3(-2607.08, 2981.38, 454.81), + new Vector3(-1771.7, 4241.02, 460.07), + new Vector3(1158.77, 4573.67, 455.08), + new Vector3(2028.63, 4842.29, 437.01), + }.AsReadOnly(); + + + public PilotJob() { JobStart += PilotJob_JobStart; @@ -28,7 +66,28 @@ namespace ReallifeGamemode.Server.Job private void PilotJob_JobStart(Client player) { - CheckPointHandle.StartCheckPointRoute(player, Route1, 0, 6, ""); + List listRouteTexts = new List(); + listRouteTexts.Add("Route 1"); + listRouteTexts.Add("Route 2"); + listRouteTexts.Add("Route 3"); + + player.TriggerEvent("showPilotRouteMenu", JsonConvert.SerializeObject(listRouteTexts)); + } + [RemoteEvent("startPilotRoute")] + public void StartPilotRoute(Client player, string type) + { + if (type == "Route 1") + { + CheckPointHandle.StartCheckPointRoute(player, Route1, 0, 6, ""); + } + else if (type == "Route 2") + { + CheckPointHandle.StartCheckPointRoute(player, Route2, 0, 6, ""); + } + else if (type == "Route 3") + { + CheckPointHandle.StartCheckPointRoute(player, Route3, 0, 6, ""); + } } } } diff --git a/ReallifeGamemode.Server/Main.cs b/ReallifeGamemode.Server/Main.cs index 2f16eceb..23db820e 100644 --- a/ReallifeGamemode.Server/Main.cs +++ b/ReallifeGamemode.Server/Main.cs @@ -60,7 +60,7 @@ namespace ReallifeGamemode.Server JobManager.LoadJobs(); HouseManager.LoadHouses(); DrivingSchool.DrivingSchool.Setup(); - + PlaneSchool.Setup(); TempBlip tempBlip = new TempBlip() {