Miese Corona Zeiten push für Lenhardt

This commit is contained in:
Siga
2020-05-10 19:19:53 +02:00
parent 15e4cec8ee
commit efbff34c21
159 changed files with 8042 additions and 8695 deletions

View File

@@ -2,21 +2,21 @@
using System.Linq;
using GTANetworkAPI;
using Newtonsoft.Json;
using ReallifeGamemode.Server.Classes;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Classes;
using ReallifeGamemode.Server.DrivingSchool;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Factions.Medic;
using ReallifeGamemode.Server.Finance;
using ReallifeGamemode.Server.Inventory;
using ReallifeGamemode.Server.Inventory.Interfaces;
using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Database;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.Inventory.Interfaces;
using ReallifeGamemode.Server.DrivingSchool;
using ReallifeGamemode.Server.Types;
using Microsoft.EntityFrameworkCore;
using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.WeaponDeal;
/**
* @overview Life of German Reallife - Event Key (Key.cs)
* @author VegaZ
@@ -46,6 +46,7 @@ namespace ReallifeGamemode.Server.Events
tempBlip.Transparency.ToString(), 200.ToString(), tempBlip.ShortRange.ToString(), 0.ToString(), 0.ToString());
player.SendNotification("~y~Blip~s~ erstellt!", false);
break;
case "atm":
SaveManager.OnSaveBlipData(player, "500", "Geldautomat", 0.7.ToString(), "11",
"0", "200", true.ToString(), 0.ToString(), 0.ToString());
@@ -170,7 +171,6 @@ namespace ReallifeGamemode.Server.Events
if (!player.IsLoggedIn()) return;
var user = player.GetUser();
if (user?.FactionId != null)
{
DutyPoint nearestDuty = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5 && d.FactionId == user.FactionId);
@@ -179,7 +179,63 @@ namespace ReallifeGamemode.Server.Events
ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3));
ClotheshopPoint nearestClotheShopPoint = PositionManager.clotheshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData<bool>("duty")));
ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
BehindVehiclePoint nearestBehindVehiclePoint = MarkerBehinVehicle.behindVehiclePoints.Find(s => s.marker.Position.DistanceTo(player.Position) <= 3 && (user.FactionId == 8 || user.FactionId == 7 || user.FactionId == 1 || user.FactionId == 3));
if (nearestBehindVehiclePoint != null)
{
if (player.HasAttachment("ammobox")) return;
using (var dbContext = new DatabaseContext())
{
List<VehicleItem> vehicleItems = dbContext.VehicleItems.Where(f => f.GetVehicle().GetVehicle() == nearestBehindVehiclePoint.vehicle && InventoryManager.GetItemById(f.ItemId) is IWeaponDealItem).ToList();
if (vehicleItems.Count == 0)
{
GTANetworkAPI.Vehicle vehicle = nearestBehindVehiclePoint.vehicle;
if (WeaponDealManager.checkWeaponDbyVehicle(vehicle))
{
vehicle.ResetData("WeaponDealLoad");
}
nearestBehindVehiclePoint.vehicle.RemoveMarkerBehind();
return;
}
foreach (var v in vehicleItems)
{
int itemToAdd = 0;
for (int i = 1; i <= v.Amount; i++)
{
if (InventoryManager.GetUserInventoryWeight(player) + (i * InventoryManager.GetItemById(v.ItemId).Gewicht) > 40000)
{
break;
}
else
{
itemToAdd = i;
}
}
if (itemToAdd == 0)
break;
v.Amount -= itemToAdd;
if (v.Amount <= 0)
dbContext.VehicleItems.Remove(v);
var newItem = new UserItem()
{
ItemId = v.ItemId,
Slot = v.Slot,
Amount = itemToAdd,
UserId = user.Id,
};
InventoryManager.AddItemToInventory(player, newItem.Id, newItem.Amount);
nearestBehindVehiclePoint.usePoint(player);
dbContext.SaveChanges();
return;
}
}
}
if (nearestDuty != null)// Duty Point
{
var nameTagColor = new Color(0, 0, 0);
@@ -259,7 +315,6 @@ namespace ReallifeGamemode.Server.Events
}
if (nearestWeapon != null) // Weapon Point
{
List<string> primarys = new List<string>();
List<string> secondarys = new List<string>();
List<string> melees = new List<string>();
@@ -271,11 +326,13 @@ namespace ReallifeGamemode.Server.Events
melees.Add("Keine");
specials.Add("Keine");
using (var context = new DatabaseContext())
{
if (player.HasAttachment("ammobox"))
{
player.AddAttachment("ammobox", true);
player.StopAnimation();
}
List<UserItem> fItem = context.UserItems.Where(u => u.UserId == user.Id).ToList();
foreach (var item in fItem)
@@ -285,7 +342,11 @@ namespace ReallifeGamemode.Server.Events
{
FactionWeapon weapon = context.FactionWeapons.Where(w => w.FactionId == user.FactionId && w.WeaponModel == iItem.Name).FirstOrDefault();
if (weapon == null)
{
context.Remove(item);
continue;
}
weapon.Ammount += item.Amount;
ChatService.SendMessage(player, item.Amount + " " + iItem.Name + " wurden im Waffenlager hinzugefürgt.");
context.Remove(item);
@@ -311,14 +372,17 @@ namespace ReallifeGamemode.Server.Events
if (user.FactionRank.Order >= weapon.Rank)
primarys.Add(weapon.WeaponModel.ToString());
break;
case 2:
if (user.FactionRank.Order >= weapon.Rank)
secondarys.Add(weapon.WeaponModel.ToString());
break;
case 3:
if (user.FactionRank.Order >= weapon.Rank)
melees.Add(weapon.WeaponModel.ToString());
break;
case 4:
if (user.FactionRank.Order >= weapon.Rank)
specials.Add(weapon.WeaponModel.ToString());
@@ -374,7 +438,8 @@ namespace ReallifeGamemode.Server.Events
public void KeyPressI(Player player)
{
if (!player.IsLoggedIn()) return;
InventoryManager.GetUserItems(player);
player.TriggerEvent("inventoryShow");
InventoryManager.SetBackpackItems(player);
}
[RemoteEvent("keyPress:O")]
@@ -429,9 +494,11 @@ namespace ReallifeGamemode.Server.Events
case 11:
tops.Add(cloth.ClothId.ToString());
break;
case 4:
legs.Add(cloth.ClothId.ToString());
break;
case 6:
shoes.Add(cloth.ClothId.ToString());
break;
@@ -441,7 +508,6 @@ namespace ReallifeGamemode.Server.Events
player.TriggerEvent("showDutyClothMenu", hats.ToArray(), tops.ToArray(), legs.ToArray(), shoes.ToArray());
}
}
}
[RemoteEvent("keyPress:L")]
@@ -526,7 +592,6 @@ namespace ReallifeGamemode.Server.Events
if (!player.IsInVehicle)
{
Vehicle.VehicleMenuLockCarEvent(player);
GroundItem.PickUpGroundItem(player);