inshallah kein fehler

This commit is contained in:
hydrant
2020-05-10 23:18:53 +02:00
153 changed files with 6517 additions and 3407 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
@@ -47,6 +47,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());
@@ -182,20 +183,73 @@ namespace ReallifeGamemode.Server.Events
if (!player.IsLoggedIn()) return;
var user = player.GetUser();
ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.6 && (user.FactionId == 1 || user.FactionId == 3));
ClotheshopPoint nearestClotheShopPoint = PositionManager.clotheshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6 && (!user.GetData<bool>("duty")));
ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6);
JobPoint nearestJobPoint = PositionManager.JobPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6);
if (user?.FactionId != null)
{
DutyPoint nearestDuty = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.6 && d.FactionId == user.FactionId);
WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.6 && w.FactionId == user.FactionId);
JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.6 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData<bool>("duty"));
DutyPoint nearestDuty = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5 && d.FactionId == user.FactionId);
WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId);
JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData<bool>("duty"));
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 (nearestDuty != null && !player.IsInVehicle)// Duty Point
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);
var factionId = user.FactionId;
@@ -275,7 +329,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>();
@@ -287,10 +340,14 @@ 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();
}
bool unloadedWeaponPackage = false;
List<UserItem> fItem = context.UserItems.Where(u => u.UserId == user.Id).ToList();
@@ -301,7 +358,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);
@@ -332,14 +393,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());
@@ -452,7 +516,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")]
@@ -507,9 +572,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;
@@ -519,7 +586,6 @@ namespace ReallifeGamemode.Server.Events
player.TriggerEvent("showDutyClothMenu", hats.ToArray(), tops.ToArray(), legs.ToArray(), shoes.ToArray());
}
}
}
[RemoteEvent("keyPress:L")]
@@ -693,7 +759,6 @@ namespace ReallifeGamemode.Server.Events
if (!player.IsInVehicle)
{
Vehicle.VehicleMenuLockCarEvent(player);
GroundItem.PickUpGroundItem(player);