formatted code

This commit is contained in:
Lennart Kampshoff
2019-05-05 17:59:11 +02:00
parent a34c03eae9
commit a88d5256a8
54 changed files with 290 additions and 210 deletions

View File

@@ -41,7 +41,7 @@ namespace ReallifeGamemode.Server.Events
break;
}
}
GroundItem.PickUpGroundItem(player);
@@ -84,15 +84,15 @@ namespace ReallifeGamemode.Server.Events
if (!player.IsLoggedIn()) return;
User user = player.GetUser();
switch (user.FactionId)
{
{
//LSFD
case 2:
player.TriggerEvent("showFactionInteraction", user.FactionId, player.GetData("duty"), user.Faction.Name, user.FactionLeader, Medic.ReviveTasks.Count.ToString(), Medic.HealTasks.Count.ToString(), Medic.FireTasks.Count.ToString());
break;
}
}
}
[RemoteEvent("keyPress:E")]
[RemoteEvent("keyPress:E")]
public void KeyPressE(Client player)
{
if (!player.IsLoggedIn()) return;
@@ -102,7 +102,7 @@ namespace ReallifeGamemode.Server.Events
DutyPoint nearest = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5);
if (nearest == null) return;
if (player.Position.DistanceTo(nearest.Position) <= 1.5 && nearest.FactionId == user.FactionId)
{
{
var nameTagColor = new Color(0, 0, 0);
var factionId = user.FactionId;
@@ -113,9 +113,9 @@ namespace ReallifeGamemode.Server.Events
if (player.GetUser().FactionId == 2) //Fire Department
{
int medicCount = 0;
foreach(Client c in NAPI.Pools.GetAllPlayers())
foreach (Client c in NAPI.Pools.GetAllPlayers())
{
if((c.GetUser()?.Faction.Id ?? 0) == 2)
if ((c.GetUser()?.Faction.Id ?? 0) == 2)
{
medicCount++;
}
@@ -134,22 +134,22 @@ namespace ReallifeGamemode.Server.Events
{
List<CharacterCloth> clothes = context.CharacterClothes.Where(u => u.UserId == user.Id && u.Duty == true).ToList();
foreach(var cloth in clothes)
foreach (var cloth in clothes)
{
if(cloth.SlotType == 0)
if (cloth.SlotType == 0)
{
player.SetClothes(cloth.SlotId, cloth.ClothId, 0);
}
else
{
if(cloth.ClothId != -1)
if (cloth.ClothId != -1)
{
player.SetAccessories(cloth.SlotId, cloth.ClothId, 0);
}
else
{
player.ClearAccessory(cloth.SlotId);
}
}
}
}
}
@@ -178,7 +178,7 @@ namespace ReallifeGamemode.Server.Events
List<Client> players = NAPI.Pools.GetAllPlayers();
List<ListPlayer> ListPlayers = new List<ListPlayer>();
foreach(Client listPlayer in players)
foreach (Client listPlayer in players)
{
var lPlayer = new ListPlayer
{
@@ -190,7 +190,7 @@ namespace ReallifeGamemode.Server.Events
ListPlayers.Add(lPlayer);
}
player.TriggerEvent("fetchPlayerList", JsonConvert.SerializeObject(ListPlayers));
}
}
[RemoteEvent("keyPress:K")]
public void KeyPressK(Client player)
{
@@ -210,9 +210,9 @@ namespace ReallifeGamemode.Server.Events
using (var context = new DatabaseContext())
{
List<DutyCloth> clothes = context.DutyClothes.ToList().FindAll(c => c.FactionId == user.FactionId && c.Gender == user.GetCharacter().Gender);
foreach(var cloth in clothes)
foreach (var cloth in clothes)
{
if(cloth.SlotType == 1)
if (cloth.SlotType == 1)
{
if (cloth.ClothId != -1)
{
@@ -242,7 +242,7 @@ namespace ReallifeGamemode.Server.Events
player.TriggerEvent("showDutyClothMenu", hats.ToArray(), tops.ToArray(), legs.ToArray(), shoes.ToArray());
}
}
}
[RemoteEvent("keyPress:L")]
public void KeyPressL(Client player)
@@ -263,19 +263,19 @@ namespace ReallifeGamemode.Server.Events
if (player.IsInVehicle && player.VehicleSeat == -1)
{
ServerVehicle veh = player.Vehicle.GetServerVehicle();
if(veh != null)
if (veh != null)
{
if(veh is FactionVehicle fV && fV.FactionId != player.GetUser()?.FactionId && (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN3) ?? false))
if (veh is FactionVehicle fV && fV.FactionId != player.GetUser()?.FactionId && (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN3) ?? false))
{
return;
}
else if(veh is ShopVehicle)
else if (veh is ShopVehicle)
{
return;
}
}
player.TriggerEvent("ToggleVehicleMenu");
}
}
}
}
}