diff --git a/ReallifeGamemode.Client.Core/ReallifeGamemode.Client.Core.csproj b/ReallifeGamemode.Client.Core/ReallifeGamemode.Client.Core.csproj new file mode 100644 index 00000000..cb631906 --- /dev/null +++ b/ReallifeGamemode.Client.Core/ReallifeGamemode.Client.Core.csproj @@ -0,0 +1,7 @@ + + + + netcoreapp3.1 + + + diff --git a/ReallifeGamemode.Client/CharCreator/main.ts b/ReallifeGamemode.Client/CharCreator/main.ts index 66c11214..19ab25ac 100644 --- a/ReallifeGamemode.Client/CharCreator/main.ts +++ b/ReallifeGamemode.Client/CharCreator/main.ts @@ -560,7 +560,7 @@ export default function charCreator(globalData: IGlobalData) { // EVENTS mp.events.add("toggleCreator", (charExists) => { - if (creatorCamera === undefined) { + if (!mp.cameras.exists(creatorCamera)) { if (charExists) { creatorCamera = mp.cameras.new("creatorCamera", surgeryCoords.camera, new mp.Vector3(0, 0, 0), 45); creatorCamera.pointAtCoord(surgeryCoords.cameraLookAt.x, surgeryCoords.cameraLookAt.y, surgeryCoords.cameraLookAt.z); @@ -572,6 +572,11 @@ export default function charCreator(globalData: IGlobalData) { creatorCamera.setActive(true); } + resetAppearanceMenu(); + resetFeaturesMenu(); + resetHairAndColorsMenu(); + resetParentsMenu(); + globalData.InMenu = true; globalData.InMenu = true; @@ -582,6 +587,7 @@ export default function charCreator(globalData: IGlobalData) { localPlayer.clearTasksImmediately(); localPlayer.freezePosition(true); mp.game.cam.renderScriptCams(true, false, 0, true, false); + applyCreatorOutfit(); } }); @@ -601,7 +607,7 @@ export default function charCreator(globalData: IGlobalData) { mp.game.ui.displayHud(true); localPlayer.freezePosition(false); mp.game.cam.renderScriptCams(false, false, 0, true, false); - creatorCamera.destroy(true); + creatorCamera.destroy(); globalData.InMenu = false; globalData.InMenu = false; if (isSurgery) isSurgery = false; diff --git a/ReallifeGamemode.Client/Gui/bigmap.ts b/ReallifeGamemode.Client/Gui/bigmap.ts new file mode 100644 index 00000000..4fd5e4c9 --- /dev/null +++ b/ReallifeGamemode.Client/Gui/bigmap.ts @@ -0,0 +1,55 @@ +import { GlobalData } from ".."; + +export default function bigmap() { + var bigmap = { status: 0, timer: null }; + + bigmap.status = 0; + bigmap.timer = null; + + mp.game.ui.setRadarZoom(1.0); + mp.game.ui.setRadarBigmapEnabled(false, false); + + mp.events.add("render", () => { + mp.game.controls.disableControlAction(0, 48, true); + if (mp.game.controls.isDisabledControlJustPressed(0, 48) && !GlobalData.InChat) { + if (bigmap.status === 0) { + mp.game.ui.setRadarZoom(0.0); + bigmap.status = 1; + + bigmap.timer = setTimeout(() => { + mp.game.ui.setRadarBigmapEnabled(false, true); + mp.game.ui.setRadarZoom(1.0); + + bigmap.status = 0; + bigmap.timer = null; + }, 10000); + } else if (bigmap.status === 1) { + if (bigmap.timer != null) { + clearTimeout(bigmap.timer); + bigmap.timer = null; + } + + mp.game.ui.setRadarBigmapEnabled(true, false); + mp.game.ui.setRadarZoom(0.0); + bigmap.status = 2; + + bigmap.timer = setTimeout(() => { + mp.game.ui.setRadarBigmapEnabled(false, true); + mp.game.ui.setRadarZoom(1.0); + + bigmap.status = 0; + bigmap.timer = null; + }, 10000); + } else { + if (bigmap.timer != null) { + clearTimeout(bigmap.timer); + bigmap.timer = null; + } + + mp.game.ui.setRadarBigmapEnabled(false, false); + mp.game.ui.setRadarZoom(1.0); + bigmap.status = 0; + } + } + }); +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/Gui/blips.ts b/ReallifeGamemode.Client/Gui/blips.ts index 85b9e1ae..a648181b 100644 --- a/ReallifeGamemode.Client/Gui/blips.ts +++ b/ReallifeGamemode.Client/Gui/blips.ts @@ -1,6 +1,13 @@ -export default function playerBlips() { +import { afkStatus } from '../Player/antiafk'; +import { getWantedCount } from './wanteds'; + +export default function playerBlips() { var playerBlipMap: Map; var ready = false; + var escapeTimer = null; + + const PD_BLIP = 38; + const FIB_BLIP = 63; setInterval(() => { if (!ready) return; @@ -43,9 +50,30 @@ pBlip.setColour(isNaN(color) ? 0 : color); pBlip.setPosition(player.position.x, player.position.y, player.position.z); + + if ((color == PD_BLIP || color == FIB_BLIP || afkStatus)) { + if (escapeTimer) { + mp.events.call("SERVER:SetWantedFlash", false); + clearInterval(escapeTimer); + escapeTimer = null; + } + return; + } } - }); + + if (!escapeTimer && !afkStatus && getWantedCount() > 0) { + mp.events.call("SERVER:SetWantedFlash", true); + escapeTimer = setInterval(() => { + if (getWantedCount() == 0) { + clearInterval(escapeTimer); + escapeTimer = null; + return; + } + + mp.events.callRemote("CLIENT:EscapeWanted"); + }, 300000); //120000 -> 2 min , 300000 -> 5min + } }, 50); mp.events.add("playerReady", () => { diff --git a/ReallifeGamemode.Client/Gui/infobox.ts b/ReallifeGamemode.Client/Gui/infobox.ts index cf1ba033..72dc766e 100644 --- a/ReallifeGamemode.Client/Gui/infobox.ts +++ b/ReallifeGamemode.Client/Gui/infobox.ts @@ -308,8 +308,8 @@ export default function (globalData: IGlobalData): void { }) mp.game.graphics.drawRect(0.0, 0.555, 0.3, 0.11, 0, 0, 0, 70) } - } + if (editMode === true) { mp.game.graphics.drawText("~r~EDIT-MODE AKTIV", [0.5, 0], { diff --git a/ReallifeGamemode.Client/Gui/notification.ts b/ReallifeGamemode.Client/Gui/notification.ts new file mode 100644 index 00000000..50b50780 --- /dev/null +++ b/ReallifeGamemode.Client/Gui/notification.ts @@ -0,0 +1,32 @@ +export default function notification() { + const _SET_NOTIFICATION_COLOR_NEXT = "0x39BBF623FC803EAC"; + const _SET_NOTIFICATION_BACKGROUND_COLOR = "0x92F0DA1E27DB96DC"; + + mp.events.add("BN_Show", (message, flashing = false, textColor = -1, bgColor = -1, flashColor = [77, 77, 77, 200]) => { + if (textColor > -1) mp.game.invoke(_SET_NOTIFICATION_COLOR_NEXT, textColor); + if (bgColor > -1) mp.game.invoke(_SET_NOTIFICATION_BACKGROUND_COLOR, bgColor); + if (flashing) mp.game.ui.setNotificationFlashColor(flashColor[0], flashColor[1], flashColor[2], flashColor[3]); + + mp.game.gxt.set("BNOTIF_LONG_TEXT_ENTRY", `~a~${message}`); + mp.game.ui.setNotificationTextEntry("BNOTIF_LONG_TEXT_ENTRY"); + mp.game.ui.addTextComponentSubstringPlayerName(""); // needed for text color to work + mp.game.ui.drawNotification(flashing, true); + }); + + mp.events.add("BN_ShowWithPicture", (title, sender, message, notifPic, icon = 0, flashing = false, textColor = -1, bgColor = -1, flashColor = [77, 77, 77, 200]) => { + if (textColor > -1) mp.game.invoke(_SET_NOTIFICATION_COLOR_NEXT, textColor); + if (bgColor > -1) mp.game.invoke(_SET_NOTIFICATION_BACKGROUND_COLOR, bgColor); + if (flashing) mp.game.ui.setNotificationFlashColor(flashColor[0], flashColor[1], flashColor[2], flashColor[3]); + mp.game.graphics.requestStreamedTextureDict(notifPic, true); + + mp.game.gxt.set("BNOTIF_LONG_TEXT_ENTRY_IMG", `~a~${message}`); + mp.game.ui.setNotificationTextEntry("BNOTIF_LONG_TEXT_ENTRY_IMG"); + mp.game.ui.addTextComponentSubstringPlayerName(""); // needed for text color to work + mp.game.ui.setNotificationMessage(notifPic, notifPic, flashing, icon, title, sender); + }); + + const notifications = { + show: (message, flashing = false, textColor = -1, bgColor = -1, flashColor = [77, 77, 77, 200]) => mp.events.call("BN_Show", message, flashing, textColor, bgColor, flashColor), + showWithPicture: (title, sender, message, notifPic, icon = 0, flashing = false, textColor = -1, bgColor = -1, flashColor = [77, 77, 77, 200]) => mp.events.call("BN_ShowWithPicture", title, sender, message, notifPic, icon, flashing, textColor, bgColor, flashColor) + }; +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/Gui/playerlist.ts b/ReallifeGamemode.Client/Gui/playerlist.ts index 1d176cba..d714cf2b 100644 --- a/ReallifeGamemode.Client/Gui/playerlist.ts +++ b/ReallifeGamemode.Client/Gui/playerlist.ts @@ -5,30 +5,39 @@ */ export default function playerList(globalData: IGlobalData): void { - var playerlistBrowser: BrowserMp = null; - var pList; + var pList = []; + var loaded = false; var factionPlayersMap: Map = new Map(); const factionIds = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; - mp.events.add("showPlayerlist", (playersJson) => { + mp.events.add("loadPlayerListCEF", () => { if (playerlistBrowser !== null) { playerlistBrowser.destroy(); - playerlistBrowser = null; - globalData.InMenu = false; - mp.gui.cursor.show(false, false); - mp.gui.chat.activate(true); } - else if (!globalData.InMenu) { + playerlistBrowser = mp.browsers.new('package://assets/html/onlinelist/index.html'); + }); + + mp.events.add("showPlayerlist", (playersJson) => { + if (!globalData.InMenu && !loaded) { globalData.InMenu = true; - playerlistBrowser = mp.browsers.new('package://assets/html/onlinelist/index.html'); + loaded = true; mp.gui.chat.activate(false); mp.gui.cursor.show(true, true); pList = JSON.parse(playersJson); + playerlistBrowser.execute(`showPlayerList()`); + } else if (loaded) { + globalData.InMenu = false; + loaded = false; + mp.gui.cursor.show(false, false); + mp.gui.chat.activate(true); + playerlistBrowser.execute(`closePlayerList()`); } }); mp.events.add("CEF:PlayerList_Loaded", () => { + playerlistBrowser.execute(`clear_row()`); + factionIds.forEach(f => { factionPlayersMap.set(f, 0); }); @@ -54,4 +63,4 @@ export default function playerList(globalData: IGlobalData): void { // table = table + tableRow; // }) // return document.write(table); -//} +//} \ No newline at end of file diff --git a/ReallifeGamemode.Client/Gui/vehiclemenu/main.ts b/ReallifeGamemode.Client/Gui/vehiclemenu/main.ts index b967f544..12d0e72d 100644 --- a/ReallifeGamemode.Client/Gui/vehiclemenu/main.ts +++ b/ReallifeGamemode.Client/Gui/vehiclemenu/main.ts @@ -50,7 +50,7 @@ export default function vehicleMenu(globalData: IGlobalData) { }); mp.events.add('ToggleVehicleMenu', () => { - if (menuBrowser !== null) { + if (globalData.InMenu && menuBrowser !== null) { menuBrowser.destroy(); menuBrowser = null; globalData.InMenu = false; @@ -59,14 +59,14 @@ export default function vehicleMenu(globalData: IGlobalData) { mp.game.graphics.stopScreenEffect("FocusIn"); mp.game.graphics.startScreenEffect("FocusOut", 0, false); return; + } else { + mp.game.graphics.stopScreenEffect("FocusOut"); + mp.game.graphics.startScreenEffect("FocusIn", 0, false); + menuBrowser = mp.browsers.new("package://assets/html/vehiclemenu/index.html"); + mp.gui.chat.show(false); + globalData.InMenu = true; + mp.gui.cursor.show(true, true); } - - mp.game.graphics.stopScreenEffect("FocusOut"); - mp.game.graphics.startScreenEffect("FocusIn", 0, false); - menuBrowser = mp.browsers.new("package://assets/html/vehiclemenu/index.html"); - mp.gui.chat.show(false); - globalData.InMenu = true; - mp.gui.cursor.show(true, true); }); mp.events.add('doAction', (action) => { diff --git a/ReallifeGamemode.Client/Player/antiafk.ts b/ReallifeGamemode.Client/Player/antiafk.ts index 229cd705..c231d5f3 100644 --- a/ReallifeGamemode.Client/Player/antiafk.ts +++ b/ReallifeGamemode.Client/Player/antiafk.ts @@ -1,13 +1,12 @@ -export default function antiAfk(globalData: IGlobalData) { +export let afkStatus: boolean = false; + +export default function antiAfk(globalData: IGlobalData) { let lastPosition: Vector3Mp = mp.players.local.position; let afkCounter: number = 0; - let afkStatus: boolean = false; - setInterval(checkAfkPosition, 1000 * 10); function checkAfkPosition() { - if (!globalData.LoggedIn) { return; } diff --git a/ReallifeGamemode.Client/Player/keys.ts b/ReallifeGamemode.Client/Player/keys.ts index 92ffe3e0..c3b7fa1d 100644 --- a/ReallifeGamemode.Client/Player/keys.ts +++ b/ReallifeGamemode.Client/Player/keys.ts @@ -122,10 +122,10 @@ export default function keys(globalData: IGlobalData) { } }); - //X // Fahrzeug Verwaltung - Menü - mp.keys.bind(0x58, false, function () { - if (!globalData.InChat && !globalData.InMenu && !globalData.InTuning) { - mp.events.callRemote("keyPress:X"); + //Z // Fahrzeug Verwaltung - Menü + KeyBinder.bind("z", () => { + if (!globalData.InChat && !globalData.InTuning) { + mp.events.callRemote("keyPress:Z"); } }); diff --git a/ReallifeGamemode.Client/Player/nodm.ts b/ReallifeGamemode.Client/Player/polygons.ts similarity index 53% rename from ReallifeGamemode.Client/Player/nodm.ts rename to ReallifeGamemode.Client/Player/polygons.ts index bffea4fc..ea468a4b 100644 --- a/ReallifeGamemode.Client/Player/nodm.ts +++ b/ReallifeGamemode.Client/Player/polygons.ts @@ -1,5 +1,31 @@ import polygons from "../polygons"; +//Start: Eingang direkt rechts, rechts entlang +const prisonVector1 = new mp.Vector3(1809.99365234375, 2612.373291015625, 40.50623321533203); +const prisonVector2 = new mp.Vector3(1810.377197265625, 2620.338623046875, 40.51300048828125); +const prisonVector3 = new mp.Vector3(1835.8336181640625, 2688.819091796875, 40.4307975769043); +const prisonVector4 = new mp.Vector3(1830.5731201171875, 2703.89990234375, 40.42714309692383); +const prisonVector5 = new mp.Vector3(1776.7342529296875, 2747.79052734375, 40.42777633666992); +const prisonVector6 = new mp.Vector3(1762.360107421875, 2752.788818359375, 40.42710494995117); +const prisonVector7 = new mp.Vector3(1662.0726318359375, 2749.177001953125, 40.444488525390625); +const prisonVector8 = new mp.Vector3(1648.1600341796875, 2742.01611328125, 40.441619873046875); +const prisonVector9 = new mp.Vector3(1584.302978515625, 2679.99072265625, 40.47876739501953); +const prisonVector10 = new mp.Vector3(1575.2301025390625, 2667.2109375, 40.48185729980469); +const prisonVector11 = new mp.Vector3(1547.1693115234375, 2591.489990234375, 40.388912200927734); +const prisonVector12 = new mp.Vector3(1546.39892578125, 2576.266845703125, 40.38877868652344); +const prisonVector13 = new mp.Vector3(1550.493896484375, 2482.98388671875, 40.38750076293945); +const prisonVector14 = new mp.Vector3(1557.9322509765625, 2468.98681640625, 40.387237548828125); +const prisonVector15 = new mp.Vector3(1652.527099609375, 2409.1259765625, 40.40341567993164); +const prisonVector16 = new mp.Vector3(1667.7176513671875, 2407.0595703125, 40.401432037353516); +const prisonVector17 = new mp.Vector3(1749.3123779296875, 2419.23779296875, 40.42228698730469); +const prisonVector18 = new mp.Vector3(1762.95849609375, 2426.209228515625, 40.42059326171875); +const prisonVector19 = new mp.Vector3(1809.08837890625, 2473.969970703125, 40.445960998535156); +const prisonVector20 = new mp.Vector3(1814.2039794921875, 2489.00830078125, 40.44499588012695); +const prisonVector21 = new mp.Vector3(1807.0340576171875, 2535.93212890625, 38.4123420715332); +const prisonVector22 = new mp.Vector3(1809.77587890625, 2590.69775390625, 38.41337966918945); +const prisonVector23 = new mp.Vector3(1819.170654296875, 2597.941650390625, 40.525978088378906); +const prisonVector24 = new mp.Vector3(1819.3084716796875, 2612.3154296875, 40.52067947387695); + const busbaseVector1 = new mp.Vector3(-522.4485, -2138.7021, 7.7564063); const busbaseVector2 = new mp.Vector3(-584.9822, -2072.467, 5.9921026); const busbaseVector3 = new mp.Vector3(-669.1689, -2172.7917, 6.009973); @@ -37,10 +63,14 @@ const polygon_pilotAnfaenger = polygons.add([pilotAnfaengerVector1, pilotAnfaeng const polygon_pilotProfi = polygons.add([pilotProfiVector1, pilotProfiVector2, pilotProfiVector3, pilotProfiVector4], 15, false, [255, 155, 0, 255], 0); const polygon_muellbase = polygons.add([muellbaseVector1, muellbaseVector2, muellbaseVector3], 15, false, [255, 155, 0, 255], 0); +const polygon_prison = polygons.add([prisonVector1, prisonVector2, prisonVector3, prisonVector4, prisonVector5, prisonVector6, prisonVector7, prisonVector8, + prisonVector9, prisonVector10, prisonVector11, prisonVector12, prisonVector13, prisonVector14, prisonVector15, prisonVector16, + prisonVector17, prisonVector18, prisonVector19, prisonVector20, prisonVector21, prisonVector22, prisonVector23, prisonVector24], 40, false, [255, 155, 0, 255], 0); + export let listNoDMZones = [polygon_busbase, polygon_stadthalle, polygon_fahrschule, polygon_pilotAnfaenger, polygon_pilotProfi, polygon_muellbase]; export let isInAnyNoDMPolygon; -export default function nodmHandler() { +export default function polygonHandler() { mp.events.add('playerEnterPolygon', (polygon) => { @@ -56,5 +86,9 @@ export default function nodmHandler() { mp.events.call('toggleNoDmZone', false); isInAnyNoDMPolygon = false; } + + if (polygon == polygon_prison) { + mp.events.callRemote("SERVER:BreakOutIfInPrison"); + } }); } diff --git a/ReallifeGamemode.Client/Player/reportmenu.ts b/ReallifeGamemode.Client/Player/reportmenu.ts index bee77944..f71426c4 100644 --- a/ReallifeGamemode.Client/Player/reportmenu.ts +++ b/ReallifeGamemode.Client/Player/reportmenu.ts @@ -1,5 +1,4 @@ -import * as NativeUI from '../libs/NativeUI'; -import jailList from './criminalrelease'; +import * as NativeUI from '../libs/NativeUI'; import InputHelper from '../inputhelper'; const Menu = NativeUI.Menu; @@ -30,16 +29,11 @@ cancelItem.HighlightedBackColor = new Color(229, 57, 53); export default function reportList(globalData: IGlobalData) { var reportMenu: NativeUI.Menu; - var users; var reportTexts; - var user = ""; var reportText = ""; - - //Weapon Menu - mp.events.add('showReportMenu', (userTickets, TicketsArr) => { if (!globalData.InMenu) { @@ -95,9 +89,9 @@ export default function reportList(globalData: IGlobalData) { globalData.InMenu = true; - var types = ["Quick Report", "Ticket Report"]; + var types = ["Ticket", "Quick-Report"]; - reportMenu = new Menu("QuickReport/Ticket", "", new Point(0, screenRes.y / 3), null, null); + reportMenu = new Menu("Report", "", new Point(0, screenRes.y / 3), null, null); var typesItem = new UIMenuListItem("Typ", "", new ItemsCollection(types)); reportMenu.AddItem(typesItem); @@ -170,4 +164,4 @@ export default function reportList(globalData: IGlobalData) { } }); -} \ No newline at end of file +} diff --git a/ReallifeGamemode.Client/Player/spawnschutz.ts b/ReallifeGamemode.Client/Player/spawnschutz.ts index 848d7c93..320a135a 100644 --- a/ReallifeGamemode.Client/Player/spawnschutz.ts +++ b/ReallifeGamemode.Client/Player/spawnschutz.ts @@ -16,6 +16,7 @@ export default function spawnschutz() { }); mp.events.add("triggerSpawnschutzTimer", () => { + clearInterval(spawnschutzTimer); spawnschutzTimer = setTimeout(() => { mp.events.call("toggleSpawnschutz", false); spawnschutzEnabled = false; diff --git a/ReallifeGamemode.Client/Player/weaponlist.ts b/ReallifeGamemode.Client/Player/weaponlist.ts index 49f640c0..cba4f2d6 100644 --- a/ReallifeGamemode.Client/Player/weaponlist.ts +++ b/ReallifeGamemode.Client/Player/weaponlist.ts @@ -1,4 +1,4 @@ -import * as NativeUI from '../libs/NativeUI'; +import * as NativeUI from '../libs/NativeUI'; const Menu = NativeUI.Menu; const UIMenuItem = NativeUI.UIMenuItem; @@ -10,7 +10,7 @@ const ItemsCollection = NativeUI.ItemsCollection; const Color = NativeUI.Color; let screenRes = mp.game.graphics.getScreenResolution(0, 0); -let saveItem = new UIMenuItem("Waffen Nehmen", ""); +let saveItem = new UIMenuItem("Waffen nehmen", ""); saveItem.BackColor = new Color(13, 71, 161); saveItem.HighlightedBackColor = new Color(25, 118, 210); @@ -131,7 +131,7 @@ export default function weaponList(globalData: IGlobalData) { weaponMenu.ItemSelect.on((item) => { - if (item.Text === "Waffen Nehmen") { + if (item.Text === "Waffen nehmen") { mp.events.callRemote("saveWeaponSelection", primary, secondary, melee, specialWep, armor); weaponMenu.Close(); globalData.InMenu = false; @@ -150,4 +150,4 @@ export default function weaponList(globalData: IGlobalData) { }); } }); -} \ No newline at end of file +} diff --git a/ReallifeGamemode.Client/Tuning/main.ts b/ReallifeGamemode.Client/Tuning/main.ts index 9da9b31b..c825708f 100644 --- a/ReallifeGamemode.Client/Tuning/main.ts +++ b/ReallifeGamemode.Client/Tuning/main.ts @@ -26,7 +26,7 @@ export default function tuning(globalData: IGlobalData) { const carModSlotName = [ { Slot: 0, Name: "Spoiler", Price: 1000 }, - { Slot: 1, Name: "Frontstoßstange", Price: 1500}, + { Slot: 1, Name: "Frontstoßstange", Price: 1500 }, { Slot: 2, Name: "Heckstoßstange", Price: 1500 }, { Slot: 3, Name: "Seitenschweller", Price: 1500 }, { Slot: 4, Name: "Auspuff", Price: 500 }, @@ -36,12 +36,12 @@ export default function tuning(globalData: IGlobalData) { { Slot: 8, Name: "Extra 1", Price: 2000 }, { Slot: 9, Name: "Extra 2", Price: 2000 }, { Slot: 10, Name: "Dach", Price: 1500 }, - { Slot: 11, Name: "Motor", Price: 50000 }, - { Slot: 12, Name: "Bremsen", Price: 30000 }, - { Slot: 13, Name: "Getriebe", Price: 15000 }, + { Slot: 11, Name: "Motor", BasePercentage: 20, PriceIncreasePerLevel: 7.5 }, + { Slot: 12, Name: "Bremsen", BasePercentage: 5, PriceIncreasePerLevel: 2.5 }, + { Slot: 13, Name: "Getriebe", BasePercentage: 10, PriceIncreasePerLevel: 2.5 }, { Slot: 14, Name: "Hupe", Price: 500 }, { Slot: 15, Name: "Federung", Price: 2000 }, - { Slot: 18, Name: "Turbo", Price: 40000 }, + { Slot: 18, Name: "Turbo", BasePercentage: 45, PriceIncreasePerLevel: 0 }, { Slot: 22, Name: "Licht", Price: 500 }, { Slot: 23, Name: "Reifen", Price: 1000 }, { Slot: -1, Name: "Lackierung", Price: 1000 }, @@ -165,7 +165,7 @@ export default function tuning(globalData: IGlobalData) { var currentActiveModItem = new Array(); var currentSelectedItem: VehicleModMenuItem = null; - mp.events.add("showTuningMenu", (noMoney) => { + mp.events.add("showTuningMenu", (noMoney, basePrice) => { mp.events.call("hideTuningInfo", false); mp.gui.chat.show(false); @@ -226,9 +226,6 @@ export default function tuning(globalData: IGlobalData) { } } - var price = noMoney? 0 : getModSlotPrice(modType); - - if (mod === null) { mod = localVehicle.getMod(modType); } @@ -248,6 +245,7 @@ export default function tuning(globalData: IGlobalData) { currentMod[modType] = mod; for (var x = -1; x < modNum; x++) { + var price = noMoney ? 0 : getModSlotPrice(modType, basePrice, x); var modText = ""; if (x === -1) { modText = "Serie"; @@ -265,7 +263,7 @@ export default function tuning(globalData: IGlobalData) { modMenu.CurrentSelection = x; } else { - item.SetRightLabel("$"+ moneyformat(price)); + item.SetRightLabel("$" + moneyformat(price)); } } @@ -304,7 +302,7 @@ export default function tuning(globalData: IGlobalData) { }); }); - + mainMenu.ItemSelect.on((item: NativeUI.UIMenuItem, index: number) => { if (item === repairItem) { @@ -315,7 +313,9 @@ export default function tuning(globalData: IGlobalData) { mainMenu.Visible = true; mainMenu.MenuClose.on(() => { - localVehicle.setLights(0); + if (localVehicle && mp.vehicles.exists(localVehicle)) { + localVehicle.setLights(0); + } globalData.InTuning = false; globalData.InMenu = false; mp.events.call("hideTuningInfo", false); @@ -456,8 +456,21 @@ export default function tuning(globalData: IGlobalData) { return realModName; } - function getModSlotPrice(modType: number): number { - return carModSlotName.filter(x => x.Slot == modType)[0].Price; + function getModSlotPrice(modType: number, basePrice: number, modIndex?: number): number { + if (modIndex === -1) { + return 0; + } + + let price = 0; + let priceInfo = carModSlotName.filter(x => x.Slot == modType)[0]; + + if (priceInfo.BasePercentage) { + price = ((priceInfo.BasePercentage + priceInfo.PriceIncreasePerLevel * modIndex) / 100) * basePrice; + } else { + price = priceInfo.Price; + } + + return price; } function setHeadlightsColor(vehicle, index) { diff --git a/ReallifeGamemode.Client/assets/css/chat/main.css b/ReallifeGamemode.Client/assets/css/chat/main.css index 3b563634..34bc6a52 100644 --- a/ReallifeGamemode.Client/assets/css/chat/main.css +++ b/ReallifeGamemode.Client/assets/css/chat/main.css @@ -14,7 +14,7 @@ html { } #chat, a, body, html { - color: #fff; + color: white; } body, html { @@ -59,12 +59,12 @@ a { #chat ul#chat_messages { height: 16.45em; min-width: 50ch; - max-width: calc(60vw + 10px); + max-width: calc(45vw + 10px); -webkit-transform: rotate(0deg); transform: rotate(0deg); overflow-y: auto; overflow-x: hidden; - word-break: break-all; + word-break: break-word; list-style-type: none; margin-bottom: .25em; } @@ -80,16 +80,17 @@ a { } #chat input#chat_msg { - width: 60vw; + width: 45vw; outline: 0; border: none; border-radius: 3px; + font-family: inherit; font-size: inherit; font-weight: inherit; - line-height: inherit; + line-height: 1; color: white; background: rgba(0, 0, 0, 0.5); - padding: .5em; + padding: .5em .75em .75em; } ::-webkit-scrollbar { @@ -104,4 +105,9 @@ a { ::-webkit-scrollbar-thumb:hover { background: rgba(255, 17, 0, 0); } -/*# sourceMappingURL=main.css.map */ \ No newline at end of file + +.timestamp { + display: inline-block; + width: 5.25em; +} +/*# sourceMappingURL=main.css.map */ diff --git a/ReallifeGamemode.Client/assets/css/chat/main.css.map b/ReallifeGamemode.Client/assets/css/chat/main.css.map index df909d16..a30a22ea 100644 --- a/ReallifeGamemode.Client/assets/css/chat/main.css.map +++ b/ReallifeGamemode.Client/assets/css/chat/main.css.map @@ -1,6 +1,6 @@ { "version": 3, - "mappings": "AAAA,AAAA,IAAI,CAAC;EAAE,UAAU,EAAE,UAAU;CAAI;;AACjC,AAAA,CAAC,EAAE,CAAC,AAAA,OAAO,EAAE,CAAC,AAAA,MAAM,CAAC;EAAE,UAAU,EAAE,OAAO;CAAI;;AAG9C,AAAA,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;EACZ,OAAO,EAAE,CAAC;EACV,MAAM,EAAE,CACV;CAAC;;AAED,AAAA,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;EACnB,KAAK,EAAE,IACT;CAAC;;AAED,AAAA,IAAI,EAAE,IAAI,CAAC;EACT,sBAAsB,EAAE,WAAW;EACnC,QAAQ,EAAE,MAAM;EAChB,SAAS,EAAE,IAAI;EACf,WAAW,EAAE,IAAI;CAClB;;AAED,AAAA,IAAI,CAAC;EACH,WAAW,EAAE,oIAAoI;EACjJ,SAAS,EAAE,kBAAkB;EAC7B,WAAW,EAAE,GAAG;EAChB,SAAS,EAAE,GAAG;CACf;;AAED,AAAA,CAAC,CAAC;EAAE,eAAe,EAAE,IAAI;CAAI;;AAE7B,AAAA,WAAW,CAAC;EACV,OAAO,EAAE,IAAI;EACb,QAAQ,EAAE,QAAQ;EAClB,KAAK,EAAE,KAAK;EACZ,MAAM,EAAE,KAAK;EACb,OAAO,EAAE,CACX;CAAC;;AAED,AAAA,KAAK,CAAC;EACJ,OAAO,EAAE,KAAK;EACd,OAAO,EAAE,CAAC;EAEV,WAAW,EAAE,IAAI;EACjB,WAAW,EAAE,8EAA8E;EAC3F,cAAc,EAAE,IAAI;EAEpB,UAAU,EAAE,GAAG;EACf,WAAW,EAAE,GAAG;CAsCjB;;AA/CD,AAWE,KAXG,CAWH,EAAE,AAAA,cAAc,CAAC;EACf,MAAM,EAAE,OAAO;EACf,SAAS,EAAE,IAAI;EACf,SAAS,EAAE,iBAAiB;EAC5B,SAAS,EAAE,YAAY;EAEvB,UAAU,EAAE,IAAI;EAChB,UAAU,EAAE,MAAM;EAClB,UAAU,EAAE,SAAS;EAErB,eAAe,EAAE,IAAI;EACrB,aAAa,EAAE,KAAK;CAQrB;;AA9BH,AAwBI,KAxBC,CAWH,EAAE,AAAA,cAAc,GAaX,EAAE,CAAC;EACJ,SAAS,EAAE,YAAY;EACvB,aAAa,EAAE,MAAM;CAGtB;;AA7BL,AA4BM,KA5BD,CAWH,EAAE,AAAA,cAAc,GAaX,EAAE,AAIF,WAAW,CAAC;EAAE,aAAa,EAAE,KAAK;CAAI;;AA5B7C,AAgCE,KAhCG,CAgCH,KAAK,AAAA,SAAS,CAAC;EACb,KAAK,EAAE,IAAI;EACX,OAAO,EAAE,CAAC;EACV,MAAM,EAAE,IAAI;EACZ,aAAa,EAAE,GAAG;EAElB,SAAS,EAAE,OAAO;EAClB,WAAW,EAAE,OAAO;EACpB,WAAW,EAAE,OAAO;EAEpB,KAAK,EAAE,KAAK;EACZ,UAAU,EAAE,kBAAiB;EAE7B,OAAO,EAAE,IAAI;CACd;;AAGH,AAAA,mBAAmB,CAAC;EAClB,KAAK,EAAE,IAAI;CAQZ;;AATD,AAGE,mBAHiB,AAGhB,MAAM,CAAC;EACN,UAAU,EAAE,mBAAmB;EAC/B,aAAa,EAAE,GAAG;CAGnB;;AARH,AAOI,mBAPe,AAGhB,MAAM,AAIJ,MAAM,CAAC;EAAE,UAAU,EAAE,mBAAmB;CAAI", + "mappings": "AAAA,AAAA,IAAI,CAAC;EAAE,UAAU,EAAE,UAAU;CAAI;;AACjC,AAAA,CAAC,EAAE,CAAC,AAAA,OAAO,EAAE,CAAC,AAAA,MAAM,CAAC;EAAE,UAAU,EAAE,OAAO;CAAI;;AAG9C,AAAA,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;EACZ,OAAO,EAAE,CAAC;EACV,MAAM,EAAE,CACV;CAAC;;AAED,AAAA,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;EAAE,KAAK,EAAE,KAAK;CAAI;;AAEvC,AAAA,IAAI,EAAE,IAAI,CAAC;EACT,sBAAsB,EAAE,WAAW;EACnC,QAAQ,EAAE,MAAM;EAChB,SAAS,EAAE,IAAI;EACf,WAAW,EAAE,IAAI;CAClB;;AAED,AAAA,IAAI,CAAC;EACH,WAAW,EAAE,oIAAoI;EACjJ,SAAS,EAAE,kBAAkB;EAC7B,WAAW,EAAE,GAAG;EAChB,SAAS,EAAE,GAAG;CACf;;AAED,AAAA,CAAC,CAAC;EAAE,eAAe,EAAE,IAAI;CAAI;;AAE7B,AAAA,WAAW,CAAC;EACV,OAAO,EAAE,IAAI;EACb,QAAQ,EAAE,QAAQ;EAClB,KAAK,EAAE,KAAK;EACZ,MAAM,EAAE,KAAK;EACb,OAAO,EAAE,CACX;CAAC;;AAED,AAAA,KAAK,CAAC;EACJ,OAAO,EAAE,KAAK;EACd,OAAO,EAAE,CAAC;EAEV,WAAW,EAAE,IAAI;EACjB,WAAW,EAAE,8EAA8E;EAC3F,cAAc,EAAE,IAAI;EAEpB,UAAU,EAAE,GAAG;EACf,WAAW,EAAE,GAAG;CAuCjB;;AAhDD,AAWE,KAXG,CAWH,EAAE,AAAA,cAAc,CAAC;EACf,MAAM,EAAE,OAAO;EACf,SAAS,EAAE,IAAI;EACf,SAAS,EAAE,iBAAiB;EAC5B,SAAS,EAAE,YAAY;EAEvB,UAAU,EAAE,IAAI;EAChB,UAAU,EAAE,MAAM;EAClB,UAAU,EAAE,UAAU;EAEtB,eAAe,EAAE,IAAI;EACrB,aAAa,EAAE,KAAK;CAQrB;;AA9BH,AAwBI,KAxBC,CAWH,EAAE,AAAA,cAAc,GAaX,EAAE,CAAC;EACJ,SAAS,EAAE,YAAY;EACvB,aAAa,EAAE,MAAM;CAGtB;;AA7BL,AA4BM,KA5BD,CAWH,EAAE,AAAA,cAAc,GAaX,EAAE,AAIF,WAAW,CAAC;EAAE,aAAa,EAAE,KAAK;CAAI;;AA5B7C,AAgCE,KAhCG,CAgCH,KAAK,AAAA,SAAS,CAAC;EACb,KAAK,EAAE,IAAI;EACX,OAAO,EAAE,CAAC;EACV,MAAM,EAAE,IAAI;EACZ,aAAa,EAAE,GAAG;EAElB,WAAW,EAAE,OAAO;EACpB,SAAS,EAAE,OAAO;EAClB,WAAW,EAAE,OAAO;EACpB,WAAW,EAAE,CAAC;EAEd,KAAK,EAAE,KAAK;EACZ,UAAU,EAAE,kBAAiB;EAE7B,OAAO,EAAE,gBAAgB;CAC1B;;AAGH,AAAA,mBAAmB,CAAC;EAClB,KAAK,EAAE,IAAI;CAQZ;;AATD,AAGE,mBAHiB,AAGhB,MAAM,CAAC;EACN,UAAU,EAAE,mBAAmB;EAC/B,aAAa,EAAE,GAAG;CAGnB;;AARH,AAOI,mBAPe,AAGhB,MAAM,AAIJ,MAAM,CAAC;EAAE,UAAU,EAAE,mBAAmB;CAAI;;AAIjD,AAAA,UAAU,CAAC;EACT,OAAO,EAAE,YAAY;EACrB,KAAK,EAAE,MAAM;CACd", "sources": [ "main.scss" ], diff --git a/ReallifeGamemode.Client/assets/css/chat/main.scss b/ReallifeGamemode.Client/assets/css/chat/main.scss index 64ae2124..da987b80 100644 --- a/ReallifeGamemode.Client/assets/css/chat/main.scss +++ b/ReallifeGamemode.Client/assets/css/chat/main.scss @@ -7,9 +7,7 @@ html { box-sizing: border-box; } margin: 0 } -#chat, a, body, html { - color: #fff -} +#chat, a, body, html { color: white; } body, html { -webkit-font-smoothing: antialiased; @@ -49,12 +47,12 @@ a { text-decoration: none; } ul#chat_messages { height: 16.45em; min-width: 50ch; - max-width: calc(60vw + 10px); + max-width: calc(45vw + 10px); transform: rotate(0deg); overflow-y: auto; overflow-x: hidden; - word-break: break-all; + word-break: break-word; list-style-type: none; margin-bottom: .25em; @@ -68,19 +66,20 @@ a { text-decoration: none; } } input#chat_msg { - width: 60vw; + width: 45vw; outline: 0; border: none; border-radius: 3px; + font-family: inherit; font-size: inherit; font-weight: inherit; - line-height: inherit; + line-height: 1; color: white; background: rgba(0, 0, 0, .5); - padding: .5em; + padding: .5em .75em .75em; } } @@ -93,4 +92,9 @@ a { text-decoration: none; } &:hover { background: rgba(255, 17, 0, 0); } } -} \ No newline at end of file +} + +.timestamp { + display: inline-block; + width: 5.25em; +} diff --git a/ReallifeGamemode.Client/assets/css/onlinelist/style.css b/ReallifeGamemode.Client/assets/css/onlinelist/style.css index a60e49cf..f4793000 100644 --- a/ReallifeGamemode.Client/assets/css/onlinelist/style.css +++ b/ReallifeGamemode.Client/assets/css/onlinelist/style.css @@ -8,7 +8,13 @@ html { -ms-user-select: none; user-select: none; } +.show { + display: show !important; +} +.hidden { + display: none !important; +} html, body { margin: unset; } @@ -59,7 +65,7 @@ h2 { top: 0; z-index: 3; font-size: .9em; - background-color: black; + background-color: #0C0C0C; padding: 1em 0; } @@ -87,15 +93,8 @@ table th { top: 3em; text-align: left; z-index: 2; - background-color: black; -} - -table th:first-child { - border-top-left-radius: .25em; -} - -table th:last-child { - border-top-right-radius: .25em; + background-color: #0C0C0C; + border-top: 1px solid #0f0f0f; } table th, table td { @@ -216,4 +215,6 @@ ol.inline.stats { ol.inline.stats abbr { text-decoration: none; } + + /*# sourceMappingURL=style.css.map */ diff --git a/ReallifeGamemode.Client/assets/css/onlinelist/style.css.map b/ReallifeGamemode.Client/assets/css/onlinelist/style.css.map index 3f63b940..8b21e62f 100644 --- a/ReallifeGamemode.Client/assets/css/onlinelist/style.css.map +++ b/ReallifeGamemode.Client/assets/css/onlinelist/style.css.map @@ -1,6 +1,6 @@ { "version": 3, - "mappings": "AAAA,AAAA,IAAI,CAAC;EACH,UAAU,EAAE,UAAU;EACtB,MAAM,EAAE,KAAK;EACb,UAAU,EAAE,WAAW;EACvB,WAAW,EAAE,IAAI;CAClB;;AAED,AAAA,IAAI,EAAE,IAAI,CAAC;EAAE,MAAM,EAAE,KAAK;CAAI;;AAC9B,AAAA,CAAC,EAAE,CAAC,AAAA,OAAO,EAAE,CAAC,AAAA,MAAM,CAAC;EAAE,UAAU,EAAE,OAAO;CAAI;;AAE9C,AAAA,IAAI,CAAC;EACH,MAAM,EAAE,WAAW;EAEnB,KAAK,EAAE,IAAI;EACX,KAAK,EAAE,KAAK;EAEZ,WAAW,EAAE,oIAAoI;EACjJ,SAAS,EAAE,GAAG;CACf;;AAED,AAAA,EAAE,EAAE,EAAE,CAAC;EACL,MAAM,EAAE,KAAK;EACb,WAAW,EAAE,CAAC;CACf;;AAED,AAAA,EAAE,CAAC;EAAE,SAAS,EAAE,MAAM;CAAI;;AAC1B,AAAA,EAAE,CAAC;EAAE,SAAS,EAAE,OAAO;CAAI;;AAE3B,AAAA,QAAQ,CAAC;EACP,OAAO,EAAE,IAAI;EACb,eAAe,EAAE,aAAa;EAC9B,WAAW,EAAE,UAAU;EACvB,aAAa,EAAE,GAAG;EAClB,OAAO,EAAE,SAAS;CACnB;;AAED,AAAA,SAAS,CAAC;EACR,QAAQ,EAAE,MAAM;EAChB,GAAG,EAAE,CAAC;EACN,OAAO,EAAE,CAAC;EAEV,SAAS,EAAE,IAAI;EACf,gBAAgB,EAAE,KAAK;EAEvB,OAAO,EAAE,KAAK;CACf;;AAED,AAAA,QAAQ,CAAC;EACP,UAAU,EAAE,IAAI;EAChB,UAAU,EAAE,IAAI;EAChB,UAAU,EAAE,MAAM;EAElB,aAAa,EAAE,KAAK;EACpB,gBAAgB,EAAO,mBAAK;CAG7B;;AATD,AAQE,QARM,AAQL,mBAAmB,CAAC;EAAE,OAAO,EAAE,IAAI;CAAI;;AAG1C,AAAA,KAAK,CAAC;EACJ,eAAe,EAAE,QAAQ;EACzB,KAAK,EAAE,IAAI;EACX,aAAa,EAAE,OAAO;CAwCvB;;AA3CD,AAKE,KALG,CAKH,EAAE,CAAC;EACD,QAAQ,EAAE,MAAM;EAChB,GAAG,EAAE,GAAG;EACR,UAAU,EAAE,IAAI;EAChB,OAAO,EAAE,CAAC;EAEV,gBAAgB,EAAE,KAAK;CAIxB;;AAfH,AAaI,KAbC,CAKH,EAAE,AAQC,YAAY,CAAC;EAAE,sBAAsB,EAAE,KAAK;CAAI;;AAbrD,AAcI,KAdC,CAKH,EAAE,AASC,WAAW,CAAC;EAAE,uBAAuB,EAAE,KAAK;CAAI;;AAdrD,AAiBE,KAjBG,CAiBH,EAAE,EAjBJ,KAAK,CAiBC,EAAE,CAAC;EACL,OAAO,EAAE,SAAS;CAInB;;AAtBH,AAoBI,KApBC,CAiBH,EAAE,AAGC,YAAY,EApBjB,KAAK,CAiBC,EAAE,AAGH,YAAY,CAAC;EAAE,YAAY,EAAE,GAAG;CAAI;;AApBzC,AAqBI,KArBC,CAiBH,EAAE,AAIC,WAAW,EArBhB,KAAK,CAiBC,EAAE,AAIH,WAAW,CAAC;EAAE,aAAa,EAAE,GAAG;CAAI;;AArBzC,AAyBI,KAzBC,CAwBH,EAAE,CACA,EAAE,CAAC;EACD,QAAQ,EAAE,MAAM;CAajB;;AAvCL,AA4BM,KA5BD,CAwBH,EAAE,CACA,EAAE,AAGC,UAAW,CAAA,CAAC,EAAE;EAAE,KAAK,EAAE,cAAc;CAAI;;AA5BhD,AA6BM,KA7BD,CAwBH,EAAE,CACA,EAAE,AAIC,UAAW,CAAA,CAAC,EAAE;EACb,SAAS,EAAE,IAAI;EACf,WAAW,EAAE,IAAI;EACjB,UAAU,EAAE,IAAI;EAChB,WAAW,EAAE,MAAM;CAGpB;;AApCP,AAmCQ,KAnCH,CAwBH,EAAE,CACA,EAAE,AAIC,UAAW,CAAA,CAAC,CAMV,mBAAmB,CAAC;EAAE,OAAO,EAAE,IAAI;CAAI;;AAnChD,AAqCM,KArCD,CAwBH,EAAE,CACA,EAAE,AAYC,UAAW,CAAA,CAAC,EAAE;EAAE,KAAK,EAAE,eAAe;CAAI;;AArCjD,AAsCM,KAtCD,CAwBH,EAAE,CACA,EAAE,AAaC,UAAW,CAAA,CAAC,EAAE;EAAE,KAAK,EAAE,eAAe;CAAI;;AAtCjD,AAyCI,KAzCC,CAwBH,EAAE,AAiBC,UAAW,CAAA,IAAI,EAAE;EAAE,gBAAgB,EAAE,mBAAkB;CAAI;;AAIhE,AACE,MADI,AACH,QAAQ,CAAC;EACR,OAAO,EAAE,EAAE;EACX,MAAM,EAAE,KAAK;EACb,KAAK,EAAE,KAAK;EACZ,aAAa,EAAE,GAAG;EAClB,OAAO,EAAE,YAAY;EACrB,KAAK,EAAE,OAAO;EACd,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,0BAA0B;EAE5C,YAAY,EAAE,IAAI;EAClB,aAAa,EAAE,GAAG;CACnB;;AAEA,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,KAAkB;CAAI;;AACtD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAe;CAAI;;AACnD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAc;CAAI;;AAClD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAc;CAAI;;AAClD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAgB;CAAI;;AACpD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAgB;CAAI;;AACpD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,KAAkB;CAAI;;AACtD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAa;CAAI;;AACjD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAgB;CAAI;;AACpD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAgB;CAAI;;AAGvD,AAAA,EAAE,AAAA,OAAO,CAAC;EACR,OAAO,EAAE,IAAI;EAEb,UAAU,EAAE,KAAK;EACjB,eAAe,EAAE,IAAI;EACrB,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,KAAK;CAGf;;AATD,AAQE,EARA,AAAA,OAAO,CAQP,EAAE,AAAA,IAAK,CAAA,WAAW,EAAE;EAAE,YAAY,EAAE,GAAG;CAAI;;AAG7C,AAAA,EAAE,AAAA,OAAO,AAAA,MAAM,CAAC;EACd,eAAe,EAAE,MAAM;CAGxB;;AAJD,AAGE,EAHA,AAAA,OAAO,AAAA,MAAM,CAGb,IAAI,CAAC;EAAE,eAAe,EAAE,IAAI;CAAI", + "mappings": "AAAA,AAAA,IAAI,CAAC;EACH,UAAU,EAAE,UAAU;EACtB,MAAM,EAAE,KAAK;EACb,UAAU,EAAE,WAAW;EACvB,WAAW,EAAE,IAAI;CAClB;;AAED,AAAA,IAAI,EAAE,IAAI,CAAC;EAAE,MAAM,EAAE,KAAK;CAAI;;AAC9B,AAAA,CAAC,EAAE,CAAC,AAAA,OAAO,EAAE,CAAC,AAAA,MAAM,CAAC;EAAE,UAAU,EAAE,OAAO;CAAI;;AAE9C,AAAA,IAAI,CAAC;EACH,MAAM,EAAE,WAAW;EAEnB,KAAK,EAAE,IAAI;EACX,KAAK,EAAE,KAAK;EAEZ,WAAW,EAAE,oIAAoI;EACjJ,SAAS,EAAE,GAAG;CACf;;AAED,AAAA,EAAE,EAAE,EAAE,CAAC;EACL,MAAM,EAAE,KAAK;EACb,WAAW,EAAE,CAAC;CACf;;AAED,AAAA,EAAE,CAAC;EAAE,SAAS,EAAE,MAAM;CAAI;;AAC1B,AAAA,EAAE,CAAC;EAAE,SAAS,EAAE,OAAO;CAAI;;AAE3B,AAAA,QAAQ,CAAC;EACP,OAAO,EAAE,IAAI;EACb,eAAe,EAAE,aAAa;EAC9B,WAAW,EAAE,UAAU;EACvB,aAAa,EAAE,GAAG;EAClB,OAAO,EAAE,SAAS;CACnB;;AAED,AAAA,SAAS,CAAC;EACR,QAAQ,EAAE,MAAM;EAChB,GAAG,EAAE,CAAC;EACN,OAAO,EAAE,CAAC;EAEV,SAAS,EAAE,IAAI;EACf,gBAAgB,EAAE,OAAO;EAEzB,OAAO,EAAE,KAAK;CACf;;AAED,AAAA,QAAQ,CAAC;EACP,UAAU,EAAE,IAAI;EAChB,UAAU,EAAE,IAAI;EAChB,UAAU,EAAE,MAAM;EAElB,aAAa,EAAE,KAAK;EACpB,gBAAgB,EAAO,mBAAK;CAG7B;;AATD,AAQE,QARM,AAQL,mBAAmB,CAAC;EAAE,OAAO,EAAE,IAAI;CAAI;;AAG1C,AAAA,KAAK,CAAC;EACJ,eAAe,EAAE,QAAQ;EACzB,KAAK,EAAE,IAAI;EACX,aAAa,EAAE,OAAO;CAsCvB;;AAzCD,AAKE,KALG,CAKH,EAAE,CAAC;EACD,QAAQ,EAAE,MAAM;EAChB,GAAG,EAAE,GAAG;EACR,UAAU,EAAE,IAAI;EAChB,OAAO,EAAE,CAAC;EAEV,gBAAgB,EAAE,OAAO;EACzB,UAAU,EAAE,iBAAiB;CAC9B;;AAbH,AAeE,KAfG,CAeH,EAAE,EAfJ,KAAK,CAeC,EAAE,CAAC;EACL,OAAO,EAAE,SAAS;CAInB;;AApBH,AAkBI,KAlBC,CAeH,EAAE,AAGC,YAAY,EAlBjB,KAAK,CAeC,EAAE,AAGH,YAAY,CAAC;EAAE,YAAY,EAAE,GAAG;CAAI;;AAlBzC,AAmBI,KAnBC,CAeH,EAAE,AAIC,WAAW,EAnBhB,KAAK,CAeC,EAAE,AAIH,WAAW,CAAC;EAAE,aAAa,EAAE,GAAG;CAAI;;AAnBzC,AAuBI,KAvBC,CAsBH,EAAE,CACA,EAAE,CAAC;EACD,QAAQ,EAAE,MAAM;CAajB;;AArCL,AA0BM,KA1BD,CAsBH,EAAE,CACA,EAAE,AAGC,UAAW,CAAA,CAAC,EAAE;EAAE,KAAK,EAAE,cAAc;CAAI;;AA1BhD,AA2BM,KA3BD,CAsBH,EAAE,CACA,EAAE,AAIC,UAAW,CAAA,CAAC,EAAE;EACb,SAAS,EAAE,IAAI;EACf,WAAW,EAAE,IAAI;EACjB,UAAU,EAAE,IAAI;EAChB,WAAW,EAAE,MAAM;CAGpB;;AAlCP,AAiCQ,KAjCH,CAsBH,EAAE,CACA,EAAE,AAIC,UAAW,CAAA,CAAC,CAMV,mBAAmB,CAAC;EAAE,OAAO,EAAE,IAAI;CAAI;;AAjChD,AAmCM,KAnCD,CAsBH,EAAE,CACA,EAAE,AAYC,UAAW,CAAA,CAAC,EAAE;EAAE,KAAK,EAAE,eAAe;CAAI;;AAnCjD,AAoCM,KApCD,CAsBH,EAAE,CACA,EAAE,AAaC,UAAW,CAAA,CAAC,EAAE;EAAE,KAAK,EAAE,eAAe;CAAI;;AApCjD,AAuCI,KAvCC,CAsBH,EAAE,AAiBC,UAAW,CAAA,IAAI,EAAE;EAAE,gBAAgB,EAAE,mBAAkB;CAAI;;AAIhE,AACE,MADI,AACH,QAAQ,CAAC;EACR,OAAO,EAAE,EAAE;EACX,MAAM,EAAE,KAAK;EACb,KAAK,EAAE,KAAK;EACZ,aAAa,EAAE,GAAG;EAClB,OAAO,EAAE,YAAY;EACrB,KAAK,EAAE,OAAO;EACd,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,0BAA0B;EAE5C,YAAY,EAAE,IAAI;EAClB,aAAa,EAAE,GAAG;CACnB;;AAEA,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,KAAkB;CAAI;;AACtD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAe;CAAI;;AACnD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAc;CAAI;;AAClD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAc;CAAI;;AAClD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAgB;CAAI;;AACpD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAgB;CAAI;;AACpD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,KAAkB;CAAI;;AACtD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAa;CAAI;;AACjD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAgB;CAAI;;AACpD,AAAD,SAAI,AAAA,QAAQ,CAAC;EAAE,gBAAgB,EAAE,OAAgB;CAAI;;AAGvD,AAAA,EAAE,AAAA,OAAO,CAAC;EACR,OAAO,EAAE,IAAI;EAEb,UAAU,EAAE,KAAK;EACjB,eAAe,EAAE,IAAI;EACrB,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,KAAK;CAGf;;AATD,AAQE,EARA,AAAA,OAAO,CAQP,EAAE,AAAA,IAAK,CAAA,WAAW,EAAE;EAAE,YAAY,EAAE,GAAG;CAAI;;AAG7C,AAAA,EAAE,AAAA,OAAO,AAAA,MAAM,CAAC;EACd,eAAe,EAAE,MAAM;CAGxB;;AAJD,AAGE,EAHA,AAAA,OAAO,AAAA,MAAM,CAGb,IAAI,CAAC;EAAE,eAAe,EAAE,IAAI;CAAI", "sources": [ "style.scss" ], diff --git a/ReallifeGamemode.Client/assets/css/onlinelist/style.scss b/ReallifeGamemode.Client/assets/css/onlinelist/style.scss index 305684ad..3887d166 100644 --- a/ReallifeGamemode.Client/assets/css/onlinelist/style.scss +++ b/ReallifeGamemode.Client/assets/css/onlinelist/style.scss @@ -40,7 +40,7 @@ h2 { font-size: 1.125em; } z-index: 3; font-size: .9em; - background-color: black; + background-color: #0C0C0C; padding: 1em 0; } @@ -67,10 +67,8 @@ table { text-align: left; z-index: 2; - background-color: black; - - &:first-child { border-top-left-radius: .25em; } - &:last-child { border-top-right-radius: .25em; } + background-color: #0C0C0C; + border-top: 1px solid #0f0f0f; } th, td { diff --git a/ReallifeGamemode.Client/assets/html/inputhelper/index.html b/ReallifeGamemode.Client/assets/html/inputhelper/index.html index a83e9194..335e30f4 100644 --- a/ReallifeGamemode.Client/assets/html/inputhelper/index.html +++ b/ReallifeGamemode.Client/assets/html/inputhelper/index.html @@ -24,7 +24,7 @@ - + + + + diff --git a/ReallifeGamemode.Client/assets/img/login/logo-light.png b/ReallifeGamemode.Client/assets/img/login/logo-light.png index 46f93732..bd3de49f 100644 Binary files a/ReallifeGamemode.Client/assets/img/login/logo-light.png and b/ReallifeGamemode.Client/assets/img/login/logo-light.png differ diff --git a/ReallifeGamemode.Client/assets/img/login/logo.png b/ReallifeGamemode.Client/assets/img/login/logo.png index ded92370..c11e0d35 100644 Binary files a/ReallifeGamemode.Client/assets/img/login/logo.png and b/ReallifeGamemode.Client/assets/img/login/logo.png differ diff --git a/ReallifeGamemode.Client/assets/js/chat/main.js b/ReallifeGamemode.Client/assets/js/chat/main.js index f9ebd0aa..4fa78a5c 100644 --- a/ReallifeGamemode.Client/assets/js/chat/main.js +++ b/ReallifeGamemode.Client/assets/js/chat/main.js @@ -1,7 +1,7 @@ let chat = { size: 0, - history_limit: 50, + history_limit: 150, container: null, input: null, enabled: false, @@ -21,10 +21,9 @@ function enableChatInput(enable) { mp.invoke("focus", enable); if (enable) { - chat.input = $("#chat").append('
').children(":last"); + chat.input = $("#chat").append('
').children(":last"); chat.input.children("input").focus(); - } - else { + } else { chat.input.fadeOut('fast', function () { chat.input.remove(); chat.input = null; @@ -66,10 +65,10 @@ var chatAPI = if (chatElement === "
  • ") { if (chat.input == null || elmnt.scrollTop == elmnt.scrollHeight - elmnt.clientHeight) { - chat.container.append("
  • " + "[" + today.toLocaleTimeString('de-DE') + "] " + text + "
  • "); + chat.container.append("
  • " + "[" + today.toLocaleTimeString('de-DE') + "] " + text + "
  • "); elmnt.scrollTop = elmnt.scrollHeight - elmnt.clientHeight; } else { - chat.container.append("
  • " + "[" + today.toLocaleTimeString('de-DE') + "] " + text + "
  • "); + chat.container.append("
  • " + "[" + today.toLocaleTimeString('de-DE') + "] " + text + "
  • "); } } else { chat.container.append(chatElement); diff --git a/ReallifeGamemode.Client/assets/js/onlinelist/script.js b/ReallifeGamemode.Client/assets/js/onlinelist/script.js index a662711b..7bf68092 100644 --- a/ReallifeGamemode.Client/assets/js/onlinelist/script.js +++ b/ReallifeGamemode.Client/assets/js/onlinelist/script.js @@ -3,12 +3,26 @@ window.onbeforeunload = () => { window.scrollTo(0, 0); } setPlayerCount = (factionId, value) => { if (factionId == -1) { document.getElementById('player-count').innerHTML = value; - addTableSorting(); } else if (factionId >= 0 && factionId <= 9) { document.getElementById(factionId).innerHTML = value; } } +function showPlayerList() { + document.getElementsByName("OnlineList")[0].classList.remove("hidden"); + mp.events.call("CEF:PlayerList_Loaded"); + window.scrollTo(0, 0); +} +function closePlayerList() { + document.getElementsByName("OnlineList")[0].classList.toggle("hidden"); +} + +function clear_row() { + document.getElementById('players').innerHTML = ''; +} + + + function getFactionNameByFactionId(factionId) { switch (parseInt(factionId)) { case 1: return "LSPD"; @@ -28,33 +42,4 @@ function addPlayerEntry(userId, userName, factionId, userPing) { document.getElementById('players').innerHTML += `${userId} ${userName} ${factionName} ${userPing}`; } -// https://www.jstips.co/en/javascript/detect-document-ready-in-pure-js/ -document.onreadystatechange = () => { - if (document.readyState === 'complete') { mp.trigger('CEF:PlayerList_Loaded'); } -}; - -// Sortierung von https://codepen.io/selbekk/pen/LNOZKL -function addTableSorting() { - const headers = Array.from(document.querySelectorAll('th')); - const rows = Array.from(document.querySelectorAll('tbody tr')); - - function sort(e) { - const index = headers.indexOf(e.target); - const sortVal = e.target.classList.contains('is-asc') ? 1 : -1; - rows.sort((a, b) => { - const aValue = a.children[index].innerHTML; - const bValue = b.children[index].innerHTML; - if(aValue > bValue) { return sortVal; } - if(aValue < bValue) { return -sortVal; } - return 0; - }) - - e.target.classList.add('is-sorted'); - e.target.classList.toggle('is-asc'); - const body = document.querySelector('tbody'); - body.innerHTML = ''; - rows.forEach(row => body.appendChild(row)); - } - - headers.forEach(header => header.addEventListener('click', sort)); -} +$("table").stupidtable(); diff --git a/ReallifeGamemode.Client/assets/js/onlinelist/stupidtable.min.js b/ReallifeGamemode.Client/assets/js/onlinelist/stupidtable.min.js new file mode 100644 index 00000000..8339200d --- /dev/null +++ b/ReallifeGamemode.Client/assets/js/onlinelist/stupidtable.min.js @@ -0,0 +1 @@ +!function(i){i.fn.stupidtable=function(n){return this.each(function(){var t=i(this);n=n||{},n=i.extend({},i.fn.stupidtable.default_sort_fns,n),t.data("sortFns",n),t.stupidtable_build(),t.on("click.stupidtable","thead th",function(){i(this).stupidsort()}),t.find("th[data-sort-onload=yes]").eq(0).stupidsort()})},i.fn.stupidtable.default_settings={should_redraw:function(t){return!0},will_manually_build_table:!1},i.fn.stupidtable.dir={ASC:"asc",DESC:"desc"},i.fn.stupidtable.default_sort_fns={int:function(t,n){return parseInt(t,10)-parseInt(n,10)},float:function(t,n){return parseFloat(t)-parseFloat(n)},string:function(t,n){return t.toString().localeCompare(n.toString())},"string-ins":function(t,n){return t=t.toString().toLocaleLowerCase(),n=n.toString().toLocaleLowerCase(),t.localeCompare(n)}},i.fn.stupidtable_settings=function(a){return this.each(function(){var t=i(this),n=i.extend({},i.fn.stupidtable.default_settings,a);t.stupidtable.settings=n})},i.fn.stupidsort=function(t){var a=i(this),n=a.data("sort")||null;if(null!==n){var r=a.closest("table"),e={$th:a,$table:r,datatype:n};return r.stupidtable.settings||(r.stupidtable.settings=i.extend({},i.fn.stupidtable.default_settings)),e.compare_fn=r.data("sortFns")[n],e.th_index=l(e),e.sort_dir=u(t,e),a.data("sort-dir",e.sort_dir),r.trigger("beforetablesort",{column:e.th_index,direction:e.sort_dir,$th:a}),r.css("display"),setTimeout(function(){r.stupidtable.settings.will_manually_build_table||r.stupidtable_build();var t=s(e),n=d(t,e);r.stupidtable.settings.should_redraw(e)&&(r.children("tbody").append(n),o(e),r.trigger("aftertablesort",{column:e.th_index,direction:e.sort_dir,$th:a}),r.css("display"))},10),a}},i.fn.updateSortVal=function(t){var n=i(this);return n.is("[data-sort-value]")&&n.attr("data-sort-value",t),n.data("sort-value",t),n},i.fn.stupidtable_build=function(){return this.each(function(){var t=i(this),a=[];t.children("tbody").children("tr").each(function(t,n){var e={$tr:i(n),columns:[],index:t};i(n).children("td").each(function(t,n){var a=i(n).data("sort-value");if(void 0===a){var r=i(n).text();i(n).data("sort-value",r),a=r}e.columns.push(a)}),a.push(e)}),t.data("stupidsort_internaltable",a)})};var s=function(s){var t,n=s.$table.data("stupidsort_internaltable"),d=s.th_index,a=s.$th.data("sort-multicolumn");t=a?a.split(","):[];var o=i.map(t,function(t,n){return r(s.$table,t)});return n.sort(function(t,n){for(var a=o.slice(0),r=s.compare_fn(t.columns[d],n.columns[d]);0===r&&a.length;){var e=a[0],i=e.$e.data("sort");r=(0,s.$table.data("sortFns")[i])(t.columns[e.index],n.columns[e.index]),a.shift()}return 0===r?t.index-n.index:r}),s.sort_dir!=i.fn.stupidtable.dir.ASC&&n.reverse(),n},r=function(t,n){var a,r=t.find("th"),e=parseInt(n,10);return e||0===e?a=r.eq(e):(a=r.siblings("#"+n),e=r.index(a)),{index:e,$e:a}},d=function(t,a){var n=i.map(t,function(t,n){return[[t.columns[a.th_index],t.$tr,n]]});return a.column=n,i.map(t,function(t){return t.$tr})},o=function(t){var n=t.$table,a=t.$th,r=a.data("sort-dir");n.find("th").data("sort-dir",null).removeClass("sorting-desc sorting-asc"),a.data("sort-dir",r).addClass("sorting-"+r)},u=function(t,n){var a,r=n.$th,e=i.fn.stupidtable.dir;return t?a=t:(a=t||r.data("sort-default")||e.ASC,r.data("sort-dir")&&(a=r.data("sort-dir")===e.ASC?e.DESC:e.ASC)),a},l=function(t){var n=0,a=t.$th.index();return t.$th.parents("tr").find("th").slice(0,a).each(function(){var t=i(this).attr("colspan")||1;n+=parseInt(t,10)}),n}}(window.jQuery); diff --git a/ReallifeGamemode.Client/dlcpacks/Fahrstuhl/dlc.rpf b/ReallifeGamemode.Client/dlcpacks/Fahrstuhl/dlc.rpf deleted file mode 100644 index ea2643a3..00000000 --- a/ReallifeGamemode.Client/dlcpacks/Fahrstuhl/dlc.rpf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6f1478ada7534b954caaec991bb2a3a24767b978de82533965e0c21c3d02831f -size 8491 diff --git a/ReallifeGamemode.Client/dlcpacks/fibgarage/dlc.rpf b/ReallifeGamemode.Client/dlcpacks/fibgarage/dlc.rpf new file mode 100644 index 00000000..1d609a52 --- /dev/null +++ b/ReallifeGamemode.Client/dlcpacks/fibgarage/dlc.rpf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7c638247cd28299585423da1746b80f7262daa3e86ffafd9d3254b9a66ef8e2 +size 38912 diff --git a/ReallifeGamemode.Client/dlcpacks/heal/dlc.rpf b/ReallifeGamemode.Client/dlcpacks/heal/dlc.rpf new file mode 100644 index 00000000..7ba23ab4 --- /dev/null +++ b/ReallifeGamemode.Client/dlcpacks/heal/dlc.rpf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb41e0f12df5bc1a1d0425d0b01f0918a18d27d6e10fec95145cd5d4633a29cd +size 38912 diff --git a/ReallifeGamemode.Client/dlcpacks/polcoquette/dlc.rpf b/ReallifeGamemode.Client/dlcpacks/polcoquette/dlc.rpf new file mode 100644 index 00000000..cb5e800d --- /dev/null +++ b/ReallifeGamemode.Client/dlcpacks/polcoquette/dlc.rpf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc9132404cdc1d20830d4684697bf82f3738bc4345cc6d1189cf2b63f0b15de8 +size 2962432 diff --git a/ReallifeGamemode.Client/dlcpacks/sheriffcoqm/dlc.rpf b/ReallifeGamemode.Client/dlcpacks/sheriffcoqm/dlc.rpf new file mode 100644 index 00000000..801bb4bb --- /dev/null +++ b/ReallifeGamemode.Client/dlcpacks/sheriffcoqm/dlc.rpf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a66cd9ec235636bd61c7cf90c0602be8bf97c303fe2fa6703b49c42352aeb7c +size 18657792 diff --git a/ReallifeGamemode.Client/dlcpacks/vagos/dlc.rpf b/ReallifeGamemode.Client/dlcpacks/vagos/dlc.rpf new file mode 100644 index 00000000..d5d31aa5 --- /dev/null +++ b/ReallifeGamemode.Client/dlcpacks/vagos/dlc.rpf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e881ff859b49942bfa942525cb5acac5bd5a123c3febbbec28da3b84acc266b6 +size 98816 diff --git a/ReallifeGamemode.Client/dlcpacks/vtvicechee/dlc.rpf b/ReallifeGamemode.Client/dlcpacks/vtvicechee/dlc.rpf new file mode 100644 index 00000000..df9b9593 --- /dev/null +++ b/ReallifeGamemode.Client/dlcpacks/vtvicechee/dlc.rpf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a7eb55afdb7bc022b5308388902e886291bff38a688b38e0dfcb48d492232a1a +size 5581312 diff --git a/ReallifeGamemode.Client/global.d.ts b/ReallifeGamemode.Client/global.d.ts index e26e3c54..49a68bad 100644 --- a/ReallifeGamemode.Client/global.d.ts +++ b/ReallifeGamemode.Client/global.d.ts @@ -91,6 +91,12 @@ declare type WeaponCategory = { Weapons: Weapon[]; } +declare type RentcarProperty = { + Name: string; + Price: number; +} +} + declare type PlayerCharacterData = { Gender: boolean; Father: number; diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts index 8572b86d..b79488aa 100644 --- a/ReallifeGamemode.Client/index.ts +++ b/ReallifeGamemode.Client/index.ts @@ -186,8 +186,8 @@ ped(); import reportList from './Player/reportmenu'; reportList(globalData); -import nodmHandler from './Player/nodm'; -nodmHandler(); +import polygonHandler from './Player/polygons'; +polygonHandler(); import checkpointHandle from './util/checkpoint'; checkpointHandle(globalData); @@ -208,7 +208,7 @@ import PilotRouteList from './Jobs/PilotRouteSelect'; PilotRouteList(globalData); import weapondamageUtil from './util/weapondamage'; -weapondamageUtil(); +weapondamageUtil(globalData); import soundUtil from './util/sound'; soundUtil(); @@ -277,6 +277,14 @@ handsup(); import spawnschutz from './Player/spawnschutz'; spawnschutz(); +import bigmap from './Gui/bigmap'; +bigmap(); + +import notification from './Gui/notification'; +notification(); + +import rentCar from './util/rentcar'; +rentCar(globalData); require('./Gui/policedepartment'); require('./Gui/helptext'); @@ -290,4 +298,4 @@ interface VehicleData { export { VehicleData -} +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/inventory/inventory.ts b/ReallifeGamemode.Client/inventory/inventory.ts index b36c7f8d..1f2a7504 100644 --- a/ReallifeGamemode.Client/inventory/inventory.ts +++ b/ReallifeGamemode.Client/inventory/inventory.ts @@ -12,51 +12,27 @@ var loaded = false; - mp.events.add('inventoryShow', () => { - if (invBrowser !== null) { - invBrowser.destroy() - invBrowser = null; - globalData.InMenu = false; - loaded = false; - mp.gui.cursor.show(false, false); - return; - } - if (!globalData.InMenu) { - globalData.InMenu = true; - mp.gui.cursor.show(true, true); - itemArr = []; - vehItemArr = []; - invBrowser = mp.browsers.new('package://assets/html/inventory/inventory.html'); - } - }); - var offer = 0; - - var tradeItemID; - var tradeItemAmount; - var tradeItemName; - var tradeItemWeight; - - mp.events.add('openInventory', () => { - globalData.InMenu = true; - mp.gui.cursor.show(true, true); + mp.events.add('loadInventoryCEF', () => { itemArr = []; vehItemArr = []; + if (invBrowser !== null) { + invBrowser.destroy + } invBrowser = mp.browsers.new('package://assets/html/inventory/inventory.html'); }); - mp.events.add('closeInventory', () => { - invBrowser.destroy() - invBrowser = null; - globalData.InMenu = false; - loaded = false; - mp.gui.cursor.show(false, false); - return; - }); - mp.events.addDataHandler("tradeOffer", (entity, value) => { - if (entity.type === "player") { - offer = parseInt(value); - if (invBrowser != null) - invBrowser.execute(`changeTradeStatus('${JSON.stringify(offer)}')`); + mp.events.add('inventoryShow', () => { + if (!globalData.InMenu && !loaded) { + globalData.InMenu = true; + mp.gui.cursor.show(true, true); + loaded = true; + + invBrowser.execute(`showInventory()`); + } else if (loaded) { + globalData.InMenu = false; + mp.gui.cursor.show(false, false); + loaded = false; + invBrowser.execute(`closeInventory()`); } }); @@ -81,17 +57,6 @@ } }); - mp.events.add("CEF:InventoryLoaded", () => { - invBrowser.execute(`setBackpackItems('${JSON.stringify(itemArr)}')`); - if (vehItemArr.length != 0) { - invBrowser.execute(`setVehicleItems('${JSON.stringify(vehItemArr)}')`); - } - - //invBrowser.execute(`setTradeItems('${JSON.stringify(tradeItemArr)}')`); - //invBrowser.execute(`setOfferItems('${JSON.stringify(offerItemArr)}')`); - loaded = true; - }); - mp.events.add("CEF:callVehicleInventory", () => { mp.events.callRemote("CLIENT:getVehicleInventory") }); @@ -117,8 +82,8 @@ mp.events.add("aproveUse", (amount, name) => { if (invBrowser !== null) { mp.game.audio.playSoundFrontend(1, "LOCAL_PLYR_CASH_COUNTER_COMPLETE", "DLC_HEISTS_GENERAL_FRONTEND_SOUNDS", true); - invBrowser.execute(`alertGreen('${JSON.stringify(amount)}','${JSON.stringify(name)}')`); - mp.events.call("closeInventory"); + //invBrowser.execute(`alertGreen('${JSON.stringify(amount)}','${JSON.stringify(name)}')`); + //mp.events.call("inventoryShow"); } }); @@ -171,16 +136,4 @@ mp.events.add("CEF:UseItemInv", (itemId) => { mp.events.callRemote('invUseItem', itemId); }); - - mp.events.add("CEF:tradeItem", (money, User, tradeItems, tradeItemAmount) => { - if (invBrowser !== null) { - try { - invBrowser.destroy() - invBrowser = null; - mp.events.callRemote('tradeItem', 0, User, tradeItems, tradeItemAmount); - } finally { - mp.gui.cursor.show(false, false); - } - } - }); } \ No newline at end of file diff --git a/ReallifeGamemode.Client/util/Gangwar.ts b/ReallifeGamemode.Client/util/Gangwar.ts index f9136552..a7b94ac8 100644 --- a/ReallifeGamemode.Client/util/Gangwar.ts +++ b/ReallifeGamemode.Client/util/Gangwar.ts @@ -1,4 +1,6 @@ export default function gangwarHandle(globalData: IGlobalData) { + var gangwarKillCounter = 0; + function inside(point, vs) { let x = point[0], y = point[1]; @@ -625,4 +627,12 @@ //turf.render(); } }); + + mp.events.add("gangWarKillNotification", (deathPlayername) => { + mp.events.call("BN_Show", "~y~GANGWAR~w~: Du hast ~r~" + deathPlayername + " ~w~getötet. Kills: " + ++gangwarKillCounter); + }); + + mp.events.add("resetKillcounter", () => { + gangwarKillCounter = 0; + }); } \ No newline at end of file diff --git a/ReallifeGamemode.Client/util/animationSync.ts b/ReallifeGamemode.Client/util/animationSync.ts index b56765a3..f786b64a 100644 --- a/ReallifeGamemode.Client/util/animationSync.ts +++ b/ReallifeGamemode.Client/util/animationSync.ts @@ -87,7 +87,7 @@ export default function animationSync() { mp.events.addDataHandler("AnimationData", (entity, string) => { entity.clearTasksImmediately(); if (animationBreakTimer) { - clearInterval(animationBreakTimer); + clearTimeout(animationBreakTimer); animationBreakTimer = null; } if (string == null) { @@ -109,13 +109,12 @@ export default function animationSync() { if (mp.players.local == entity) { if (!endless) { - animationBreakTimer = setInterval(() => breakAnimation(name), 120000); + animationBreakTimer = setTimeout(() => breakAnimation(name), 120000); } if (!loop) { - let a = setInterval(function () { - clearInterval(a); - mp.game.wait(500); + let a = setTimeout(function () { + clearTimeout(a); mp.events.callRemote("CLIENT:ClearAnimationData", true); }, duration); } @@ -126,7 +125,7 @@ export default function animationSync() { let { animName, msg } = animationBreakMessage.find(c => c.animName == name) if (msg) - mp.events.call("renderTextOnScreen", msg); + mp.events.call("BN_Show", msg); clearInterval(animationBreakTimer); animationBreakTimer = null; diff --git a/ReallifeGamemode.Client/util/rentcar.ts b/ReallifeGamemode.Client/util/rentcar.ts new file mode 100644 index 00000000..58095235 --- /dev/null +++ b/ReallifeGamemode.Client/util/rentcar.ts @@ -0,0 +1,102 @@ +import * as NativeUI from '../libs/NativeUI'; + +const Menu = NativeUI.Menu; +const UIMenuItem = NativeUI.UIMenuItem; +const UIMenuListItem = NativeUI.UIMenuListItem; +const Point = NativeUI.Point; +const ItemsCollection = NativeUI.ItemsCollection; +const Color = NativeUI.Color; + + +let screenRes = mp.game.graphics.getScreenResolution(0, 0); + +let sendItem = new UIMenuItem("Mieten", "Fahrzeug Mieten"); +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 rentCar(globalData: IGlobalData) { + + var rentcarMenu: NativeUI.Menu; + var vehiclesToRent: RentcarProperty[] = []; + var vehicleNames: string[] = []; + var vehiclePrices: number[] = []; + var selectedIndex: number; + + var payTimer; + var totalTime: number = 0; + var totalBill: number = 0; + + mp.events.add('showRentcarMenu', (vehiclestring, rentcarLocation) => { + if (globalData.InMenu) { + return; + } + + globalData.InMenu = true; + + vehiclesToRent = JSON.parse(vehiclestring); + + vehicleNames = []; + vehiclePrices = []; + for (let entry of vehiclesToRent) { + vehicleNames.push(entry.Name); + vehiclePrices.push(entry.Price); + } + + rentcarMenu = new Menu("Fahrzeugverleih", "", new Point(0, screenRes.y / 3), null, null); + rentcarMenu.AddItem(new UIMenuListItem("Fahrzeug", "$" + vehiclePrices[0] + " alle 3 Minuten", new ItemsCollection(vehicleNames))); + + rentcarMenu.AddItem(sendItem); + rentcarMenu.AddItem(cancelItem); + rentcarMenu.Visible = true; + //outeText = "Route 1"; + + selectedIndex = 0; + + rentcarMenu.ListChange.on((item: NativeUI.UIMenuListItem, index) => { + switch (item.Text) { + case "Fahrzeug": + item.Description = "$" + vehiclePrices[index] + " alle 3 Minuten"; + selectedIndex = index; + //item.Description = item.SelectedValue; + break; + } + }); + + rentcarMenu.ItemSelect.on((item) => { + if (item.Text === "Mieten") { + mp.events.callRemote("SERVER:rentcarBooked", vehicleNames[selectedIndex], vehiclePrices[selectedIndex], rentcarLocation); + rentcarMenu.Close(); + globalData.InMenu = false; + } else if (item.Text === "Abbrechen") { + rentcarMenu.Close(); + globalData.InMenu = false; + } + }); + + rentcarMenu.MenuClose.on(() => { + globalData.InMenu = false; + }); + }); + + mp.events.add('triggerRentcarTimer', (interval, pricePerInterval) => { + totalBill = pricePerInterval; + mp.events.callRemote("SERVER:updateRentCarBill", totalBill, totalTime); + clearInterval(payTimer); + + payTimer = setInterval(() => { + totalTime += interval; + totalBill += pricePerInterval; + + mp.events.callRemote("SERVER:updateRentCarBill", totalBill, totalTime); + }, interval * 1000); + }); + + mp.events.add('abortRentcarTimer', () => { + clearInterval(payTimer); + }); +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/util/weapondamage.ts b/ReallifeGamemode.Client/util/weapondamage.ts index 555d4292..49f3bc55 100644 --- a/ReallifeGamemode.Client/util/weapondamage.ts +++ b/ReallifeGamemode.Client/util/weapondamage.ts @@ -1,4 +1,4 @@ -import { isInAnyNoDMPolygon, listNoDMZones } from "../Player/nodm"; +import { isInAnyNoDMPolygon, listNoDMZones } from "../Player/polygons"; import polygons from "../polygons"; import { getWantedCount } from "../Gui/wanteds"; import { spawnschutzEnabled } from "../Player/spawnschutz"; @@ -18,7 +18,7 @@ function isTargetInPolygon(pos): boolean { return false; } -export default function weapondamageUtil() { +export default function weapondamageUtil(globalData: IGlobalData) { let blockInput = false; mp.players.local.setSuffersCriticalHits(false); @@ -32,12 +32,16 @@ export default function weapondamageUtil() { return true; } + if (globalData.IsAfk == true && getWantedCount() === 0) { + return true; + } + if (spawnschutzEnabled && getWantedCount() === 0) { return true; } }); - mp.events.add('outgoingDamage', (sourceEntity, targetEntity, sourcePlayer, weapon, boneIndex, damage) => { + mp.events.add(RageEnums.EventKey.OUTGOING_DAMAGE, (sourceEntity, targetEntity, sourcePlayer, weapon, boneIndex, damage) => { if (spawnschutzEnabled && getWantedCount() === 0) { return true; } diff --git a/ReallifeGamemode.Database/Entities/Door.cs b/ReallifeGamemode.Database/Entities/Door.cs index 19eb04c4..ab26cf4a 100644 --- a/ReallifeGamemode.Database/Entities/Door.cs +++ b/ReallifeGamemode.Database/Entities/Door.cs @@ -22,6 +22,7 @@ namespace ReallifeGamemode.Database.Entities public float Y { get; set; } public float Z { get; set; } public float Radius { get; set; } + public bool AlwaysOpen { get; set; } [NotMapped] public Vector3 Position => new Vector3(X, Y, Z); diff --git a/ReallifeGamemode.Database/Migrations/20210429134927_AddDoorAlwaysOpenFlag.Designer.cs b/ReallifeGamemode.Database/Migrations/20210429134927_AddDoorAlwaysOpenFlag.Designer.cs new file mode 100644 index 00000000..14f87b5b --- /dev/null +++ b/ReallifeGamemode.Database/Migrations/20210429134927_AddDoorAlwaysOpenFlag.Designer.cs @@ -0,0 +1,2180 @@ +// +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("20210429134927_AddDoorAlwaysOpenFlag")] + partial class AddDoorAlwaysOpenFlag + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("PropertyAccessMode", PropertyAccessMode.PreferFieldDuringConstruction) + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ATM", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Active") + .HasColumnType("tinyint(1)"); + + b.Property("Balance") + .HasColumnType("int"); + + b.Property("Faulty") + .HasColumnType("tinyint(1)"); + + b.Property("X") + .HasColumnType("float"); + + b.Property("Y") + .HasColumnType("float"); + + b.Property("Z") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("ATMs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Ban", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Applied") + .HasColumnType("int"); + + b.Property("BannedBy") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Reason") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("UntilDateTime") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Bans"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusRoute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.ToTable("BusRoutes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusRoutePoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("BusRouteId") + .HasColumnType("int"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("X") + .HasColumnType("float"); + + b.Property("Y") + .HasColumnType("float"); + + b.Property("Z") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("BusRouteId"); + + b.ToTable("BusRoutesPoints"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusinessBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Balance") + .HasColumnType("int"); + + b.Property("BusinessId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BusinessId") + .IsUnique(); + + b.ToTable("BusinessBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusinessData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("BusinessId") + .HasColumnType("int"); + + b.Property("Price") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("BusinessData"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Character", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Ageing") + .HasColumnType("tinyint unsigned"); + + b.Property("AgeingOpacity") + .HasColumnType("float"); + + b.Property("BeardColor") + .HasColumnType("tinyint unsigned"); + + b.Property("Blemishes") + .HasColumnType("tinyint unsigned"); + + b.Property("BlemishesOpacity") + .HasColumnType("float"); + + b.Property("Blush") + .HasColumnType("tinyint unsigned"); + + b.Property("BlushColor") + .HasColumnType("tinyint unsigned"); + + b.Property("BlushOpacity") + .HasColumnType("float"); + + b.Property("BrowDepth") + .HasColumnType("float"); + + b.Property("BrowHeight") + .HasColumnType("float"); + + b.Property("CheekDepth") + .HasColumnType("float"); + + b.Property("CheekboneHeight") + .HasColumnType("float"); + + b.Property("CheekboneWidth") + .HasColumnType("float"); + + b.Property("ChestHair") + .HasColumnType("tinyint unsigned"); + + b.Property("ChestHairColor") + .HasColumnType("tinyint unsigned"); + + b.Property("ChestHairOpacity") + .HasColumnType("float"); + + b.Property("ChinDepth") + .HasColumnType("float"); + + b.Property("ChinHeight") + .HasColumnType("float"); + + b.Property("ChinIndent") + .HasColumnType("float"); + + b.Property("ChinWidth") + .HasColumnType("float"); + + b.Property("Complexion") + .HasColumnType("tinyint unsigned"); + + b.Property("ComplexionOpacity") + .HasColumnType("float"); + + b.Property("EyeColor") + .HasColumnType("tinyint unsigned"); + + b.Property("EyeSize") + .HasColumnType("float"); + + b.Property("EyebrowColor") + .HasColumnType("tinyint unsigned"); + + b.Property("Eyebrows") + .HasColumnType("tinyint unsigned"); + + b.Property("EyebrowsOpacity") + .HasColumnType("float"); + + b.Property("FacialHair") + .HasColumnType("tinyint unsigned"); + + b.Property("FacialHairOpacity") + .HasColumnType("float"); + + b.Property("Father") + .HasColumnType("tinyint unsigned"); + + b.Property("Freckles") + .HasColumnType("tinyint unsigned"); + + b.Property("FrecklesOpacity") + .HasColumnType("float"); + + b.Property("Gender") + .HasColumnType("tinyint(1)"); + + b.Property("Hair") + .HasColumnType("tinyint unsigned"); + + b.Property("HairColor") + .HasColumnType("tinyint unsigned"); + + b.Property("HairHighlightColor") + .HasColumnType("tinyint unsigned"); + + b.Property("JawShape") + .HasColumnType("float"); + + b.Property("JawWidth") + .HasColumnType("float"); + + b.Property("LipThickness") + .HasColumnType("float"); + + b.Property("Lipstick") + .HasColumnType("tinyint unsigned"); + + b.Property("LipstickColor") + .HasColumnType("tinyint unsigned"); + + b.Property("LipstickOpacity") + .HasColumnType("float"); + + b.Property("Makeup") + .HasColumnType("tinyint unsigned"); + + b.Property("MakeupOpacity") + .HasColumnType("float"); + + b.Property("Mother") + .HasColumnType("tinyint unsigned"); + + b.Property("NeckWidth") + .HasColumnType("float"); + + b.Property("NoseBottomHeight") + .HasColumnType("float"); + + b.Property("NoseBridgeDepth") + .HasColumnType("float"); + + b.Property("NoseBroken") + .HasColumnType("float"); + + b.Property("NoseTipHeight") + .HasColumnType("float"); + + b.Property("NoseTipLength") + .HasColumnType("float"); + + b.Property("NoseWidth") + .HasColumnType("float"); + + b.Property("Similarity") + .HasColumnType("float"); + + b.Property("SkinSimilarity") + .HasColumnType("float"); + + b.Property("SunDamage") + .HasColumnType("tinyint unsigned"); + + b.Property("SunDamageOpacity") + .HasColumnType("float"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.CharacterCloth", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("ClothId") + .HasColumnType("int"); + + b.Property("Duty") + .HasColumnType("tinyint(1)"); + + b.Property("SlotId") + .HasColumnType("int"); + + b.Property("SlotType") + .HasColumnType("tinyint unsigned"); + + b.Property("Texture") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("CharacterClothes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ClothCombination", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Gender") + .HasColumnType("tinyint(1)"); + + b.Property("Top") + .HasColumnType("int"); + + b.Property("Torso") + .HasColumnType("int"); + + b.Property("Undershirt") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("ClothCombinations"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Door", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AlwaysOpen") + .HasColumnType("tinyint(1)"); + + b.Property("Category") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("FactionId") + .HasColumnType("int"); + + b.Property("Locked") + .HasColumnType("tinyint(1)"); + + b.Property("Model") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Radius") + .HasColumnType("float"); + + b.Property("X") + .HasColumnType("float"); + + b.Property("Y") + .HasColumnType("float"); + + b.Property("Z") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("Doors"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.DutyCloth", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("ClothId") + .HasColumnType("int"); + + b.Property("FactionId") + .HasColumnType("int"); + + b.Property("Gender") + .HasColumnType("tinyint(1)"); + + b.Property("SlotId") + .HasColumnType("int"); + + b.Property("SlotType") + .HasColumnType("tinyint unsigned"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("DutyClothes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Faction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("BankAccountId") + .HasColumnType("int"); + + b.Property("GangOwned") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasColumnType("varchar(32) CHARACTER SET utf8mb4") + .HasMaxLength(32); + + b.Property("StateOwned") + .HasColumnType("tinyint(1)"); + + b.Property("WeaponDealTime") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BankAccountId"); + + b.ToTable("Factions"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Active") + .HasColumnType("tinyint(1)"); + + b.Property("Balance") + .HasColumnType("int"); + + b.Property("Bic") + .HasColumnType("varchar(12) CHARACTER SET utf8mb4") + .HasMaxLength(12); + + b.Property("Iban") + .HasColumnType("varchar(32) CHARACTER SET utf8mb4") + .HasMaxLength(32); + + b.HasKey("Id"); + + b.ToTable("FactionBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("FactionId") + .HasColumnType("int"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("RankName") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionRanks"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionWeapon", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Ammount") + .HasColumnType("int"); + + b.Property("FactionId") + .HasColumnType("int"); + + b.Property("Rank") + .HasColumnType("int"); + + b.Property("SlotID") + .HasColumnType("int"); + + b.Property("WeaponModel") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionWeapons"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.GotoPoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Active") + .HasColumnType("tinyint(1)"); + + b.Property("Description") + .HasColumnType("varchar(32) CHARACTER SET utf8mb4") + .HasMaxLength(32); + + b.Property("X") + .HasColumnType("float"); + + b.Property("Y") + .HasColumnType("float"); + + b.Property("Z") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("GotoPoints"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Group", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("BankAccountId") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("BankAccountId"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Balance") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("GroupBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.House", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("BankAccountId") + .HasColumnType("int"); + + b.Property("CanRentIn") + .HasColumnType("tinyint(1)"); + + b.Property("LastRentSetTime") + .HasColumnType("datetime(6)"); + + b.Property("OwnerId") + .HasColumnType("int"); + + b.Property("Price") + .HasColumnType("int"); + + b.Property("RentalFee") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("X") + .HasColumnType("float"); + + b.Property("Y") + .HasColumnType("float"); + + b.Property("Z") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("BankAccountId"); + + b.HasIndex("OwnerId"); + + b.ToTable("Houses"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.HouseBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Balance") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("HouseBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.HouseRental", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("HouseId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("HouseId"); + + b.HasIndex("UserId"); + + b.ToTable("HouseRentals"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Interior", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("EnterPositionStr") + .HasColumnName("EnterPosition") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ExitPositionStr") + .HasColumnName("ExitPosition") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Name") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.ToTable("Interiors"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Heading") + .HasColumnType("double"); + + b.Property("X") + .HasColumnType("double"); + + b.Property("Y") + .HasColumnType("double"); + + b.Property("Z") + .HasColumnType("double"); + + b.HasKey("Id"); + + b.ToTable("Locations"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.BankAccountTransactionHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Fee") + .HasColumnType("int"); + + b.Property("MoneySent") + .HasColumnType("int"); + + b.Property("NewReceiverBalance") + .HasColumnType("int"); + + b.Property("NewSenderBalance") + .HasColumnType("int"); + + b.Property("Origin") + .HasColumnType("varchar(32) CHARACTER SET utf8mb4") + .HasMaxLength(32); + + b.Property("Receiver") + .HasColumnType("varchar(32) CHARACTER SET utf8mb4") + .HasMaxLength(32); + + b.Property("ReceiverBalance") + .HasColumnType("int"); + + b.Property("Sender") + .HasColumnType("varchar(32) CHARACTER SET utf8mb4") + .HasMaxLength(32); + + b.Property("SenderBalance") + .HasColumnType("int"); + + b.Property("Timestamp") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("BankAccountTransactionLogs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Text") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Time") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("ChatLogs"); + + b.HasDiscriminator("Discriminator").HasValue("ChatLogEntry"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.CommandLogEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("Command") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Time") + .HasColumnType("datetime(6)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("CommandLogs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Death", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("CauseOfDeath") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("KillerHeading") + .HasColumnType("float"); + + b.Property("KillerId") + .HasColumnType("int"); + + b.Property("KillerPositionX") + .HasColumnType("float"); + + b.Property("KillerPositionY") + .HasColumnType("float"); + + b.Property("KillerPositionZ") + .HasColumnType("float"); + + b.Property("Timestamp") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)"); + + b.Property("VictimHeading") + .HasColumnType("float"); + + b.Property("VictimId") + .HasColumnType("int"); + + b.Property("VictimPositionX") + .HasColumnType("float"); + + b.Property("VictimPositionY") + .HasColumnType("float"); + + b.Property("VictimPositionZ") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("KillerId"); + + b.HasIndex("VictimId"); + + b.ToTable("DeathLogs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.LoginLogoutLogEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + b.Property("IpAddress") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("LoginLogout") + .HasColumnType("tinyint(1)"); + + b.Property("PlayerId") + .HasColumnType("bigint"); + + b.Property("SocialClubName") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Time") + .HasColumnType("datetime(6)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.Property("Username") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("LoginLogoutLogs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.News", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Active") + .HasColumnType("tinyint(1)"); + + b.Property("Caption") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Content") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Timestamp") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("News"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedBlip", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Active") + .HasColumnType("tinyint(1)"); + + b.Property("Alpha") + .HasColumnType("tinyint unsigned"); + + b.Property("Color") + .HasColumnType("tinyint unsigned"); + + b.Property("Dimension") + .HasColumnType("tinyint unsigned"); + + b.Property("DrawDistance") + .HasColumnType("float"); + + b.Property("Name") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("PositionX") + .HasColumnType("float"); + + b.Property("PositionY") + .HasColumnType("float"); + + b.Property("PositionZ") + .HasColumnType("float"); + + b.Property("Rotation") + .HasColumnType("float"); + + b.Property("Scale") + .HasColumnType("float"); + + b.Property("ShortRange") + .HasColumnType("tinyint(1)"); + + b.Property("Sprite") + .HasColumnType("smallint"); + + b.HasKey("Id"); + + b.ToTable("Blips"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedMarker", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Active") + .HasColumnType("tinyint(1)"); + + b.Property("ColorA") + .HasColumnType("tinyint unsigned"); + + b.Property("ColorB") + .HasColumnType("tinyint unsigned"); + + b.Property("ColorG") + .HasColumnType("tinyint unsigned"); + + b.Property("ColorR") + .HasColumnType("tinyint unsigned"); + + b.Property("Dimension") + .HasColumnType("tinyint unsigned"); + + b.Property("DirectionX") + .HasColumnType("float"); + + b.Property("DirectionY") + .HasColumnType("float"); + + b.Property("DirectionZ") + .HasColumnType("float"); + + b.Property("PositionX") + .HasColumnType("float"); + + b.Property("PositionY") + .HasColumnType("float"); + + b.Property("PositionZ") + .HasColumnType("float"); + + b.Property("RotationX") + .HasColumnType("float"); + + b.Property("RotationY") + .HasColumnType("float"); + + b.Property("RotationZ") + .HasColumnType("float"); + + b.Property("Scale") + .HasColumnType("float"); + + b.Property("Type") + .HasColumnType("tinyint unsigned"); + + b.Property("Visible") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.ToTable("Markers"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedPed", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Active") + .HasColumnType("tinyint(1)"); + + b.Property("Dimension") + .HasColumnType("tinyint unsigned"); + + b.Property("HashModel") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Heading") + .HasColumnType("float"); + + b.Property("PositionX") + .HasColumnType("float"); + + b.Property("PositionY") + .HasColumnType("float"); + + b.Property("PositionZ") + .HasColumnType("float"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Peds"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedPickup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Active") + .HasColumnType("tinyint(1)"); + + b.Property("Dimension") + .HasColumnType("tinyint unsigned"); + + b.Property("PositionX") + .HasColumnType("float") + .HasMaxLength(128); + + b.Property("PositionY") + .HasColumnType("float"); + + b.Property("PositionZ") + .HasColumnType("float"); + + b.Property("RespawnTime") + .HasColumnType("int"); + + b.Property("RotationX") + .HasColumnType("float"); + + b.Property("RotationY") + .HasColumnType("float"); + + b.Property("RotationZ") + .HasColumnType("float"); + + b.Property("Vehicle") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.ToTable("Pickups"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedTextLabel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Active") + .HasColumnType("tinyint(1)"); + + b.Property("ColorA") + .HasColumnType("tinyint unsigned"); + + b.Property("ColorB") + .HasColumnType("tinyint unsigned"); + + b.Property("ColorG") + .HasColumnType("tinyint unsigned"); + + b.Property("ColorR") + .HasColumnType("tinyint unsigned"); + + b.Property("Dimension") + .HasColumnType("tinyint unsigned"); + + b.Property("DrawDistance") + .HasColumnType("float"); + + b.Property("Font") + .HasColumnType("tinyint unsigned"); + + b.Property("LOS") + .HasColumnType("tinyint(1)"); + + b.Property("PositionX") + .HasColumnType("float"); + + b.Property("PositionY") + .HasColumnType("float"); + + b.Property("PositionZ") + .HasColumnType("float"); + + b.Property("Text") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.ToTable("TextLabels"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ServerVariable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("int"); + + b.Property("Variable") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.ToTable("ServerVariables"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ServerVehicle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Active") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("Discriminator") + .IsRequired() + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DistanceDriven") + .HasColumnType("float"); + + b.Property("Heading") + .HasColumnType("float"); + + b.Property("Livery") + .HasColumnType("int"); + + b.Property("Locked") + .HasColumnType("tinyint(1)"); + + b.Property("Model") + .HasColumnType("int unsigned"); + + b.Property("NumberPlate") + .HasColumnType("varchar(8) CHARACTER SET utf8mb4") + .HasMaxLength(8); + + b.Property("PositionX") + .HasColumnType("float"); + + b.Property("PositionY") + .HasColumnType("float"); + + b.Property("PositionZ") + .HasColumnType("float"); + + b.Property("PrimaryColor") + .HasColumnType("int"); + + b.Property("SecondaryColor") + .HasColumnType("int"); + + b.Property("TankAmount") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("ServerVehicles"); + + b.HasDiscriminator("Discriminator").HasValue("ServerVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ShopClothe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Category") + .HasColumnType("int"); + + b.Property("ClotheId") + .HasColumnType("int"); + + b.Property("ComponentId") + .HasColumnType("int"); + + b.Property("Gender") + .HasColumnType("tinyint(1)"); + + b.Property("Price") + .HasColumnType("int"); + + b.Property("TypeId") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.ToTable("ShopClothes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ShopItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Amount") + .HasColumnType("int"); + + b.Property("ItemId") + .HasColumnType("int"); + + b.Property("Price") + .HasColumnType("int"); + + b.Property("ShopId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("ShopItems"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.TuningGarage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("X") + .HasColumnType("float"); + + b.Property("Y") + .HasColumnType("float"); + + b.Property("Z") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("TuningGarages"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Turfs", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Color") + .HasColumnType("int"); + + b.Property("FactionId") + .HasColumnType("int"); + + b.Property("MaxValue") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Owner") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Range") + .HasColumnType("float"); + + b.Property("Rotation") + .HasColumnType("float"); + + b.Property("Surplus") + .HasColumnType("tinyint(1)"); + + b.Property("Value") + .HasColumnType("int"); + + b.Property("Vector") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("X") + .HasColumnType("float"); + + b.Property("Y") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Turfs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AdminLevel") + .HasColumnType("int"); + + b.Property("BanId") + .HasColumnType("int"); + + b.Property("BankAccountId") + .HasColumnType("int"); + + b.Property("BusSkill") + .HasColumnType("int"); + + b.Property("BusinessId") + .HasColumnType("int"); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("Dead") + .HasColumnType("tinyint(1)"); + + b.Property("DriverLicenseBike") + .HasColumnType("tinyint(1)"); + + b.Property("DriverLicenseVehicle") + .HasColumnType("tinyint(1)"); + + b.Property("Email") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("FactionId") + .HasColumnType("int"); + + b.Property("FactionLeader") + .HasColumnType("tinyint(1)"); + + b.Property("FactionRankId") + .HasColumnType("int"); + + b.Property("FlyingLicensePlane") + .HasColumnType("tinyint(1)"); + + b.Property("GroupId") + .HasColumnType("int"); + + b.Property("GroupRank") + .HasColumnType("int"); + + b.Property("Handmoney") + .HasColumnType("int"); + + b.Property("HouseId") + .HasColumnType("int"); + + b.Property("JailTime") + .HasColumnType("int"); + + b.Property("JobId") + .HasColumnType("int"); + + b.Property("LogUserId") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("varchar(32) CHARACTER SET utf8mb4") + .HasMaxLength(32); + + b.Property("Password") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("PaydayTimer") + .HasColumnType("int"); + + b.Property("PilotSkill") + .HasColumnType("int"); + + b.Property("PlayedMinutes") + .HasColumnType("int"); + + b.Property("Points") + .HasColumnType("int"); + + b.Property("PositionX") + .HasColumnType("float"); + + b.Property("PositionY") + .HasColumnType("float"); + + b.Property("PositionZ") + .HasColumnType("float"); + + b.Property("RegistrationDate") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)"); + + b.Property("SocialClubName") + .HasColumnType("varchar(32) CHARACTER SET utf8mb4") + .HasMaxLength(32); + + b.Property("Wage") + .HasColumnType("int"); + + b.Property("Wanteds") + .HasColumnType("int"); + + b.Property("WeaponLicense") + .HasColumnType("tinyint(1)"); + + b.Property("failpoints") + .HasColumnType("int"); + + b.Property("otheramount") + .HasColumnType("int"); + + b.Property("trashcount") + .HasColumnType("int"); + + b.Property("warn") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BanId"); + + b.HasIndex("BankAccountId"); + + b.HasIndex("BusinessId") + .IsUnique(); + + b.HasIndex("CharacterId"); + + b.HasIndex("FactionId"); + + b.HasIndex("FactionRankId"); + + b.HasIndex("GroupId"); + + b.HasIndex("HouseId"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Active") + .HasColumnType("tinyint(1)"); + + b.Property("Balance") + .HasColumnType("int"); + + b.Property("Bic") + .HasColumnType("varchar(12) CHARACTER SET utf8mb4") + .HasMaxLength(12); + + b.Property("Iban") + .HasColumnType("varchar(32) CHARACTER SET utf8mb4") + .HasMaxLength(32); + + b.HasKey("Id"); + + b.ToTable("UserBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Amount") + .HasColumnType("int"); + + b.Property("ItemId") + .HasColumnType("int"); + + b.Property("Slot") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserItems"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserWeapon", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Ammo") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.Property("WeaponId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("WeaponId"); + + b.ToTable("UserWeapons"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Amount") + .HasColumnType("int"); + + b.Property("ItemId") + .HasColumnType("int"); + + b.Property("Slot") + .HasColumnType("int"); + + b.Property("VehicleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("VehicleId"); + + b.ToTable("VehicleItems"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleMod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("ModId") + .HasColumnType("int"); + + b.Property("ServerVehicleId") + .HasColumnType("int"); + + b.Property("Slot") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ServerVehicleId", "Slot") + .IsUnique(); + + b.ToTable("VehicleMods"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Weapon", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Ammo") + .HasColumnType("int"); + + b.Property("AmmunationActive") + .HasColumnType("tinyint(1)"); + + b.Property("CategoryId") + .HasColumnType("int"); + + b.Property("Legal") + .HasColumnType("tinyint(1)"); + + b.Property("Price") + .HasColumnType("float"); + + b.Property("SlotID") + .HasColumnType("int"); + + b.Property("WeaponModel") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.ToTable("Weapons"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.WeaponCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Category") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.ToTable("WeaponCategories"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Whitelist", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("SocialClubName") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.HasKey("Id"); + + b.ToTable("WhitelistEntries"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.DepartmentChatLogEntry", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry"); + + b.HasDiscriminator().HasValue("DepartmentChatLogEntry"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.FactionChatLogEntry", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry"); + + b.Property("FactionId") + .HasColumnType("int"); + + b.HasIndex("FactionId"); + + b.HasDiscriminator().HasValue("FactionChatLogEntry"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.GangChatLogEntry", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry"); + + b.HasDiscriminator().HasValue("GangChatLogEntry"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.GroupChatLogEntry", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry"); + + b.Property("GroupId") + .HasColumnType("int"); + + b.HasIndex("GroupId"); + + b.HasDiscriminator().HasValue("GroupChatLogEntry"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.LeaderChatLogEntry", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry"); + + b.HasDiscriminator().HasValue("LeaderChatLogEntry"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.LocalChatLogEntry", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry"); + + b.HasDiscriminator().HasValue("LocalChatLogEntry"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.NewsChatLogEntry", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry"); + + b.HasDiscriminator().HasValue("NewsChatLogEntry"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.OChatLogEntry", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry"); + + b.HasDiscriminator().HasValue("OChatLogEntry"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("BuyPrice") + .HasColumnType("int"); + + b.Property("Owners") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.ToTable("FactionVehicles"); + + b.HasDiscriminator().HasValue("FactionVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("GroupId") + .HasColumnType("int"); + + b.HasIndex("GroupId"); + + b.HasDiscriminator().HasValue("GroupVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.JobVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("JobId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("JobVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.NoobSpawnVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.HasDiscriminator().HasValue("NoobSpawnVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.NoobVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.HasDiscriminator().HasValue("NoobVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.HasDiscriminator().HasValue("SavedVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.SchoolVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("SchoolId") + .HasColumnType("int"); + + b.HasDiscriminator().HasValue("SchoolVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ShopVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("BusinessId") + .HasColumnType("int"); + + b.Property("Price") + .HasColumnType("int"); + + b.ToTable("ShopVehicles"); + + b.HasDiscriminator().HasValue("ShopVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("BusinessId") + .HasColumnName("UserVehicle_BusinessId") + .HasColumnType("int"); + + b.Property("Price") + .HasColumnName("UserVehicle_Price") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + 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) + .IsRequired(); + }); + + 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) + .IsRequired(); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.CharacterCloth", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + 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) + .IsRequired(); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Faction", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.FactionBankAccount", "BankAccount") + .WithMany() + .HasForeignKey("BankAccountId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionRank", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionWeapon", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Group", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.GroupBankAccount", "BankAccount") + .WithMany() + .HasForeignKey("BankAccountId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.House", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.HouseBankAccount", "BankAccount") + .WithMany() + .HasForeignKey("BankAccountId"); + + 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("Rentals") + .HasForeignKey("HouseId"); + + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.ChatLogEntry", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.CommandLogEntry", b => + { + 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) + .IsRequired(); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.LoginLogoutLogEntry", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + 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.UserBankAccount", "BankAccount") + .WithMany() + .HasForeignKey("BankAccountId"); + + 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.UserItem", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserWeapon", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ReallifeGamemode.Database.Entities.Weapon", "Weapon") + .WithMany() + .HasForeignKey("WeaponId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleItem", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.ServerVehicle", "Vehicle") + .WithMany() + .HasForeignKey("VehicleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleMod", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.ServerVehicle", "Vehicle") + .WithMany() + .HasForeignKey("ServerVehicleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Weapon", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.WeaponCategory", "WeaponCategory") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.FactionChatLogEntry", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Chat.GroupChatLogEntry", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Group", "Group") + .WithMany() + .HasForeignKey("GroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + 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) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/ReallifeGamemode.Database/Migrations/20210429134927_AddDoorAlwaysOpenFlag.cs b/ReallifeGamemode.Database/Migrations/20210429134927_AddDoorAlwaysOpenFlag.cs new file mode 100644 index 00000000..eb390066 --- /dev/null +++ b/ReallifeGamemode.Database/Migrations/20210429134927_AddDoorAlwaysOpenFlag.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace ReallifeGamemode.Database.Migrations +{ + public partial class AddDoorAlwaysOpenFlag : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "AlwaysOpen", + table: "Doors", + nullable: false, + defaultValue: false); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "AlwaysOpen", + table: "Doors"); + } + } +} diff --git a/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs b/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs index 78a5dfaf..341f3a2d 100644 --- a/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs +++ b/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs @@ -398,6 +398,9 @@ namespace ReallifeGamemode.Database.Migrations .ValueGeneratedOnAdd() .HasColumnType("int"); + b.Property("AlwaysOpen") + .HasColumnType("tinyint(1)"); + b.Property("Category") .HasColumnType("longtext CHARACTER SET utf8mb4"); diff --git a/ReallifeGamemode.Server/Bank/bank.cs b/ReallifeGamemode.Server/Bank/bank.cs index 6b2788d8..145b97ce 100644 --- a/ReallifeGamemode.Server/Bank/bank.cs +++ b/ReallifeGamemode.Server/Bank/bank.cs @@ -150,6 +150,7 @@ namespace ReallifeGamemode.Server.Bank else { player.SendNotification($"~w~Du hast {target.Name} $~g~{amount} ~w~Überwiesen."); + target.SendNotification($"~w~{player.Name} hat dir $~g~{amount} ~w~Überwiesen."); player.GetUser(dbContext).BankAccount.Balance -= (int)(amount * 1.05); target.GetUser(dbContext).otheramount += amount; dbContext.SaveChanges(); diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index dedd99e7..01f7d261 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; @@ -545,6 +545,29 @@ namespace ReallifeGamemode.Server.Commands #region Admin + [Command("remspawnschutz", "~m~Benutzung: ~s~/rmss [Target]", Alias = "rmss")] + public void CmdAdminRmss(Player player, String targetname) + { + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + + Player target = PlayerService.GetPlayerByNameOrId(targetname); + + if (target == null || !target.IsLoggedIn()) + { + ChatService.PlayerNotFound(player); + return; + } + + target.SendChatMessage(player.Name + " hat deinen Spawnschutz entfernt"); + player.SendChatMessage("Du hast den Spawnschutz von " + target.Name + " entfernt"); + target.TriggerEvent("abortSpawnschutz"); + + } + [Command("countdown", "~m~Benutzung: ~s~/countdown [Zeit] [Text]", GreedyArg = true)] public void CmdAdminCountdown(Player player, string timer_string, string text) { @@ -614,7 +637,7 @@ namespace ReallifeGamemode.Server.Commands [Command("mark", "~m~Benutzung: ~s~/mark")] public void CmdAdminMark(Player player) { - if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) { ChatService.NotAuthorized(player); return; @@ -626,7 +649,7 @@ namespace ReallifeGamemode.Server.Commands [Command("gotomark", "~m~Benutzung: ~s~/gotomark")] public void CmdAdminGotoMark(Player player) { - if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) { ChatService.NotAuthorized(player); return; @@ -1159,7 +1182,7 @@ namespace ReallifeGamemode.Server.Commands return; } target.RemoveAllWeapons(); - ChatService.SendMessage(target, "~b~Deine Waffen wurden dir von " + player.Name + "(Admin) abgenommen"); + ChatService.SendMessage(target, "~b~Deine Waffen wurden dir von " + player.Name + " (Admin) abgenommen"); ChatService.SendMessage(player, "~b~Dem Spieler " + target.Name + " wurden erfolgreich alle Waffen abgenommen "); } @@ -1488,33 +1511,6 @@ namespace ReallifeGamemode.Server.Commands Medic.delReviveTask(target); } - [Command("aunshow", "~m~Benutzung:~s~ /aunshow")] - public void CmdAdminUnshow(Player player) - { - User user = player.GetUser(); - if (!user.IsAdmin(AdminLevel.HEADADMIN)) - { - ChatService.NotAuthorized(player); - return; - } - - bool currentStatus = user.GetData("adminUnshow"); - currentStatus = !currentStatus; - user.SetData("adminUnshow", currentStatus); - player.TriggerEvent("toggleAdminUnshowMode", currentStatus); - - user.SetBlipAndNametagColor(); - - if(currentStatus) - { - ChatService.SendMessage(player, "~b~[ADMIN]~s~ Du bist nun Unshow"); - } - else - { - ChatService.SendMessage(player, "~b~[ADMIN]~s~ Du bist nun nicht mehr Unshow"); - } - } - [Command("setap", "~m~Benutzung: ~s~/setap [Spieler] (Armor)")] public void CmdAdminSetAP(Player player, string name, int armor = 100) { @@ -1810,6 +1806,38 @@ namespace ReallifeGamemode.Server.Commands } } + [Command("aunshow", "~m~Benutzung:~s~ /aunshow")] + public void CmdAdminUnshow(Player player) + { + User user = player.GetUser(); + if (!user.IsAdmin(AdminLevel.ADMIN)) + { + ChatService.NotAuthorized(player); + return; + } + + if (!player.IsTSupport()) + { + ChatService.ErrorMessage(player, "Du bist nicht im T-Support"); + return; + } + + bool currentStatus = user.GetData("adminUnshow"); + currentStatus = !currentStatus; + user.SetData("adminUnshow", currentStatus); + player.TriggerEvent("toggleAdminUnshowMode", currentStatus); + + user.SetBlipAndNametagColor(); + + if (currentStatus) + { + ChatService.SendMessage(player, "~b~[ADMIN]~s~ Du bist nun Unshow"); + } + else + { + ChatService.SendMessage(player, "~b~[ADMIN]~s~ Du bist nun nicht mehr Unshow"); + } + } #endregion Admin @@ -3878,10 +3906,16 @@ namespace ReallifeGamemode.Server.Commands [RemoteEvent("Noclip")] public void Noclip(Player player) { - if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) { return; } + if (!player.IsTSupport()) + { + ChatService.ErrorMessage(player, "Du bist nicht im T-Support"); + return; + } + if (player.HasData("Adminduty") && player.GetData("Adminduty")) player.TriggerEvent("ADMIN:NoClip"); } diff --git a/ReallifeGamemode.Server/Commands/FactionCommands.cs b/ReallifeGamemode.Server/Commands/FactionCommands.cs index f6ad5d2a..9d90d3a2 100644 --- a/ReallifeGamemode.Server/Commands/FactionCommands.cs +++ b/ReallifeGamemode.Server/Commands/FactionCommands.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; @@ -82,15 +82,15 @@ namespace ReallifeGamemode.Server.Commands message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", ""); - string rank = string.Empty; + string factionName = string.Empty; if (f?.GangOwned == true) { - rank = user.FactionRank.RankName; + factionName = user.Faction.Name + " – " + user.FactionRank.RankName; } else { - rank = "[ADMIN]"; + factionName = "ADMIN"; } var logEntry = new GangChatLogEntry() @@ -102,7 +102,7 @@ namespace ReallifeGamemode.Server.Commands dbContext.GangChatLogs.Add(logEntry); dbContext.SaveChanges(); - string broadcastMessage = "!{FF0000}** " + rank + " " + player.Name + ": " + message + " **"; + string broadcastMessage = "!{E52222}** [" + factionName + "] " + player.Name + ": " + message + " **"; using (var context = new DatabaseContext()) { ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.GangOwned), true, (admin) => admin.HasData("togga")); @@ -166,11 +166,11 @@ namespace ReallifeGamemode.Server.Commands if (f?.StateOwned ?? false) { - factionName = user.FactionRank.RankName; + factionName = user.Faction.Name + " – " + user.FactionRank.RankName; } else { - factionName = "[ADMIN]"; + factionName = "ADMIN"; } var logEntry = new DepartmentChatLogEntry() @@ -182,7 +182,7 @@ namespace ReallifeGamemode.Server.Commands dbContext.DepartmentChatLogs.Add(logEntry); dbContext.SaveChanges(); - string broadcastMessage = "!{CC3333}** " + factionName + " " + player.Name + ": " + message + ", over **"; + string broadcastMessage = "!{CC3333}** [" + factionName + "] " + player.Name + ": " + message + ", over **"; using (var context = new DatabaseContext()) { ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.StateOwned), true, (admin) => admin.HasData("togd")); @@ -402,10 +402,17 @@ namespace ReallifeGamemode.Server.Commands ChatService.ErrorMessage(player, "Der Spieler hat eine Revivesperre"); return; } + using (var dbContext = new DatabaseContext()) { var deadPlayerUser = deadPlayer.GetUser(dbContext); + if (deadPlayerUser.Wanteds > 0) + { + ChatService.ErrorMessage(player, "Dieser Spieler hat Wanteds"); + return; + } + if (deadPlayerUser.Handmoney >= 100) { deadPlayerUser.Handmoney -= 100; @@ -504,7 +511,7 @@ namespace ReallifeGamemode.Server.Commands #region Staatsfraktionen (LSPD / FBI) Commands - [Command("m", "~m~Benutzung: ~s~/m [Message]", GreedyArg = true)] + [Command("m", "~m~Benutzung: ~s~/m [Nachricht]", GreedyArg = true)] public void CmdFactionMegaphone(Player player, string message) { User user = player.GetUser(); @@ -526,7 +533,7 @@ namespace ReallifeGamemode.Server.Commands return; } - ChatService.SendInRange(player.Position, 50, "!{#FFFF00}[" + player.GetUser().Faction.Name + " " + player.Name + ": !{#FFFF00}" + message + "]"); + ChatService.SendInRange(player.Position, 50, "!{#FFFF00}Megafon (" + player.Name + "): " + message); } [Command("cuff", "~m~Benutzung: ~s~/cuff")] diff --git a/ReallifeGamemode.Server/Commands/UserCommands.cs b/ReallifeGamemode.Server/Commands/UserCommands.cs index 1afc483c..204c681f 100644 --- a/ReallifeGamemode.Server/Commands/UserCommands.cs +++ b/ReallifeGamemode.Server/Commands/UserCommands.cs @@ -17,6 +17,79 @@ namespace ReallifeGamemode.Server.Commands { internal class UserCommands : Script { + [Command("rent", "~m~rent stop")] + public void CmdUserStopRent(Player player, String option = "") { + if (!player.IsLoggedIn()) return; + + if (option != "stop") + { + player.SendChatMessage("Mit \"/rent stop\" kannst du die Miete kündigen"); + return; + } + + if (!player.HasData("hasRentcar")) + { + ChatService.ErrorMessage(player, "Du hast zurzeit kein Fahrzeug gemietet"); + return; + } + + Rentcar.cancelRent(player); + } + + [Command("eventport", "~m~eventport")] + public void CmdUserEventport(Player player, String option = "") + { + if (!player.IsLoggedIn()) return; + + if (option == "on") + { + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + return; + } + PositionManager.eventportPosition = player.Position; + PositionManager.eventportActive = true; + player.SendChatMessage("~y~Du hast hier erfolgreich einen Eventport gesetzt."); + return; + } + + if (option == "off") + { + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + return; + } + PositionManager.eventportActive = false; + player.SendChatMessage("~y~Du hast den Eventport deaktiviert."); + return; + } + + if (!PositionManager.eventportActive || PositionManager.eventportPosition == null) + { + player.SendChatMessage("~y~Im Moment ist kein Eventport aktiv."); + return; + } + + using (var dbContext = new DatabaseContext()) + { + User user = player.GetUser(dbContext); + if (user.Wanteds > 0 || user.JailTime > 0 || player.HasData("inGangWar") || !player.IsAlive()) + { + ChatService.ErrorMessage(player, "Momentan kannst du keinen Eventport nutzen"); + return; + } + } + + Random rnd = new Random(); + int randomX = rnd.Next(-3, 3); + int randomY = rnd.Next(-3, 3); + + Vector3 teleportPosition = new Vector3(PositionManager.eventportPosition.X + randomX, PositionManager.eventportPosition.Y + randomY, PositionManager.eventportPosition.Z); + + player.SafeTeleport(teleportPosition); + player.SendNotification("Du hast dich zum Event teleportiert"); + } + [Command("look", "~m~look")] public void CmdUserLook(Player player) { diff --git a/ReallifeGamemode.Server/DrivingSchool/DrivingSchool.cs b/ReallifeGamemode.Server/DrivingSchool/DrivingSchool.cs index fe51c527..590bbf7e 100644 --- a/ReallifeGamemode.Server/DrivingSchool/DrivingSchool.cs +++ b/ReallifeGamemode.Server/DrivingSchool/DrivingSchool.cs @@ -71,7 +71,7 @@ namespace ReallifeGamemode.Server.DrivingSchool new Vector3(-255.55, -1419.48, 32.75), new Vector3(-369.08, -1415.37, 29.68), new Vector3(-114.48, -1251.43, 37.59), - new Vector3(59.22, -1261.71, 29.84), + new Vector3(70.312744, -1250.7972, 29.84), new Vector3(39.12, -1165.28, 29.87), new Vector3(-307.52, -1200.85, 37.79), new Vector3(-441.79, -1251.67, 46.37), diff --git a/ReallifeGamemode.Server/Events/Connect.cs b/ReallifeGamemode.Server/Events/Connect.cs index 9a235a20..19ce8c88 100644 --- a/ReallifeGamemode.Server/Events/Connect.cs +++ b/ReallifeGamemode.Server/Events/Connect.cs @@ -77,6 +77,13 @@ namespace ReallifeGamemode.Server.Events player.TriggerEvent("CLIENT:AddPed", 2, "player_two", 1706.76953125, 3277.220947265625, 41.1555061340332, -159.447998046875, 0, false, true, 0, "none", true, true, true);//Ped_Pilot Sandyshores player.TriggerEvent("CLIENT:AddPed", 3, "s_m_m_pilot_01", -1621.4542236328125, -3152.724365234375, 13.991769790649414, 50.73009490966797, 0, false, true, 0, "none", true, true, true);//Ped_Pilot LS Airport player.TriggerEvent("CLIENT:AddPed", 4, "u_m_o_finguru_01", -534.4425659179688, -2145.747314453125, 5.992100715637207, 53.96156692504883, 0, false, true, 0, "none", true, true, true);//Ped Busfahrer + player.TriggerEvent("CLIENT:AddPed", 5, "csb_prolsec", 1690.84, 2591.17 , 45.91, -2.66, 0, false, true, 0, "none", true, true, true);//Ped Knast + player.TriggerEvent("CLIENT:AddPed", 6, "ig_siemonyetarian", -1023.1589, -2693.6948, 13.98, 173.95613, 0, false, true, 0, "none", true, true, true);//Ped Rentcar NoobSpawn + player.TriggerEvent("CLIENT:AddPed", 7, "ig_siemonyetarian", -369.1589, -230.92816, 36.028805, 150.26433, 0, false, true, 0, "none", true, true, true);//Ped Rentcar KH/Stadthalle + player.TriggerEvent("CLIENT:AddPed", 8, "ig_siemonyetarian", 1222.0868, 2726.5286, 38.00415, 113.77263, 0, false, true, 0, "none", true, true, true);//Ped Rentcar Knast + player.TriggerEvent("CLIENT:AddPed", 9, "ig_siemonyetarian", -215.4218292236328, 6218.90478515625, 31.491567611694336, -135.07437133789062, 0, false, true, 0, "none", true, true, true);//Ped Rentcar Paleto + player.TriggerEvent("CLIENT:AddPed", 10, "ig_siemonyetarian", 818.239990234375, -1040.833984375, 26.750696182250977, 3.0542829036712646, 0, false, true, 0, "none", true, true, true);//Ped Rentcar Lamesa + TimeSpan currentTime = TimeManager.CurrentTime; bool disableLightMode = currentTime > LightModeTimeFrom && currentTime < LightModeTimeTo; diff --git a/ReallifeGamemode.Server/Events/Death.cs b/ReallifeGamemode.Server/Events/Death.cs index cb2cf4a2..965733cf 100644 --- a/ReallifeGamemode.Server/Events/Death.cs +++ b/ReallifeGamemode.Server/Events/Death.cs @@ -79,6 +79,7 @@ namespace ReallifeGamemode.Server.Events var playerInGangwar = player.HasData("inGangWar"); var killerInGangwar = killer.HasData("inGangWar"); + NAPI.Util.ConsoleOutput($"OnPlayerDeath - Player {player.Name} died - PlayerInGangwar = {playerInGangwar}, KillerInGangwar = {killerInGangwar}"); if (playerInGangwar && killerInGangwar) { @@ -148,7 +149,7 @@ namespace ReallifeGamemode.Server.Events if (copNearby) { user.SetJailTime(true, dbContext); - Jail.Check_PutBehindBars(user); + Jail.Check_PutBehindBars(user, JailInLocations.InCell); ChatService.HQMessage(user.Name + " wurde ins Gefängnis eingeliefert."); } else @@ -163,7 +164,7 @@ namespace ReallifeGamemode.Server.Events { user.Dead = true; - if (!player.HasData("reviveSperre") && player.GetData("isDead") == false && !player.HasData("inGangWar") && player.GetData("SAdminduty") == false) + if (user.Wanteds == 0 && !player.HasData("reviveSperre") && player.GetData("isDead") == false && !player.HasData("inGangWar") && player.GetData("SAdminduty") == false) { //MEDIC AUFTRAG MedicTask reviveTask = new MedicTask() diff --git a/ReallifeGamemode.Server/Events/Disconnect.cs b/ReallifeGamemode.Server/Events/Disconnect.cs index 356d548b..e4708593 100644 --- a/ReallifeGamemode.Server/Events/Disconnect.cs +++ b/ReallifeGamemode.Server/Events/Disconnect.cs @@ -127,6 +127,11 @@ namespace ReallifeGamemode.Server.Events } } + if (Rentcar.mapPlayerRentcarBill.ContainsKey(player.Name)) + { + Rentcar.cancelRent(player); + } + //Vehicle LastVehicle = player.GetData("LastVehicle"); JobBase job = JobManager.GetJob(player.GetUser().JobId ?? -1); if (job != null) diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index b8a05068..965ec8c9 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using GTANetworkAPI; @@ -34,7 +35,7 @@ namespace ReallifeGamemode.Server.Events [RemoteEvent("keyPress:NUM2")] public void KeyPressNUM2(Player player) { - if (!player.IsLoggedIn()) return; + if (!player.IsLoggedIn() || player.GetData("isDead")) return; if (player.GetData("editmode") == true && player.GetUser().IsAdmin(AdminLevel.HEADADMIN) == true) { var saveMode = player.GetData("quicksavemode"); @@ -91,7 +92,7 @@ namespace ReallifeGamemode.Server.Events [RemoteEvent("keyPress:RIGHT_ARROW")] public void KeyPressRightArrow(Player player) { - if (!player.IsLoggedIn()) return; + if (!player.IsLoggedIn() || player.GetData("isDead")) return; User user = player.GetUser(); if (!player.IsDuty()) @@ -116,10 +117,10 @@ namespace ReallifeGamemode.Server.Events [RemoteEvent("keyPress:M")] public void KeyPressM(Player player) { + if (!player.IsLoggedIn()) return; using var dbContext = new DatabaseContext(); User u = player.GetUser(dbContext); if (u == null) return; - if (player.GetData("isDead")) return; var vehicles = dbContext.UserVehicles.Where(veh => veh.UserId == u.Id).OrderBy(veh => veh.Id).Select(v => new { @@ -135,7 +136,6 @@ namespace ReallifeGamemode.Server.Events Price = f.BuyPrice }); - Paycheck paycheck = null; if (Economy.Paychecks.ContainsKey(u.Id)) paycheck = Economy.Paychecks[u.Id]; @@ -189,6 +189,7 @@ namespace ReallifeGamemode.Server.Events int ticket_amount = 0; int pay_amount = 0; bool house = false; + bool hasRentcar = player.GetData("hasRentcar") == true; if (u.House != null) { @@ -204,13 +205,14 @@ namespace ReallifeGamemode.Server.Events { pay_amount = player.GetData("pay_amount"); } - player.TriggerEvent("SERVER:InteractionMenu_OpenMenu", JsonConvert.SerializeObject(accountData), factionleader, JsonConvert.SerializeObject(memberList), JsonConvert.SerializeObject(jobData), faction, group, factionInvite, groupInvite, ticket_boolean, ticket_amount, pay_amount, house); + + player.TriggerEvent("SERVER:InteractionMenu_OpenMenu", JsonConvert.SerializeObject(accountData), factionleader, JsonConvert.SerializeObject(memberList), JsonConvert.SerializeObject(jobData), faction, group, factionInvite, groupInvite, ticket_boolean, ticket_amount, pay_amount, JsonConvert.SerializeObject(hasRentcar), house); } [RemoteEvent("keyPress:E")] public void KeyPressE(Player player) { - if (!player.IsLoggedIn()) return; + if (!player.IsLoggedIn() || player.GetData("isDead") || player.IsInVehicle) return; var user = player.GetUser(); if (player.HasData("nearATM")) @@ -219,12 +221,9 @@ namespace ReallifeGamemode.Server.Events return; } - if (!player.IsInVehicle) + if (GroundItem.PickUpGroundItem(player)) { - if (GroundItem.PickUpGroundItem(player)) - { - return; - } + return; } DutyPoint nearestDuty = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5 && d.FactionId == user.FactionId); @@ -237,6 +236,7 @@ namespace ReallifeGamemode.Server.Events JobPoint nearestJobPoint = PositionManager.JobPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6); Player nearestCuffPlayer = PositionManager.cuffPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6 && user.GetData("duty")); AmmunationPoint nearestAmmunationPoint = PositionManager.AmmunationPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5); + RentcarPoint nearestRentcarPoint = PositionManager.rentcarPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5); if (user?.FactionId != null) { @@ -355,6 +355,41 @@ namespace ReallifeGamemode.Server.Events user.SetBlipAndNametagColor(); } + //Rentcar Points + if (nearestRentcarPoint != null) + { + if (player.IsInVehicle) + { + return; + } + + //Noobspawn + if (player.Position.DistanceTo(PositionManager.rentcarPoints[0].Position) <= 1.5) + { + player.TriggerEvent("showRentcarMenu", JsonConvert.SerializeObject(Rentcar.noobspawnVehicleProperties), "noobspawn"); + } + //Stadthalle + else if (player.Position.DistanceTo(PositionManager.rentcarPoints[1].Position) <= 1.5) + { + player.TriggerEvent("showRentcarMenu", JsonConvert.SerializeObject(Rentcar.stadthalleVehicleProperties), "stadthalle"); + } + //Knast + else if (player.Position.DistanceTo(PositionManager.rentcarPoints[2].Position) <= 1.5) + { + player.TriggerEvent("showRentcarMenu", JsonConvert.SerializeObject(Rentcar.knastVehicleProperties), "knast"); + } + //Paleto + else if (player.Position.DistanceTo(PositionManager.rentcarPoints[3].Position) <= 1.5) + { + player.TriggerEvent("showRentcarMenu", JsonConvert.SerializeObject(Rentcar.paletoVehicleProperties), "paleto"); + } + //Lamesa + else if (player.Position.DistanceTo(PositionManager.rentcarPoints[4].Position) <= 1.5) + { + player.TriggerEvent("showRentcarMenu", JsonConvert.SerializeObject(Rentcar.paletoVehicleProperties), "lamesa"); + } + } + if (nearestWeapon != null) // Weapon Point { List primarys = new List(); @@ -466,9 +501,7 @@ namespace ReallifeGamemode.Server.Events }); } - player.TriggerEvent("showWeaponMenu", primarys.ToArray(), secondarys.ToArray(), melees.ToArray(), specials.ToArray(), armor.ToArray(), JsonConvert.SerializeObject(timer.ToArray()), JsonConvert.SerializeObject(amountInfos)); - } } if (nearestJailReleasePoint != null) @@ -558,7 +591,8 @@ namespace ReallifeGamemode.Server.Events ChatService.ErrorMessage(player, "Du benötigst $15.000 auf dem Bankkonto um die Operation durchzuführen"); return; } - ChatService.SendMessage(player, "~r~ACHTUNG! Dadurch wird dein alter Charakter gelöscht. Du kannst dir hiermit einen neuen erstellen.\nBeim Wechsel des Geschlechts verlierst du ebenfalls deine gekaufte Kleidung"); + ChatService.SendMessage(player, "~r~ACHTUNG! Dadurch wird dein alter Charakter gelöscht. Du kannst dir hiermit einen neuen erstellen."); + ChatService.SendMessage(player, "Beim Wechsel des Geschlechts verlierst du ebenfalls deine gekaufte Kleidung"); if (freeSurgery == true) { ChatService.SendMessage(player, "Du kannst deinen Charakter dieses mal kostenlos erstellen"); @@ -567,8 +601,15 @@ namespace ReallifeGamemode.Server.Events { ChatService.SendMessage(player, "Die Änderung des Charakters kostet ~g~$15.000"); } - ChatService.SendMessage(player, "Du kannst die Charaktererstellung wieder verlassen und behältst deinen alten Charakter! Bitte starte mit ~g~J"); + ChatService.SendMessage(player, "Du kannst die Charaktererstellung wieder verlassen und behältst deinen alten Charakter!"); + ChatService.SendMessage(player, "Bitte starte mit ~g~J"); + player.SetData("charSurgery", true); + NAPI.Task.Run(() => + { + if (player.GetData("charSurgery") == true) player.ResetData("charSurgery"); + player.SendNotification("~r~Chirurg-Angebot abgebrochen."); + }, 30000); } if (user.FactionLeader) { @@ -628,7 +669,7 @@ namespace ReallifeGamemode.Server.Events [RemoteEvent("keyPress:I")] public void KeyPressI(Player player) { - if (!player.IsLoggedIn()) return; + if (!player.IsLoggedIn() || player.GetData("isDead")) return; if (player.GetData("isDead")) return; player.TriggerEvent("inventoryShow"); @@ -638,7 +679,7 @@ namespace ReallifeGamemode.Server.Events [RemoteEvent("keyPress:J")] public void KeyPressJ(Player player) { - if (!player.IsLoggedIn()) return; + if (!player.IsLoggedIn() || player.GetData("isDead")) return; if (player.GetData("healDecision") == true) { player.ResetData("healDecision"); @@ -646,18 +687,18 @@ namespace ReallifeGamemode.Server.Events return; } - if(player.GetData("SellVehicleDecision") == true && player.HasData("VehicleToSell")) + if (player.GetData("SellVehicleDecision") == true && player.HasData("VehicleToSell")) { InteractionManager.SellServerVehicle(player, player.GetData("VehicleToSell")); player.ResetData("SellVehicleDecision"); - player.ResetData("VehicleToSell"); + player.ResetData("VehicleToSell"); return; } if(player.GetData("charSurgery") == true) { CharacterCreator.StartSurgery(player); - player.ResetData("charSurgery"); + player.SetData("charSurgery",false); } User u = player.GetUser(); @@ -740,7 +781,7 @@ namespace ReallifeGamemode.Server.Events [RemoteEvent("keyPress:K")] public void KeyPressK(Player player) { - if (!player.IsLoggedIn()) return; + if (!player.IsLoggedIn() || player.GetData("isDead")) return; var user = player.GetUser(); if (user == null) { @@ -800,14 +841,14 @@ namespace ReallifeGamemode.Server.Events [RemoteEvent("keyPress:L")] public void KeyPressL(Player player) { - if (!player.IsLoggedIn()) return; + if (!player.IsLoggedIn() || player.GetData("isDead")) return; DoorManager.ChangeDoorState(player); } [RemoteEvent("keyPress:N")] public void KeyPressN(Player player) { - if (!player.IsLoggedIn()) return; + if (!player.IsLoggedIn() || player.GetData("isDead")) return; if (player.GetData("healDecision") == true) { @@ -898,10 +939,10 @@ namespace ReallifeGamemode.Server.Events VehicleStreaming.SetEngineState(v, !state); } - [RemoteEvent("keyPress:X")] + [RemoteEvent("keyPress:Z")] public void KeyPressX(Player player) { - if (!player.IsLoggedIn()) return; + if (!player.IsLoggedIn() || player.GetData("isDead")) return; if (!player.IsInVehicle) { diff --git a/ReallifeGamemode.Server/Events/Login.cs b/ReallifeGamemode.Server/Events/Login.cs index a4357238..328525b3 100644 --- a/ReallifeGamemode.Server/Events/Login.cs +++ b/ReallifeGamemode.Server/Events/Login.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using GTANetworkAPI; using Microsoft.EntityFrameworkCore; using Newtonsoft.Json; @@ -82,6 +82,7 @@ namespace ReallifeGamemode.Server.Events player.SetData("Adminduty", false); player.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney, 0); player.TriggerEvent("headshotoff"); + player.SetData("togdeath", true); Gangwar.Gangwar.loadPlayer(player); if (user.FactionLeader) { @@ -164,7 +165,7 @@ namespace ReallifeGamemode.Server.Events } else { - Jail.Check_PutBehindBars(user); + Jail.Check_PutBehindBars(user, JailInLocations.InCell); } player.Dimension = 0; @@ -183,6 +184,9 @@ namespace ReallifeGamemode.Server.Events } } + player.TriggerEvent("loadInventoryCEF"); + player.TriggerEvent("loadPlayerListCEF"); + player.TriggerEvent("draw", player.Name, player.Handle.Value); NAPI.Task.Run(() => { diff --git a/ReallifeGamemode.Server/Extensions/ClientExtension.cs b/ReallifeGamemode.Server/Extensions/ClientExtension.cs index 56f0d4f7..e2e1636b 100644 --- a/ReallifeGamemode.Server/Extensions/ClientExtension.cs +++ b/ReallifeGamemode.Server/Extensions/ClientExtension.cs @@ -103,7 +103,7 @@ namespace ReallifeGamemode.Server.Extensions int factionMoney = user.Wanteds * 6; var executiveFactions = dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 1 || f.Id == 3); - foreach(var faction in executiveFactions) + foreach (var faction in executiveFactions) { faction.BankAccount.Balance += factionMoney; } @@ -186,6 +186,11 @@ namespace ReallifeGamemode.Server.Extensions return player.HasData("Adminduty") ? player.GetData("Adminduty") : false; } + public static bool IsTSupport(this Player player) + { + return player.HasData("SAdminduty") ? player.GetData("SAdminduty") : false; + } + public static Vector3 GetPositionFromPlayer(Player player, float distance, int offset = 0) { var pos = player.Position; @@ -224,8 +229,7 @@ namespace ReallifeGamemode.Server.Extensions dbUser.SetBlipAndNametagColor(); dbContext.SaveChanges(); } - ChatService.SendMessage(user.Player, "!{#FF614A}Du hast ein Verbrechen begangen: " + reason + "" + (cop != null ? " | Gemeldet von: " + cop.Name + "." : "")); - ChatService.SendMessage(user.Player, " !{#FFFF00}Fahndungslevel:~s~ " + newWanteds); + user.Player.TriggerEvent("BN_ShowWithPicture", "Straftat", cop != null ? "Officer " + cop.Name + "" : "LSPD", "Du hast ein Verbrechen begangen: " + reason + " (" + newWanteds + ")", "DIA_POLICE", 1, true, 6); foreach (var copPlayer in NAPI.Pools.GetAllPlayers()) { diff --git a/ReallifeGamemode.Server/Finance/Economy.cs b/ReallifeGamemode.Server/Finance/Economy.cs index 3e5cfce8..456f25af 100644 --- a/ReallifeGamemode.Server/Finance/Economy.cs +++ b/ReallifeGamemode.Server/Finance/Economy.cs @@ -200,7 +200,7 @@ namespace ReallifeGamemode.Server.Finance if (putInJail != 0 && minusJail) { - Jail.Check_PutBehindBars(u); + Jail.Check_PutBehindBars(u, JailInLocations.InCell); } } diff --git a/ReallifeGamemode.Server/Gangwar/Gangwar.cs b/ReallifeGamemode.Server/Gangwar/Gangwar.cs index 56d7f42d..8d6ac346 100644 --- a/ReallifeGamemode.Server/Gangwar/Gangwar.cs +++ b/ReallifeGamemode.Server/Gangwar/Gangwar.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using GTANetworkAPI; using Newtonsoft.Json; @@ -13,6 +13,7 @@ namespace ReallifeGamemode.Server.Gangwar { public static Turf[] _loadedTurfs; private static List turfs; + public const int GANGWAR_TOTAL_TIME = 900; public static void loadTurfs() { @@ -56,7 +57,8 @@ namespace ReallifeGamemode.Server.Gangwar if (killerInsideTurf && victimInsideTurf) { - NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - Killer and Victim are in Turf area"); + NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - Killer and Victim are in Turf area"); + killer.TriggerEvent("gangWarKillNotification", victim.Name); foreach (var turf in getTurfs()) { if (turf.getId() == victim.GetData("inGangWar")) diff --git a/ReallifeGamemode.Server/Gangwar/Turf.cs b/ReallifeGamemode.Server/Gangwar/Turf.cs index 8f0466c5..3cd1d52b 100644 --- a/ReallifeGamemode.Server/Gangwar/Turf.cs +++ b/ReallifeGamemode.Server/Gangwar/Turf.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -142,7 +142,7 @@ namespace ReallifeGamemode.Server.Gangwar continue; } - gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score, 900 - timerCount); + gangwarPlayer.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score, Gangwar.GANGWAR_TOTAL_TIME - timerCount); } /*if (this.Att_Score >= 200) { @@ -153,7 +153,7 @@ namespace ReallifeGamemode.Server.Gangwar this.takeOver(this.Owner); }*/ timerCount += 1; - if (timerCount >= 900) //change to 900 (seconds) before release for testing reasons change to whatever you like + if (timerCount >= Gangwar.GANGWAR_TOTAL_TIME) { if (this.Att_Score > this.Def_Score) { @@ -259,10 +259,13 @@ namespace ReallifeGamemode.Server.Gangwar return; } + string takeOverMessage = string.Empty; + if (getOwner() == FactionName) { - ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat erfolgreich das Gebiet ~g~" + getName() + "~w~ verteidigt.", ownerFaction); - ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat den Angrif auf das Gebiet ~r~" + getName() + "~w~ verloren.", attackerFaction); + takeOverMessage = $"~y~[GANGWAR] ~w~Die {getOwner()} konnten ihr Gebiet ~g~{getName()} ~w~ erfolgreich gegen die {getAttacker()} verteidigen."; + //ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat erfolgreich das Gebiet ~g~" + getName() + "~w~ verteidigt.", ownerFaction); + //ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion hat den Angrif auf das Gebiet ~r~" + getName() + "~w~ verloren.", attackerFaction); foreach (var o in owners) { @@ -276,8 +279,9 @@ namespace ReallifeGamemode.Server.Gangwar } else if (getOwner() != FactionName) { - ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion konnte das Gebiet ~r~" + getName() + "~w~ nicht verteidigen.", ownerFaction); - ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion konnte erfolgreich das Gebiet ~g~" + getName() + "~w~ erobern.", attackerFaction); + takeOverMessage = $"~y~[GANGWAR] ~w~Die {getAttacker()} konnten das Gebiet ~g~{getName()} ~w~ der {getOwner()} erfolgreich erobern."; + //ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion konnte das Gebiet ~r~" + getName() + "~w~ nicht verteidigen.", ownerFaction); + //ChatService.BroadcastFaction("~y~[GANGWAR] ~w~Deine Fraktion konnte erfolgreich das Gebiet ~g~" + getName() + "~w~ erobern.", attackerFaction); foreach (var o in owners) { if (o != null) @@ -294,6 +298,7 @@ namespace ReallifeGamemode.Server.Gangwar turf.Owner = this.Owner; turf.FactionId = attackerFaction.Id; } + ChatService.Broadcast(takeOverMessage); dbContext.SaveChanges(); } this.Attacker = null; @@ -307,6 +312,7 @@ namespace ReallifeGamemode.Server.Gangwar c.TriggerEvent("CLIENT:setAttackBlip", false, TurfID); c.ResetData("inGangWar"); c.ResetData("GotInsideOfTurf"); + c.TriggerEvent("resetKillcounter"); } this.playerInGangwar = null; this.status = "conquered"; @@ -358,9 +364,11 @@ namespace ReallifeGamemode.Server.Gangwar u.TriggerEvent("CLIENT:setAttackBlip", true, TurfID); u.TriggerEvent("GangwarScore", this.Attacker, this.Owner, this.Att_Score, this.Def_Score); u.SetData("inGangWar", getId()); - ChatService.SendMessage(u, "~y~[GANGWAR]~w~ Die " + getAttacker() + " haben das Gebiet ~y~" + TurfName + "~w~ der " + getOwner() + " angegriffen."); clientsInGangwar.Add(u); } + + ChatService.Broadcast("~y~[GANGWAR]~w~ Die " + getAttacker() + " haben das Gebiet ~y~" + TurfName + "~w~ der " + getOwner() + " angegriffen."); + playerInGangwar = clientsInGangwar.ToArray(); NAPI.ClientEvent.TriggerClientEventForAll("CLIENT:Turf_Update", JsonConvert.SerializeObject(this.TurfID), JsonConvert.SerializeObject(this.status), JsonConvert.SerializeObject(this.Owner), JsonConvert.SerializeObject(this.Attacker)); this.TurfTick(); diff --git a/ReallifeGamemode.Server/Job/PilotJob.cs b/ReallifeGamemode.Server/Job/PilotJob.cs index 98b5a729..fb3d80dc 100644 --- a/ReallifeGamemode.Server/Job/PilotJob.cs +++ b/ReallifeGamemode.Server/Job/PilotJob.cs @@ -24,8 +24,8 @@ namespace ReallifeGamemode.Server.Job public const string INTERMEDIATE = "Fortgeschrittener"; public const string PROFESSIONAL = "Profi"; - public const int WAGE_BEGINNER = 300; - public const int WAGE_INTERMEDIATE = 900; + public const int WAGE_BEGINNER = 350; + public const int WAGE_INTERMEDIATE = 950; public const uint VEHICLE_BEGINNER = (uint)VehicleHash.Cuban800; public const uint VEHICLE_INTERMEDIATE = (uint)VehicleHash.Velum2; diff --git a/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs b/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs index cc187fc8..cb757cb2 100644 --- a/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs +++ b/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using GTANetworkAPI; @@ -21,7 +21,7 @@ namespace ReallifeGamemode.Server.Job public override bool NeedVehicleToStart => false; private const int MAX_BAG = 40; - private const int WAGE = 80; + private const int WAGE = 50; private const int BONUS = 10; public RefuseCollectorJob() @@ -273,8 +273,8 @@ namespace ReallifeGamemode.Server.Job { if (target != null) { - user1.Wage += WAGE / 2; - user2.Wage += WAGE / 2; + user1.Wage += (int)(WAGE * 0.7); + user2.Wage += (int)(WAGE * 0.7); } else { @@ -308,8 +308,8 @@ namespace ReallifeGamemode.Server.Job if (target != null) { - user1.Wage += (int)(bonus / 2); - user2.Wage += (int)(bonus / 2); + user1.Wage += bonus; + user2.Wage += bonus; } else { diff --git a/ReallifeGamemode.Server/Main.cs b/ReallifeGamemode.Server/Main.cs index 6ade1d26..d6314dfc 100644 --- a/ReallifeGamemode.Server/Main.cs +++ b/ReallifeGamemode.Server/Main.cs @@ -146,6 +146,7 @@ namespace ReallifeGamemode.Server Introduction.Setup(); PositionManager.LoadPositionManager(); LoadManager.LoadLoadManager(); + Rentcar.Setup(); TempBlip tempBlip = new TempBlip() { diff --git a/ReallifeGamemode.Server/Managers/CharacterCreator.cs b/ReallifeGamemode.Server/Managers/CharacterCreator.cs index 3a0a2fdd..d7b62b32 100644 --- a/ReallifeGamemode.Server/Managers/CharacterCreator.cs +++ b/ReallifeGamemode.Server/Managers/CharacterCreator.cs @@ -32,21 +32,6 @@ namespace ReallifeGamemode.Server.Managers [RemoteEvent("creatorSave")] public void CreatorSave(Player player, bool gender, string parentData, string featureData, string appearanceData, string hairAndColorData) { - - var charExists = false; - var genderSwap = false; - - var cUser = player.GetUser(); - - if (cUser.CharacterId != null) - { - charExists = true; - if(cUser.Character.Gender != gender) - { - genderSwap = true; - } - } - var jParentData = JObject.Parse(parentData); var jFeatureData = JArray.Parse(featureData); var jAppearanceData = JArray.Parse(appearanceData); @@ -79,27 +64,27 @@ namespace ReallifeGamemode.Server.Managers float neckWidth = jFeatureData.Value(19); byte blemishes = jAppearanceData[0].Value("Value"); - float blemishesOpacity = jAppearanceData[0].Value("Opacity"); + float blemishesOpacity = jAppearanceData[0].Value("Opacity"); byte facialHair = jAppearanceData[1].Value("Value"); - float facialHairOpacity = jAppearanceData[1].Value("Opacity"); + float facialHairOpacity = jAppearanceData[1].Value("Opacity"); byte eyebrows = jAppearanceData[2].Value("Value"); - float eyebrowsOpacity = jAppearanceData[2].Value("Opacity"); + float eyebrowsOpacity = jAppearanceData[2].Value("Opacity"); byte ageing = jAppearanceData[3].Value("Value"); - float ageingOpacity = jAppearanceData[3].Value("Opacity"); + float ageingOpacity = jAppearanceData[3].Value("Opacity"); byte makeup = jAppearanceData[4].Value("Value"); - float makeupOpacity = jAppearanceData[4].Value("Opacity"); + float makeupOpacity = jAppearanceData[4].Value("Opacity"); byte blush = jAppearanceData[5].Value("Value"); - float blushOpacity = jAppearanceData[5].Value("Opacity"); + float blushOpacity = jAppearanceData[5].Value("Opacity"); byte complexion = jAppearanceData[6].Value("Value"); - float complexionOpacity = jAppearanceData[6].Value("Opacity"); + float complexionOpacity = jAppearanceData[6].Value("Opacity"); byte sunDamage = jAppearanceData[7].Value("Value"); - float sunDamageOpacity = jAppearanceData[7].Value("Opacity"); + float sunDamageOpacity = jAppearanceData[7].Value("Opacity"); byte lipstick = jAppearanceData[8].Value("Value"); - float lipstickOpacity = jAppearanceData[8].Value("Opacity"); + float lipstickOpacity = jAppearanceData[8].Value("Opacity"); byte freckles = jAppearanceData[9].Value("Value"); - float frecklesOpacity = jAppearanceData[9].Value("Opacity"); + float frecklesOpacity = jAppearanceData[9].Value("Opacity"); byte chestHair = jAppearanceData[10].Value("Value"); - float chestHairOpacity = jAppearanceData[10].Value("Opacity"); + float chestHairOpacity = jAppearanceData[10].Value("Opacity"); byte hair = jHairAndColorData.Value(0); byte hairColor = jHairAndColorData.Value(1); @@ -111,8 +96,26 @@ namespace ReallifeGamemode.Server.Managers byte lipstickColor = jHairAndColorData.Value(7); byte chestHairColor = jHairAndColorData.Value(8); + var charExists = false; + var genderSwap = false; + using (var saveCharacter = new DatabaseContext()) { + + var userId = player.GetUser(saveCharacter).Id; + var user = saveCharacter.Users.SingleOrDefault(u => u.Id == userId); + + var oldChar = saveCharacter.Characters.FirstOrDefault(c => c.UserId == user.Id); + + if (user.CharacterId != null) + { + charExists = true; + if (oldChar.Gender != gender) + { + genderSwap = true; + } + } + var character = new Database.Entities.Character { UserId = player.GetUser().Id, @@ -181,20 +184,15 @@ namespace ReallifeGamemode.Server.Managers saveCharacter.Characters.Add(character); saveCharacter.SaveChanges(); - var userId = player.GetUser().Id; - var user = saveCharacter.Users.SingleOrDefault(u => u.Id == userId); + user.CharacterId = character.Id; if (genderSwap) { - var charClothes = saveCharacter.CharacterClothes.Where(c => c.UserId == user.Id); - - foreach(var cloth in charClothes) - { - saveCharacter.Remove(cloth); - saveCharacter.SaveChanges(); - } + var charClothes = saveCharacter.CharacterClothes.Where(c => c.UserId == user.Id); + saveCharacter.RemoveRange(charClothes); + saveCharacter.SaveChanges(); } for (var x = 1; x <= 11; x++) @@ -280,12 +278,12 @@ namespace ReallifeGamemode.Server.Managers } } - if (charExists) { user.BankAccount.Balance -= 15000; if(user.FreeSurgery == true) user.FreeSurgery = false; - } + saveCharacter.Remove(oldChar); + } saveCharacter.SaveChanges(); } //HeadOverlay makeupHo = new HeadOverlay() @@ -304,14 +302,15 @@ namespace ReallifeGamemode.Server.Managers //}; //player.SetHeadOverlay(4, makeupHo); //player.SetHeadOverlay(5, blushHo); - player.SafeTeleport(Main.DEFAULT_SPAWN_POSITION, Main.DEFAULT_SPAWN_HEADING, true); - player.TriggerEvent("draw", player.Name, player.Handle.Value); - player.Dimension = 0; - if (charExists) - { - ApplyCharacter(player); - UpdateCharacterCloth.LoadCharacterDefaults(player); + { + LeaveSurgery(player); + } + else + { + player.SafeTeleport(Main.DEFAULT_SPAWN_POSITION, Main.DEFAULT_SPAWN_HEADING, true); + player.TriggerEvent("draw", player.Name, player.Handle.Value); + player.Dimension = 0; } } diff --git a/ReallifeGamemode.Server/Managers/DoorManager.cs b/ReallifeGamemode.Server/Managers/DoorManager.cs index c5a6e223..61431ca5 100644 --- a/ReallifeGamemode.Server/Managers/DoorManager.cs +++ b/ReallifeGamemode.Server/Managers/DoorManager.cs @@ -24,7 +24,7 @@ namespace ReallifeGamemode.Server.Managers { foreach (Door door in dbContext.Doors) { - _doorColShapes[door.Id] = NAPI.ColShape.CreateSphereColShape(door.Position, 30f); + _doorColShapes[door.Id] = NAPI.ColShape.CreateSphereColShape(door.Position, door.AlwaysOpen ? 200f : 30f); } } } @@ -63,7 +63,7 @@ namespace ReallifeGamemode.Server.Managers player.SendNotification(notStr, true); - NAPI.Pools.GetAllPlayers().ForEach(p => p.TriggerEvent("changeDoorState", d.Model, d.X, d.Y, d.Z, (d.Locked ? 1 : 0), 0.0f, 0.0f, 0.0f)); + NAPI.Pools.GetAllPlayers().ForEach(p => UpdateDoorState(p, d)); } } dbContext.SaveChanges(); @@ -80,9 +80,14 @@ namespace ReallifeGamemode.Server.Managers using (var dbContext = new DatabaseContext()) { Door door = dbContext.Doors.Where(d => d.Id == doorId).First(); - player.TriggerEvent("changeDoorState", door.Model, door.X, door.Y, door.Z, (door.Locked ? 1 : 0), 0.0f, 0.0f, 0.0f); + UpdateDoorState(player, door); } } } + + private static void UpdateDoorState(Player player, Door door) + { + player.TriggerEvent("changeDoorState", door.Model, door.X, door.Y, door.Z, (door.Locked || door.AlwaysOpen ? 1 : 0), 0.0f, 0.0f, door.AlwaysOpen ? 1.0f : 0.0f); + } } } diff --git a/ReallifeGamemode.Server/Managers/InteractionManager.cs b/ReallifeGamemode.Server/Managers/InteractionManager.cs index 1a4c30ca..ce438abe 100644 --- a/ReallifeGamemode.Server/Managers/InteractionManager.cs +++ b/ReallifeGamemode.Server/Managers/InteractionManager.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using GTANetworkAPI; using Newtonsoft.Json; @@ -603,16 +603,16 @@ namespace ReallifeGamemode.Server.Managers { if (amount > 0 && amount <= 10000) { - player.SendNotification($"~w~Du hast ~y~{targetname} ~w~ein Ticket in Höhe von ~b~{amount}$ ~w~gestellt. Grund: ~g~{reason}~w~."); - target.SendNotification($"~b~{player.GetUser().FactionRank.RankName} | {playername} ~w~hat dir ein Ticket in Höhe von ~y~{amount}$ ~w~gestellt.", true); - target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Strafticket im Interaktionsmenü annehmen.", true); + player.SendNotification($"~w~Du hast ~y~{targetname} ~w~ein Ticket in Höhe von ~b~${amount} ~w~ausgestellt. Grund: ~g~{reason}~w~."); + target.SendNotification($"~b~{player.GetUser().FactionRank.RankName} {playername} ~w~hat dir ein Ticket in Höhe von ~y~${amount} ~w~ausgestellt.", true); + target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Das Ticket kann im Interaktionsmenü angenommen werden.", true); target.SetData("ticket_boolean", true); target.SetData("ticket_amount", amount); target.SetData("ticket_player", player); } else { - player.SendNotification("~r~Du kannst nur zwischen 1$ und 10000$ angeben!"); + player.SendNotification("~r~Du kannst nur zwischen $1 und $10.000 angeben!"); } } } @@ -668,8 +668,8 @@ namespace ReallifeGamemode.Server.Managers targetUser.Points += amount; player.SendNotification($"~w~Du hast ~y~{targetname} ~b~{amount} ~w~Strafpunkte gegeben. Grund: ~g~{reason}~w~."); - target.SendNotification($"~b~{player.GetUser().FactionRank.RankName} | {playername} ~w~hat dir ~y~{amount} ~w~Strafpunkte gegeben.", true); - ChatService.HQMessage(targetname + " hat von " + playername + " " + amount + " Strafpunkt(e) erhalten. Gesamt: " + targetUser.Points); + target.SendNotification($"~b~{player.GetUser().FactionRank.RankName} {playername} ~w~hat dir ~y~{amount} ~w~Strafpunkte gegeben (Grund: ~r~{reason}~w~).", true); + ChatService.HQMessage(targetname + " hat von " + playername + " " + amount + " Strafpunkt(e) erhalten (Grund: " + reason + "). Gesamt: " + targetUser.Points); if (targetUser.Points < 0) { @@ -677,9 +677,7 @@ namespace ReallifeGamemode.Server.Managers } else if (targetUser.Points >= 12) { - target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~r~12/12 ~x~Strafpunkten.", true); - target.SendNotification($"~w~Dir wird ~r~Auto- ~w~und ~r~Motorradführerschein ~w~entzogen.", true); //FlashNotif - + target.SendNotification($"~x~Du hast nun ~r~12/12 ~x~Strafpunkte. ~w~Dir wurde dein ~r~Auto- und dein Motorradführerschein ~w~entzogen.", true); ChatService.HQMessage(targetname + " besitzt nun keinen Führerschein mehr."); targetUser.Points = 0; @@ -688,7 +686,7 @@ namespace ReallifeGamemode.Server.Managers } else { - target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~y~{targetUser.Points}/12 ~x~Strafpunkten.", true); + target.SendNotification($"~x~Du hast nun ~y~{targetUser.Points}/12 ~x~Strafpunkt(e).", true); } dbContext.SaveChanges(); @@ -755,7 +753,16 @@ namespace ReallifeGamemode.Server.Managers public void InteractionMenu_Pay(Player player, string jsonNameOrId, string stringAmount) { string nameOrId = (string)JsonConvert.DeserializeObject(jsonNameOrId); - int amount = Int32.Parse(stringAmount); + int amount; + try + { + amount = Int32.Parse(stringAmount); + } + catch + { + player.SendNotification("~r~" + stringAmount + " ist kein gültiger Betrag."); + return; + } Player target = PlayerService.GetPlayerByNameOrId(nameOrId); List nearbyPlayers = NAPI.Player.GetPlayersInRadiusOfPlayer(3, player); @@ -771,7 +778,7 @@ namespace ReallifeGamemode.Server.Managers } else if (!nearbyPlayers.Contains(target)) { - player.SendNotification("~r~Dieser Spieler befindet sich nicht in deiner nähe!"); + player.SendNotification("~r~Dieser Spieler befindet sich nicht in deiner Nähe!"); } else if (player.GetUser().Handmoney < amount) { diff --git a/ReallifeGamemode.Server/Managers/InventoryManager.cs b/ReallifeGamemode.Server/Managers/InventoryManager.cs index d20a69b8..ffeb557b 100644 --- a/ReallifeGamemode.Server/Managers/InventoryManager.cs +++ b/ReallifeGamemode.Server/Managers/InventoryManager.cs @@ -531,8 +531,7 @@ namespace ReallifeGamemode.Server.Managers { if (usableItemObj.Use(fItem)) { - List items = backpackItems[player]; - player.SetSharedData("backpackItems", JsonConvert.SerializeObject(items.ToArray())); + SetBackpackItems(player); player.TriggerEvent("aproveUse", 1, iItem.Name); } } @@ -590,6 +589,7 @@ namespace ReallifeGamemode.Server.Managers break; } context.SaveChanges(); + } } diff --git a/ReallifeGamemode.Server/Managers/JobManager.cs b/ReallifeGamemode.Server/Managers/JobManager.cs index 007228ac..30a623df 100644 --- a/ReallifeGamemode.Server/Managers/JobManager.cs +++ b/ReallifeGamemode.Server/Managers/JobManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -204,7 +204,7 @@ namespace ReallifeGamemode.Server.Managers if (job != null && job.GetUsersInJob().Contains(player)) { - if(job.CheckVehicle(player, veh) && seat == 0) + if (job.CheckVehicle(player, veh) && seat == 0) { if (!playerTimersJobVehicleRespawn.ContainsKey(player)) return; @@ -212,7 +212,7 @@ namespace ReallifeGamemode.Server.Managers playerTimersJobVehicleRespawn[player].Stop(); playerTimersJobVehicleRespawn.Remove(player); } - else + else if (job != GetJob()) { player.StopAnimation(); player.WarpOutOfVehicle(); diff --git a/ReallifeGamemode.Server/Managers/PositionManager.cs b/ReallifeGamemode.Server/Managers/PositionManager.cs index 7a3c8c05..4c8392cb 100644 --- a/ReallifeGamemode.Server/Managers/PositionManager.cs +++ b/ReallifeGamemode.Server/Managers/PositionManager.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using GTANetworkAPI; using ReallifeGamemode.Server.Shop.Clothing; @@ -32,6 +32,11 @@ namespace ReallifeGamemode.Server.Managers public static List AmmunationPoints = new List(); + public static List rentcarPoints = new List(); + + public static Vector3 eventportPosition; + public static bool eventportActive = false; + public static void LoadPositionManager() { #region DutyPoints @@ -148,7 +153,7 @@ namespace ReallifeGamemode.Server.Managers }; ElevatorPoint FibElevatorPointGarage = new ElevatorPoint() { - Position = new Vector3(124.2521, -741.3329, 33.13322), //FBI ganz ganz unten + Position = new Vector3(125.172, -739.3329, 33.13322), //FBI ganz ganz unten FactionId = 3, Stage = "Garage" }; @@ -304,8 +309,47 @@ namespace ReallifeGamemode.Server.Managers } #endregion Shops + + #region RentCar + + RentcarPoint rentCarNoobSpawn = new RentcarPoint() + { + Position = Rentcar.noobSpawnBlipPosition + }; + RentcarPoint rentCarStadthalle = new RentcarPoint() + { + Position = Rentcar.stadthalleBlipPosition + }; + RentcarPoint rentCarKnast = new RentcarPoint() + { + Position = Rentcar.knastBlipPosition + }; + RentcarPoint rentCarPaleto = new RentcarPoint() + { + Position = Rentcar.paletoBlipPosition + }; + RentcarPoint rentCarLamesa = new RentcarPoint() + { + Position = Rentcar.lamesaBlipPosition + }; + + rentcarPoints.Add(rentCarNoobSpawn); + rentcarPoints.Add(rentCarLamesa); + rentcarPoints.Add(rentCarStadthalle); + rentcarPoints.Add(rentCarKnast); + rentcarPoints.Add(rentCarPaleto); + + foreach (RentcarPoint point in rentcarPoints) + { + NAPI.Marker.CreateMarker(1, new Vector3(point.Position.X, point.Position.Y, point.Position.Z - 2), new Vector3(point.Position.X, point.Position.Y, point.Position.Z + 1), + new Vector3(0, 0, 0), 1.5f, new Color(255, 255, 255, 50), false, 0); + NAPI.TextLabel.CreateTextLabel("~y~Fahrzeugverleih\n~w~Drücke ~b~E~w~ um ein Fahrzeug zu mieten", point.Position, 7, 1, 0, new Color(255, 255, 255), false, 0); + + NAPI.Blip.CreateBlip(88, new Vector3(point.Position.X, point.Position.Y, point.Position.Z), (float)0.7, 59, "Fahrzeugvermietung", 255, 200, true, 0, 0); + } } + #endregion RentCar [RemoteEvent("sendClientToStage")] public void ElevatorSendToStage(Player player, string level) { @@ -436,3 +480,9 @@ public class AmmunationPoint public Vector3 Position { get; set; } public Ammunation Ammunation { get; set; } } + +public class RentcarPoint +{ + public Vector3 Position { get; set; } +} + diff --git a/ReallifeGamemode.Server/Managers/TuningManager.cs b/ReallifeGamemode.Server/Managers/TuningManager.cs index 9a4d9cc9..3799c5eb 100644 --- a/ReallifeGamemode.Server/Managers/TuningManager.cs +++ b/ReallifeGamemode.Server/Managers/TuningManager.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using GTANetworkAPI; using ReallifeGamemode.Database.Entities; @@ -35,7 +36,7 @@ namespace ReallifeGamemode.Server.Managers colShape.OnEntityEnterColShape += (cs, c) => { using var dbContext = new DatabaseContext(); - if (c.IsInVehicle && c.VehicleSeat == 0) + if (c.IsInVehicle && c.VehicleSeat == 0 && IsPlayerAllowedToTuneVehicle(c, c.Vehicle, dbContext)) { c.TriggerEvent("showTuningInfo"); } @@ -43,12 +44,42 @@ namespace ReallifeGamemode.Server.Managers colShape.OnEntityExitColShape += (cs, c) => { - c.TriggerEvent("hideTuningInfo", true); + if(c.IsInVehicle) + { + c.TriggerEvent("hideTuningInfo", true); + } }; tuningGarages.Add(colShape); } + private static bool IsPlayerAllowedToTuneVehicle(Player c, Vehicle vehicle, DatabaseContext dbContext) + { + User user = c.GetUser(); + if(user == null) + { + return false; + } + + ServerVehicle serverVehicle = vehicle.GetServerVehicle(dbContext); + if(serverVehicle == null) + { + return false; + } + + if(serverVehicle is UserVehicle userVehicle && userVehicle.UserId == user.Id) + { + return true; + } + + if(serverVehicle is FactionVehicle factionVehicle && factionVehicle.GetOwners().Contains(user.FactionId ?? 0)) + { + return true; + } + + return false; + } + public static void ApplyTuningToServerVehicle(ServerVehicle sVeh) { Vehicle veh = VehicleManager.GetVehicleFromServerVehicle(sVeh); @@ -81,7 +112,33 @@ namespace ReallifeGamemode.Server.Managers { if (!player.IsInVehicle) return; - player.TriggerEvent("showTuningMenu"); + player.TriggerEvent("showTuningMenu", false, GetVehicleBasePrice(player.Vehicle)); + } + + private int GetVehicleBasePrice(Vehicle vehicle) + { + if(vehicle == null) + { + return 0; + } + + ServerVehicle serverVehicle = vehicle.GetServerVehicle(); + if(serverVehicle == null) + { + return 0; + } + + if(serverVehicle is UserVehicle userVehicle) + { + return userVehicle.Price ?? 0; + } + + if(serverVehicle is FactionVehicle factionVehicle) + { + return factionVehicle.BuyPrice; + } + + return 0; } [RemoteEvent("repairVehicle")] diff --git a/ReallifeGamemode.Server/Managers/VehicleManager.cs b/ReallifeGamemode.Server/Managers/VehicleManager.cs index 923a6112..fdcfae35 100644 --- a/ReallifeGamemode.Server/Managers/VehicleManager.cs +++ b/ReallifeGamemode.Server/Managers/VehicleManager.cs @@ -5,7 +5,9 @@ using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Log; +using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Util; +using ReallifeGamemode.Services; using System; using System.Collections.Generic; using System.Linq; @@ -770,11 +772,13 @@ namespace ReallifeGamemode.Server.Managers "fibd2",//mod "fibj",//mod "fibn3",//mod - "fibr"//mod - + "fibr",//mod + "vicechee", //mod + "sheriffcoqm", //mod + "polcoquette", //mod }; - private static readonly Dictionary _serverVehicles = new Dictionary(); + private static readonly Dictionary _serverVehicles = new Dictionary(); private static readonly Dictionary lastPositions = new Dictionary(); private static DateTime lastSave = DateTime.UtcNow; @@ -855,17 +859,23 @@ namespace ReallifeGamemode.Server.Managers { if (_serverVehicles.ContainsKey(serverVehicle.Id)) { - logger.LogCritical("Server Vehicle {Id} already has a spawned vehicle", serverVehicle.Id); - _serverVehicles[serverVehicle.Id].Entity().Delete(); + var spawnedHandle = _serverVehicles.Where(s => s.Key == serverVehicle.Id).First().Value; + logger.LogCritical("Server Vehicle {Id} already has a spawned vehicle with handle {spawnedHandle}", serverVehicle.Id, spawnedHandle); + new NetHandle(_serverVehicles[serverVehicle.Id], EntityType.Vehicle).Entity().Delete(); } - if (_serverVehicles.ContainsValue(vehicle.Handle)) + if (_serverVehicles.ContainsValue(vehicle.Handle.Value)) { - logger.LogCritical("Vehicle handle {Handle} already belongs"); + var dbId = _serverVehicles.Where(v => v.Value == vehicle.Handle.Value).First().Key; + var dbIdHandle = vehicle.Handle.Value; + logger.LogCritical("Vehicle handle {handle} already belongs to server vehicle {dbIdHandle}", dbIdHandle, dbId); return; } - _serverVehicles[serverVehicle.Id] = vehicle.Handle; + var id = serverVehicle.Id; + var handle = vehicle.Handle.Value; + logger.LogInformation("Mapping server vehicle id {id} to vehicle {handle}", id, handle); + _serverVehicles[serverVehicle.Id] = vehicle.Handle.Value; } internal static void DeleteVehicle(Vehicle veh) @@ -873,15 +883,18 @@ namespace ReallifeGamemode.Server.Managers ServerVehicle sVeh; if ((sVeh = GetServerVehicleFromVehicle(veh)) != null) { + var id = sVeh.Id; + var handle = veh.Handle.Value; + logger.LogInformation("Deleting server vehicle {id} mapping to spawned veh {handle}", id, handle); _serverVehicles.Remove(sVeh.Id); } veh?.Delete(); } - public static Vehicle GetVehicleFromHandle(NetHandle handle) + public static Vehicle GetVehicleFromHandle(ushort handle) { - return NAPI.Pools.GetAllVehicles().Find(v => v.Handle == handle); + return NAPI.Pools.GetAllVehicles().Find(v => v.Handle.Value == handle); } public static Vehicle GetVehicleFromId(int id) @@ -917,9 +930,9 @@ namespace ReallifeGamemode.Server.Managers dbContext = dbContext ?? new DatabaseContext(); - foreach (KeyValuePair pair in _serverVehicles) + foreach (KeyValuePair pair in _serverVehicles) { - if (pair.Value == veh.Handle) + if (pair.Value == veh.Handle.Value) { return dbContext.ServerVehicles.Find(pair.Key); } @@ -946,6 +959,17 @@ namespace ReallifeGamemode.Server.Managers [ServerEvent(Event.VehicleDeath)] public static void VehicleManagerVehicleDeath(Vehicle vehicle) { + /* + String rentCarOwner = Rentcar.mapPlayerRentcarBill.FirstOrDefault(x => x.Value.Item1 == vehicle).Key; + + ChatService.Broadcast("a:" + ""); + if (rentCarOwner != null) + { + Player target = PlayerService.GetPlayerByNameOrId(rentCarOwner); + Rentcar.cancelRent(target); + } + */ + ServerVehicle serverVehicle = GetServerVehicleFromVehicle(vehicle); if (serverVehicle == null) diff --git a/ReallifeGamemode.Server/Report/Report.cs b/ReallifeGamemode.Server/Report/Report.cs index d07ed8c7..d8a5d9bf 100644 --- a/ReallifeGamemode.Server/Report/Report.cs +++ b/ReallifeGamemode.Server/Report/Report.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using GTANetworkAPI; using Newtonsoft.Json; @@ -124,7 +124,7 @@ namespace ReallifeGamemode.Server.Report { user = PlayerService.GetPlayerByNameOrId(username); - if (text.Equals("quit")) + if (text.Equals("quit") || text.Equals("close")) { ChatService.SendMessage(user, "!{#008fff}[REPORT]!{#FFFFFF} Chat vom Admin beendet"); ChatService.SendMessage(client, "!{#008fff}[REPORT]!{#FFFFFF} Chat beendet"); @@ -180,7 +180,7 @@ namespace ReallifeGamemode.Server.Report public void RequestReport(Player user, string type, string data) { string text = JsonConvert.DeserializeObject(data); - if (type == "Ticket Report") + if (type == "Ticket") { ReportManage temp = null; for (int a = 0; a < listReports.Count; a++) @@ -213,10 +213,10 @@ namespace ReallifeGamemode.Server.Report listReports.Add(ticket); //ChatService.SendMessage(user, "!{#addc8d}In Bearbeitung"); } - if (type == "Quick Report") + if (type == "Quick-Report") { ChatService.BroadcastAdmin("!{#008fff}[QR]~w~ " + user.Name + " (" + user.Handle.Value + ")~w~: " + text, AdminLevel.SUPPORTER); - user.SendChatMessage("~w~Dein Quick Report wurde an das Adminteam weitergeleitet"); + user.SendChatMessage("~w~Dein Quick-Report wurde an das Adminteam weitergeleitet"); } } diff --git a/ReallifeGamemode.Server/Util/GlobalHelper.cs b/ReallifeGamemode.Server/Util/GlobalHelper.cs index 8fcd8b3a..91c3e025 100644 --- a/ReallifeGamemode.Server/Util/GlobalHelper.cs +++ b/ReallifeGamemode.Server/Util/GlobalHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using GTANetworkAPI; @@ -14,6 +14,10 @@ namespace ReallifeGamemode.Server.Util { ".MichaPlays.", "Der echte Ballas Leader ist online (MichaPlays)" }, { "iCroniX", "Life of Malle - Eimer für Alle - Alle für Malle - Böllern! (CroniX)" }, { "balboistderbeste", "Hurra! Hurra! Der Balbo ist jetzt da! (balbo)" }, + { "AirMake", "The fresh breeze of the stone ist back. (AirMake)" }, + { "raviatex", "I'll remember you all in therapy. (aviate)" }, + { "datgame__", "KOPF ENTWICKLUNG!! (hydrant)" }, + { "Roachkook", "2head Entwickler ist wieder online (kookroach)" } }; public static DateTime CountdownUntil { get; internal set; } diff --git a/ReallifeGamemode.Server/Util/Rentcar.cs b/ReallifeGamemode.Server/Util/Rentcar.cs new file mode 100644 index 00000000..ceac4e87 --- /dev/null +++ b/ReallifeGamemode.Server/Util/Rentcar.cs @@ -0,0 +1,204 @@ +using System; +using System.Collections.Generic; +using System.Text; +using GTANetworkAPI; +using ReallifeGamemode.Database.Entities; +using ReallifeGamemode.Database.Models; +using ReallifeGamemode.Server.Extensions; +using ReallifeGamemode.Server.Managers; +using ReallifeGamemode.Server.Services; + +namespace ReallifeGamemode.Server.Util +{ + class Rentcar : Script + { + //In Sekunden + public static int PAY_TIMER = 180; + + //In Stunden + private static int PAYTIME_FREE = 30; + + public static List noobspawnVehicleProperties = new List(); + private static Vector3 noobspawnVehicleSpawnPosition = new Vector3(-1020.18695, -2695.2253, 13.988778); + private static double noobspawnVehicleSpawnHeading = 151.39877; + public static Vector3 noobSpawnBlipPosition = new Vector3(-1023.3046, -2694.8992, 13.906858); + + public static List stadthalleVehicleProperties = new List(); + private static Vector3 stadthalleVehicleSpawnPosition = new Vector3(-373, -236.31334, 35.8506); + private static double stadthalleVehicleSpawnHeading = 109.96821; + public static Vector3 stadthalleBlipPosition = new Vector3(-369.7236, -231.82654, 35.993023); + + public static List knastVehicleProperties = new List(); + private static Vector3 knastVehicleSpawnPosition = new Vector3(1212.741, 2726.6135, 38.00415); + private static double knastVehicleSpawnHeading = 173.14825; + public static Vector3 knastBlipPosition = new Vector3(1220.3483, 2725.4932, 38.00414); + + public static List paletoVehicleProperties = new List(); + private static Vector3 paletoVehicleSpawnPosition = new Vector3(-216.75778198242188, 6215.0068359375, 31.490657806396484); + private static double paletoVehicleSpawnHeading = -133.99148559570312; + public static Vector3 paletoBlipPosition = new Vector3(-214.52447509765625, 6218.1708984375, 31.49131965637207); + + public static List lamesaVehicleProperties = new List(); + private static Vector3 lamesaVehicleSpawnPosition = new Vector3(811.4766235351562, -1041.594482421875, 26.58707618713379); + private static double lamesaVehicleSpawnHeading = 88.71146392822266; + public static Vector3 lamesaBlipPosition = new Vector3(818.3075561523438, -1039.78759765625, 26.750783920288086); + + public static Dictionary mapPlayerRentcarBill = new Dictionary(); + + public static void Setup() + { + noobspawnVehicleProperties.Add(new RentcarProperty("bmx", 10)); + noobspawnVehicleProperties.Add(new RentcarProperty("faggio3", 50)); + + stadthalleVehicleProperties.Add(new RentcarProperty("bmx", 10)); + stadthalleVehicleProperties.Add(new RentcarProperty("faggio3", 50)); + + knastVehicleProperties.Add(new RentcarProperty("bmx", 10)); + knastVehicleProperties.Add(new RentcarProperty("faggio3", 50)); + + paletoVehicleProperties.Add(new RentcarProperty("bmx", 10)); + paletoVehicleProperties.Add(new RentcarProperty("faggio3", 50)); + + lamesaVehicleProperties.Add(new RentcarProperty("bmx", 10)); + lamesaVehicleProperties.Add(new RentcarProperty("faggio3", 50)); + } + + public static void cancelRent(Player player) + { + using (var dbContext = new DatabaseContext()) + { + User user = player.GetUser(dbContext); + user.BankAccount.Balance -= mapPlayerRentcarBill[player.Name].Item2; + dbContext.SaveChanges(); + } + + player.SetData("hasRentcar", false); + player.TriggerEvent("abortRentcarTimer"); + player.SendChatMessage("Fahrzeugmiete erfolgreich gekündigt (Kosten: ~g~$" + mapPlayerRentcarBill[player.Name].Item2 + ")."); + VehicleManager.DeleteVehicle(mapPlayerRentcarBill[player.Name].Item1); + Rentcar.mapPlayerRentcarBill.Remove(player.Name); + } + + [RemoteEvent("SERVER:updateRentCarBill")] + public void updateRentCarBill(Player player, int bill, int time) + { + if (canRentForFree(player)) + { + return; + } + + using (var dbContext = new DatabaseContext()) + { + User user = player.GetUser(dbContext); + + if (bill > user.BankAccount.Balance) + { + ChatService.ErrorMessage(player, "Du hast nicht genügend Geld auf dem Konto. Dein Mietfahrzeug wurde zurückgegeben"); + cancelRent(player); + dbContext.SaveChanges(); + return; + } + dbContext.SaveChanges(); + } + + if (!mapPlayerRentcarBill.ContainsKey(player.Name)) + { + return; + } + + player.TriggerEvent("BN_Show", "Fahrzeug seit ~b~" + (int)(time / 60) + "~w~ Minuten gemietet (Gesamtkosten: ~g~$" + bill + "~s~)."); + mapPlayerRentcarBill[player.Name] = (mapPlayerRentcarBill[player.Name].Item1, bill); + } + + [RemoteEvent("SERVER:rentcarBooked")] + public void rentcarBooked(Player player, string vehicleName, int price, String rentcarLocation) + { + if (player.GetData("hasRentcar") == true) + { + ChatService.ErrorMessage(player, "Du hast bereits ein Fahrzeug gemietet. Mit '/rent stop' kündigst du den Mietvertrag"); + return; + } + + if (!uint.TryParse(vehicleName, out uint uHash)) + uHash = NAPI.Util.GetHashKey(vehicleName); + + if (!VehicleManager.IsValidHash(uHash)) + { + return; + } + + using (var dbContext = new DatabaseContext()) + { + User user = player.GetUser(dbContext); + + if (price > user.BankAccount.Balance) + { + ChatService.ErrorMessage(player, "Du hast nicht genügend Geld auf dem Konto"); + dbContext.SaveChanges(); + return; + } + dbContext.SaveChanges(); + } + Vehicle v = null; + + if (rentcarLocation == "noobspawn") + { + v = NAPI.Vehicle.CreateVehicle(uHash, noobspawnVehicleSpawnPosition, (float)noobspawnVehicleSpawnHeading, 111, 111, engine: true); + } + else if (rentcarLocation == "stadthalle") + { + v = NAPI.Vehicle.CreateVehicle(uHash, stadthalleVehicleSpawnPosition, (float)stadthalleVehicleSpawnHeading, 111, 111, engine: true); + } + else if (rentcarLocation == "knast") + { + v = NAPI.Vehicle.CreateVehicle(uHash, knastVehicleSpawnPosition, (float)knastVehicleSpawnHeading, 111, 111, engine: true); + } + else if (rentcarLocation == "paleto") + { + v = NAPI.Vehicle.CreateVehicle(uHash, paletoVehicleSpawnPosition, (float)paletoVehicleSpawnHeading, 111, 111, engine: true); + } + else if (rentcarLocation == "lamesa") + { + v = NAPI.Vehicle.CreateVehicle(uHash, lamesaVehicleSpawnPosition, (float)lamesaVehicleSpawnHeading, 111, 111, engine: true); + } + + if (v == null) + { + return; + } + + VehicleStreaming.SetEngineState(v, true); + VehicleStreaming.SetLockStatus(v, false); + + mapPlayerRentcarBill[player.Name] = (v, 0); + + player.SendChatMessage("~y~[Fahrzeugvermietung] ~w~Viel Spaß mit deinem Fahrzeug! Mit '/rent stop' kannst du den Mietvertrag kündigen."); + + if (canRentForFree(player)) + { + player.SendChatMessage("~y~[Fahrzeugvermietung] ~w~Da du neu in der Stadt bist, wird dir diese Fahrt nicht in Rechnung gestellt."); + } + + player.SetData("hasRentcar", true); + player.TriggerEvent("triggerRentcarTimer", PAY_TIMER, price); + } + public static bool canRentForFree(Player player) + { + bool ret = false; + + using (var dbContext = new DatabaseContext()) + { + User user = player.GetUser(dbContext); + + if (user.PlayedMinutes < PAYTIME_FREE * 60) + { + ret = true; + } + + dbContext.SaveChanges(); + } + + return ret; + } + } +} diff --git a/ReallifeGamemode.Server/Util/RentcarProperty.cs b/ReallifeGamemode.Server/Util/RentcarProperty.cs new file mode 100644 index 00000000..6bd31143 --- /dev/null +++ b/ReallifeGamemode.Server/Util/RentcarProperty.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +namespace ReallifeGamemode.Server.Util +{ + class RentcarProperty + { + public string Name { get; set; } + public int Price { get; set; } + + public RentcarProperty(String n, int p){ + Name = n; + Price = p; + } + } +} diff --git a/ReallifeGamemode.Server/Util/ThreadTimers.cs b/ReallifeGamemode.Server/Util/ThreadTimers.cs index 7b5db17b..e86fe5b5 100644 --- a/ReallifeGamemode.Server/Util/ThreadTimers.cs +++ b/ReallifeGamemode.Server/Util/ThreadTimers.cs @@ -32,9 +32,6 @@ namespace ReallifeGamemode.Server.Util timer5000.Start(); timer5000.Elapsed += Timer5000_Elapsed; - timer10000.Start(); - timer10000.Elapsed += Timer10000_Elapsed; - timer60000.Start(); timer60000.Elapsed += Timer60000_Elapsed; } @@ -65,7 +62,6 @@ namespace ReallifeGamemode.Server.Util }); } - private static void Timer60000_Elapsed(object sender, ElapsedEventArgs e) { NAPI.Task.Run(() => @@ -78,19 +74,10 @@ namespace ReallifeGamemode.Server.Util }); } - private static void Timer10000_Elapsed(object sender, ElapsedEventArgs e) - { - NAPI.Task.Run(() => - { - Jail.BrakeOut_Elapsed(); - }); - } - private static void Timer2500_Elapsed(object sender, ElapsedEventArgs e) { NAPI.Task.Run(() => { - WantedEscapeTimer.Timer_Elapsed(); Jail.JailIn_Elapsed(); Gangwar.Gangwar.Value_TimerElapsed(); }); diff --git a/ReallifeGamemode.Server/Wanted/Jail.cs b/ReallifeGamemode.Server/Wanted/Jail.cs index 745a12e1..6af59153 100644 --- a/ReallifeGamemode.Server/Wanted/Jail.cs +++ b/ReallifeGamemode.Server/Wanted/Jail.cs @@ -19,7 +19,17 @@ namespace ReallifeGamemode.Server.Wanted { private static Dictionary Jailtime { get; set; } = new Dictionary(); //time in seconds - public static void Check_PutBehindBars(User user) + private static Vector3 JailIn_Point = new Vector3(1690.754, 2591.0464, 45.914402); + private static int JailIn_Range = 3; + private static Vector3 JailOut_Point = new Vector3(1848.3097, 2585.9036, 45.67201); + + private static List prisonCells = new List() { + new Vector3(1629.2026, 2569.8057, 45.564846), + new Vector3(1642.7831, 2570.2622, 45.56483), + new Vector3(1651.512, 2570.2249, 45.564907) + }; + + public static void Check_PutBehindBars(User user, JailInLocations positionInJail) { user.SetBlipAndNametagColor(); Player player = user.Player; @@ -31,15 +41,20 @@ namespace ReallifeGamemode.Server.Wanted player.ClearAnimation(); player.SafeSetHealth(100); player.Armor = 0; - Random rnd = new Random(); - int rndInt = rnd.Next(1, 3); - Vector3 position = new Vector3(); - if (rndInt == 1) - position = new Vector3(458.9842, -997.2126, 24.91485); //send client to jail - if (rndInt == 2) - position = new Vector3(459.696, -994.3766, 24.91486); //send client to jail - if (rndInt == 3) - position = new Vector3(458.3372, -1001.258, 24.91485); //send client to jail + + Vector3 position = null; + + if (positionInJail == JailInLocations.InCell) + { + Random rnd = new Random(); + int rndInt = rnd.Next(1, 3); + position = prisonCells[rndInt]; + + } + else if (positionInJail == JailInLocations.Outside) + { + position = new Vector3(1691.42, 2562.77, 45.56); + } player.SafeTeleport(position, 0, true); @@ -78,7 +93,7 @@ namespace ReallifeGamemode.Server.Wanted using var dbContext = new DatabaseContext(); foreach (var player in NAPI.Pools.GetAllPlayers()) { - if (player.Position.DistanceTo(new Vector3(458.9842, -997.2126, 24.91485)) > 7) + if (player.Position.DistanceTo(JailIn_Point) > JailIn_Range) { continue; } @@ -98,7 +113,8 @@ namespace ReallifeGamemode.Server.Wanted user.SetBlipAndNametagColor(); user.AnnouncePlayerJailedIn(); dbContext.SaveChanges(); - Check_PutBehindBars(user); + //HERE: Freilauf + Check_PutBehindBars(user, JailInLocations.Outside); break; } } @@ -107,27 +123,6 @@ namespace ReallifeGamemode.Server.Wanted } } - public static void BrakeOut_Elapsed() - { - foreach (var player in NAPI.Pools.GetAllPlayers()) - { - User user = player.GetUser(); - - if (user != null && player.Position.DistanceTo2D(new Vector3(458.9842, -997.2126, 24.91485)) > 7 && Jailtime.ContainsKey(user.Id)) - { - using (var dbContext = new DatabaseContext()) - { - user = player.GetUser(dbContext); - user.JailTime = 0; - user.GiveWanteds(null, 50, "Knast-Ausbruch"); - player.TriggerEvent("jailTime", 0); - dbContext.SaveChanges(); - Jailtime.Remove(user.Id); - } - } - } - } - public static void JailOut_Elapsed() { using var dbContext = new DatabaseContext(); @@ -139,7 +134,7 @@ namespace ReallifeGamemode.Server.Wanted if (user.JailTime <= 0) { Jailtime.Remove(user.Id); - player.SafeTeleport(new Vector3(427.879, -984.65, 30.71)); + player.SafeTeleport(JailOut_Point); player.TriggerEvent("jailTime", 0); return; } @@ -183,7 +178,7 @@ namespace ReallifeGamemode.Server.Wanted dbContext.SaveChanges(); } player.SafeSetHealth(100); - player.SafeTeleport(new Vector3(427.879, -984.65, 30.71)); + player.SafeTeleport(JailOut_Point); ChatService.HQMessage("Beamter " + cop.Name + " hat " + user.Name + " aus dem Knast entlassen."); ChatService.SendMessage(player, "!{#8181E9}Der Beamte " + cop.Name + " hat dich aus dem Knast entlassen"); @@ -203,7 +198,7 @@ namespace ReallifeGamemode.Server.Wanted dbContext.SaveChanges(); target.SafeSetHealth(100); - target.SafeTeleport(new Vector3(427.879, -984.65, 30.71)); + target.SafeTeleport(JailOut_Point); ChatService.HQMessage(" Admin " + admin.Name + " hat " + user.Name + " aus dem Knast entlassen."); ChatService.SendMessage(target, "!{#8181E9}Admin " + admin.Name + " hat dich aus dem Knast entlassen"); @@ -211,5 +206,39 @@ namespace ReallifeGamemode.Server.Wanted target.TriggerEvent("jailTime", 0); } } + + public static void BreakOut(Player player) + { + User user = player.GetUser(); + + using (var dbContext = new DatabaseContext()) + { + user = player.GetUser(dbContext); + user.JailTime = 0; + user.GiveWanteds(null, 50, "Knast-Ausbruch"); + player.TriggerEvent("jailTime", 0); + dbContext.SaveChanges(); + Jailtime.Remove(user.Id); + } + } + + [RemoteEvent("SERVER:BreakOutIfInPrison")] + public void breakOutIfInPrison(Player player) + { + User user = player.GetUser(); + + using (var dbContext = new DatabaseContext()) + { + if (Jailtime.ContainsKey(user.Id)) + { + user = player.GetUser(dbContext); + user.JailTime = 0; + user.GiveWanteds(null, 50, "Knast-Ausbruch"); + player.TriggerEvent("jailTime", 0); + dbContext.SaveChanges(); + Jailtime.Remove(user.Id); + } + } + } } } diff --git a/ReallifeGamemode.Server/Wanted/JailInLocations.cs b/ReallifeGamemode.Server/Wanted/JailInLocations.cs new file mode 100644 index 00000000..b988c9db --- /dev/null +++ b/ReallifeGamemode.Server/Wanted/JailInLocations.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ReallifeGamemode.Server.Wanted +{ + public enum JailInLocations + { + Outside, + InCell + } +} diff --git a/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs b/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs index 7f6fe6ea..32985165 100644 --- a/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs +++ b/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs @@ -13,82 +13,25 @@ using ReallifeGamemode.Server.Services; namespace ReallifeGamemode.Server.Wanted { - public class WantedEscapeTimer + public class WantedEscapeTimer : Script { - private const int WantedEscapeTime = 300000; - - public static Dictionary waTimer { get; set; } = new Dictionary(); //zeit in ms - /* - public static void WantedTimer() - { - //System.Timers.Timer timer = new System.Timers.Timer(2500); - //timer.Start(); - //timer.Elapsed += Timer_Elapsed; - } - */ - - public static void ResetWantedTimeToElapse(User user) - { - waTimer[user.Id] = WantedEscapeTime; - } - - public static void Timer_Elapsed() + [RemoteEvent("CLIENT:EscapeWanted")] + public void WantedEscape(Player player) { using var dbContext = new DatabaseContext(); - foreach (var player in NAPI.Pools.GetAllPlayers()) + User user = player.GetUser(dbContext); + + if (user.Wanteds <= 0) + return; + + player.TriggerEvent("BN_ShowWithPicture", "Abgetaucht", "Lester", "Du hast erfolgreich ein Wanted ~y~abgetaucht", "CHAR_LESTER", 1, true); + user.Wanteds -= 1; + if (user.Wanteds == 0) { - User user = player.GetUser(dbContext); - if (user != null && user.Wanteds > 0) - { - if (!waTimer.ContainsKey(user.Id)) - ResetWantedTimeToElapse(user); - - bool isNearCop = false; - foreach (var playerCop in NAPI.Pools.GetAllPlayers()) - { - if (!playerCop.IsLoggedIn()) continue; - - User cop = playerCop.GetUser(); - if (cop != null && (cop.FactionId == 1 || cop.FactionId == 3)) - { - if (cop.GetData("duty") && playerCop.Position.DistanceTo2D(player.Position) <= 500) - { - //Schriftzug 'abgetaucht' zerstören :( - isNearCop = true; - break; - } - //Hier abgetaucht schriftzug einfügen :) - } - } - - if (!waTimer.ContainsKey(user.Id)) - waTimer[user.Id] = 300000; - - if (waTimer[user.Id] <= 0) - { - ResetWantedTimeToElapse(user); - player.SendChatMessage("~y~Du hast erfolgreich einen Wanted abgetaucht."); - user.Wanteds -= 1; - if (user.Wanteds == 0) - { - ChatService.HQMessage(player.Name + " konnte solange abtauchen, sodass er nicht mehr gesucht wird."); - user.SetBlipAndNametagColor(); - } - dbContext.SaveChanges(); - waTimer[user.Id] = WantedEscapeTime; - } - else if (!isNearCop && !player.IsAfk()) - { - player.TriggerEvent("SERVER:SetWantedFlash", true); - waTimer[user.Id] -= 2500; - } - else if (isNearCop) - { - player.TriggerEvent("SERVER:SetWantedFlash", false); - ResetWantedTimeToElapse(user); - } - } + ChatService.HQMessage(player.Name + " konnte solange abtauchen, sodass er nicht mehr gesucht wird."); + user.SetBlipAndNametagColor(); } + dbContext.SaveChanges(); } } } diff --git a/ReallifeGamemode.sln b/ReallifeGamemode.sln index 5658771a..8bb089e4 100644 --- a/ReallifeGamemode.sln +++ b/ReallifeGamemode.sln @@ -41,6 +41,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReallifeGamemode.Server.Log EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReallifeGamemode.Server.Core.Extensions", "ReallifeGamemode.Server.Core.Extensions\ReallifeGamemode.Server.Core.Extensions.csproj", "{C21396B2-31D3-47C5-8D87-651FA16E60FD}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReallifeGamemode.Client.Core", "ReallifeGamemode.Client.Core\ReallifeGamemode.Client.Core.csproj", "{EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -288,6 +290,24 @@ Global {C21396B2-31D3-47C5-8D87-651FA16E60FD}.ServerBuild|x64.Build.0 = Debug|Any CPU {C21396B2-31D3-47C5-8D87-651FA16E60FD}.ServerBuild|x86.ActiveCfg = Release|Any CPU {C21396B2-31D3-47C5-8D87-651FA16E60FD}.ServerBuild|x86.Build.0 = Release|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.Debug|x64.ActiveCfg = Debug|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.Debug|x64.Build.0 = Debug|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.Debug|x86.ActiveCfg = Debug|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.Debug|x86.Build.0 = Debug|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.Release|Any CPU.Build.0 = Release|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.Release|x64.ActiveCfg = Release|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.Release|x64.Build.0 = Release|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.Release|x86.ActiveCfg = Release|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.Release|x86.Build.0 = Release|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.ServerBuild|Any CPU.ActiveCfg = Debug|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.ServerBuild|Any CPU.Build.0 = Debug|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.ServerBuild|x64.ActiveCfg = Debug|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.ServerBuild|x64.Build.0 = Debug|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.ServerBuild|x86.ActiveCfg = Debug|Any CPU + {EF0A3ED3-FA93-4FFA-B080-C92FE556D7F1}.ServerBuild|x86.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE