added editorconfig and formatted code
This commit is contained in:
124
ReallifeGamemode.Server/.editorconfig
Normal file
124
ReallifeGamemode.Server/.editorconfig
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
# Informationen zu EDITORCONFIG-Dateien finden Sie unter https://aka.ms/editorconfigdocs
|
||||||
|
###############################
|
||||||
|
# Core EditorConfig Options #
|
||||||
|
###############################
|
||||||
|
root = true
|
||||||
|
# All files
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
# Code files
|
||||||
|
[*.{cs,csx,vb,vbx}]
|
||||||
|
indent_size = 2
|
||||||
|
insert_final_newline = true
|
||||||
|
charset = utf-8-bom
|
||||||
|
###############################
|
||||||
|
# .NET Coding Conventions #
|
||||||
|
###############################
|
||||||
|
[*.{cs,vb}]
|
||||||
|
# Organize usings
|
||||||
|
dotnet_sort_system_directives_first = true
|
||||||
|
# this. preferences
|
||||||
|
dotnet_style_qualification_for_field = true:warn
|
||||||
|
dotnet_style_qualification_for_property = true:warn
|
||||||
|
dotnet_style_qualification_for_method = true:warn
|
||||||
|
dotnet_style_qualification_for_event = true:warn
|
||||||
|
# Language keywords vs BCL types preferences
|
||||||
|
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
|
||||||
|
dotnet_style_predefined_type_for_member_access = true:silent
|
||||||
|
# Parentheses preferences
|
||||||
|
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
|
||||||
|
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
|
||||||
|
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
|
||||||
|
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
|
||||||
|
# Modifier preferences
|
||||||
|
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
|
||||||
|
dotnet_style_readonly_field = true:suggestion
|
||||||
|
# Expression-level preferences
|
||||||
|
dotnet_style_object_initializer = true:suggestion
|
||||||
|
dotnet_style_collection_initializer = true:suggestion
|
||||||
|
dotnet_style_explicit_tuple_names = true:suggestion
|
||||||
|
dotnet_style_null_propagation = true:suggestion
|
||||||
|
dotnet_style_coalesce_expression = true:suggestion
|
||||||
|
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
|
||||||
|
dotnet_prefer_inferred_tuple_names = true:suggestion
|
||||||
|
dotnet_prefer_inferred_anonymous_type_member_names = true:suggestion
|
||||||
|
dotnet_style_prefer_auto_properties = true:silent
|
||||||
|
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
|
||||||
|
dotnet_style_prefer_conditional_expression_over_return = true:silent
|
||||||
|
###############################
|
||||||
|
# Naming Conventions #
|
||||||
|
###############################
|
||||||
|
# Style Definitions
|
||||||
|
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
|
||||||
|
# Use PascalCase for constant fields
|
||||||
|
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
|
||||||
|
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
|
||||||
|
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
|
||||||
|
dotnet_naming_symbols.constant_fields.applicable_kinds = field
|
||||||
|
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
|
||||||
|
dotnet_naming_symbols.constant_fields.required_modifiers = const
|
||||||
|
###############################
|
||||||
|
# C# Coding Conventions #
|
||||||
|
###############################
|
||||||
|
[*.cs]
|
||||||
|
# var preferences
|
||||||
|
csharp_style_var_for_built_in_types = true:silent
|
||||||
|
csharp_style_var_when_type_is_apparent = true:silent
|
||||||
|
csharp_style_var_elsewhere = true:silent
|
||||||
|
# Expression-bodied members
|
||||||
|
csharp_style_expression_bodied_methods = false:silent
|
||||||
|
csharp_style_expression_bodied_constructors = false:silent
|
||||||
|
csharp_style_expression_bodied_operators = false:silent
|
||||||
|
csharp_style_expression_bodied_properties = true:silent
|
||||||
|
csharp_style_expression_bodied_indexers = true:silent
|
||||||
|
csharp_style_expression_bodied_accessors = true:silent
|
||||||
|
# Pattern matching preferences
|
||||||
|
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
|
||||||
|
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
|
||||||
|
# Null-checking preferences
|
||||||
|
csharp_style_throw_expression = true:suggestion
|
||||||
|
csharp_style_conditional_delegate_call = true:suggestion
|
||||||
|
# Modifier preferences
|
||||||
|
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
|
||||||
|
# Expression-level preferences
|
||||||
|
csharp_prefer_braces = true:silent
|
||||||
|
csharp_style_deconstructed_variable_declaration = true:suggestion
|
||||||
|
csharp_prefer_simple_default_expression = true:suggestion
|
||||||
|
csharp_style_pattern_local_over_anonymous_function = true:suggestion
|
||||||
|
csharp_style_inlined_variable_declaration = true:suggestion
|
||||||
|
###############################
|
||||||
|
# C# Formatting Rules #
|
||||||
|
###############################
|
||||||
|
# New line preferences
|
||||||
|
csharp_new_line_before_open_brace = all
|
||||||
|
csharp_new_line_before_else = true
|
||||||
|
csharp_new_line_before_catch = true
|
||||||
|
csharp_new_line_before_finally = true
|
||||||
|
csharp_new_line_before_members_in_object_initializers = true
|
||||||
|
csharp_new_line_before_members_in_anonymous_types = true
|
||||||
|
csharp_new_line_between_query_expression_clauses = true
|
||||||
|
# Indentation preferences
|
||||||
|
csharp_indent_case_contents = true
|
||||||
|
csharp_indent_switch_labels = true
|
||||||
|
csharp_indent_labels = flush_left
|
||||||
|
# Space preferences
|
||||||
|
csharp_space_after_cast = false
|
||||||
|
csharp_space_after_keywords_in_control_flow_statements = true
|
||||||
|
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_parentheses = false
|
||||||
|
csharp_space_before_colon_in_inheritance_clause = true
|
||||||
|
csharp_space_after_colon_in_inheritance_clause = true
|
||||||
|
csharp_space_around_binary_operators = before_and_after
|
||||||
|
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||||
|
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||||
|
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||||
|
# Wrapping preferences
|
||||||
|
csharp_preserve_single_line_statements = true
|
||||||
|
csharp_preserve_single_line_blocks = true
|
||||||
|
###############################
|
||||||
|
# VB Coding Conventions #
|
||||||
|
###############################
|
||||||
|
[*.vb]
|
||||||
|
# Modifier preferences
|
||||||
|
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion
|
||||||
@@ -2525,7 +2525,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
else if (option1 == "type")
|
else if (option1 == "type")
|
||||||
{
|
{
|
||||||
if(option2 == null)
|
if (option2 == null)
|
||||||
{
|
{
|
||||||
ChatService.ErrorMessage(player, "~m~Benutzung: ~s~/house type [Type]");
|
ChatService.ErrorMessage(player, "~m~Benutzung: ~s~/house type [Type]");
|
||||||
return;
|
return;
|
||||||
@@ -2551,7 +2551,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(option1 == "reloadhouses")
|
else if (option1 == "reloadhouses")
|
||||||
{
|
{
|
||||||
HouseManager.ReloadAllHouses();
|
HouseManager.ReloadAllHouses();
|
||||||
player.SendNotification("Alle Häuser wurden neu geladen");
|
player.SendNotification("Alle Häuser wurden neu geladen");
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(amount <= 0)
|
if (amount <= 0)
|
||||||
{
|
{
|
||||||
ChatService.ErrorMessage(player, "Es muss eine positive Wantedanzahl vergeben werden");
|
ChatService.ErrorMessage(player, "Es muss eine positive Wantedanzahl vergeben werden");
|
||||||
return;
|
return;
|
||||||
@@ -233,7 +233,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
User targetUser = target.GetUser(dbContext);
|
User targetUser = target.GetUser(dbContext);
|
||||||
if(targetUser.Wanteds == 0)
|
if (targetUser.Wanteds == 0)
|
||||||
{
|
{
|
||||||
ChatService.ErrorMessage(player, "Der Spieler hat keine Wanteds");
|
ChatService.ErrorMessage(player, "Der Spieler hat keine Wanteds");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace ReallifeGamemode.Server.Entities
|
|||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
using(var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
return "Gruppen Fahrzeug | Gruppe: " + dbContext.GroupVehicles.Include(g => g.Group).First(g => g.Id == this.Id).Group.Name;
|
return "Gruppen Fahrzeug | Gruppe: " + dbContext.GroupVehicles.Include(g => g.Group).First(g => g.Id == this.Id).Group.Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace ReallifeGamemode.Server.Entities
|
|||||||
numberplate = $"G{gV.GroupId} " + numberplate;
|
numberplate = $"G{gV.GroupId} " + numberplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this is JobVehicle jV)
|
if (this is JobVehicle jV)
|
||||||
{
|
{
|
||||||
numberplate = $"J{jV.JobId} " + numberplate;
|
numberplate = $"J{jV.JobId} " + numberplate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
|
|
||||||
user.Wanteds = user.Wanteds;
|
user.Wanteds = user.Wanteds;
|
||||||
|
|
||||||
if(user.Group != null)
|
if (user.Group != null)
|
||||||
{
|
{
|
||||||
string msg = $"{player.Name} ist wieder online.";
|
string msg = $"{player.Name} ist wieder online.";
|
||||||
ChatService.BroadcastGroup(msg, user.Group);
|
ChatService.BroadcastGroup(msg, user.Group);
|
||||||
@@ -84,7 +84,7 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
{
|
{
|
||||||
CharacterCreator.ApplyCharacter(player);
|
CharacterCreator.ApplyCharacter(player);
|
||||||
UpdateCharacterCloth.LoadCharacterDefaults(player);
|
UpdateCharacterCloth.LoadCharacterDefaults(player);
|
||||||
if(user.JailTime == 0)
|
if (user.JailTime == 0)
|
||||||
{
|
{
|
||||||
NAPI.Player.SpawnPlayer(player, new Vector3(user.PositionX, user.PositionY, user.PositionZ), 0);
|
NAPI.Player.SpawnPlayer(player, new Vector3(user.PositionX, user.PositionY, user.PositionZ), 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,15 +46,15 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
}
|
}
|
||||||
else if (sV is GroupVehicle gV)
|
else if (sV is GroupVehicle gV)
|
||||||
{
|
{
|
||||||
if(gV.GroupId != u.Group.Id && !state && !u.IsAdmin(AdminLevel.ADMIN3))
|
if (gV.GroupId != u.Group.Id && !state && !u.IsAdmin(AdminLevel.ADMIN3))
|
||||||
{
|
{
|
||||||
player.SendNotification("~r~Du hast keinen Schlüssel.");
|
player.SendNotification("~r~Du hast keinen Schlüssel.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(sV is JobVehicle jV)
|
else if (sV is JobVehicle jV)
|
||||||
{
|
{
|
||||||
if(!jV.GetJob().GetUsersInJob().Contains(player) && !u.IsAdmin(AdminLevel.ADMIN3))
|
if (!jV.GetJob().GetUsersInJob().Contains(player) && !u.IsAdmin(AdminLevel.ADMIN3))
|
||||||
{
|
{
|
||||||
player.SendNotification("~r~Du hast keinen Schlüssel.");
|
player.SendNotification("~r~Du hast keinen Schlüssel.");
|
||||||
return;
|
return;
|
||||||
@@ -132,15 +132,15 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(sV is FactionVehicle fV)
|
else if (sV is FactionVehicle fV)
|
||||||
{
|
{
|
||||||
if(fV.FactionId != u.FactionId || !u.FactionLeader)
|
if (fV.FactionId != u.FactionId || !u.FactionLeader)
|
||||||
{
|
{
|
||||||
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht parken.");
|
player.SendNotification("~r~Du darfst dieses Fahrzeug nicht parken.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(sV is GroupVehicle gV)
|
else if (sV is GroupVehicle gV)
|
||||||
{
|
{
|
||||||
if (gV.GroupId != u.Group.Id || u.GroupRank < GroupRank.MANAGER)
|
if (gV.GroupId != u.Group.Id || u.GroupRank < GroupRank.MANAGER)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace ReallifeGamemode.Server.Extensions
|
|||||||
|
|
||||||
public static string GetName(this GroupRank rank)
|
public static string GetName(this GroupRank rank)
|
||||||
{
|
{
|
||||||
switch(rank)
|
switch (rank)
|
||||||
{
|
{
|
||||||
case GroupRank.OWNER:
|
case GroupRank.OWNER:
|
||||||
return "Besitzer";
|
return "Besitzer";
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace ReallifeGamemode.Server.Extensions
|
|||||||
{
|
{
|
||||||
public static House Refresh(this House house)
|
public static House Refresh(this House house)
|
||||||
{
|
{
|
||||||
using(var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
return dbContext.Houses.Where(h => h.Id == house.Id).Include(h => h.Owner).FirstOrDefault();
|
return dbContext.Houses.Where(h => h.Id == house.Id).Include(h => h.Owner).FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace ReallifeGamemode.Server.Factions.Medic
|
|||||||
|
|
||||||
public static void RemoveTaskFromList(MedicTask task)
|
public static void RemoveTaskFromList(MedicTask task)
|
||||||
{
|
{
|
||||||
if(task == null)
|
if (task == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
ServerVehicle newVeh = null;
|
ServerVehicle newVeh = null;
|
||||||
|
|
||||||
if(target == "Spieler")
|
if (target == "Spieler")
|
||||||
{
|
{
|
||||||
newVeh = new UserVehicle
|
newVeh = new UserVehicle
|
||||||
{
|
{
|
||||||
@@ -168,7 +168,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
Active = true,
|
Active = true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if(target == "Fraktion")
|
else if (target == "Fraktion")
|
||||||
{
|
{
|
||||||
newVeh = new FactionVehicle
|
newVeh = new FactionVehicle
|
||||||
{
|
{
|
||||||
@@ -184,7 +184,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
Active = true,
|
Active = true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if(target == "Gruppe")
|
else if (target == "Gruppe")
|
||||||
{
|
{
|
||||||
newVeh = new GroupVehicle
|
newVeh = new GroupVehicle
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,12 +39,12 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
User u = player.GetUser(dbContext);
|
User u = player.GetUser(dbContext);
|
||||||
if(u.Group != null)
|
if (u.Group != null)
|
||||||
{
|
{
|
||||||
ChatService.ErrorMessage(player, "Du bist schon in einer Gruppe");
|
ChatService.ErrorMessage(player, "Du bist schon in einer Gruppe");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(dbContext.Groups.Any(g => g.Name.ToLower() == name.ToLower()))
|
if (dbContext.Groups.Any(g => g.Name.ToLower() == name.ToLower()))
|
||||||
{
|
{
|
||||||
ChatService.ErrorMessage(player, "Dieser Name ist schon vergeben");
|
ChatService.ErrorMessage(player, "Dieser Name ist schon vergeben");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
public static void LoadHouses()
|
public static void LoadHouses()
|
||||||
{
|
{
|
||||||
using(var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
foreach (House house in dbContext.Houses.Include(h => h.Owner))
|
foreach (House house in dbContext.Houses.Include(h => h.Owner))
|
||||||
{
|
{
|
||||||
@@ -31,7 +31,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
foreach(House house in await dbContext.Houses.Include(h => h.Owner).ToListAsync())
|
foreach (House house in await dbContext.Houses.Include(h => h.Owner).ToListAsync())
|
||||||
{
|
{
|
||||||
RemoveHouse(house);
|
RemoveHouse(house);
|
||||||
LoadHouse(house, false);
|
LoadHouse(house, false);
|
||||||
@@ -41,7 +41,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
public static House GetNearHouse(Vector3 position, DatabaseContext dbContext = null)
|
public static House GetNearHouse(Vector3 position, DatabaseContext dbContext = null)
|
||||||
{
|
{
|
||||||
if(dbContext == null)
|
if (dbContext == null)
|
||||||
{
|
{
|
||||||
using (dbContext = new DatabaseContext())
|
using (dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
@@ -80,7 +80,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
houseMarkers[house.Id] = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, house.Position.Subtract(new Vector3(0, 0, 1.7)), new Vector3(), new Vector3(), 1.6f, new Color(255, 255, 255));
|
houseMarkers[house.Id] = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, house.Position.Subtract(new Vector3(0, 0, 1.7)), new Vector3(), new Vector3(), 1.6f, new Color(255, 255, 255));
|
||||||
string text = $"~g~Zum Verkauf\n~s~{house.Type}\nPreis: ~y~{house.Price.ToMoneyString()}";
|
string text = $"~g~Zum Verkauf\n~s~{house.Type}\nPreis: ~y~{house.Price.ToMoneyString()}";
|
||||||
if(house.User != null)
|
if (house.User != null)
|
||||||
{
|
{
|
||||||
text = $"{house.Type}\n~s~Besitzer: ~y~{house.User.Name}";
|
text = $"{house.Type}\n~s~Besitzer: ~y~{house.User.Name}";
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
houseMarkers.Remove(house.Id);
|
houseMarkers.Remove(house.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(houseLabels.ContainsKey(house.Id))
|
if (houseLabels.ContainsKey(house.Id))
|
||||||
{
|
{
|
||||||
houseLabels[house.Id].Entity<TextLabel>().Delete();
|
houseLabels[house.Id].Entity<TextLabel>().Delete();
|
||||||
houseLabels.Remove(house.Id);
|
houseLabels.Remove(house.Id);
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
{
|
{
|
||||||
var taxiJob = JobManager.GetJob<TaxiDriverJob>();
|
var taxiJob = JobManager.GetJob<TaxiDriverJob>();
|
||||||
|
|
||||||
if(taxiJob.TaxiContracts.Where(t => t.Name == player.Name).Count() != 0)
|
if (taxiJob.TaxiContracts.Where(t => t.Name == player.Name).Count() != 0)
|
||||||
{
|
{
|
||||||
ChatService.ErrorMessage(player, "Du kannst nur einmal ein Taxi rufen");
|
ChatService.ErrorMessage(player, "Du kannst nur einmal ein Taxi rufen");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
|
|
||||||
Client driver = veh.GetDriver();
|
Client driver = veh.GetDriver();
|
||||||
|
|
||||||
if(driver != null && contract.Driver.Handle != veh.GetDriver().Handle)
|
if (driver != null && contract.Driver.Handle != veh.GetDriver().Handle)
|
||||||
{
|
{
|
||||||
ChatService.SendMessage(contract.Driver, $"!{{02FCFF}}{player.Name} ist in ein Taxi eingestiegen, der Auftrag wurde beendet.");
|
ChatService.SendMessage(contract.Driver, $"!{{02FCFF}}{player.Name} ist in ein Taxi eingestiegen, der Auftrag wurde beendet.");
|
||||||
ChatService.SendMessage(player, $"!{{02FCFF}}Du bist in ein Taxi eingestiegen, der Auftrag wurde beendet.");
|
ChatService.SendMessage(player, $"!{{02FCFF}}Du bist in ein Taxi eingestiegen, der Auftrag wurde beendet.");
|
||||||
|
|||||||
@@ -673,9 +673,9 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
timer.Elapsed += VehicleTimerTick;
|
timer.Elapsed += VehicleTimerTick;
|
||||||
timer.Start();
|
timer.Start();
|
||||||
|
|
||||||
foreach(var name in _enabledMods)
|
foreach (var name in _enabledMods)
|
||||||
{
|
{
|
||||||
if(_enabledMods.Where(x => x == name).Count() != 1)
|
if (_enabledMods.Where(x => x == name).Count() != 1)
|
||||||
{
|
{
|
||||||
NAPI.Util.ConsoleOutput($"{name} double");
|
NAPI.Util.ConsoleOutput($"{name} double");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
{
|
{
|
||||||
public class Jail
|
public class Jail
|
||||||
{
|
{
|
||||||
public static Dictionary<int, int> jailtime { get; set; } = new Dictionary<int, int>(); //time in seconds
|
private static Dictionary<int, int> Jailtime { get; set; } = new Dictionary<int, int>(); //time in seconds
|
||||||
|
|
||||||
|
|
||||||
public static void Check_PutBehindBars(Client client)
|
public static void Check_PutBehindBars(Client client)
|
||||||
@@ -27,7 +27,7 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
if (rndInt == 3)
|
if (rndInt == 3)
|
||||||
client.Position = new Vector3(458.3372, -1001.258, 24.91485); //send client to jail
|
client.Position = new Vector3(458.3372, -1001.258, 24.91485); //send client to jail
|
||||||
|
|
||||||
jailtime[user.Id] = user.JailTime; // 54 sec for each wanted star -> in total 45min for 50 Wanteds
|
Jailtime[user.Id] = user.JailTime; // 54 sec for each wanted star -> in total 45min for 50 Wanteds
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (user.Wanteds <= 0)
|
if (user.Wanteds <= 0)
|
||||||
@@ -56,7 +56,7 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
dbContext.SaveChanges();
|
dbContext.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
jailtime[user.Id] = user.Wanteds * 54; // 54 sec for each wanted star -> in total 45min for 50 Wanteds
|
Jailtime[user.Id] = user.Wanteds * 54; // 54 sec for each wanted star -> in total 45min for 50 Wanteds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,16 +72,16 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
brakeOut.Start();
|
brakeOut.Start();
|
||||||
jailIn.Start();
|
jailIn.Start();
|
||||||
timer.Elapsed += Timer_Elapsed;
|
timer.Elapsed += Timer_Elapsed;
|
||||||
brakeOut.Elapsed += brakeOut_Elapsed;
|
brakeOut.Elapsed += BrakeOut_Elapsed;
|
||||||
jailIn.Elapsed += jailIn_Elapsed;
|
jailIn.Elapsed += JailIn_Elapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void jailIn_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
private static void JailIn_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
foreach (var player in NAPI.Pools.GetAllPlayers())
|
foreach (var player in NAPI.Pools.GetAllPlayers())
|
||||||
{
|
{
|
||||||
User user = player.GetUser();
|
User user = player.GetUser();
|
||||||
if (!jailtime.ContainsKey(user.Id))
|
if (!Jailtime.ContainsKey(user.Id))
|
||||||
{
|
{
|
||||||
foreach (var copPlayer in NAPI.Pools.GetAllPlayers())
|
foreach (var copPlayer in NAPI.Pools.GetAllPlayers())
|
||||||
{
|
{
|
||||||
@@ -103,20 +103,20 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void brakeOut_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
private static void BrakeOut_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
foreach (var player in NAPI.Pools.GetAllPlayers())
|
foreach (var player in NAPI.Pools.GetAllPlayers())
|
||||||
{
|
{
|
||||||
User user = player.GetUser();
|
User user = player.GetUser();
|
||||||
|
|
||||||
if (player.Position.DistanceTo2D(new Vector3(458.9842, -997.2126, 24.91485)) > 7 && jailtime.ContainsKey(user.Id))
|
if (player.Position.DistanceTo2D(new Vector3(458.9842, -997.2126, 24.91485)) > 7 && Jailtime.ContainsKey(user.Id))
|
||||||
{
|
{
|
||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
{
|
{
|
||||||
user = player.GetUser(dbContext);
|
user = player.GetUser(dbContext);
|
||||||
user.GiveWanteds(null, 50, "Knast-Ausbruch");
|
user.GiveWanteds(null, 50, "Knast-Ausbruch");
|
||||||
dbContext.SaveChanges();
|
dbContext.SaveChanges();
|
||||||
jailtime.Remove(user.Id);
|
Jailtime.Remove(user.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -128,13 +128,13 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
foreach (var player in NAPI.Pools.GetAllPlayers())
|
foreach (var player in NAPI.Pools.GetAllPlayers())
|
||||||
{
|
{
|
||||||
User user = player.GetUser();
|
User user = player.GetUser();
|
||||||
if (jailtime.ContainsKey(user.Id))
|
if (Jailtime.ContainsKey(user.Id))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (user.JailTime <= 0)
|
if (user.JailTime <= 0)
|
||||||
{
|
{
|
||||||
player.Position = new Vector3(461.7256, -988.6035, 24.91487);
|
player.Position = new Vector3(461.7256, -988.6035, 24.91487);
|
||||||
jailtime.Remove(user.Id);
|
Jailtime.Remove(user.Id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (user.JailTime > 0)
|
if (user.JailTime > 0)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
public class WantedEscapeTimer
|
public class WantedEscapeTimer
|
||||||
{
|
{
|
||||||
|
|
||||||
public static Dictionary<int,int> waTimer { get; set; } = new Dictionary<int, int>(); //zeit in ms
|
public static Dictionary<int, int> waTimer { get; set; } = new Dictionary<int, int>(); //zeit in ms
|
||||||
|
|
||||||
public static void WantedTimer()
|
public static void WantedTimer()
|
||||||
{
|
{
|
||||||
@@ -43,7 +43,7 @@ namespace ReallifeGamemode.Server.Wanted
|
|||||||
foreach (var player in NAPI.Pools.GetAllPlayers())
|
foreach (var player in NAPI.Pools.GetAllPlayers())
|
||||||
{
|
{
|
||||||
User user = player.GetUser();
|
User user = player.GetUser();
|
||||||
if(user.Wanteds > 0)
|
if (user.Wanteds > 0)
|
||||||
{
|
{
|
||||||
if (!waTimer.ContainsKey(user.Id))
|
if (!waTimer.ContainsKey(user.Id))
|
||||||
ResetWantedTimeToElapse(player);
|
ResetWantedTimeToElapse(player);
|
||||||
|
|||||||
Reference in New Issue
Block a user