Code formatiert

This commit is contained in:
Lennart Kampshoff
2019-12-21 14:03:06 +01:00
parent c5f72c2ce5
commit ed95acc24d
56 changed files with 1771 additions and 1764 deletions

View File

@@ -23,8 +23,8 @@ namespace ReallifeGamemode.Server.Events
player.SetData("isLoggedIn", false);
player.Position = new Vector3(-1883.736, -781.4911, -10);
player.FreezePosition = true;
using (var dbContext = new DatabaseContext())
{
if (!dbContext.WhitelistEntries.Any(w => w.SocialClubName.ToLower() == player.SocialClubName.ToLower()))
@@ -40,7 +40,7 @@ namespace ReallifeGamemode.Server.Events
return;
}
}
if (IsPlayerBanned(player)) return;
player.TriggerEvent("SERVER:Login_ShowBrowser");

View File

@@ -23,11 +23,11 @@ namespace ReallifeGamemode.Server.Events
public void OnPlayerDeath(Client player, Client killer, uint reason)
{
if (!player.IsLoggedIn()) player.Kick();
player.SetData("isDead", true);
player.SetData("isDead", true);
//TODO: Zum Full Release entfernen
ChatService.SendMessage(player, "Du bist durch " + killer.Name + " gestorben: " + reason.ToString());
int? killerId;
float killerPosX;
float killerPosY;
@@ -49,7 +49,7 @@ namespace ReallifeGamemode.Server.Events
killerPosY = killer.Position.Y;
killerPosZ = killer.Position.Z;
killerHeading = killer.Heading;
if(player.HasData("inGangWar") && killer.HasData("inGangWar"))
if (player.HasData("inGangWar") && killer.HasData("inGangWar"))
{
Gangwar.Gangwar.GangwarKill(killer, player);
}
@@ -57,13 +57,13 @@ namespace ReallifeGamemode.Server.Events
if (player != killer)
{
Autowanted.Check_AutoWanted(killer, player);
string message = "~y~[HINWEIS]: " + killer.Name + " hat " + player.Name + " getötet (" + Managers.WeaponManager.GetCauseOfDeathByHash(reason)+ ")";
string message = "~y~[HINWEIS]: " + killer.Name + " hat " + player.Name + " getötet (" + Managers.WeaponManager.GetCauseOfDeathByHash(reason) + ")";
ChatService.BroadcastAdmin(message, AdminLevel.ADMIN);
}
}
User user = player.GetUser();
if(user.JailTime <= 0)
if (user.JailTime <= 0)
{
//MEDIC AUFTRAG
MedicTask reviveTask = new MedicTask()
@@ -113,7 +113,7 @@ namespace ReallifeGamemode.Server.Events
//JailTime.cs
Jail.Check_PutBehindBars(player);

View File

@@ -38,7 +38,7 @@ namespace ReallifeGamemode.Server.Events
{
NAPI.Util.ConsoleOutput(player.Name + " Timeoutet");
}
if (GlobalHelper.DutyAdmins.Contains(player))
{
GlobalHelper.DutyAdmins.Remove(player);

View File

@@ -29,7 +29,7 @@ namespace ReallifeGamemode.Server.Events
if ((VehicleHash)vehicle.Model == VehicleHash.Burrito3)
{
if (WeaponDealManager.checkWeaponDbyVehicle(vehicle))
return;
return;
}
player.StopAnimation();
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht benutzen!", true);

View File

@@ -10,7 +10,7 @@ using ReallifeGamemode.Server.WeaponDeal;
namespace ReallifeGamemode.Server.Events
{
public class ExitVehicle:Script
public class ExitVehicle : Script
{
[ServerEvent(Event.PlayerExitVehicleAttempt)]
public void OnPlayerExitVehicle(Client client, GTANetworkAPI.Vehicle vehicle)

View File

@@ -32,12 +32,12 @@ namespace ReallifeGamemode.Server.Events
{
vehicleInventory = getVehItem(veh);
}
client.TriggerEvent("setVehiclesInventory", vehicleInventory.ToArray());
client.TriggerEvent("setVehiclesInventory", vehicleInventory.ToArray());
return;
}
}
}
}
}
}
}
public List<VehicleInventory> getVehItem(GTANetworkAPI.Vehicle veh)

View File

@@ -113,7 +113,7 @@ namespace ReallifeGamemode.Server.Events
if (Economy.Paychecks.ContainsKey(u.Id)) paycheck = Economy.Paychecks[u.Id];
Licenses licenses = new Licenses(u.DriverLicenseVehicle, u.DriverLicenseBike, u.FlyingLicensePlane);
var accountData = new
{
regDate = u.RegistrationDate.ToShortDateString(),
@@ -140,7 +140,7 @@ namespace ReallifeGamemode.Server.Events
{
if (!player.IsLoggedIn()) return;
var user = player.GetUser();
if (user?.FactionId != null)
{
@@ -245,13 +245,13 @@ namespace ReallifeGamemode.Server.Events
using (var context = new DatabaseContext())
{
List<UserItem> fItem = context.UserItems.Where(u => u.UserId == user.Id).ToList();
foreach(var item in fItem)
foreach (var item in fItem)
{
IItem iItem = InventoryManager.GetItemById(item.ItemId);
if(iItem is IWeaponDealItem obj)
if (iItem is IWeaponDealItem obj)
{
FactionWeapon weapon = context.FactionWeapons.Where(w => w.FactionId == user.FactionId && w.WeaponModel == iItem.Name).FirstOrDefault();
if (weapon == null)
@@ -267,7 +267,7 @@ namespace ReallifeGamemode.Server.Events
Database.Entities.Faction faction = context.Factions.Where(fac => fac.Id == user.FactionId).FirstOrDefault();
if (faction.WeaponDealTime > 0)
dealTime = "noch " + faction.WeaponDealTime.ToString()+" min. übrig";
dealTime = "noch " + faction.WeaponDealTime.ToString() + " min. übrig";
timer.Add(dealTime);
@@ -296,7 +296,7 @@ namespace ReallifeGamemode.Server.Events
}
}
}
player.TriggerEvent("showWeaponMenu", primarys.ToArray(), secondarys.ToArray(), melees.ToArray(), specials.ToArray(), JsonConvert.SerializeObject(timer.ToArray()));
}
if (nearestJailReleasePoint != null)
@@ -309,16 +309,16 @@ namespace ReallifeGamemode.Server.Events
if (c.JailTime > 0)
{
criminals.Add(c.Name);
}
}
}
player.TriggerEvent("showJailMenu", JsonConvert.SerializeObject(criminals.ToArray()));
}
if (nearestElevatorPoint != null)
{
List<string> stages = new List<string>();
foreach(var e in PositionManager.ElevatorPoints)
foreach (var e in PositionManager.ElevatorPoints)
{
if(e.Position.DistanceTo2D(player.Position) <= 25 && e.Position.DistanceTo(player.Position) > 1.5)
if (e.Position.DistanceTo2D(player.Position) <= 25 && e.Position.DistanceTo(player.Position) > 1.5)
{
stages.Add(e.Stage);
}

View File

@@ -58,7 +58,7 @@ namespace ReallifeGamemode.Server.Events
player.SetData("editmode", false);
player.SetData("quicksavemode", "none");
}
var userBankAccount = user.GetBankAccount();
userBankAccount.Balance = userBankAccount.Balance;
@@ -73,9 +73,10 @@ namespace ReallifeGamemode.Server.Events
if (GlobalHelper.CustomJoinMessages.ContainsKey(player.SocialClubName))
{
ChatService.BroadcastAdmin("!{#FFFF00}*** " + GlobalHelper.CustomJoinMessages[player.SocialClubName] + " [ID: " + player.Handle.Value + "] (" + user.AdminLevel.GetName() + ")", AdminLevel.TEAM);
} else if (user.IsAdmin(AdminLevel.TEAM))
}
else if (user.IsAdmin(AdminLevel.TEAM))
{
ChatService.BroadcastAdmin("!{#FFFF00}*** " + user.Name +" [ID: " + player.Handle.Value + "]" + " hat sich als " + user.AdminLevel.GetName() + " eingeloggt!", AdminLevel.TEAM);
ChatService.BroadcastAdmin("!{#FFFF00}*** " + user.Name + " [ID: " + player.Handle.Value + "]" + " hat sich als " + user.AdminLevel.GetName() + " eingeloggt!", AdminLevel.TEAM);
}
var userItems = dbContext.UserItems.Where(u => u.UserId == user.Id).ToList();

View File

@@ -13,7 +13,7 @@ namespace ReallifeGamemode.Server.Events
public void SaveWeaponSelection(Client client, string stage)
{
ElevatorPoint elevator = PositionManager.ElevatorPoints.Find(e => e.Stage == stage);
if(elevator != null)
if (elevator != null)
{
client.Position = elevator.Position;
}

View File

@@ -12,7 +12,7 @@ namespace ReallifeGamemode.Server.Events
[RemoteEvent("updateWeaponSelection")]
public void UpdateWeaponSelection(Client client, string weaponModel, int slot)
{
if(weaponModel == "Keine")
if (weaponModel == "Keine")
{
client.RemoveAllWeapons();
return;
@@ -38,14 +38,14 @@ namespace ReallifeGamemode.Server.Events
if (slot == 4)
{
client.RemoveAllWeapons();
client.GiveWeapon(weaponHash, 0);
client.GiveWeapon(weaponHash, 0);
}
}
[RemoteEvent("cancelWeaponSelection")]
public void CancelWeaponSelection(Client client)
{
client.RemoveAllWeapons();
client.RemoveAllWeapons();
}
@@ -68,12 +68,12 @@ namespace ReallifeGamemode.Server.Events
if (meleeModel.Contains("mk2") && !meleeModel.Contains("_mk2")) meleeModel = meleeModel.Replace("mk2", "_mk2");
melee = NAPI.Util.GetHashKey($"weapon_{meleeModel}");
}
client.GiveWeapon((WeaponHash)primary, 50);
client.GiveWeapon((WeaponHash)secondary, 150);
client.GiveWeapon((WeaponHash)melee, 1);
if(specialModel != "Schutzweste")
if (specialModel != "Schutzweste")
{
client.Armor = 0;
if (!uint.TryParse(specialModel, out uint special))
@@ -87,8 +87,8 @@ namespace ReallifeGamemode.Server.Events
{
client.Armor = 50;
}
using(var context = new DatabaseContext())
using (var context = new DatabaseContext())
{
User user = client.GetUser();
FactionWeapon slot1 = context.FactionWeapons.Where(w => w.FactionId == user.FactionId && w.WeaponModel == primaryModel).FirstOrDefault();

View File

@@ -202,7 +202,7 @@ namespace ReallifeGamemode.Server.Events
[ServerEvent(Event.VehicleDeath)]
public void VehicleDeathEvent(GTANetworkAPI.Vehicle veh)
{
}
}
}