From a1234a7fcfc3315461400606b8eb5dcd5586b12d Mon Sep 17 00:00:00 2001 From: "michael.reiswich" Date: Fri, 21 May 2021 20:57:55 +0200 Subject: [PATCH] some changes --- ReallifeGamemode.Server/Events/EnterVehicleAttempt.cs | 2 +- ReallifeGamemode.Server/Events/Key.cs | 5 +++++ ReallifeGamemode.Server/Factions/Medic/Medic.cs | 2 +- ReallifeGamemode.Server/Finance/Economy.cs | 9 +++++++-- ReallifeGamemode.Server/Inventory/Items/Notfallkit.cs | 5 +++++ ReallifeGamemode.Server/Inventory/Items/Rubellos.cs | 8 ++++---- ReallifeGamemode.Server/Util/AttachmentSync.cs | 8 ++++---- 7 files changed, 27 insertions(+), 12 deletions(-) diff --git a/ReallifeGamemode.Server/Events/EnterVehicleAttempt.cs b/ReallifeGamemode.Server/Events/EnterVehicleAttempt.cs index f4814c45..fa9700dc 100644 --- a/ReallifeGamemode.Server/Events/EnterVehicleAttempt.cs +++ b/ReallifeGamemode.Server/Events/EnterVehicleAttempt.cs @@ -31,7 +31,7 @@ namespace ReallifeGamemode.Server.Events { if (!veh.GetOwners().Contains(player.GetUser().FactionId ?? 0) && !(u.IsAdmin(AdminLevel.HEADADMIN) && player.IsAdminDuty()) && !JobBase.GetPlayerInJob().Contains(player)) { - if ((VehicleHash)vehicle.Model == WeaponDealManager.WEAPON_DEAL_GANG_VEHICLE_HASH) + if ((VehicleHash)vehicle.Model == WeaponDealManager.WEAPON_DEAL_GANG_VEHICLE_HASH || (VehicleHash)vehicle.Model == WeaponDealManager.WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH) { if (WeaponDealManager.checkWeaponDbyVehicle(vehicle)) return; diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index 56bced38..dde1e8cf 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -946,6 +946,11 @@ namespace ReallifeGamemode.Server.Events return; } + if(player.Dead == true) + { + return; + } + bool state = VehicleStreaming.GetEngineState(v); ServerVehicle sV = v.GetServerVehicle(); if (sV != null) diff --git a/ReallifeGamemode.Server/Factions/Medic/Medic.cs b/ReallifeGamemode.Server/Factions/Medic/Medic.cs index 58847dcf..96a17975 100644 --- a/ReallifeGamemode.Server/Factions/Medic/Medic.cs +++ b/ReallifeGamemode.Server/Factions/Medic/Medic.cs @@ -28,7 +28,7 @@ namespace ReallifeGamemode.Server.Factions.Medic public static List HealTasks = new List(); public static List FireTasks = new List(); public static List HealDecisions = new List(); - public static int ReviveIncome = 100; + public static int ReviveIncome = 50; public static int dutyMedics = 0; public static int reviveTaskTime = 120; diff --git a/ReallifeGamemode.Server/Finance/Economy.cs b/ReallifeGamemode.Server/Finance/Economy.cs index 860f3c05..ca79a7d2 100644 --- a/ReallifeGamemode.Server/Finance/Economy.cs +++ b/ReallifeGamemode.Server/Finance/Economy.cs @@ -105,6 +105,11 @@ namespace ReallifeGamemode.Server.Finance healthInsurance = 0; } + if (healthInsurance > 150) + { + healthInsurance = 150; + } + int? factionMoney = null; if (user.Faction != null && user.FactionRank != null) @@ -185,8 +190,8 @@ namespace ReallifeGamemode.Server.Finance .ThenInclude(h => h.BankAccount) .Where(hR => hR.UserId == u.Id); - dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 2).First().BankAccount.Balance += (int)(paycheck.HealthInsurance * 0.1); - logger.LogInformation("Medic faction got a health insurance payment of {0} dollars from player {1}", paycheck.HealthInsurance * 0.1, client.Name); + dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 2).First().BankAccount.Balance += (int)(paycheck.HealthInsurance); + logger.LogInformation("Medic faction got a health insurance payment of {0} dollars from player {1}", paycheck.HealthInsurance, client.Name); if (rentals.Any()) { foreach (var rental in rentals) diff --git a/ReallifeGamemode.Server/Inventory/Items/Notfallkit.cs b/ReallifeGamemode.Server/Inventory/Items/Notfallkit.cs index 5ea73a88..5dff4e68 100644 --- a/ReallifeGamemode.Server/Inventory/Items/Notfallkit.cs +++ b/ReallifeGamemode.Server/Inventory/Items/Notfallkit.cs @@ -19,6 +19,9 @@ namespace ReallifeGamemode.Server.Inventory.Items public override uint Object => 875075437; public override int Price => 500; + + public static readonly VehicleHash WEAPON_DEAL_GANG_VEHICLE_HASH = VehicleHash.Gburrito2; + public static readonly VehicleHash WEAPON_DEAL_STAATSFRAK_VEHICLE_HASH = VehicleHash.Policet; public override bool Use(UserItem uItem) { Player player = uItem.GetUser().Player; @@ -28,6 +31,8 @@ namespace ReallifeGamemode.Server.Inventory.Items return false; } + + Vehicle veh = null; var nearestVeh = NAPI.Pools.GetAllVehicles().Where(v => v.Position.DistanceTo(player.Position) <= 5).FirstOrDefault(); diff --git a/ReallifeGamemode.Server/Inventory/Items/Rubellos.cs b/ReallifeGamemode.Server/Inventory/Items/Rubellos.cs index 22c2f1e4..7372b6f1 100644 --- a/ReallifeGamemode.Server/Inventory/Items/Rubellos.cs +++ b/ReallifeGamemode.Server/Inventory/Items/Rubellos.cs @@ -29,21 +29,21 @@ namespace ReallifeGamemode.Server.Inventory.Items return false; } Random random = new Random(); - int randomNumber = random.Next(1, 5); + int randomNumber = random.Next(1, 2); if (randomNumber == 1) { using (var dbContext = new DatabaseContext()) { User winner = player.GetUser(dbContext); winner.Handmoney += 1000; - player.TriggerEvent("SERVER:SET_HANDMONEY", winner.Handmoney); + //player.TriggerEvent("SERVER:SET_HANDMONEY", winner.Handmoney); dbContext.SaveChanges(); } - Services.ChatService.SendMessage(player, "Glückwunsch, du hast $1000 gewonnen!"); + player.SendNotification("Glückwunsch du hast ~g~$~w~1000 gewonnen!"); } else { - Services.ChatService.SendMessage(player, "Leider kein Gewinn, viel Glück beim nächsten mal"); + player.SendNotification("Leider kein Gewinn, viel Glück beim nächsten mal."); } player.SendNotification("Du hast ~g~" + InventoryManager.GetItemById(uItem.ItemId).Name + " ~s~verwendet.", false); InventoryManager.RemoveUserItem(player.GetUser(), uItem, 1); diff --git a/ReallifeGamemode.Server/Util/AttachmentSync.cs b/ReallifeGamemode.Server/Util/AttachmentSync.cs index 5828917a..505e1c62 100644 --- a/ReallifeGamemode.Server/Util/AttachmentSync.cs +++ b/ReallifeGamemode.Server/Util/AttachmentSync.cs @@ -135,15 +135,15 @@ public class AttachmentSyncExample : Script player.AddAttachment(Base36Extensions.FromBase36(hash), true); } - //[Command("xdd")] + [Command("xdd")] public void attachment(Player player) { Vehicle veh = player.Vehicle; - if (!player.HasAttachment("ammobox")) + if (!veh.HasAttachment("weapondeal")) { - player.AddAttachment("ammobox", false); + //player.AddAttachment("weapondeal", false); //player.SyncAnimation("carryBox"); - //veh.AddAttachment("weapondeal1", false); + veh.AddAttachment("weapondeal", false); //veh.AddAttachment("weapondeal2", false); } else