From c871805430c088b7c48e3b935f49c06e0079e08f Mon Sep 17 00:00:00 2001 From: Siga Date: Sat, 4 Apr 2020 18:33:20 +0200 Subject: [PATCH] Add RefuseCollector Job and other misc --- .../clothes/female_torso_top_combination.json | 7 + .../clothes/male_torso_top_combination.json | 7 - .../Jobs/RefuseCollector.ts | 155 ++ ReallifeGamemode.Client/index.ts | 3 + ReallifeGamemode.Client/util/Gangwar.ts | 125 +- ReallifeGamemode.Database/Entities/Turfs.cs | 3 + ...0200403035225_TurfSurplusValue.Designer.cs | 1443 +++++++++++++++++ .../20200403035225_TurfSurplusValue.cs | 33 + .../DatabaseContextModelSnapshot.cs | 4 + .../Managers/HouseManager.cs | 4 +- ReallifeGamemode.Server.Core/Script.cs | 2 +- .../Commands/AdminCommands.cs | 2 +- ReallifeGamemode.Server/Finance/Economy.cs | 6 +- ReallifeGamemode.Server/Gangwar/Gangwar.cs | 48 +- ReallifeGamemode.Server/Gangwar/Turf.cs | 38 +- .../Job/RefuseCollectorJob.cs | 343 +++- ReallifeGamemode.Server/Job/TaxiDriverJob.cs | 9 +- ReallifeGamemode.Server/Main.cs | 17 +- .../Managers/JobManager.cs | 2 +- .../Managers/VehicleManager.cs | 8 +- ReallifeGamemode.Server/Util/ThreadTimers.cs | 61 + ReallifeGamemode.Server/Wanted/Jail.cs | 16 +- .../Wanted/WantedEscapeTimer.cs | 12 +- .../WeaponDeal/WeaponDealManager.cs | 7 +- 24 files changed, 2251 insertions(+), 104 deletions(-) create mode 100644 ReallifeGamemode.Client/Jobs/RefuseCollector.ts create mode 100644 ReallifeGamemode.Database/Migrations/20200403035225_TurfSurplusValue.Designer.cs create mode 100644 ReallifeGamemode.Database/Migrations/20200403035225_TurfSurplusValue.cs create mode 100644 ReallifeGamemode.Server/Util/ThreadTimers.cs diff --git a/ReallifeGamemode.Client/Interaction/clothes/female_torso_top_combination.json b/ReallifeGamemode.Client/Interaction/clothes/female_torso_top_combination.json index 515c94eb..c335c35e 100644 --- a/ReallifeGamemode.Client/Interaction/clothes/female_torso_top_combination.json +++ b/ReallifeGamemode.Client/Interaction/clothes/female_torso_top_combination.json @@ -1,5 +1,12 @@ { "combination": [ + { + "_id": 0, + "Top": 0, + "Torso": 0, + "Undershirt": 2 + }, + { "_id": 1, "Top": 1, diff --git a/ReallifeGamemode.Client/Interaction/clothes/male_torso_top_combination.json b/ReallifeGamemode.Client/Interaction/clothes/male_torso_top_combination.json index eda5d4ed..3cde781c 100644 --- a/ReallifeGamemode.Client/Interaction/clothes/male_torso_top_combination.json +++ b/ReallifeGamemode.Client/Interaction/clothes/male_torso_top_combination.json @@ -1,12 +1,5 @@ { "combination": [ - - { - "_id": 0, - "Top": 0, - "Torso": 0, - "Undershirt": 15 - }, { "_id": 1, "Top": 1, diff --git a/ReallifeGamemode.Client/Jobs/RefuseCollector.ts b/ReallifeGamemode.Client/Jobs/RefuseCollector.ts new file mode 100644 index 00000000..2e2cd576 --- /dev/null +++ b/ReallifeGamemode.Client/Jobs/RefuseCollector.ts @@ -0,0 +1,155 @@ +export default function RefuseCollector() { + + var State = false; + var Traegt = false; + var HintenVoll = false; + var MuellSack = null; + var BlipTonneHinten = null; + var CheckpointTonneHinten = null; + var ShapeTonneHinten = null; + var BlipTonneBase = null; + var CheckpointTonneBase = null; + var ShapeTonneBase = null; + var vehicle = null; + + var BlipTonne = []; + var ShapeTonne = []; + + + + mp.events.add('SERVER:MuellmannStatusTrue', () => { + State = true; + }); + + mp.events.add('SERVER:MuellmannStatusFalse', () => { + State = false; + }); + + mp.events.add('SERVER:MuellmannBCSErstellen', (jsonPosArr, veh) => { + + let posArr = JSON.parse(jsonPosArr); + vehicle = veh; + for (var i = 0; i < posArr.length; i++) { + let pos = new mp.Vector3(posArr[i].x, posArr[i].y, posArr[i].z - 1) + BlipTonne.push(mp.blips.new(1, pos, { name: 'Müllmann', color: 45, shortRange: false })); + ShapeTonne.push(mp.colshapes.newSphere(posArr[i].x, posArr[i].y, posArr[i].z +0.5, 1.75)); + } + + BlipTonneBase = mp.blips.new(1, new mp.Vector3(-535.1912, -1713.742, 19.23861 - 1), { name: 'Müllmann', color: 5, shortRange: false }); + CheckpointTonneBase = mp.markers.new(1, new mp.Vector3(-535.1912, -1713.742, 19.23861 - 1), 10, { direction: new mp.Vector3(-235.5747, -1685.475, 32.7207), color: [255, 255, 0, 150], visible: true, dimension: 0 }); + ShapeTonneBase = mp.colshapes.newSphere(-535.1912, -1713.742, 19.23861 - 1, 10); + }); + mp.events.add('SERVER:MuellmannBCSEntfernen', () => { + + for (var i = 0; i < BlipTonne.length; i++) { + if (BlipTonne[i] == null) continue; + BlipTonne[i].destroy(); + ShapeTonne[i].destroy(); + } + BlipTonne = []; + ShapeTonne = []; + + if (BlipTonneHinten) BlipTonneHinten.destroy(); + BlipTonneHinten = null; + if (CheckpointTonneHinten) CheckpointTonneHinten.destroy(); + CheckpointTonneHinten = null; + if (ShapeTonneHinten) ShapeTonneHinten.destroy(); + ShapeTonneHinten = null; + if (BlipTonneBase) BlipTonneBase.destroy(); + BlipTonneBase = null; + if (CheckpointTonneBase) CheckpointTonneBase.destroy(); + CheckpointTonneBase = null; + if (ShapeTonneBase) ShapeTonneBase.destroy(); + ShapeTonneBase = null; + Traegt = false; + }); + + mp.events.add("playerEnterColshape", (Shape, player) => { + //mp.events.callRemote('CLIENT:ImShape', JSON.stringify(Shape)); + for (var i = 0; i < ShapeTonne.length; i++) { + if (Shape != ShapeTonne[i]) continue; + if (!Traegt) { + if (!HintenVoll) { + mp.events.callRemote('CLIENT:MuellmannImShape', JSON.stringify(Shape)); + Traegt = true; + BlipTonne[i].destroy(); + BlipTonne[i] = null; + ShapeTonne[i].destroy(); + ShapeTonne[i] = null; + MuellSack = mp.objects.new(600967813, mp.players.local.position, { rotation: new mp.Vector3(0.0, 0.0, 0.0), alpha: 255, dimension: 0 }); + MuellSack.attachTo(mp.players.local.handle, mp.players.local.getBoneIndex(6286), 0.45, -0.9, -0.075, 270.0, 0.0, 25.0, true, true, false, false, 0, true); + + createMarker(); + } + else { + mp.gui.chat.push("Der Müllwagen ist bereits voll! Fahre zur Base und lade ab!"); + return; + } + } + else { + mp.gui.chat.push(`Du trägst bereits einen Müllsack!`); + return; + } + } + if (Shape == ShapeTonneHinten) { + if (Traegt) { + + Traegt = false; + mp.events.callRemote('CLIENT:MuellmannAddSack'); + + if (BlipTonneHinten) BlipTonneHinten.destroy(); + BlipTonneHinten = null; + if (CheckpointTonneHinten) CheckpointTonneHinten.destroy(); + CheckpointTonneHinten = null; + if (ShapeTonneHinten) ShapeTonneHinten.destroy(); + ShapeTonneHinten = null; + MuellSack.destroy(); + + } + + } + else if (Shape == ShapeTonneBase) { + BlipTonneBase.setRoute(false); + mp.events.callRemote('CLIENT:MuellmannBaseSack'); + } + }); + mp.events.add("MuellmannUpdateColshape", (jsonColShape) => { + let ColShape = JSON.parse(jsonColShape); + for (var i = 0; i < ShapeTonne.length; i++) { + if (ColShape != ShapeTonne[i]) continue; + BlipTonne[i].destroy(); + BlipTonne[i] = null; + ShapeTonne[i].destroy(); + ShapeTonne[i] = null; + } + + + }); + + mp.events.add("SERVER:MuellmannZuBase", () => { + BlipTonneBase.setRoute(true); + BlipTonneBase.setRouteColour(5); + HintenVoll = true; + }); + + mp.events.add("SERVER:MuellmannWiederLeer", () => { + HintenVoll = false; + }); + + function createMarker() { + if (vehicle != null) { + const playerPos = vehicle.position; + let pos = new mp.Vector3(vehicle.position.x, vehicle.position.y - 5.5, vehicle.position.z - 1); + if (BlipTonneHinten) BlipTonneHinten.destroy(); + BlipTonneHinten = null; + if (CheckpointTonneHinten) CheckpointTonneHinten.destroy(); + CheckpointTonneHinten = null; + if (ShapeTonneHinten) ShapeTonneHinten.destroy(); + ShapeTonneHinten = null; + BlipTonneHinten = mp.blips.new(1, pos, { name: 'Müllmann', color: 24, shortRange: false }); + CheckpointTonneHinten = mp.markers.new(1, pos, 1, { direction: new mp.Vector3(-235.5747, -1685.475, 32.7207), color: [0, 255, 0, 255], visible: true, dimension: 0 }); + ShapeTonneHinten = mp.colshapes.newSphere(vehicle.position.x, vehicle.position.y - 5.5, vehicle.position.z - 1, 2); + } + }; + +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts index fab30534..ce111e3f 100644 --- a/ReallifeGamemode.Client/index.ts +++ b/ReallifeGamemode.Client/index.ts @@ -203,6 +203,9 @@ itemShopList(globalData); import taximeterInput from './Gui/taximeter'; taximeterInput(globalData); +import refuseCollector from './Jobs/RefuseCollector'; +refuseCollector(); + require('./Gui/policedepartment'); interface VehicleData { diff --git a/ReallifeGamemode.Client/util/Gangwar.ts b/ReallifeGamemode.Client/util/Gangwar.ts index ee13e3b1..1dc2e32a 100644 --- a/ReallifeGamemode.Client/util/Gangwar.ts +++ b/ReallifeGamemode.Client/util/Gangwar.ts @@ -1,4 +1,6 @@ -export default function gangwarHandle(globalData: IGlobalData) { + + +export default function gangwarHandle(globalData: IGlobalData) { function inside(point, vs) { let x = point[0], @@ -48,7 +50,10 @@ attacker: string; blip: BlipMp; _colshape: ColshapeMp; + _marker: MarkerMp; vector: Vector3Mp; + value: number; + _status: string; _entered: boolean; _isEntering: boolean; @@ -60,17 +65,17 @@ leaderBlipVector: Vector3Mp; leaderColShape: MarkerMp; - constructor(name, id, x, y, range, color, rot, owner, edit, vector) { - this._setup(name, id, x, y, range, color, rot, owner, edit, vector); + constructor(name, id, x, y, range, color, rot, owner, edit, vector, value) { + this._setup(name, id, x, y, range, color, rot, owner, edit, vector, value); } - _setup(name, id, x, y, range, color, rot, owner, edit, vector) { - + _setup(name, id, x, y, range, color, rot, owner, edit, vector, value) { + var self = this; self.name = name; self.id = id; self.range = range; - self.setColor(owner); + self.setColor(owner); self.x = x; self.y = y; self.rotation = rot; @@ -86,12 +91,13 @@ self.loadArea(); self.attackBlip = null; self.leaderBlip = null; + self.value = value; if (vector != null) { self.leaderBlipVector = JSON.parse(vector); } else { self.leaderBlipVector = null; } - + self.leaderColShape = null; } @@ -123,6 +129,7 @@ var self = this; self.blip = mp.game.ui.addBlipForRadius(self.x, self.y, 1, self.range); + mp.game.invoke(Natives.SET_BLIP_SPRITE, self.blip, 5); mp.game.invoke(Natives.SET_BLIP_ALPHA, self.blip, 70); mp.game.invoke(Natives.SET_BLIP_COLOUR, self.blip, self.color); @@ -136,12 +143,15 @@ if (self.edit == true) { let vector3 = mp.players.local.getRotation(2); self.rotation = Math.round(vector3.z); + //self.blip.setPosition(mp.players.local.position.x, mp.players.local.position.y, 1); + mp.game.invoke(Natives.SET_BLIP_COORDS, self.blip, mp.players.local.position.x, mp.players.local.position.y, 1); self.x = mp.players.local.position.x; self.y = mp.players.local.position.y; } - mp.game.invoke(Natives.SET_BLIP_ROTATION, self.blip, self.rotation); - + //self.blip.setRotation(self.rotation); + mp.game.invoke(Natives.SET_BLIP_ROTATION, self.blip, self.rotation); + } @@ -192,10 +202,10 @@ a += 0.001 } */ - } - + } + } - + if (self.isInsideArea()) { mp.game.graphics.drawText(self.name, [self.x, self.y, mp.players.local.position.z + 20], { @@ -205,7 +215,7 @@ outline: true, centre: true }); - + } } } @@ -213,7 +223,7 @@ let dist = mp.game.gameplay.getDistanceBetweenCoords(mp.players.local.position.x, mp.players.local.position.y, mp.players.local.position.z, self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z, false); if (self.isInsideArea() && self._status != "attack" && dist <= 6) { if (self.leaderBlipVector != null) { - mp.game.graphics.drawText(self.name + "\n~y~Gang: ~s~" + self.owner + "\n~y~Wert: ~s~$~g~187", [self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z], { + mp.game.graphics.drawText(self.name + "\n~y~Gang: ~s~" + self.owner + "\n~y~Wert: ~s~$~g~" + self.value, [self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z], { font: 7, color: [255, 255, 255, 185], scale: [0.4, 0.4], @@ -223,11 +233,11 @@ } } } - + } - startGangWar() { + startGangWar() { var self = this; if (self._status == "normal") { let dist = mp.game.gameplay.getDistanceBetweenCoords(mp.players.local.position.x, mp.players.local.position.y, 0, self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z, false); @@ -246,12 +256,14 @@ } self._status = "attack"; self.attacker = args[1]; + //self.blip.setFlashes(true); mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, true); return; } if (status == "normal") { self._status = "normal"; - mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false); + //self.blip.setFlashes(false); + mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false); return; } if (status == "conquered") { @@ -259,8 +271,10 @@ self._status = "normal"; self.owner = args[0]; self.attacker = null; + //self.blip.setFlashes(false); mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false); self.setColor(self.owner) + //self.blip.setColour(self.color); mp.game.invoke(Natives.SET_BLIP_COLOUR, self.blip, self.color); self.setLeaderColShape(); return; @@ -296,19 +310,19 @@ self.setLeaderColShape(); mp.game.invoke(Natives.SET_BLIP_SPRITE, self.leaderBlip, 437); mp.game.invoke(Natives.SET_BLIP_AS_SHORT_RANGE, self.leaderBlip, false); - - } + + } } setLeaderColShape() { var self = this; - let newVector = new mp.Vector3(self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z - 2) - - self.leaderColShape = mp.markers.new(1, newVector, 2, { - color: [255, 255, 0, 150], - visible: true, - dimension: 0 - }); + let newVector = new mp.Vector3(self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z - 2) + + self.leaderColShape = mp.markers.new(1, newVector, 2, { + color: [255, 255, 0, 150], + visible: true, + dimension: 0 + }); } @@ -321,7 +335,7 @@ } check() { - var self = this + var self = this if (self._entered == true) { if (!self.isInsideArea() || (self.isNearGround() == false)) { self._entered = false; @@ -329,7 +343,7 @@ } } } - + enter() { var self = this; self._timerCheck = setInterval(function () { @@ -340,8 +354,8 @@ mp.game.audio.playSoundFrontend(1, "Enter_Capture_Zone", "DLC_Apartments_Drop_Zone_Sounds", true); mp.game.graphics.stopScreenEffect("MinigameTransitionIn"); mp.game.graphics.startScreenEffect("MinigameTransitionOut", 500, false); - - } + + } mp.events.callRemote("Gangarea:Enter", JSON.stringify(self.id)); } } else if (self._entered == true) { @@ -350,7 +364,7 @@ if (self._status === "attack") { mp.game.audio.playSoundFrontend(1, "Exit_Capture_Zone", "DLC_Apartments_Drop_Zone_Sounds", true); mp.game.graphics.startScreenEffect("MinigameTransitionIn", 500, false); - } + } mp.events.callRemote("Gangarea:Leave", JSON.stringify(self.id)); } } @@ -360,7 +374,7 @@ leave() { var self = this; clearInterval(self._timerCheck); - + self.check(); } isNearGround() { @@ -412,6 +426,11 @@ } return false; } + + setValue(value) { + var self = this; + self.value = value; + } } var gangturfs = []; @@ -453,23 +472,28 @@ let last_blip = mp.game.invoke(Natives.GET_FIRST_BLIP_INFO_ID, 5); while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_blip)) { - mp.game.ui.removeBlip(last_blip); + mp.game.invoke(Natives.SET_BLIP_SPRITE, last_blip, -1); + mp.game.ui.removeBlip(last_blip); last_blip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 5); + x++; + mp.gui.chat.push(""+x); } let last_attackBlip = mp.game.invoke(Natives.GET_FIRST_BLIP_INFO_ID, 378); while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_attackBlip)) { + mp.game.invoke(Natives.SET_BLIP_SPRITE, last_attackBlip, -1); mp.game.ui.removeBlip(last_attackBlip); last_attackBlip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 378); } let last_leaderBlip = mp.game.invoke(Natives.GET_FIRST_BLIP_INFO_ID, 437); while (mp.game.invoke(Natives.DOES_BLIP_EXIST, last_leaderBlip)) { + mp.game.invoke(Natives.SET_BLIP_SPRITE, last_leaderBlip, -1); mp.game.ui.removeBlip(last_leaderBlip); last_leaderBlip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 437); } } - + mp.events.add('GangAreas:Create', (turfsJSON) => { var turfs = JSON.parse(turfsJSON); if (gangturfs.length > 0) { @@ -481,15 +505,25 @@ turf.leaderColShape.destroy(); turf.leaderColShape = null; } + if (turf._marker) + if (turf.blip != null) { + mp.game.ui.removeBlip(turf.blip); + } + if (turf.leaderBlip != null) { + mp.game.ui.removeBlip(turf.leaderBlip); + } + if (turf.attackBlip != null) { + mp.game.ui.removeBlip(turf.attackBlip); + } }); } clearBlips(); if (turfs.length > 0) { - + gangturfs = []; turfs.forEach(function (turf) { if (turf.Id != undefined) { - gangturfs[gangturfs.length] = new Gangturf(turf.Name, turf.Id, turf.X, turf.Y, turf.Range, turf.Color, turf.Rotation, turf.Owner, false, turf.Vector); + gangturfs[gangturfs.length] = new Gangturf(turf.Name, turf.Id, turf.X, turf.Y, turf.Range, turf.Color, turf.Rotation, turf.Owner, false, turf.Vector, turf.Value); } }); } @@ -497,7 +531,7 @@ mp.events.add('ADMIN:CreateTurf', (rangeJSON) => { var range = JSON.parse(rangeJSON); - gangturfs[gangturfs.length] = new Gangturf("Reload For Name", -1, mp.players.local.position.x, mp.players.local.position.y, range, 0, mp.players.local.getHeading(), "Neutral", true, null); + gangturfs[gangturfs.length] = new Gangturf("Reload For Name", -1, mp.players.local.position.x, mp.players.local.position.y, range, 0, mp.players.local.getHeading(), "Neutral", true, null, 0); }); mp.events.add('ADMIN:SetTurf', (name) => { @@ -505,7 +539,7 @@ if (gangturfs[gangturfs.length - 1].id == -1) { mp.events.callRemote("SERVER:SetTurf", JSON.stringify(gangturfs[gangturfs.length - 1].x), JSON.stringify(gangturfs[gangturfs.length - 1].y), JSON.stringify(gangturfs[gangturfs.length - 1].rotation), JSON.stringify(gangturfs[gangturfs.length - 1].range), name); - } + } }); mp.events.add('ADMIN:DeleteTurf', () => { @@ -541,13 +575,13 @@ mp.events.add('CLIENT:Turf_LoadLeaderBlip', () => { gangturfs.forEach(function (turf) { - turf.setLeaderBlip(false); + turf.setLeaderBlip(false); }); }); mp.events.add('ADMIN:Turf_CreateLeaderBlip', () => { gangturfs.forEach(function (turf) { - if (turf._entered == true) { + if (turf._entered == true) { turf.setLeaderBlip(true); } }); @@ -556,8 +590,17 @@ mp.events.add('CLIENT:StartGangwar', () => { gangturfs.forEach(function (turf) { if (turf._entered == true) { - turf.startGangWar(); + turf.startGangWar(); } }); }); + + mp.events.add('CLIENT:UpdateTurfValue', (jsonValues) => { + let values = JSON.parse(jsonValues); + for (var i = 0; i < gangturfs.length; i++) { + let turf = gangturfs[i]; + turf.setValue(values[i]); + turf.render(); + } + }); } \ No newline at end of file diff --git a/ReallifeGamemode.Database/Entities/Turfs.cs b/ReallifeGamemode.Database/Entities/Turfs.cs index aa818e48..9ca8a6be 100644 --- a/ReallifeGamemode.Database/Entities/Turfs.cs +++ b/ReallifeGamemode.Database/Entities/Turfs.cs @@ -22,6 +22,9 @@ namespace ReallifeGamemode.Database.Entities public float Range { get; set; } public int Color { get; set; } public string Vector { get; set; } = null; + public int Value {get; set;} = 0; + public int MaxValue { get; set; } = 0; + public bool Surplus { get; set; } = false; } } diff --git a/ReallifeGamemode.Database/Migrations/20200403035225_TurfSurplusValue.Designer.cs b/ReallifeGamemode.Database/Migrations/20200403035225_TurfSurplusValue.Designer.cs new file mode 100644 index 00000000..72a64fb7 --- /dev/null +++ b/ReallifeGamemode.Database/Migrations/20200403035225_TurfSurplusValue.Designer.cs @@ -0,0 +1,1443 @@ +// +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("20200403035225_TurfSurplusValue")] + partial class TurfSurplusValue + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.1.11-servicing-32099") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ATM", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Balance"); + + b.Property("Faulty"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("ATMs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Ban", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Applied"); + + b.Property("BannedBy"); + + b.Property("Reason"); + + b.Property("UntilDateTime"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Bans"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusinessBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Balance"); + + b.Property("BusinessId"); + + b.HasKey("Id"); + + b.HasIndex("BusinessId") + .IsUnique(); + + b.ToTable("BusinessBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusinessData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BusinessId"); + + b.Property("Price"); + + b.HasKey("Id"); + + b.ToTable("BusinessData"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusRoute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.HasKey("Id"); + + b.ToTable("BusRoutes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusRoutePoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BusRouteId"); + + b.Property("Description"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.HasIndex("BusRouteId"); + + b.ToTable("BusRoutesPoints"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Character", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Ageing"); + + b.Property("AgeingOpacity"); + + b.Property("BeardColor"); + + b.Property("Blemishes"); + + b.Property("BlemishesOpacity"); + + b.Property("Blush"); + + b.Property("BlushColor"); + + b.Property("BlushOpacity"); + + b.Property("BrowDepth"); + + b.Property("BrowHeight"); + + b.Property("CheekDepth"); + + b.Property("CheekboneHeight"); + + b.Property("CheekboneWidth"); + + b.Property("ChestHair"); + + b.Property("ChestHairColor"); + + b.Property("ChestHairOpacity"); + + b.Property("ChinDepth"); + + b.Property("ChinHeight"); + + b.Property("ChinIndent"); + + b.Property("ChinWidth"); + + b.Property("Complexion"); + + b.Property("ComplexionOpacity"); + + b.Property("EyeColor"); + + b.Property("EyeSize"); + + b.Property("EyebrowColor"); + + b.Property("Eyebrows"); + + b.Property("EyebrowsOpacity"); + + b.Property("FacialHair"); + + b.Property("FacialHairOpacity"); + + b.Property("Father"); + + b.Property("Freckles"); + + b.Property("FrecklesOpacity"); + + b.Property("Gender"); + + b.Property("Hair"); + + b.Property("HairColor"); + + b.Property("HairHighlightColor"); + + b.Property("JawShape"); + + b.Property("JawWidth"); + + b.Property("LipThickness"); + + b.Property("Lipstick"); + + b.Property("LipstickColor"); + + b.Property("LipstickOpacity"); + + b.Property("Makeup"); + + b.Property("MakeupOpacity"); + + b.Property("Mother"); + + b.Property("NeckWidth"); + + b.Property("NoseBottomHeight"); + + b.Property("NoseBridgeDepth"); + + b.Property("NoseBroken"); + + b.Property("NoseTipHeight"); + + b.Property("NoseTipLength"); + + b.Property("NoseWidth"); + + b.Property("Similarity"); + + b.Property("SkinSimilarity"); + + b.Property("SunDamage"); + + b.Property("SunDamageOpacity"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.CharacterCloth", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClothId"); + + b.Property("Duty"); + + b.Property("SlotId"); + + b.Property("SlotType"); + + b.Property("Texture"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("CharacterClothes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ClothCombination", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Gender"); + + b.Property("Top"); + + b.Property("Torso"); + + b.Property("Undershirt"); + + b.HasKey("Id"); + + b.ToTable("ClothCombinations"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Door", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Category"); + + b.Property("FactionId"); + + b.Property("Locked"); + + b.Property("Model"); + + b.Property("Name"); + + b.Property("Radius"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("Doors"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.DutyCloth", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClothId"); + + b.Property("FactionId"); + + b.Property("Gender"); + + b.Property("SlotId"); + + b.Property("SlotType"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("DutyClothes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Faction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BankAccountId"); + + b.Property("Name") + .HasMaxLength(32); + + b.Property("StateOwned"); + + b.Property("WeaponDealTime"); + + b.HasKey("Id"); + + b.HasIndex("BankAccountId"); + + b.ToTable("Factions"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Balance"); + + b.Property("Bic") + .HasMaxLength(12); + + b.Property("Iban") + .HasMaxLength(32); + + b.HasKey("Id"); + + b.ToTable("FactionBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("FactionId"); + + b.Property("Order"); + + b.Property("RankName"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionRanks"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionWeapon", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Ammount"); + + b.Property("FactionId"); + + b.Property("Rank"); + + b.Property("SlotID"); + + b.Property("WeaponModel"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionWeapons"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.GotoPoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Description") + .HasMaxLength(32); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("GotoPoints"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Group", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BankAccountId"); + + b.Property("Name"); + + b.HasKey("Id"); + + b.HasIndex("BankAccountId"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Balance"); + + b.HasKey("Id"); + + b.ToTable("GroupBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.House", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BankAccountId"); + + b.Property("CanRentIn"); + + b.Property("LastRentSetTime"); + + b.Property("OwnerId"); + + b.Property("Price"); + + b.Property("RentalFee"); + + b.Property("Type"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.HasIndex("BankAccountId"); + + b.HasIndex("OwnerId"); + + b.ToTable("Houses"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.HouseBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Balance"); + + b.HasKey("Id"); + + b.ToTable("HouseBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.HouseRental", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("HouseId"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("HouseId"); + + b.HasIndex("UserId"); + + b.ToTable("HouseRentals"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Interior", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("EnterPositionStr") + .HasColumnName("EnterPosition"); + + b.Property("ExitPositionStr") + .HasColumnName("ExitPosition"); + + b.Property("Name"); + + b.HasKey("Id"); + + b.ToTable("Interiors"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("Heading"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("Locations"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.BankAccountTransactionHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Fee"); + + b.Property("MoneySent"); + + b.Property("NewReceiverBalance"); + + b.Property("NewSenderBalance"); + + b.Property("Origin") + .HasMaxLength(32); + + b.Property("Receiver") + .HasMaxLength(32); + + b.Property("ReceiverBalance"); + + b.Property("Sender") + .HasMaxLength(32); + + b.Property("SenderBalance"); + + b.Property("Timestamp") + .ValueGeneratedOnAdd(); + + b.HasKey("Id"); + + b.ToTable("BankAccountTransactionLogs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Logs.Death", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CauseOfDeath") + .HasMaxLength(64); + + b.Property("KillerHeading"); + + b.Property("KillerId"); + + b.Property("KillerPositionX"); + + b.Property("KillerPositionY"); + + b.Property("KillerPositionZ"); + + b.Property("Timestamp") + .ValueGeneratedOnAdd(); + + b.Property("VictimHeading"); + + b.Property("VictimId"); + + b.Property("VictimPositionX"); + + b.Property("VictimPositionY"); + + b.Property("VictimPositionZ"); + + b.HasKey("Id"); + + b.HasIndex("KillerId"); + + b.HasIndex("VictimId"); + + b.ToTable("DeathLogs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.News", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Caption"); + + b.Property("Content"); + + b.Property("Timestamp"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("News"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedBlip", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Alpha"); + + b.Property("Color"); + + b.Property("Dimension"); + + b.Property("DrawDistance"); + + b.Property("Name"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("Rotation"); + + b.Property("Scale"); + + b.Property("ShortRange"); + + b.Property("Sprite"); + + b.HasKey("Id"); + + b.ToTable("Blips"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedMarker", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("ColorA"); + + b.Property("ColorB"); + + b.Property("ColorG"); + + b.Property("ColorR"); + + b.Property("Dimension"); + + b.Property("DirectionX"); + + b.Property("DirectionY"); + + b.Property("DirectionZ"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("RotationX"); + + b.Property("RotationY"); + + b.Property("RotationZ"); + + b.Property("Scale"); + + b.Property("Type"); + + b.Property("Visible"); + + b.HasKey("Id"); + + b.ToTable("Markers"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedPed", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Dimension"); + + b.Property("HashModel"); + + b.Property("Heading"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.HasKey("Id"); + + b.ToTable("Peds"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedPickup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Dimension"); + + b.Property("PositionX") + .HasMaxLength(128); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("RespawnTime"); + + b.Property("RotationX"); + + b.Property("RotationY"); + + b.Property("RotationZ"); + + b.Property("Vehicle"); + + b.HasKey("Id"); + + b.ToTable("Pickups"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedTextLabel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("ColorA"); + + b.Property("ColorB"); + + b.Property("ColorG"); + + b.Property("ColorR"); + + b.Property("Dimension"); + + b.Property("DrawDistance"); + + b.Property("Font"); + + b.Property("LOS"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("Text") + .IsRequired(); + + b.HasKey("Id"); + + b.ToTable("TextLabels"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ServerVehicle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active") + .ValueGeneratedOnAdd() + .HasDefaultValue(true); + + b.Property("Discriminator") + .IsRequired(); + + b.Property("DistanceDriven"); + + b.Property("Heading"); + + b.Property("Livery"); + + b.Property("Locked"); + + b.Property("Model"); + + b.Property("NumberPlate") + .HasMaxLength(8); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("PrimaryColor"); + + b.Property("SecondaryColor"); + + b.Property("TankAmount"); + + b.HasKey("Id"); + + b.ToTable("ServerVehicles"); + + b.HasDiscriminator("Discriminator").HasValue("ServerVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ShopClothe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Category"); + + b.Property("ClotheId"); + + b.Property("ComponentId"); + + b.Property("Gender"); + + b.Property("Price"); + + b.Property("TypeId"); + + b.HasKey("Id"); + + b.ToTable("ShopClothes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ShopItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Amount"); + + b.Property("ItemId"); + + b.Property("Price"); + + b.Property("ShopId"); + + b.HasKey("Id"); + + b.ToTable("ShopItems"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.TuningGarage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("TuningGarages"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Turfs", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Color"); + + b.Property("FactionId"); + + b.Property("Name"); + + b.Property("Owner"); + + b.Property("Range"); + + b.Property("Rotation"); + + b.Property("Surplus"); + + b.Property("Value"); + + b.Property("Vector"); + + b.Property("X"); + + b.Property("Y"); + + b.HasKey("Id"); + + b.ToTable("Turfs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AdminLevel"); + + b.Property("BanId"); + + b.Property("BankAccountId"); + + b.Property("BusinessId"); + + b.Property("CharacterId"); + + b.Property("Dead"); + + b.Property("DriverLicenseBike"); + + b.Property("DriverLicenseVehicle"); + + b.Property("Email") + .HasMaxLength(64); + + b.Property("FactionId"); + + b.Property("FactionLeader"); + + b.Property("FactionRankId"); + + b.Property("FlyingLicensePlane"); + + b.Property("GroupId"); + + b.Property("GroupRank"); + + b.Property("Handmoney"); + + b.Property("HouseId"); + + b.Property("JailTime"); + + b.Property("JobId"); + + b.Property("LogUserId"); + + b.Property("Name") + .HasMaxLength(32); + + b.Property("Password") + .HasMaxLength(64); + + b.Property("PaydayTimer"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("RegistrationDate") + .ValueGeneratedOnAdd(); + + b.Property("SocialClubName") + .HasMaxLength(32); + + b.Property("Wage"); + + b.Property("Wanteds"); + + b.Property("WeaponLicense"); + + 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.ToTable("Users"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Balance"); + + b.Property("Bic") + .HasMaxLength(12); + + b.Property("Iban") + .HasMaxLength(32); + + b.HasKey("Id"); + + b.ToTable("UserBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Amount"); + + b.Property("ItemId"); + + b.Property("Slot"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserItems"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Amount"); + + b.Property("ItemId"); + + b.Property("Slot"); + + b.Property("VehicleId"); + + b.HasKey("Id"); + + b.HasIndex("VehicleId"); + + b.ToTable("VehicleItems"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleMod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ModId"); + + b.Property("ServerVehicleId"); + + b.Property("Slot"); + + b.HasKey("Id"); + + b.HasIndex("ServerVehicleId", "Slot") + .IsUnique(); + + b.ToTable("VehicleMods"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Whitelist", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("SocialClubName"); + + b.HasKey("Id"); + + b.ToTable("WhitelistEntries"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.FactionVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("Owners"); + + b.ToTable("FactionVehicles"); + + b.HasDiscriminator().HasValue("FactionVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("GroupId"); + + b.HasIndex("GroupId"); + + b.ToTable("GroupVehicle"); + + b.HasDiscriminator().HasValue("GroupVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.JobVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("JobId"); + + b.ToTable("JobVehicle"); + + b.HasDiscriminator().HasValue("JobVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Saves.SavedVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + + b.ToTable("SavedVehicle"); + + b.HasDiscriminator().HasValue("SavedVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.SchoolVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("SchoolId"); + + b.ToTable("SchoolVehicle"); + + b.HasDiscriminator().HasValue("SchoolVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.ShopVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("BusinessId"); + + b.Property("Price"); + + b.ToTable("ShopVehicles"); + + b.HasDiscriminator().HasValue("ShopVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Database.Entities.ServerVehicle"); + + b.Property("Price") + .HasColumnName("UserVehicle_Price"); + + b.Property("UserId"); + + b.HasIndex("UserId"); + + b.ToTable("UserVehicles"); + + b.HasDiscriminator().HasValue("UserVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Ban", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.BusRoutePoint", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.BusRoute", "BusRoute") + .WithMany("RoutePoints") + .HasForeignKey("BusRouteId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Character", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.CharacterCloth", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.Door", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.DutyCloth", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.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); + }); + + 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.Death", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "Killer") + .WithMany() + .HasForeignKey("KillerId"); + + b.HasOne("ReallifeGamemode.Database.Entities.User", "Victim") + .WithMany() + .HasForeignKey("VictimId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.News", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.User", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Ban", "Ban") + .WithMany() + .HasForeignKey("BanId"); + + b.HasOne("ReallifeGamemode.Database.Entities.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); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleItem", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.ServerVehicle", "Vehicle") + .WithMany() + .HasForeignKey("VehicleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.VehicleMod", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.ServerVehicle", "Vehicle") + .WithMany() + .HasForeignKey("ServerVehicleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.GroupVehicle", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Database.Entities.UserVehicle", b => + { + b.HasOne("ReallifeGamemode.Database.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/ReallifeGamemode.Database/Migrations/20200403035225_TurfSurplusValue.cs b/ReallifeGamemode.Database/Migrations/20200403035225_TurfSurplusValue.cs new file mode 100644 index 00000000..7a2460fb --- /dev/null +++ b/ReallifeGamemode.Database/Migrations/20200403035225_TurfSurplusValue.cs @@ -0,0 +1,33 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace ReallifeGamemode.Database.Migrations +{ + public partial class TurfSurplusValue : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Surplus", + table: "Turfs", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "Value", + table: "Turfs", + nullable: false, + defaultValue: 0); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Surplus", + table: "Turfs"); + + migrationBuilder.DropColumn( + name: "Value", + table: "Turfs"); + } + } +} diff --git a/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs b/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs index 7e462864..249edd7f 100644 --- a/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs +++ b/ReallifeGamemode.Database/Migrations/DatabaseContextModelSnapshot.cs @@ -965,6 +965,10 @@ namespace ReallifeGamemode.Database.Migrations b.Property("Rotation"); + b.Property("Surplus"); + + b.Property("Value"); + b.Property("Vector"); b.Property("X"); diff --git a/ReallifeGamemode.Server.Core/Managers/HouseManager.cs b/ReallifeGamemode.Server.Core/Managers/HouseManager.cs index 542ebfa9..0b6e0851 100644 --- a/ReallifeGamemode.Server.Core/Managers/HouseManager.cs +++ b/ReallifeGamemode.Server.Core/Managers/HouseManager.cs @@ -13,9 +13,9 @@ using ReallifeGamemode.Server.Common; namespace ReallifeGamemode.Server.Core.Managers { - class HouseManager : Script + public class HouseManager : Script { - private readonly Dictionary houseMarkers = new Dictionary(); + public static readonly Dictionary houseMarkers = new Dictionary(); private readonly Dictionary houseLabels = new Dictionary(); private readonly Dictionary houseColShapes = new Dictionary(); private readonly Dictionary houseBlips = new Dictionary(); diff --git a/ReallifeGamemode.Server.Core/Script.cs b/ReallifeGamemode.Server.Core/Script.cs index cae8eded..5d87f5d2 100644 --- a/ReallifeGamemode.Server.Core/Script.cs +++ b/ReallifeGamemode.Server.Core/Script.cs @@ -8,7 +8,7 @@ using ReallifeGamemode.Server.Log; namespace ReallifeGamemode.Server.Core { - internal abstract class Script + public abstract class Script { protected IAPI Api => Main.API; diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index 7d304b62..64c50660 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -995,7 +995,7 @@ namespace ReallifeGamemode.Server.Commands return; } - if (name is null || component == null || drawable == null) + if (name == null || component == null || drawable == null) { player.SendChatMessage("~m~Benutzung: ~s~/clothes [Spieler] [Component ID] [Drawable] (Textur)"); return; diff --git a/ReallifeGamemode.Server/Finance/Economy.cs b/ReallifeGamemode.Server/Finance/Economy.cs index dbaeda7e..3bed3a98 100644 --- a/ReallifeGamemode.Server/Finance/Economy.cs +++ b/ReallifeGamemode.Server/Finance/Economy.cs @@ -119,15 +119,15 @@ namespace ReallifeGamemode.Server.Finance ChatService.SendMessage(client, "~g~[PAYDAY]~s~ Dein Stundenumsatz beträgt - $~r~" + paycheck.Amount + "~s~."); } - + /* public static void PaydayTimer() { System.Timers.Timer timer = new System.Timers.Timer(60000); timer.Start(); timer.Elapsed += Timer_Elapsed; } - - private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) + */ + public static void Timer_Elapsed() { foreach (var player in NAPI.Pools.GetAllPlayers()) { diff --git a/ReallifeGamemode.Server/Gangwar/Gangwar.cs b/ReallifeGamemode.Server/Gangwar/Gangwar.cs index 7f474fd6..4bfcc2a6 100644 --- a/ReallifeGamemode.Server/Gangwar/Gangwar.cs +++ b/ReallifeGamemode.Server/Gangwar/Gangwar.cs @@ -1,13 +1,12 @@ using System; using System.Collections.Generic; -using System.Text; -using GTANetworkAPI; using System.Linq; -using ReallifeGamemode.Database.Models; -using ReallifeGamemode.Database.Entities; +using GTANetworkAPI; using Newtonsoft.Json; -using ReallifeGamemode.Server.Services; +using ReallifeGamemode.Database.Entities; +using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Extensions; +using ReallifeGamemode.Server.Services; namespace ReallifeGamemode.Server.Gangwar { @@ -25,7 +24,7 @@ namespace ReallifeGamemode.Server.Gangwar List turfing = new List(); foreach (var t in turfs) { - Turf newTurf = new Turf(t.Id, t.Name, t.Color, t.Owner); + Turf newTurf = new Turf(t.Id, t.Name, t.Color, t.Owner, t.Value, t.MaxValue, t.Surplus); turfing.Add(newTurf); } _loadedTurfs = turfing.ToArray(); @@ -40,13 +39,12 @@ namespace ReallifeGamemode.Server.Gangwar public static void loadTurfs_ToAllPlayers() { NAPI.ClientEvent.TriggerClientEventForAll("GangAreas:Create", JsonConvert.SerializeObject(turfs.ToArray())); - foreach(var l in NAPI.Pools.GetAllPlayers()) + foreach (var l in NAPI.Pools.GetAllPlayers()) { if (!l.IsLoggedIn() && !l.GetUser().FactionLeader) return; l.TriggerEvent("CLIENT:Turf_LoadLeaderBlip"); - } } @@ -99,7 +97,7 @@ namespace ReallifeGamemode.Server.Gangwar } } } - + [RemoteEvent("SERVER:SetTurf")] public void RmtEvent_SetTurf(Player client, string jsonX, string jsonY, string jsonRot, string jsonRange, string Name) { @@ -117,7 +115,7 @@ namespace ReallifeGamemode.Server.Gangwar Range = Range, Owner = "Neutral", Color = 0, - Vector = null + Vector = null }; using (var dbContext = new DatabaseContext()) { @@ -151,7 +149,8 @@ namespace ReallifeGamemode.Server.Gangwar } [RemoteEvent("SERVER:Turf_SetNewLeaderPoint")] - public void RmtEvent_SetNewLeaderPoint(Player client, string vector, string jsonId) { + public void RmtEvent_SetNewLeaderPoint(Player client, string vector, string jsonId) + { int id = JsonConvert.DeserializeObject(jsonId); if (id == -1) { @@ -171,7 +170,6 @@ namespace ReallifeGamemode.Server.Gangwar } } - [RemoteEvent("SERVER:StartGangwar")] public void RmtEvent_StartGangwar(Player client) { @@ -182,7 +180,7 @@ namespace ReallifeGamemode.Server.Gangwar { if (turf.status == "attack") { - ChatService.ErrorMessage(client,"Du kannst momentan kein Gangwar starten"); + ChatService.ErrorMessage(client, "Du kannst momentan kein Gangwar starten"); return; } } @@ -200,8 +198,30 @@ namespace ReallifeGamemode.Server.Gangwar } } } - } + public static void Value_TimerElapsed() + { + List values = new List(); + using (var dbContext = new DatabaseContext()) + { + foreach (var turf in getTurfs()) + { + if((turf.getValue() + 5) >= turf.getMaxValue()) + { + turf.setValue(turf.getMaxValue()); + } + else + { + turf.addValue(5); + } + values.Add(turf.getValue()); + Turfs _turf = dbContext.Turfs.Where(t => t.Id == turf.getId()).FirstOrDefault(); + _turf.Value = turf.getValue(); + } + dbContext.SaveChanges(); + } + NAPI.ClientEvent.TriggerClientEventForAll("CLIENT:UpdateTurfValue", JsonConvert.SerializeObject(values.ToArray())); + } } } diff --git a/ReallifeGamemode.Server/Gangwar/Turf.cs b/ReallifeGamemode.Server/Gangwar/Turf.cs index 8035348a..957168c7 100644 --- a/ReallifeGamemode.Server/Gangwar/Turf.cs +++ b/ReallifeGamemode.Server/Gangwar/Turf.cs @@ -24,18 +24,24 @@ namespace ReallifeGamemode.Server.Gangwar public int Att_Score { get; set; } public int Def_Score { get; set; } public string status { get; set; } + public int value { get; set; } + public int maxValue { get; set; } + public bool surplus { get; set; } public List playerInside { get; set; } public Timer timer { get; set; } public Player[] playerInGangwar { get; set; } public int timerCount; - public Turf(int TurfID, string TurfName, int color, string Owner) + public Turf(int TurfID, string TurfName, int color, string Owner, int value, int maxValue,bool surplus) { this.TurfID = TurfID; this.TurfName = TurfName; this.Color = color; this.Owner = Owner; + this.value = value; + this.maxValue = maxValue; + this.surplus = surplus; this.Attacker = null; this.Att_Score = 50; this.Def_Score = 50; @@ -50,6 +56,36 @@ namespace ReallifeGamemode.Server.Gangwar return this.TurfID; } + public int getValue() + { + return this.value; + } + + public void setValue(int value) + { + this.value = value; + } + + public void addValue(int addedValue) + { + this.value += addedValue; + } + + public int getMaxValue() + { + return maxValue; + } + + public bool getSurplus() + { + return surplus; + } + + public void setSurplus(bool surplus) + { + this.surplus = surplus; + } + public string getName() { return this.TurfName; diff --git a/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs b/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs index eeb8324c..279df8ea 100644 --- a/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs +++ b/ReallifeGamemode.Server/Job/RefuseCollectorJob.cs @@ -1,6 +1,11 @@ using System; using System.Collections.Generic; -using System.Text; +using System.Linq; +using GTANetworkAPI; +using Newtonsoft.Json; +using ReallifeGamemode.Server.Services; +using ReallifeGamemode.Database.Models; +using ReallifeGamemode.Server.Core.Managers; namespace ReallifeGamemode.Server.Job { @@ -11,5 +16,341 @@ namespace ReallifeGamemode.Server.Job public override string Name => "Müllmann"; public override bool NeedVehicleToStart => false; + + + public RefuseCollectorJob() + { + JobStart += RefuseCollectorJobJobStart; + JobStop += RefuseCollectorJobJobStop; + } + + private void RefuseCollectorJobJobStart(Player player) + { + //setClothes + } + + private void RefuseCollectorJobJobStop(Player player) + { + //removeClothes and replace with old + MuellmannJobBeenden(player); + } + + + + public List muellmanData = new List(); + private List vector3s = new List(); + + [ServerEvent(Event.ResourceStart)] + public void LoadHouses() + { + foreach(var marker in HouseManager.houseMarkers) + { + vector3s.Add(new Vector3(marker.Value.Position.X, marker.Value.Position.Y, marker.Value.Position.Z)); + } + } + + + [RemoteEvent("CLIENT:MuellmannJobStarten")] + public void MuellmannJobStarten(Player player, Vehicle vehicle) + { + + if (vehicle.Model == (uint)Types.VehicleModel.Trash || vehicle.Model == (uint)Types.VehicleModel.Trash2) + { + Vehicle veh; + foreach (var data in muellmanData) + { + if (data.getDataFromClient(player) == null) continue; + veh = data.vehicle; + ChatService.SendMessage((Player)player, "~g~Du hast den Müllmann-Job gestartet!"); + player.TriggerEvent("SERVER:MuellmannStatusTrue"); + player.TriggerEvent("SERVER:MuellmannBCSErstellen", JsonConvert.SerializeObject(vector3s.ToArray()), veh); + return; + } + } + } + + + public void MuellmannJobBeenden(Player player) + { + if (player.IsInVehicle) + { + Vehicle vehicle = player.Vehicle; + if (vehicle.Model == (uint)Types.VehicleModel.Trash || vehicle.Model == (uint)Types.VehicleModel.Trash2) + { + + ChatService.SendMessage((Player)player, "~g~Du hast den Müllmann-Job beendet!"); + player.TriggerEvent("SERVER:MuellmannStatusFalse"); + player.TriggerEvent("SERVER:MuellmannBCSEntfernen"); + + } + else + { + ChatService.SendMessage((Player)player, "~r~INFO: Das ist kein Müllwagen!"); + } + } + else + { + ChatService.SendMessage((Player)player, "~r~INFO: Zum Job beenden musst du im Auto sein."); + } + + } + [RemoteEvent("CLIENT:MuellmannImShape")] + public void MuellmannImShape(Player player, string jsonColShape) + { + foreach (var data in muellmanData) + { + if (data.getDataFromClient(player) == null) continue; + Player target = data.getPartnerClient(player); + if (target != null) target.TriggerEvent("MuellmannUpdateColshape", jsonColShape); + ChatService.SendMessage((Player)player, "Du hast den Müllsack in der Hand. Bringe ihm zum Müllwagen hinten."); + return; + } + } + + [RemoteEvent("CLIENT:MuellmannAddSack")] + public void MuellmannAddSack(Player player) + { + foreach (var data in muellmanData) + { + if (data.getDataFromClient(player) == null) continue; + + int count = data.getTrashCount(); + count++; + data.setTrashCount(count); + + Player target = data.getPartnerClient(player); + if (target != null) ChatService.SendMessage((Player)target, $"Es sind jetzt {count} Säcke im Müllwagen."); + ChatService.SendMessage((Player)player, $"Es sind jetzt {count} Säcke im Müllwagen."); + + if (data.getTrashCount() >= 2) + { + ChatService.SendMessage((Player)player, "Auto ist voll fahre nun zu Base."); + if (target != null) { ChatService.SendMessage((Player)target, "Auto ist voll fahre nun zu Base."); target.TriggerEvent("SERVER:MuellmannZuBase"); } + player.TriggerEvent("SERVER:MuellmannZuBase"); + } + //bonus pro sack + return; + } + } + + [RemoteEvent("CLIENT:MuellmannBaseSack")] + public void MuellmannBaseSack(Player player) + { + if (player.VehicleSeat != 0) return; + + foreach (var data in muellmanData) + { + if (data.getDataFromClient(player) == null) continue; + + int count = data.getTrashCount(); + + Player target = data.getPartnerClient(player); + if (target != null) ChatService.SendMessage((Player)target, $"Fahrzeug wurde entleert. Säcke: {count}"); + ChatService.SendMessage((Player)player, $"Fahrzeug wurde entleert. Säcke: {count}"); + player.TriggerEvent("SERVER:MuellmannHintenWiederLeer"); + //bonus pro sack + + data.setTrashCount(0); + return; + } + } + + #region zweiSpeieler + [ServerEvent(Event.PlayerDisconnected)] + private void SrvEvent_PlayerDc(Player player) + { + if (!GetPlayerInJob().Contains(player)) return; + foreach (var data in muellmanData) + { + if (data.getDataFromClient(player) == null) continue; + + if (data.hasFreePlace()) + { + muellmanData.Remove(data); + //müllwagen respawnen + return; + } + + data.removeClientFromData(player); + return; + } + + } + + [ServerEvent(Event.PlayerDeath)] + private void SrvEvent_PlayerDeath(Player player) + { + if (!GetPlayerInJob().Contains(player)) return; + foreach (var data in muellmanData) + { + if (data.getDataFromClient(player) == null) continue; + + if (data.hasFreePlace()) + { + muellmanData.Remove(data); + //müllwagen respawnen + return; + } + + data.removeClientFromData(player); + return; + } + + } + + [ServerEvent(Event.VehicleDeath)] + private void SrvEvent_Vehicle(Vehicle veh) + { + if (veh.Model != (uint)Types.VehicleModel.Trash && veh.Model != (uint)Types.VehicleModel.Trash2) return; + foreach (var data in muellmanData) + { + if (data.vehicle == veh) + { + //müllfahrzeug respawnen + + List clients = data.getClientsFromData(); + foreach(var c in clients){ RefuseCollectorJobJobStop(c); } + + muellmanData.Remove(data); + return; + } + } + } + + [ServerEvent(Event.PlayerEnterVehicleAttempt)] + public void SrvEvent_PlayerEnterVehicle(Player player, Vehicle vehicle, sbyte seat) + { + Player target; + if (!GetPlayerInJob().Contains(player)) return; + + if (vehicle.Model == (uint)Types.VehicleModel.Trash || vehicle.Model == (uint)Types.VehicleModel.Trash2) + { + foreach (var data in muellmanData) + { + if (data.vehicle == vehicle) + { + if (data.getDataFromClient(player) != null) + return; + + if (!data.hasFreePlace()) + { + player.StopAnimation(); + return; + } + CheckDataForDuplicatePlayer(player, data); + data.setClientToData(player); + + MuellmannJobStarten(player, vehicle); + + target = data.getPartnerClient(player); + if (target == null) + return; + + ChatService.SendMessage((Player)player, $"Dein Partner ist {target.Name} !"); + ChatService.SendMessage((Player)target, $"Dein Partner ist {player.Name} !"); + return; + } + } + + MuellmannData newData = new MuellmannData(vehicle); + muellmanData.Add(newData); + CheckDataForDuplicatePlayer(player, newData); + newData.setClientToData(player); + + MuellmannJobStarten(player, vehicle); + + target = newData.getPartnerClient(player); + if (target == null) + return; + + ChatService.SendMessage((Player)player, $"Dein Partner ist {target.Name} !"); + ChatService.SendMessage((Player)target, $"Dein Partner ist {player.Name} !"); + } + } + + public void CheckDataForDuplicatePlayer(Player player, MuellmannData data) + { + foreach (var d in muellmanData) + { + if (d == data) continue; + + MuellmannData temp = d.getDataFromClient(player); + if (temp == null) continue; + + temp.removeClientFromData(player); + } + } + + #endregion + + #region Data + public class MuellmannData + { + Player client1; + Player client2; + public Vehicle vehicle; + int trashCount = 0; + + public MuellmannData(Vehicle vehicle) + { + this.vehicle = vehicle; + } + public void setClientToData(Player player) + { + if (client1 == player || client2 == player) + { + Console.WriteLine("Spieler schon gespeichert"); + return; + } + + if (client1 == null) { client1 = player; return; } + else if (client2 == null) { client2 = player; return; } + else if (client1 != null && client2 != null) { Console.WriteLine("kein Platz"); } + } + public void removeClientFromData(Player player) + { + if (client1 == player) { client1 = null; } + if (client2 == player) { client2 = null; } + } + public int getTrashCount() + { + return this.trashCount; + } + public void setTrashCount(int i) + { + this.trashCount = i; + } + public List getClientsFromData() + { + List tempList = new List(); + if (client1 != null) { tempList.Add(client1); } + if (client2 != null) { tempList.Add(client2); } + return tempList; + } + public MuellmannData getDataFromClient(Player player) + { + if (client1 != player && client2 != player) + return null; + return this; + } + public bool hasFreePlace() + { + if (client1 != null && client2 != null) + return false; + return true; + } + public Player getPartnerClient(Player player) + { + if (client1 != player && client2 != player) + return null; + + if (client1 == player) { return client2; } + if (client2 == player) { return client1; } + return null; + } + } + #endregion } + } + diff --git a/ReallifeGamemode.Server/Job/TaxiDriverJob.cs b/ReallifeGamemode.Server/Job/TaxiDriverJob.cs index d70ba2bb..2ae1865b 100644 --- a/ReallifeGamemode.Server/Job/TaxiDriverJob.cs +++ b/ReallifeGamemode.Server/Job/TaxiDriverJob.cs @@ -92,17 +92,22 @@ namespace ReallifeGamemode.Server.Job } + /* public static void StartTaxiTimer() { - Timer timer = new Timer(1000); + Timer timer = new Timer(500); timer.Start(); timer.Elapsed += UpdateFare; } + */ - private static void UpdateFare(object sender, ElapsedEventArgs e) + public static void UpdateFare() { foreach (var player in GetPlayerInJob()) { + User u = player.GetUser(); + if (u.JobId != 1) return; + Console.WriteLine(player.Name); if (!player.HasData("hasPassager")) { player.SetData("hasPassager", false); continue; } int playerId = player.GetUser().Id; diff --git a/ReallifeGamemode.Server/Main.cs b/ReallifeGamemode.Server/Main.cs index 4ffe5353..c81678c9 100644 --- a/ReallifeGamemode.Server/Main.cs +++ b/ReallifeGamemode.Server/Main.cs @@ -23,6 +23,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Services; + /** * @overview Life of German Reallife - Main Class (Main.cs) * @author VegaZ, hydrant @@ -64,7 +65,7 @@ namespace ReallifeGamemode.Server NAPI.Server.SetGlobalServerChat(false); - //NAPI.Server.SetCommandErrorMessage("~r~[FEHLER]~s~ Dieser Command existiert nicht."); + NAPI.Server.SetCommandErrorMessage("~r~[FEHLER]~s~ Dieser Command existiert nicht."); NAPI.Server.SetDefaultSpawnLocation(DEFAULT_SPAWN_POSITION, DEFAULT_SPAWN_HEADING); NAPI.Server.SetAutoSpawnOnConnect(false); NAPI.Server.SetAutoRespawnAfterDeath(false); @@ -84,7 +85,7 @@ namespace ReallifeGamemode.Server TuningManager.LoadTuningGarages(); TimeManager.StartTimeManager(); - VehicleManager.StartTimer(); + VehicleManager.CheckEnabledMods(); DatabaseHelper.InitDatabaseFirstTime(); @@ -95,7 +96,7 @@ namespace ReallifeGamemode.Server ATMManager.InitATMs(); CityHallManager.LoadCityHall(); JobManager.LoadJobs(); - TaxiDriverJob.StartTaxiTimer(); + //TaxiDriverJob.StartTaxiTimer(); Obselete //HouseManager.LoadHouses(); DrivingSchool.DrivingSchool.Setup(); PlaneSchool.Setup(); @@ -113,10 +114,12 @@ namespace ReallifeGamemode.Server NAPI.Data.SetWorldData("blipTemplate", tempBlip); - WantedEscapeTimer.WantedTimer(); - Jail.JailTimer(); - Economy.PaydayTimer(); - WeaponDealManager.WeaponDealTimer(); + //WantedEscapeTimer.WantedTimer(); Obselete + //Jail.JailTimer(); Obselete + //Economy.PaydayTimer(); Obselete + // WeaponDealManager.WeaponDealTimer(); Obselete + + ThreadTimers.StartAllTimers(); UserBankAccount.BalanceChanged += (account) => { diff --git a/ReallifeGamemode.Server/Managers/JobManager.cs b/ReallifeGamemode.Server/Managers/JobManager.cs index 6c0145ea..b391be06 100644 --- a/ReallifeGamemode.Server/Managers/JobManager.cs +++ b/ReallifeGamemode.Server/Managers/JobManager.cs @@ -261,7 +261,7 @@ namespace ReallifeGamemode.Server.Managers { ServerVehicle sVeh = veh.GetServerVehicle(); if (sVeh == null) return; - if (sVeh is JobVehicle jV && jV.JobId == 1) // Spieler steigt in Taxi aus + if (sVeh is JobVehicle jV && jV.JobId == 1) // Spieler steigt vom Taxi aus { var taxiJob = JobManager.GetJob(); if (veh.Occupants.Count == 0) return; diff --git a/ReallifeGamemode.Server/Managers/VehicleManager.cs b/ReallifeGamemode.Server/Managers/VehicleManager.cs index 9542459d..f366d345 100644 --- a/ReallifeGamemode.Server/Managers/VehicleManager.cs +++ b/ReallifeGamemode.Server/Managers/VehicleManager.cs @@ -722,12 +722,8 @@ namespace ReallifeGamemode.Server.Managers private static readonly Dictionary lastPositions = new Dictionary(); private static DateTime lastSave = DateTime.UtcNow; - public static void StartTimer() + public static void CheckEnabledMods() { - Timer timer = new Timer(500); - timer.Elapsed += VehicleTimerTick; - timer.Start(); - foreach (var name in _enabledMods) { if (_enabledMods.Where(x => x == name).Count() != 1) @@ -737,7 +733,7 @@ namespace ReallifeGamemode.Server.Managers } } - private static void VehicleTimerTick(object sender, ElapsedEventArgs e) + public static void VehicleTimerTick() { NAPI.Pools.GetAllVehicles().ForEach(v => { diff --git a/ReallifeGamemode.Server/Util/ThreadTimers.cs b/ReallifeGamemode.Server/Util/ThreadTimers.cs new file mode 100644 index 00000000..d960a370 --- /dev/null +++ b/ReallifeGamemode.Server/Util/ThreadTimers.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Timers; +using ReallifeGamemode.Server.Wanted; +using ReallifeGamemode.Server.Finance; +using ReallifeGamemode.Server.WeaponDeal; +using ReallifeGamemode.Server.Job; +using ReallifeGamemode.Server.Managers; + +namespace ReallifeGamemode.Server.Util +{ + public class ThreadTimers + { + + private static Timer timer500 = new Timer(500); //0.5 seconds timer + private static Timer timer2500 = new Timer(2500); //2.5 seconds timer + private static Timer timer10000 = new Timer(10000); // 10 second timer + private static Timer timer60000 = new Timer(60000); //60 seconds timer + + public static void StartAllTimers() + { + timer500.Start(); + timer500.Elapsed += Timer500_Elapsed; + + timer2500.Start(); + timer2500.Elapsed += Timer2500_Elapsed; + + timer10000.Start(); + timer10000.Elapsed += Timer10000_Elapsed; + + timer60000.Start(); + timer60000.Elapsed += Timer60000_Elapsed; + } + + private static void Timer500_Elapsed(object sender, ElapsedEventArgs e) + { + TaxiDriverJob.UpdateFare(); + VehicleManager.VehicleTimerTick(); + } + + private static void Timer60000_Elapsed(object sender, ElapsedEventArgs e) + { + Jail.JailOut_Elapsed(); + Economy.Timer_Elapsed(); + WeaponDealManager.Timer_Elapsed(); + } + + private static void Timer10000_Elapsed(object sender, ElapsedEventArgs e) + { + Jail.BrakeOut_Elapsed(); + } + + private static void Timer2500_Elapsed(object sender, ElapsedEventArgs e) + { + 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 a00f9f98..7261b784 100644 --- a/ReallifeGamemode.Server/Wanted/Jail.cs +++ b/ReallifeGamemode.Server/Wanted/Jail.cs @@ -124,7 +124,7 @@ namespace ReallifeGamemode.Server.Wanted } - + /* public static void JailTimer() { System.Timers.Timer timer = new System.Timers.Timer(60000); @@ -133,12 +133,12 @@ namespace ReallifeGamemode.Server.Wanted timer.Start(); brakeOut.Start(); jailIn.Start(); - timer.Elapsed += Timer_Elapsed; - brakeOut.Elapsed += BrakeOut_Elapsed; - jailIn.Elapsed += JailIn_Elapsed; + //timer.Elapsed += Timer_Elapsed; + //brakeOut.Elapsed += BrakeOut_Elapsed; + //jailIn.Elapsed += JailIn_Elapsed; } - - private static void JailIn_Elapsed(object sender, System.Timers.ElapsedEventArgs e) + */ + public static void JailIn_Elapsed() { foreach (var player in NAPI.Pools.GetAllPlayers()) { @@ -166,7 +166,7 @@ namespace ReallifeGamemode.Server.Wanted } } - private static void BrakeOut_Elapsed(object sender, System.Timers.ElapsedEventArgs e) + public static void BrakeOut_Elapsed() { foreach (var player in NAPI.Pools.GetAllPlayers()) { @@ -188,7 +188,7 @@ namespace ReallifeGamemode.Server.Wanted } } - private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) + public static void JailOut_Elapsed() { foreach (var player in NAPI.Pools.GetAllPlayers()) { diff --git a/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs b/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs index d1856626..d182b004 100644 --- a/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs +++ b/ReallifeGamemode.Server/Wanted/WantedEscapeTimer.cs @@ -20,14 +20,14 @@ namespace ReallifeGamemode.Server.Wanted public class WantedEscapeTimer { 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; + //System.Timers.Timer timer = new System.Timers.Timer(2500); + //timer.Start(); + //timer.Elapsed += Timer_Elapsed; } - + */ public static void ResetWantedTimeToElapse(Player client) { User user = client.GetUser(); @@ -37,7 +37,7 @@ namespace ReallifeGamemode.Server.Wanted waTimer[user.Id] = 300000; } - private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) + public static void Timer_Elapsed() { foreach (var player in NAPI.Pools.GetAllPlayers()) { diff --git a/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs b/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs index d76c4a9e..3bb9737c 100644 --- a/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs +++ b/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs @@ -28,7 +28,7 @@ namespace ReallifeGamemode.Server.WeaponDeal var user = client.GetUser(); using (var context = new DatabaseContext()) { - FactionVehicle factionVehicle = context.FactionVehicles.Where(f => f.GetOwners().Contains(user.FactionId ?? 0) && f.Model == VehicleHash.Burrito3).FirstOrDefault(); + FactionVehicle factionVehicle = context.FactionVehicles.ToList().Where(f => f.GetOwners().Contains(user.FactionId ?? 0) && f.Model == VehicleHash.Burrito3).FirstOrDefault(); Vehicle fVeh = VehicleManager.GetVehicleFromServerVehicle(factionVehicle); if (fVeh.Position.DistanceTo(client.Position) > 50) @@ -53,14 +53,15 @@ namespace ReallifeGamemode.Server.WeaponDeal } } + /* public static void WeaponDealTimer() { System.Timers.Timer timer = new System.Timers.Timer(60000); timer.Start(); timer.Elapsed += Timer_Elapsed; } - - private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) + */ + public static void Timer_Elapsed() { using (var context = new DatabaseContext()) {