diff --git a/ReallifeGamemode.Client/Gui/bigmap.ts b/ReallifeGamemode.Client/Gui/bigmap.ts index 4fd5e4c9..4548f311 100644 --- a/ReallifeGamemode.Client/Gui/bigmap.ts +++ b/ReallifeGamemode.Client/Gui/bigmap.ts @@ -1,54 +1,34 @@ import { GlobalData } from ".."; export default function bigmap() { - var bigmap = { status: 0, timer: null }; + var bigmap = { enabled: false, timer: null }; - bigmap.status = 0; - bigmap.timer = null; - - mp.game.ui.setRadarZoom(1.0); + mp.game.ui.setRadarZoom(0.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; - } + if (bigmap.timer != null) { + clearTimeout(bigmap.timer); + bigmap.timer = null; + } + if (!bigmap.enabled) { mp.game.ui.setRadarBigmapEnabled(true, false); - mp.game.ui.setRadarZoom(0.0); - bigmap.status = 2; + mp.game.ui.setRadarZoom(1.0); + bigmap.enabled = true; bigmap.timer = setTimeout(() => { - mp.game.ui.setRadarBigmapEnabled(false, true); - mp.game.ui.setRadarZoom(1.0); - - bigmap.status = 0; + mp.game.ui.setRadarBigmapEnabled(false, false); + mp.game.ui.setRadarZoom(0.0); + bigmap.enabled = false; bigmap.timer = null; - }, 10000); + }, 7500); } 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; + mp.game.ui.setRadarZoom(0.0); + bigmap.enabled = false; } } }); diff --git a/ReallifeGamemode.Client/Gui/playerlist.ts b/ReallifeGamemode.Client/Gui/playerlist.ts index 1d5009f3..b30ce5cd 100644 --- a/ReallifeGamemode.Client/Gui/playerlist.ts +++ b/ReallifeGamemode.Client/Gui/playerlist.ts @@ -44,7 +44,7 @@ export default function playerList(globalData: IGlobalData): void { pList.forEach((player) => { playerlistBrowser.execute(`addPlayerEntry('${player.Id}', '${player.Name}', '${player.FactionId}', '${player.Ping}');`); - factionPlayersMap.set(player.factionId, factionPlayersMap.get(player.factionId) + 1); + factionPlayersMap.set(player.FactionId, factionPlayersMap.get(player.FactionId) + 1); }); factionPlayersMap.forEach((value, key) => { diff --git a/ReallifeGamemode.Client/Tuning/sync.ts b/ReallifeGamemode.Client/Tuning/sync.ts index dd500d21..4b5391e6 100644 --- a/ReallifeGamemode.Client/Tuning/sync.ts +++ b/ReallifeGamemode.Client/Tuning/sync.ts @@ -14,8 +14,7 @@ var wheelType = vehicle.getVariable('wheelType'); if (wheelType !== undefined) { - vehicle.setWheelType(wheelType); - vehicle.setMod(23, vehicle.getMod(23)); + setWheelType(vehicle, wheelType); } if (mod18 !== undefined) { @@ -29,7 +28,7 @@ return; } if (slot == -2) { - veh.setWheelType(newval); + setWheelType(veh, newval); } else { veh.toggleMod(slot, newval); @@ -37,6 +36,16 @@ }); + function setWheelType(vehicle, wheelType) { + setTimeout(() => { + if (mp.vehicles.exists(vehicle)) { + var mod = vehicle.getMod(23); + vehicle.setWheelType(wheelType); + vehicle.setMod(23, mod); + } + }, 1000); + } + mp.events.addDataHandler("vehicleTaxiLight", (entity: VehicleMp, state: boolean) => { if (!entity) { return; diff --git a/ReallifeGamemode.Client/assets/css/onlinelist/style.css b/ReallifeGamemode.Client/assets/css/onlinelist/style.css index b959ef3e..fdf1cad4 100644 --- a/ReallifeGamemode.Client/assets/css/onlinelist/style.css +++ b/ReallifeGamemode.Client/assets/css/onlinelist/style.css @@ -110,13 +110,13 @@ table tr td { table tr td span.player__status { position: absolute; - top: .45em; + top: .55em; right: 1em; font-size: .9em; font-weight: normal; - line-height: 1.15; - padding: .4em .5em; - background-color: rgba(255, 255, 255, 0.125); + line-height: 1; + padding: .2em .3em .4em; + background-color: rgba(255, 255, 255, 0.075); border-radius: 3px; } diff --git a/ReallifeGamemode.Client/assets/css/onlinelist/style.css.map b/ReallifeGamemode.Client/assets/css/onlinelist/style.css.map index 375dfcc9..c4dcc4f2 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,GAA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AA,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;;AAGlC,AAAA,KAAK,CAAC;EAAE,OAAO,EAAE,IAAI;CAAI;;AACzB,AAAA,OAAO,CAAC;EAAE,OAAO,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 9c815a47..a81508c6 100644 --- a/ReallifeGamemode.Client/assets/css/onlinelist/style.scss +++ b/ReallifeGamemode.Client/assets/css/onlinelist/style.scss @@ -85,15 +85,15 @@ table { span.player__status { position: absolute; - top: .45em; + top: .55em; right: 1em; font-size: .9em; font-weight: normal; - line-height: 1.15; - padding: .4em .5em; + line-height: 1; + padding: .2em .3em .4em; - background-color: rgba(white, .125); + background-color: rgba(white, 0.075); border-radius: 3px; } diff --git a/ReallifeGamemode.Client/core/rage-mp/entities.ts b/ReallifeGamemode.Client/core/rage-mp/entities.ts index 2a855054..9ea5e794 100644 --- a/ReallifeGamemode.Client/core/rage-mp/entities.ts +++ b/ReallifeGamemode.Client/core/rage-mp/entities.ts @@ -4,17 +4,27 @@ import game from "../.."; class RageEntity implements IEntity { private entity: EntityMp; + private entityType: string; public __attachments: any[]; public __attachmentObjects: any[]; get id(): number { - if (!this.entity) { + if (!this.entity || !this.exists()) { return null; } return this.entity.id; } + exists() { + switch (this.entityType) { + case "player": + return mp.players.exists(this.entity as PlayerMp); + case "vehicle": + return mp.vehicles.exists(this.entity as VehicleMp); + } + } + get attachments(): number { var color = this.entity.getVariable("nametagColor"); if (!color) @@ -36,6 +46,7 @@ class RageEntity implements IEntity { constructor(entity: EntityMp) { this.entity = entity; + this.entityType = this.entity.type; } get type(): EntityType { diff --git a/ReallifeGamemode.Client/dlcpacks/fibgarage/dlc.rpf b/ReallifeGamemode.Client/dlcpacks/fibgarage/dlc.rpf index 1d609a52..38e3f86c 100644 --- a/ReallifeGamemode.Client/dlcpacks/fibgarage/dlc.rpf +++ b/ReallifeGamemode.Client/dlcpacks/fibgarage/dlc.rpf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d7c638247cd28299585423da1746b80f7262daa3e86ffafd9d3254b9a66ef8e2 +oid sha256:3ba7f639477be4ae4cfae3b9f0c024052786bf8196bc157525255d47dab97c3d size 38912 diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index 3b48f9d9..916f4293 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -5,6 +5,7 @@ using System.Net.Http; using System.Text.RegularExpressions; using GTANetworkAPI; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; using Newtonsoft.Json; using ReallifeGamemode.Database.Entities; using ReallifeGamemode.Database.Entities.Logs.Chat; @@ -16,6 +17,7 @@ using ReallifeGamemode.Server.Factions.Medic; using ReallifeGamemode.Server.Finance; using ReallifeGamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Job; +using ReallifeGamemode.Server.Log; using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Types; @@ -33,6 +35,8 @@ namespace ReallifeGamemode.Server.Commands { public class AdminCommands : Script { + private ILogger logger = LogManager.GetLogger(); + #region Todo [Command("syncanim", "~m~Benutzung: ~s~/syncanim [animName]")] @@ -187,12 +191,12 @@ namespace ReallifeGamemode.Server.Commands if (player.HasData("togip")) { player.ResetData("togip"); - player.SendNotification("Die IP-Adressen sind nun ~r~deaktiviert~s~."); + player.SendNotification("IP-Adressen ~r~deaktiviert"); } else { player.SetData("togip", true); - player.SendNotification("Die IP-Adressen sind nun ~g~aktiviert~s~."); + player.SendNotification("IP-Adressen ~g~aktiviert"); } break; @@ -200,12 +204,12 @@ namespace ReallifeGamemode.Server.Commands if (player.HasData("togdeath")) { player.ResetData("togdeath"); - player.SendNotification("Du hast die Todesbenachrichtigungen ~r~deaktiviert~s~."); + player.SendNotification("Todesbenachrichtigungen ~r~deaktiviert"); } else { player.SetData("togdeath", true); - player.SendNotification("Du hast die Todesbenachrichtigungen ~g~aktiviert~s~."); + player.SendNotification("Todesbenachrichtigungen ~g~aktiviert"); } break; @@ -213,12 +217,12 @@ namespace ReallifeGamemode.Server.Commands if (player.HasData("toglc")) { player.ResetData("toglc"); - player.SendNotification("Du hast den /lc-Chat ~r~deaktiviert~s~."); + player.SendNotification("/lc-Chat ~r~deaktiviert"); } else { player.SetData("toglc", true); - player.SendNotification("Du hast den /lc-Chat ~g~aktiviert~s~."); + player.SendNotification("/lc-Chat ~g~aktiviert"); } break; @@ -226,36 +230,36 @@ namespace ReallifeGamemode.Server.Commands if (player.HasData("togconnect")) { player.ResetData("togconnect"); - player.SendNotification("Du hast die Connect-Nachrichten ~r~deaktiviert~s~."); + player.SendNotification("Connect-Nachrichten ~r~deaktiviert"); } else { player.SetData("togconnect", true); - player.SendNotification("Du hast die Connect-Nachrichten ~g~aktiviert~s~."); + player.SendNotification("Connect-Nachrichten ~g~aktiviert"); } break; case "d": if (player.HasData("togd")) { player.ResetData("togd"); - player.SendNotification("Du hast den /d-Chat ~r~deaktiviert~s~."); + player.SendNotification("/d-Chat ~r~deaktiviert"); } else { player.SetData("togd", true); - player.SendNotification("Du hast den /d-Chat ~g~aktiviert~s~."); + player.SendNotification("/d-Chat ~g~aktiviert"); } break; case "ga": if (player.HasData("togga")) { player.ResetData("togga"); - player.SendNotification("Du hast den /ga-Chat ~r~deaktiviert~s~."); + player.SendNotification("/ga-Chat ~r~deaktiviert"); } else { player.SetData("togga", true); - player.SendNotification("Du hast den /ga-Chat ~g~aktiviert~s~."); + player.SendNotification("/ga-Chat ~g~aktiviert"); } break; case "all": @@ -270,7 +274,7 @@ namespace ReallifeGamemode.Server.Commands player.SetData("togga", true); player.SetData("togall", true); - player.SendNotification("Du hast alle Benachrichtigungen ~g~aktiviert~s~."); + player.SendNotification("Du hast alle Benachrichtigungen ~g~aktiviert"); } else { @@ -283,7 +287,7 @@ namespace ReallifeGamemode.Server.Commands player.ResetData("togga"); player.ResetData("togall"); - player.SendNotification("Du hast alle Benachrichtigungen ~r~deaktiviert~s~."); + player.SendNotification("Du hast alle Benachrichtigungen ~r~deaktiviert"); } break; } @@ -682,23 +686,33 @@ namespace ReallifeGamemode.Server.Commands else player.SafeTeleport(player.GetData("mark")); } - [Command("flip", "")] + [Command("flip", "~m~Benutzung:~s~ /flip")] public void CmdAdminFlip(Player player) { - if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true) { ChatService.NotAuthorized(player); return; } + Vehicle vehToFlip = null; + if (player.IsInVehicle) { - player.Vehicle.Rotation = new Vector3(0.0, 0.0, player.Vehicle.Rotation.Z); + vehToFlip = player.Vehicle; } else { - player.SendChatMessage("~r~Du befindest dich in keinem Fahrzeug!"); + vehToFlip = NAPI.Pools.GetAllVehicles().Where(v => v.Position.DistanceTo(player.Position) <= 5).OrderBy(v => v.Position.DistanceTo(player.Position)).FirstOrDefault(); } + + if (vehToFlip == null) + { + ChatService.ErrorMessage(player, "Es wurde kein Fahrzeug zum Flippen gefunden"); + return; + } + + vehToFlip.Rotation = new Vector3(0, 0, vehToFlip.Rotation.Z); } [Command("up", "~m~Benutzung: ~s~/up [Wert]")] @@ -816,7 +830,7 @@ namespace ReallifeGamemode.Server.Commands [Command("setdimension", "~m~Benutzung: ~s~/setdimension [Spieler] [Dimension]")] public void CmdAdminSetDimension(Player player, string targetname, uint dimension) { - if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) { ChatService.NotAuthorized(player); return; @@ -1203,6 +1217,25 @@ namespace ReallifeGamemode.Server.Commands ChatService.SendMessage(player, "~b~Dem Spieler " + target.Name + " wurden erfolgreich alle Waffen abgenommen "); } + [Command("rtakeweapon", "~m~Benutzung: ~s~/rtakeweapon [Radius]")] + public void CmdAdminRangeTakeWeapon(Player player, int range) + { + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + + var players = NAPI.Player.GetPlayersInRadiusOfPlayer(range, player); + foreach (Player target in players) + { + target.RemoveAllWeapons(); + ChatService.SendMessage(target, "~b~Deine Waffen wurden dir von " + player.Name + " (Admin) abgenommen"); + } + + ChatService.BroadcastAdmin($"~b~[ADMIN]~s~ ~y~{player.Name}~s~ hat ~o~{players.Count}~s~ Spielern im Radius ~o~{range}~s~ die Waffen abgenommen", AdminLevel.ADMIN); + } + [Command("tov", "~m~Benutzung: ~s~/tov [Fahrzeug ID]")] public void CmdAdminTov(Player player, int vehid) { @@ -1401,74 +1434,6 @@ namespace ReallifeGamemode.Server.Commands ChatService.SendMessage(player, "~b~Du hast die HP von " + target.Name + " auf " + hp + " gesetzt."); } - [Command("clothes", "~m~Benutzung: ~s~/clothes [Spieler] [Component ID] [Drawable] (Textur)")] - public void CmdAdminClothes(Player player, string name, int component, int drawable, int texture = 0) - { - if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) - { - ChatService.NotAuthorized(player); - return; - } - - Player target = PlayerService.GetPlayerByNameOrId(name); - if (target == null || !target.IsLoggedIn()) - { - ChatService.PlayerNotFound(player); - return; - } - - using (var dbContext = new DatabaseContext()) - { - User user = target.GetUser(dbContext); - bool duty = user.GetData("duty"); - CharacterCloth cloth = dbContext.CharacterClothes.Where(c => c.UserId == user.Id && c.SlotId == component && c.SlotType == 0 && c.Duty == duty).FirstOrDefault(); - if (cloth == null) - { - cloth = new CharacterCloth() - { - Duty = duty, - ClothId = drawable, - SlotId = component, - SlotType = 0, - Texture = texture, - UserId = user.Id, - }; - dbContext.CharacterClothes.Add(cloth); - } - else - { - cloth.ClothId = drawable; - cloth.Texture = texture; - } - dbContext.SaveChanges(); - NAPI.Player.SetPlayerClothes(target, component, drawable, texture); - } - } - - [Command("props", "~m~Benutzung: ~s~/props [Spieler] [Component ID] [Drawable] (Textur)")] - public void CmdAdminProps(Player player, string name, int slot, int component, int texture = 0) - { - if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) - { - ChatService.NotAuthorized(player); - return; - } - - Player target = PlayerService.GetPlayerByNameOrId(name); - if (target == null || !target.IsLoggedIn()) - { - ChatService.PlayerNotFound(player); - return; - } - - if (component == -1) - { - target.ClearAccessory(slot); - return; - } - target.SetAccessories(slot, component, texture); - } - [Command("aunjail", "~m~Benutzung: ~s~/aunjail [Spieler]", GreedyArg = true)] public void CmdAdminAunjai(Player player, string targetname) { @@ -1586,31 +1551,11 @@ namespace ReallifeGamemode.Server.Commands } } - [Command("adice", "~m~Benutzung: ~s~/adice [Zahl]")] - public void CmdUserAdice(Player player, int number) - { - if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) - { - ChatService.NotAuthorized(player); - return; - } - - if (!player.IsLoggedIn()) return; - - var peopleInRange = NAPI.Player.GetPlayersInRadiusOfPlayer(7, player); - - foreach (var managedPlayer in peopleInRange) - { - if (!managedPlayer.IsLoggedIn()) return; - ChatService.SendMessage(managedPlayer, "* " + player.Name + " hat eine " + number + " gewürfelt."); - } - } - [Command("veh", "~m~Benutzung: ~s~/veh [Fahrzeug] (Farbe 1) (Farbe 2)")] public void CmdAdminVeh(Player player, string hash, int color1 = 111, int color2 = 111) { - if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) - //TODO: Bestimmte Autos nur ab Adminlevel 1337, "normale Fahrzeuge" schon ab Adminlevel 3. + User user = player.GetUser(); + if (!user.IsAdmin(AdminLevel.ADMIN)) { ChatService.NotAuthorized(player); return; @@ -1631,6 +1576,12 @@ namespace ReallifeGamemode.Server.Commands return; } + if (VehicleManager.IsVehicleRestricted(hash) && !user.IsAdmin(AdminLevel.HEADADMIN)) + { + ChatService.ErrorMessage(player, "Du darfst dieses Fahrzeug nicht spawnen"); + return; + } + Vehicle v = NAPI.Vehicle.CreateVehicle(uHash, player.Position, player.Heading, color1, color2, engine: true); VehicleStreaming.SetEngineState(v, true); VehicleStreaming.SetLockStatus(v, false); @@ -1718,47 +1669,6 @@ namespace ReallifeGamemode.Server.Commands ChatService.SendMessage(player, "Farb-ID1 " + color1 + ", Farb-ID2 " + color2 + ""); } - [Command("giveweapon", "~m~Benutzung: ~s~/giveweapon [Spieler] [Waffe] [Munition]")] - public void CmdAdminGiveweapon(Player player, string name, string hash, int ammo) - { - if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) - { - ChatService.NotAuthorized(player); - return; - } - - if (ammo <= 0) - { - ChatService.ErrorMessage(player, "Es muss mindestens 1 Munition vergeben werden"); - return; - } - - hash = hash.ToLower(); - - Player target = PlayerService.GetPlayerByNameOrId(name); - if (target == null || !target.IsLoggedIn()) - { - ChatService.PlayerNotFound(player); - return; - } - - if (!uint.TryParse(hash, out uint uHash)) - { - if (hash.Contains("mk2") && !hash.Contains("_mk2")) hash = hash.Replace("mk2", "_mk2"); - uHash = NAPI.Util.GetHashKey($"weapon_{hash}"); - } - - if (!WeaponManager.IsValidHash(uHash)) - { - ChatService.ErrorMessage(player, "Diese Waffe existiert nicht"); - return; - } - - target.GiveWeapon((WeaponHash)uHash, ammo); - ChatService.SendMessage(target, "~b~Du hast von " + player.Name + " eine/n " + hash + " mit einer Munition von " + ammo + " erhalten."); - ChatService.SendMessage(player, "~b~Du hast " + target.Name + " eine/n " + hash + " mit einer Munition von " + ammo + " gegeben."); - } - [Command("aneon", "~m~Benutzung: ~s~/aneon [R][G][B]")] public void CmdAdminNeon(Player player, int r, int g, int b) { @@ -2111,7 +2021,8 @@ namespace ReallifeGamemode.Server.Commands [Command("rgiveweapon", "~m~Benutzung: ~s~/rgiveweapon [Radius] [Waffe] [Munition]")] public void CmdAdminRangeGiveWeapon(Player player, float radius, string weapon, int munition) { - if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) + User user = player.GetUser(); + if (!user.IsAdmin(AdminLevel.ADMIN)) { ChatService.NotAuthorized(player); return; @@ -2131,6 +2042,12 @@ namespace ReallifeGamemode.Server.Commands return; } + if (!WeaponManager.IsAllowedWeapon(weapon) && !user.IsAdmin(AdminLevel.HEADADMIN)) + { + ChatService.ErrorMessage(player, "Du darfst diese Waffe nicht vergeben"); + return; + } + WeaponHash weaponHash = (WeaponHash)uHash; var peopleInRange = NAPI.Player.GetPlayersInRadiusOfPlayer(radius, player); @@ -2147,7 +2064,7 @@ namespace ReallifeGamemode.Server.Commands [Command("rsetap", "~m~Benutzung: ~s~/rsetap [Radius] (Armor)")] public void CmdAdminRangeSetAP(Player player, float radius, int Armor = 100) { - if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) { ChatService.NotAuthorized(player); return; @@ -2166,7 +2083,7 @@ namespace ReallifeGamemode.Server.Commands [Command("rsethp", "~m~Benutzung: ~s~/rsethp [Radius] (Leben)")] public void CmdAdminRangeSetHP(Player player, float radius, int hp = 100) { - if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) { ChatService.NotAuthorized(player); return; @@ -2824,10 +2741,15 @@ namespace ReallifeGamemode.Server.Commands case "fvehicle": if (player.IsInVehicle) { - string fIdStr = (option1 + " " + option2).Trim(); int[] fIds = null; - string[] fIdStrs = fIdStr.Split(" "); + string[] fIdStrs = option1.Split(","); + + if (!int.TryParse(option2, out int buyPrice) || buyPrice < 0) + { + ChatService.ErrorMessage(player, "Der Kaufpreis ist ungültig oder negativ"); + return; + } try { @@ -2853,7 +2775,7 @@ namespace ReallifeGamemode.Server.Commands Vehicle vehicle = player.Vehicle; int playerSeat = player.VehicleSeat; vehicle = SaveManager.SaveFactionVehicleData(vehicle, (VehicleHash)vehicle.Model, vehicle.Position, vehicle.Heading, vehicle.NumberPlate, - vehicle.PrimaryColor, vehicle.SecondaryColor, vehicle.Locked, vehicle.EngineStatus, fIds, vehicle.Livery); + vehicle.PrimaryColor, vehicle.SecondaryColor, vehicle.Locked, vehicle.EngineStatus, fIds, vehicle.Livery, buyPrice); player.SendNotification("Fraktionsfahrzeug ~g~" + vehicle.DisplayName + "~s~ gespeichert.", true); player.SetIntoVehicle(vehicle, playerSeat); } @@ -3809,7 +3731,7 @@ namespace ReallifeGamemode.Server.Commands player.SendChatMessage("~m~Benutzung:~s~ /business [price] [Option]"); } - [Command("checkstats", "~m~Benutzung:~s~ /checkstats [Spieler]")] + [Command("checkstats", "~m~Benutzung:~s~ /checkstats [Spieler]", Alias = "info")] public void CmdAdminCheckStats(Player player, string nameOrId) { User user = player.GetUser(); @@ -3834,7 +3756,7 @@ namespace ReallifeGamemode.Server.Commands bool flyingLicense = targetUser.FlyingLicensePlane; bool weaponLicense = targetUser.WeaponLicense; int playedHours = targetUser.PlayedMinutes / 60; - string playedHoursString = ""; + string playedHoursString; int jailTime = targetUser.JailTime; if (user.IsAdmin(AdminLevel.HEADADMIN)) @@ -3850,6 +3772,182 @@ namespace ReallifeGamemode.Server.Commands ChatService.SendMessage(player, $"Statistiken von {target.Name} - HandMoney: {handmoney.ToMoneyString()}, BankMoney: {bankmoney.ToMoneyString()}, DriverLicense: {driverLicense.ToString()}, BikeLicense: {bikeLicense.ToString()}, FlyingLicense: {flyingLicense.ToString()}, WeaponLicense: {weaponLicense.ToString()}, playedHours: {playedHoursString}, JailTime: {jailTime.ToString()}"); } + [Command("setvehiclebuyprice", "~m~Benutzung: ~s~/setvehiclebuyprice [Preis]", Alias = "svbp")] + public void CmdAdminSetVehicleBuyPrice(Player player, int price) + { + using var dbContext = new DatabaseContext(); + User user = player.GetUser(dbContext); + + if (!user.IsAdmin(AdminLevel.HEADADMIN)) + { + ChatService.NotAuthorized(player); + return; + } + + if (price < 0) + { + ChatService.ErrorMessage(player, "Der neue Kaufpreis muss positiv sein"); + return; + } + + if (!player.IsInVehicle) + { + ChatService.ErrorMessage(player, "Du sitzt nicht in einem Fahrzeug"); + return; + } + + Vehicle vehicle = player.Vehicle; + ServerVehicle serverVehicle = vehicle.GetServerVehicle(dbContext); + + if (serverVehicle == null) + { + ChatService.ErrorMessage(player, "Dieses Fahrzeug ist keinem System zugeordnet"); + return; + } + + int? oldPrice = null; + + if (serverVehicle is UserVehicle userVehicle) + { + oldPrice = userVehicle.Price; + userVehicle.Price = price; + } + else if (serverVehicle is FactionVehicle factionVehicle) + { + oldPrice = factionVehicle.BuyPrice; + factionVehicle.BuyPrice = price; + } + else + { + ChatService.ErrorMessage(player, "Dieses Fahrzeug ist weder ein User- noch ein Fraktionsfahrzeug"); + return; + } + + logger.LogInformation("{0} set the buyprice of vehicle {1} to {2}", user.Name, serverVehicle.Id, price); + + dbContext.SaveChanges(); + + string oldPriceStr = oldPrice == null ? "nicht gesetzt" : oldPrice.ToMoneyString(); + + ChatService.SendMessage(player, $"~b~[ADMIN]~s~ Der Kaufpreis des Fahrzeugs ~y~{serverVehicle.Id}~s~ wurde auf ~g~{price.ToMoneyString()} gesetzt. Alter Preis: {oldPriceStr}"); + } + + [Command("setclothes", "~m~Benutzung: ~s~/setclothes [Spieler] [Component ID] [Drawable] (Textur)")] + public void CmdAdminSetClothes(Player player, string name, int component, int drawable, int texture = 0) + { + if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + + Player target = PlayerService.GetPlayerByNameOrId(name); + if (target == null || !target.IsLoggedIn()) + { + ChatService.PlayerNotFound(player); + return; + } + + using (var dbContext = new DatabaseContext()) + { + User user = target.GetUser(dbContext); + bool duty = user.GetData("duty"); + CharacterCloth cloth = dbContext.CharacterClothes.Where(c => c.UserId == user.Id && c.SlotId == component && c.SlotType == 0 && c.Duty == duty).FirstOrDefault(); + if (cloth == null) + { + cloth = new CharacterCloth() + { + Duty = duty, + ClothId = drawable, + SlotId = component, + SlotType = 0, + Texture = texture, + UserId = user.Id, + }; + dbContext.CharacterClothes.Add(cloth); + } + else + { + cloth.ClothId = drawable; + cloth.Texture = texture; + } + dbContext.SaveChanges(); + NAPI.Player.SetPlayerClothes(target, component, drawable, texture); + } + } + + [Command("setprops", "~m~Benutzung: ~s~/setprops [Spieler] [Component ID] [Drawable] (Textur)")] + public void CmdAdminSetProps(Player player, string name, int slot, int component, int texture = 0) + { + if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + + Player target = PlayerService.GetPlayerByNameOrId(name); + if (target == null || !target.IsLoggedIn()) + { + ChatService.PlayerNotFound(player); + return; + } + + if (component == -1) + { + target.ClearAccessory(slot); + return; + } + target.SetAccessories(slot, component, texture); + } + + [Command("giveweapon", "~m~Benutzung: ~s~/giveweapon [Spieler] [Waffe] [Munition]")] + public void CmdAdminGiveweapon(Player player, string name, string hash, int ammo) + { + User user = player.GetUser(); + if (!user.IsAdmin(AdminLevel.ADMIN)) + { + ChatService.NotAuthorized(player); + return; + } + + if (ammo <= 0) + { + ChatService.ErrorMessage(player, "Es muss mindestens 1 Munition vergeben werden"); + return; + } + + hash = hash.ToLower(); + + Player target = PlayerService.GetPlayerByNameOrId(name); + if (target == null || !target.IsLoggedIn()) + { + ChatService.PlayerNotFound(player); + return; + } + + if (!uint.TryParse(hash, out uint uHash)) + { + if (hash.Contains("mk2") && !hash.Contains("_mk2")) hash = hash.Replace("mk2", "_mk2"); + uHash = NAPI.Util.GetHashKey($"weapon_{hash}"); + } + + if (!WeaponManager.IsValidHash(uHash)) + { + ChatService.ErrorMessage(player, "Diese Waffe existiert nicht"); + return; + } + + if (!WeaponManager.IsAllowedWeapon(hash) && !user.IsAdmin(AdminLevel.HEADADMIN)) + { + ChatService.ErrorMessage(player, "Du darfst diese Waffe nicht vergeben"); + return; + } + + target.GiveWeapon((WeaponHash)uHash, ammo); + ChatService.SendMessage(target, "~b~Du hast von " + player.Name + " eine/n " + hash + " mit einer Munition von " + ammo + " erhalten."); + ChatService.SendMessage(player, "~b~Du hast " + target.Name + " eine/n " + hash + " mit einer Munition von " + ammo + " gegeben."); + } + #endregion ALevel1337 #region ALevel1338 diff --git a/ReallifeGamemode.Server/Commands/UserCommands.cs b/ReallifeGamemode.Server/Commands/UserCommands.cs index ac56c25e..2ed40def 100644 --- a/ReallifeGamemode.Server/Commands/UserCommands.cs +++ b/ReallifeGamemode.Server/Commands/UserCommands.cs @@ -19,7 +19,8 @@ namespace ReallifeGamemode.Server.Commands internal class UserCommands : Script { [Command("rent", "~m~rent stop")] - public void CmdUserStopRent(Player player, String option = "") { + public void CmdUserStopRent(Player player, String option = "") + { if (!player.IsLoggedIn()) return; if (option != "stop") @@ -112,7 +113,8 @@ namespace ReallifeGamemode.Server.Commands using (var dbContext = new DatabaseContext()) { User user = player.GetUser(dbContext); - if (user.BankAccount.Balance < 5) { + if (user.BankAccount.Balance < 5) + { ChatService.ErrorMessage(player, "Dafür hast du nicht genug Geld auf deinem Bankkonto"); return; } @@ -144,7 +146,7 @@ namespace ReallifeGamemode.Server.Commands var lastDriverDic = new Dictionary(); - if(VehicleManager.lastDriversInVehicle.ContainsKey(veh)) + if (VehicleManager.lastDriversInVehicle.ContainsKey(veh)) { lastDriverDic = VehicleManager.lastDriversInVehicle[veh]; } @@ -220,8 +222,25 @@ namespace ReallifeGamemode.Server.Commands if (pVeh.GetServerVehicle(dbContext) is ServerVehicle veh) { - string dbIdStr = player.GetUser(dbContext).IsAdmin(AdminLevel.ADMIN) ? $" | DB-ID: {veh.Id}" : ""; - ChatService.SendMessage(player, "~m~" + ((VehicleHash)pVeh.Model) + " | " + veh.ToString() + " | Farbe 1: " + pVeh.PrimaryColor + " | Farbe 2: " + pVeh.SecondaryColor + " | ID: " + pVeh.Handle.Value + dbIdStr); + User user = player.GetUser(dbContext); + string addInfoStr = ""; + if (user.IsAdmin(AdminLevel.ADMIN)) + { + addInfoStr += $" | DB-ID: {veh.Id}"; + } + + if (user.IsAdmin(AdminLevel.HEADADMIN)) + { + if (veh is FactionVehicle factionVehicle) + { + addInfoStr += " | Kaufpreis: " + factionVehicle.BuyPrice.ToMoneyString(); + } + else if (veh is UserVehicle userVehicle) + { + addInfoStr += " | Kaufpreis: " + userVehicle.Price.ToMoneyString(); + } + } + ChatService.SendMessage(player, "~m~" + ((VehicleHash)pVeh.Model) + " | " + veh.ToString() + " | Farbe 1: " + pVeh.PrimaryColor + " | Farbe 2: " + pVeh.SecondaryColor + " | ID: " + pVeh.Handle.Value + addInfoStr); } else { diff --git a/ReallifeGamemode.Server/Events/Death.cs b/ReallifeGamemode.Server/Events/Death.cs index 965733cf..f64e53a6 100644 --- a/ReallifeGamemode.Server/Events/Death.cs +++ b/ReallifeGamemode.Server/Events/Death.cs @@ -51,7 +51,7 @@ namespace ReallifeGamemode.Server.Events player.TriggerEvent("abortSpawnschutz"); //TODO: Zum Full Release entfernen - if (player.HasData("togdeath")) + if (player.HasData("togdeath") && user.IsAdmin(AdminLevel.ADMIN)) { ChatService.SendMessage(player, "Du bist durch " + (killer?.Name ?? "Niemanden") + " gestorben: " + reason.ToString()); } @@ -246,7 +246,7 @@ namespace ReallifeGamemode.Server.Events } player.SafeTeleport(new Vector3(-495.45, -336.33, 34.5), 0, true); - + player.TriggerEvent("enableSpawnschutz"); } } diff --git a/ReallifeGamemode.Server/Events/Vehicle.cs b/ReallifeGamemode.Server/Events/Vehicle.cs index 8c9ce883..2bb8c2ae 100644 --- a/ReallifeGamemode.Server/Events/Vehicle.cs +++ b/ReallifeGamemode.Server/Events/Vehicle.cs @@ -241,7 +241,7 @@ namespace ReallifeGamemode.Server.Events if (sV is UserVehicle uV) { - if (uV.UserId != u.Id) + if (uV.UserId != u.Id && (!u.IsAdmin(AdminLevel.HEADADMIN) || !player.IsTSupport())) { player.SendNotification("~r~Du darfst dieses Fahrzeug nicht parken."); return; @@ -249,7 +249,7 @@ namespace ReallifeGamemode.Server.Events } else if (sV is FactionVehicle fV) { - if (!fV.GetOwners().Contains(u.FactionId ?? 0) || !u.FactionLeader) + if ((!fV.GetOwners().Contains(u.FactionId ?? 0) || !u.FactionLeader) && (!u.IsAdmin(AdminLevel.HEADADMIN) || !player.IsTSupport())) { player.SendNotification("~r~Du darfst dieses Fahrzeug nicht parken."); return; diff --git a/ReallifeGamemode.Server/Events/Weapon.cs b/ReallifeGamemode.Server/Events/Weapon.cs index eb73287e..c32f22c0 100644 --- a/ReallifeGamemode.Server/Events/Weapon.cs +++ b/ReallifeGamemode.Server/Events/Weapon.cs @@ -102,7 +102,7 @@ namespace ReallifeGamemode.Server.Events SLOT_PRIMARY => 500, SLOT_SECONDARY => 250, SLOT_MEELE => 1, - SLOT_SPECIAL => 20, + SLOT_SPECIAL => 30, _ => 1 }; diff --git a/ReallifeGamemode.Server/Finance/Economy.cs b/ReallifeGamemode.Server/Finance/Economy.cs index d00119e1..f602fb3a 100644 --- a/ReallifeGamemode.Server/Finance/Economy.cs +++ b/ReallifeGamemode.Server/Finance/Economy.cs @@ -185,7 +185,7 @@ namespace ReallifeGamemode.Server.Finance } } if (paycheck.Amount > 0) - ChatService.SendMessage(client, $"~g~[PAYDAY]~s~ Dein Stundenumsatz beträgt ~g~+{ paycheck.Amount.ToMoneyString() }~s~."); + ChatService.SendMessage(client, $"~g~[PAYDAY]~s~ Dein Stundenumsatz beträgt ~g~{ paycheck.Amount.ToMoneyString() }~s~."); else ChatService.SendMessage(client, $"~g~[PAYDAY]~s~ Dein Stundenumsatz beträgt ~r~-{ Math.Abs(paycheck.Amount).ToMoneyString() }~s~."); diff --git a/ReallifeGamemode.Server/Managers/BusinessManager.cs b/ReallifeGamemode.Server/Managers/BusinessManager.cs index 6507ea0b..9662974b 100644 --- a/ReallifeGamemode.Server/Managers/BusinessManager.cs +++ b/ReallifeGamemode.Server/Managers/BusinessManager.cs @@ -131,7 +131,7 @@ namespace ReallifeGamemode.Server.Managers [ServerEvent(Event.PlayerEnterVehicle)] public void CarDealerBusiness_PlayerEnterVehicle(Player player, Vehicle veh, int seat) { - if(player.IsAdminDuty()) + if (player.IsAdminDuty()) { return; } @@ -181,7 +181,7 @@ namespace ReallifeGamemode.Server.Managers return; } player.SendChatMessage("~y~Du hast das Fahrzeug erfolgreich gekauft"); - player.SendNotification("~r~[Wichtig] ~w~Benutze 'X', um dein Fahrzeug umzuparken."); + player.SendNotification("~r~[Wichtig] ~w~Benutze 'Z', um dein Fahrzeug umzuparken."); newVeh = new UserVehicle { @@ -222,7 +222,7 @@ namespace ReallifeGamemode.Server.Managers PrimaryColor = 111, SecondaryColor = 111, Active = true, - BuyPrice = price + BuyPrice = (int)(price * FACTION_CAR_MULTIPLIER) }; } //else if (target == "Gruppe") diff --git a/ReallifeGamemode.Server/Managers/InteractionManager.cs b/ReallifeGamemode.Server/Managers/InteractionManager.cs index 78983665..536a9fe9 100644 --- a/ReallifeGamemode.Server/Managers/InteractionManager.cs +++ b/ReallifeGamemode.Server/Managers/InteractionManager.cs @@ -475,7 +475,7 @@ namespace ReallifeGamemode.Server.Managers var backPrice = (int)(vehPrice * 0.4); player.SetData("SellVehicleDecision", true); player.SetData("VehicleToSell", id); - ChatService.SendMessage(player, "~s~Möchtes du das Fahrzeug ~y~" + veh.DisplayName + " ~s~wirklich für ~g~$" + backPrice + " ~s~verkaufen? Drücke ~g~J~s~ zum Bestätigen oder ~r~N ~s~zum Abbrechen"); + ChatService.SendMessage(player, "~s~Möchtest du das Fahrzeug ~y~" + veh.DisplayName + " ~s~wirklich für ~g~" + backPrice.ToMoneyString() + " ~s~verkaufen? Drücke ~g~J~s~ zum Bestätigen oder ~r~N ~s~zum Abbrechen."); } } @@ -493,7 +493,7 @@ namespace ReallifeGamemode.Server.Managers GTANetworkAPI.Vehicle veh = VehicleManager.GetVehicleFromServerVehicle(userVehicle); user.BankAccount.Balance += backPrice; - ChatService.SendMessage(player, $"~b~[INFO]~s~ Du hast durch den Autoverkauf ~g~{backPrice.ToMoneyString()}~s~ erhalten."); + ChatService.SendMessage(player, $"~b~[INFO]~s~ Du hast durch den Autoverkauf ~g~{backPrice.ToMoneyString()} ~s~erhalten."); VehicleManager.DeleteVehicle(veh); dbContext.UserVehicles.Remove(userVehicle); @@ -570,7 +570,7 @@ namespace ReallifeGamemode.Server.Managers player.SetData("SellVehicleDecision", true); player.SetData("VehicleToSell", id); - ChatService.SendMessage(player, "~s~Möchtes du das Fahrzeug ~y~" + veh.DisplayName + " ~s~wirklich für ~g~$" + backPrice + " ~s~verkaufen? Drücke ~g~J~s~ zum Bestätigen oder ~r~N ~s~zum Abbrechen"); + ChatService.SendMessage(player, "~s~Möchtest du das Fahrzeug ~y~" + veh.DisplayName + " ~s~wirklich für ~g~" + backPrice.ToMoneyString() + " ~s~verkaufen? Drücke ~g~J~s~ zum Bestätigen oder ~r~N ~s~zum Abbrechen."); } } @@ -603,8 +603,8 @@ 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~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); + player.SendNotification($"~w~Du hast ~y~{targetname} ~w~ein Ticket in Höhe von ~b~{amount.ToMoneyString()} ~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.ToMoneyString()} ~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); @@ -612,7 +612,7 @@ namespace ReallifeGamemode.Server.Managers } else { - player.SendNotification("~r~Du kannst nur zwischen $1 und $10.000 angeben!"); + player.SendNotification("~r~Du kannst nur einen Betrag zwischen $1 und $10.000 angeben!"); } } } @@ -655,7 +655,7 @@ namespace ReallifeGamemode.Server.Managers if (targetUser.DriverLicenseVehicle == false && targetUser.DriverLicenseBike == false) { - player.SendNotification("~r~Spieler hat weder Auto- noch Motorradführerschein!"); + player.SendNotification("~r~Der Spieler hat weder einen Auto- noch einen Motorradführerschein!"); return; } @@ -667,7 +667,7 @@ namespace ReallifeGamemode.Server.Managers targetUser.Points += amount; - player.SendNotification($"~w~Du hast ~y~{targetname} ~b~{amount} ~w~Strafpunkte gegeben. Grund: ~g~{reason}~w~."); + 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 (Grund: ~r~{reason}~w~).", true); ChatService.HQMessage(targetname + " hat von " + playername + " " + amount + " Strafpunkt(e) erhalten (Grund: " + reason + "). Gesamt: " + targetUser.Points); @@ -712,8 +712,8 @@ namespace ReallifeGamemode.Server.Managers if (type == "Angenommen") { - target.SendNotification($"~g~Du hast das Ticket über ~b~{ticket_amount}$ ~g~angenommen und bezahlt.", true); - player.SendNotification($"~y~{targetname} ~g~hat das Ticket über ~b~{ticket_amount}$ ~g~angenommen und bezahlt.", true); + target.SendNotification($"~g~Du hast das Ticket über ~b~{ticket_amount.ToMoneyString()} ~g~angenommen und bezahlt.", true); + player.SendNotification($"~y~{targetname} ~g~hat das Ticket über ~b~{ticket_amount.ToMoneyString()} ~g~angenommen und bezahlt.", true); using (var dbContext = new DatabaseContext()) { User user = player.GetUser(dbContext); @@ -741,8 +741,8 @@ namespace ReallifeGamemode.Server.Managers } else if (type == "Abgelehnt") { - target.SendNotification($"~r~Du hast das Ticket über ~b~{ticket_amount}$ ~r~abgelehnt.", true); - player.SendNotification($"~y~{targetname} ~r~hat das Ticket über ~b~{ticket_amount}$ ~r~abgelehnt.", true); + target.SendNotification($"~r~Du hast das Ticket über ~b~{ticket_amount.ToMoneyString()} ~r~abgelehnt.", true); + player.SendNotification($"~y~{targetname} ~r~hat das Ticket über ~b~{ticket_amount.ToMoneyString()} ~r~abgelehnt.", true); target.ResetData("ticket_boolean"); target.ResetData("ticket_amount"); target.ResetData("ticket_player"); @@ -798,8 +798,8 @@ namespace ReallifeGamemode.Server.Managers if (amount > 0 && amount <= 5000) { - player.SendNotification($"~w~Du hast ~y~{targetname} ~w~ ${amount} gegeben."); - target.SendNotification($"~w~ Du hast von ~y~{playername} ~w~ ${amount} erhalten.", true); + player.SendNotification($"~w~Du hast ~y~{targetname} ~w~{amount.ToMoneyString()} gegeben."); + target.SendNotification($"~w~ Du hast von ~y~{playername} ~w~{amount.ToMoneyString()} erhalten.", true); using (var dbContext = new DatabaseContext()) { @@ -810,7 +810,7 @@ namespace ReallifeGamemode.Server.Managers } else { - player.SendNotification("~r~ Du kannst nur zwischen $1 und $5.000 geben!"); + player.SendNotification("~r~Du kannst nur zwischen $1 und $5.000 geben!"); } } } @@ -832,7 +832,7 @@ namespace ReallifeGamemode.Server.Managers if (listPlayers.Count() > 0) player.TriggerEvent("showWantedlist", JsonConvert.SerializeObject(listPlayers)); else - player.SendNotification("~r~[Fehler] ~w~Es gibt derzeitig keine Verbrecher!"); + player.SendNotification("~r~[Fehler] ~w~Es gibt derzeit keine Verbrecher!"); } @@ -860,7 +860,7 @@ namespace ReallifeGamemode.Server.Managers { if (player.GetUser().FactionId == 2 && player.IsDuty()) { - player.SendNotification("~r~[Fehler] ~w~Du kannst keinen Sanitäter rufen."); + player.SendNotification("~r~[Fehler] ~w~Du kannst keinen Sanitäter rufen"); return; } @@ -877,14 +877,14 @@ namespace ReallifeGamemode.Server.Managers }; if (player.GetData("healauftrag") == true) { - player.SendNotification("~r~[Fehler] ~w~Du hast bereits ein Sanitäter gerufen."); + player.SendNotification("~r~[Fehler] ~w~Du hast bereits einen Sanitäter gerufen"); } else { Medic.AddTaskToList(healTask); player.SetData("healauftrag", true); player.SendNotification("~w~Du hast einen Sanitäter um Hilfe gerufen"); - ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " hat soeben einen Serviceauftrag beantragt.", new List() { 2 }); + ChatService.BroadcastFaction("~y~[MEDIC] ~w~" + player.Name + " hat soeben einen Service-Auftrag aufgegeben.", new List() { 2 }); } } diff --git a/ReallifeGamemode.Server/Managers/SaveManager.cs b/ReallifeGamemode.Server/Managers/SaveManager.cs index 7dc79981..87f397b7 100644 --- a/ReallifeGamemode.Server/Managers/SaveManager.cs +++ b/ReallifeGamemode.Server/Managers/SaveManager.cs @@ -158,7 +158,7 @@ namespace ReallifeGamemode.Server.Managers public static Vehicle SaveFactionVehicleData(Vehicle veh, VehicleHash vehicleModel, Vector3 vehiclePosition, float vehicleHeading, - string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, int[] factionId, int livery) + string vehicleNumberPlate, int vehiclePrimaryColor, int vehicleSecondaryColor, bool vehicleLocked, bool vehicleEngine, int[] factionId, int livery, int buyPrice) { using (var saveData = new DatabaseContext()) { @@ -175,7 +175,8 @@ namespace ReallifeGamemode.Server.Managers SecondaryColor = vehicleSecondaryColor, Locked = vehicleLocked, Active = true, - Livery = livery + Livery = livery, + BuyPrice = buyPrice }; saveData.FactionVehicles.Add(dataSet); saveData.SaveChanges(); diff --git a/ReallifeGamemode.Server/Managers/TuningManager.cs b/ReallifeGamemode.Server/Managers/TuningManager.cs index 62c765f2..af39a796 100644 --- a/ReallifeGamemode.Server/Managers/TuningManager.cs +++ b/ReallifeGamemode.Server/Managers/TuningManager.cs @@ -36,7 +36,7 @@ namespace ReallifeGamemode.Server.Managers colShape.OnEntityEnterColShape += (cs, c) => { using var dbContext = new DatabaseContext(); - if (c.IsInVehicle && c.VehicleSeat == 0 && IsPlayerAllowedToTuneVehicle(c, c.Vehicle, dbContext)) + if (c.IsInVehicle && c.VehicleSeat == 0) { c.TriggerEvent("showTuningInfo"); } @@ -53,7 +53,7 @@ namespace ReallifeGamemode.Server.Managers tuningGarages.Add(colShape); } - private static bool IsPlayerAllowedToTuneVehicle(Player c, Vehicle vehicle, DatabaseContext dbContext) + private static bool IsPlayerAllowedToTuneVehicle(Player c, ServerVehicle serverVehicle, DatabaseContext dbContext) { User user = c.GetUser(); if (user == null) @@ -61,7 +61,6 @@ namespace ReallifeGamemode.Server.Managers return false; } - ServerVehicle serverVehicle = vehicle.GetServerVehicle(dbContext); if (serverVehicle == null) { return false; @@ -89,11 +88,12 @@ namespace ReallifeGamemode.Server.Managers using (var dbContext = new DatabaseContext()) { - foreach (VehicleMod vMod in dbContext.VehicleMods.Where(vM => vM.ServerVehicleId == sVeh.Id).ToList()) + foreach (VehicleMod vMod in dbContext.VehicleMods.Where(vM => vM.ServerVehicleId == sVeh.Id).OrderByDescending(v => v.Slot).ToList()) { if (vMod.Slot == -2) { veh.SetSharedData("wheelType", vMod.ModId); + NAPI.ClientEvent.TriggerClientEventForAll("vehicleToggleMod", veh, -2, vMod.ModId); } else if (vMod.Slot == 18) { @@ -106,6 +106,10 @@ namespace ReallifeGamemode.Server.Managers if (vMod.ModId == 1) color = 13; veh.SetSharedData("headlightColor", color); } + else if (vMod.Slot == 23) + { + veh.SetMod(23, vMod.ModId); + } else veh.SetMod(vMod.Slot, vMod.ModId - 1); } } @@ -120,13 +124,20 @@ namespace ReallifeGamemode.Server.Managers bool onlyRepair = false; - ServerVehicle serverVehicle = vehicle.GetServerVehicle(); + using var dbContext = new DatabaseContext(); + + ServerVehicle serverVehicle = vehicle.GetServerVehicle(dbContext); if (serverVehicle is FactionVehicle factionVehicle && factionVehicle.BuyPrice == 0) { player.SendNotification("~r~Dieses Fahrzeug kann aktuell leider nicht getunt werden"); onlyRepair = true; } + if (!IsPlayerAllowedToTuneVehicle(player, serverVehicle, dbContext)) + { + onlyRepair = true; + } + player.TriggerEvent("showTuningMenu", false, GetVehicleBasePrice(player.Vehicle), onlyRepair); } diff --git a/ReallifeGamemode.Server/Managers/VehicleManager.cs b/ReallifeGamemode.Server/Managers/VehicleManager.cs index 80aa1580..341437a4 100644 --- a/ReallifeGamemode.Server/Managers/VehicleManager.cs +++ b/ReallifeGamemode.Server/Managers/VehicleManager.cs @@ -767,6 +767,126 @@ namespace ReallifeGamemode.Server.Managers "fibr",//mod }; + private static readonly List _restrictedVehicles = new List() + { + "dinghy5", + "kosatka", + "cerberus", + "cerberus2", + "cerberus3", + "firetruk", + "issi4", + "issi5", + "issi6", + "jb700", + "jb7002", + "riot2", + "akula", + "annihilator", + "buzzard", + "havok", + "hunter", + "savage", + "seasparrow", + "valkyrie", + "valkyrie2", + "annihilator2", + "seasparrow2", + "seasparrow3", + "apc", + "barrage", + "chernobog", + "halftrack", + "khanjali", + "minitank", + "rhino", + "scarab", + "scarab2", + "scarab3", + "thruster", + "trailersmall2", + "oppressor", + "oppressor2", + "deathbike", + "deathbike2", + "deathbike3", + "dominator4", + "dominator5", + "dominator6", + "slamvan4", + "slamvan5", + "slamvan6", + "imperator3", + "imperator", + "imperator2", + "impaler2", + "impaler3", + "impaler4", + "tampa3", + "bruiser", + "bruiser2", + "bruiser3", + "brutus", + "brutus2", + "brutus3", + "caracara", + "dune3", + "insurgent", + "insurgent3", + "monster3", + "monster4", + "monster5", + "menacer", + "nightshark", + "fibn2", + "rcbandito", + "minitank", + "technical", + "technical2", + "technical3", + "avenger", + "avenger2", + "bombushka", + "hydra", + "lazer", + "microlight", + "mogul", + "molotok", + "nokota", + "pyro", + "rogue", + "strikeforce", + "seabreeze", + "starling", + "tula", + "volatol", + "alkonost", + "limo2", + "zr380", + "zr3802", + "zr3803", + "ardent", + "deluxo", + "stromberg", + "toreador", + "comet4", + "scramjet", + "vigilante", + "voltic2", + "freight", + "freightcar", + "freightcont1", + "freightcont2", + "freightgrain", + "metrotrain", + "tankercar", + "trailerlarge", + "boxville5", + "mule4", + "speedo4", + "pounder2" + }; + private static readonly Dictionary _serverVehicles = new Dictionary(); private static readonly Dictionary lastPositions = new Dictionary(); @@ -785,6 +905,8 @@ namespace ReallifeGamemode.Server.Managers } } + public static bool IsVehicleRestricted(string name) => _restrictedVehicles.Contains(name.ToLower()); + public static void VehicleTimerTick() { NAPI.Task.Run(() => @@ -967,7 +1089,7 @@ namespace ReallifeGamemode.Server.Managers return; } InventoryManager.RemoveAllItemsfromVehicleInventory(vehicle); - + serverVehicle.Spawn(vehicle); } diff --git a/ReallifeGamemode.Server/Managers/WeaponManager.cs b/ReallifeGamemode.Server/Managers/WeaponManager.cs index dc111434..75a7390f 100644 --- a/ReallifeGamemode.Server/Managers/WeaponManager.cs +++ b/ReallifeGamemode.Server/Managers/WeaponManager.cs @@ -105,6 +105,26 @@ namespace ReallifeGamemode.Server.Managers "militaryrifle" }; + private static readonly List _restrictedWeapons = new List() + { + "bat", + "flashlight", + "knuckle", + "nightstick", + "pistol", + "pistol_mk2", + "combatpistol", + "stungun", + "pistol50", + "smg", + "assaultsmg", + "combatpdw", + "pumpshotgun", + "assaultrifle", + "carbinerifle", + "sniperrifle" + }; + private static readonly Dictionary causeOfDeath = new Dictionary() { { 2460120199, "Antique Cavalry Dagger"}, @@ -341,6 +361,8 @@ namespace ReallifeGamemode.Server.Managers { 1470379660 ,"Perico Pistol" }, }; + public static bool IsAllowedWeapon(string name) => _restrictedWeapons.Contains(name.ToLower()); + public static bool IsValidHash(uint hash) { foreach (WeaponHash vh in Enum.GetValues(typeof(WeaponHash))) diff --git a/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs b/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs index 3b11c680..fe7af038 100644 --- a/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs +++ b/ReallifeGamemode.Server/WeaponDeal/WeaponDealManager.cs @@ -76,6 +76,7 @@ namespace ReallifeGamemode.Server.WeaponDeal vector = WeaponDealPoints.getRndWD_Route(user.FactionId.Value); if (vector == new Vector3()) return; + fVeh.SetData("weaponDealPoint", vector); if (user.Faction.WeaponDealTime > 0) @@ -95,7 +96,7 @@ namespace ReallifeGamemode.Server.WeaponDeal switch (i) { case 1: - msg = "Das Madrazo Kartell scheint am Strand noch einige Waffen verbuddelt zu haben"; + msg = "Ein paar hochrangige Mitglieder der U.S. Armee versuchen alte sowjetische Waffen loszuwerden"; break; case 2: @@ -103,19 +104,15 @@ namespace ReallifeGamemode.Server.WeaponDeal break; case 3: - msg = "Ein paar hochrangige Mitglieder der U.S. Armee versuchen alte sowjetische Waffen loszuwerden"; - break; - - case 4: msg = "Die Triaden können uns mit östlichen Importen beliefern"; break; - case 5: + case 4: msg = "Die albanische Mafia will wohl wieder Geschäfte mit uns machen"; break; - case 6: - msg = "Die Waffen der Russen waren schon immer zuverlässig"; + case 5: + msg = "Das Madrazo Kartell scheint am Strand noch einige Waffen verbuddelt zu haben"; break; } } @@ -127,8 +124,7 @@ namespace ReallifeGamemode.Server.WeaponDeal ChatService.BroadcastFaction($"~y~[WAFFENDEAL]~s~ {msg}.", user.Faction); - string vehName = NAPI.Vehicle.GetVehicleDisplayName(factionVehicle.Model); - ChatService.SendMessage(client, $"~y~[WAFFENDEAL]~s~ Steige in den {vehName} ein und fahre zum Übergabepunkt."); + ChatService.SendMessage(client, "~y~[WAFFENDEAL]~s~ Steige in den ~y~Transporter ~s~ein und fahre zum Übergabepunkt."); fVeh.SetData("weaponDeal", true); InventoryManager.RemoveAllItemsfromVehicleInventory(fVeh); Faction fac = context.Factions.Where(f => f.Id == user.FactionId).FirstOrDefault(); diff --git a/ReallifeGamemode.Server/WeaponDeal/WeaponDealPoints.cs b/ReallifeGamemode.Server/WeaponDeal/WeaponDealPoints.cs index d549ccd7..4f2a085b 100644 --- a/ReallifeGamemode.Server/WeaponDeal/WeaponDealPoints.cs +++ b/ReallifeGamemode.Server/WeaponDeal/WeaponDealPoints.cs @@ -11,18 +11,17 @@ namespace ReallifeGamemode.Server.WeaponDeal public static readonly IReadOnlyCollection WT_Route = new List { - //new Vector3(2465.163, 1589.396, 32.72029), ungeeignet - new Vector3(1532.045, 1702.775, 107.7561), //Hütte iwo Östlich - new Vector3(58.67861, 3717.103, 37.75301), //Lost MC - new Vector3(-2174.734, 4269.301, 46.95574), //Army Base - new Vector3(2530.14, 2617.15, 35.76), - new Vector3(-3179.78, 820.08, 1.59), + new Vector3(-2174.734, 4269.301, 46.95574), // U.S. Armee + new Vector3(58.67861, 3717.103, 37.75301), // Lost MC + new Vector3(2530.14, 2617.15, 35.76), // Triaden + new Vector3(1532.045, 1702.775, 107.7561), // Albanische Mafia + new Vector3(-3179.78, 820.08, 1.59) // Madrazo Kartell }.AsReadOnly(); public static readonly IReadOnlyCollection StaatsFrakWT_Route = new List { - new Vector3(3627.138, 3759.711, 25.515), //Human Labs - new Vector3(-1805.300, 3101.446, 29.841) //Staatsfraktions WT Army Base + new Vector3(3627.138, 3759.711, 25.515), //Humane Labs + new Vector3(-1805.300, 3101.446, 29.841) //Army Base }.AsReadOnly(); public static Vector3 getRndWD_Route(int factionID) @@ -42,15 +41,6 @@ namespace ReallifeGamemode.Server.WeaponDeal factionWeaponDeal[factionID] = rnd.Next(0, WT_Route.Count); return WT_Route.ElementAt(factionWeaponDeal[factionID]); } - - /* if (factionWeaponDeal[factionID] == -1) - { - Random rnd = new Random(); - factionWeaponDeal[factionID] = rnd.Next(0, WT_Route.Count - 1); - } - return WT_Route.ElementAt(factionWeaponDeal[factionID]); - - */ } } }