Umstrukturierung
This commit is contained in:
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Server.Entities;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
@@ -13,11 +13,13 @@ using ReallifeGamemode.Server.Business;
|
||||
using System.Text.RegularExpressions;
|
||||
using ReallifeGamemode.Server.Classes;
|
||||
using ReallifeGamemode.Server.Factions.Medic;
|
||||
using ReallifeGamemode.Server.Models;
|
||||
using ReallifeGamemode.Server.Job;
|
||||
using ReallifeGamemode.Server.Finance;
|
||||
using ReallifeGamemode.Server.Wanted;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Database;
|
||||
using ReallifeGamemode.Services;
|
||||
|
||||
/**
|
||||
* @overview Life of German Reallife - Admin Commands (Admin.cs)
|
||||
@@ -300,7 +302,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
ChatService.SendMessage(player, "~m~__________ ~s~Fraktionen ~m~__________");
|
||||
foreach (Entities.Faction f in dbContext.Factions)
|
||||
foreach (Faction f in dbContext.Factions)
|
||||
{
|
||||
ChatService.SendMessage(player, f.Id.ToString().PadRight(3) + " | " + f.Name);
|
||||
}
|
||||
@@ -1662,14 +1664,14 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
Entities.Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == faction);
|
||||
Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == faction);
|
||||
if (f == null && faction != 0)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Diese Fraktion existiert nicht (Liste: ~m~/factionlist~s~)");
|
||||
return;
|
||||
}
|
||||
|
||||
Entities.User u = target.GetUser(dbContext);
|
||||
User u = target.GetUser(dbContext);
|
||||
|
||||
if (faction != 0)
|
||||
{
|
||||
@@ -1713,14 +1715,14 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
Entities.Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == faction);
|
||||
Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == faction);
|
||||
if (f == null)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Diese Fraktion existiert nicht (Liste: ~m~/factionlist~s~)");
|
||||
return;
|
||||
}
|
||||
|
||||
Entities.User u = target.GetUser(dbContext);
|
||||
User u = target.GetUser(dbContext);
|
||||
|
||||
u.FactionId = f.Id;
|
||||
u.FactionRankId = dbContext.FactionRanks.
|
||||
@@ -2198,7 +2200,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
Entities.Faction f = context.Factions.FirstOrDefault(id => id.Id == factionID);
|
||||
Faction f = context.Factions.FirstOrDefault(id => id.Id == factionID);
|
||||
if (f == null)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Diese Fraktion existiert nicht (Liste: ~m~/factionlist~s~)");
|
||||
@@ -2378,7 +2380,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
Entities.User targetUser = target.GetUser(dbContext);
|
||||
User targetUser = target.GetUser(dbContext);
|
||||
targetUser.BusinessId = businessid;
|
||||
|
||||
dbContext.SaveChanges();
|
||||
@@ -2756,7 +2758,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
Entities.Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == factionID);
|
||||
Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == factionID);
|
||||
if (f == null)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Diese Fraktion existiert nicht (Liste: ~m~/factionlist~s~)");
|
||||
@@ -2776,10 +2778,10 @@ namespace ReallifeGamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
Entities.FactionWeapon fw = dbContext.FactionWeapons.FirstOrDefault(w => w.FactionId == factionID && w.WeaponModel == weaponModel);
|
||||
FactionWeapon fw = dbContext.FactionWeapons.FirstOrDefault(w => w.FactionId == factionID && w.WeaponModel == weaponModel);
|
||||
if (fw == null)
|
||||
{
|
||||
var newWeapon = new Entities.FactionWeapon
|
||||
var newWeapon = new FactionWeapon
|
||||
{
|
||||
WeaponModel = weaponModel,
|
||||
SlotID = slotId,
|
||||
@@ -2799,10 +2801,10 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
}
|
||||
|
||||
Entities.FactionWeapon fw2 = dbContext.FactionWeapons.FirstOrDefault(w => w.FactionId == factionID && w.WeaponModel == weaponModel);
|
||||
FactionWeapon fw2 = dbContext.FactionWeapons.FirstOrDefault(w => w.FactionId == factionID && w.WeaponModel == weaponModel);
|
||||
if (fw2 == null)
|
||||
{
|
||||
var schutzweste = new Entities.FactionWeapon
|
||||
var schutzweste = new FactionWeapon
|
||||
{
|
||||
WeaponModel = weaponModel,
|
||||
SlotID = slotId,
|
||||
@@ -2834,7 +2836,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
Entities.Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == factionID);
|
||||
Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == factionID);
|
||||
if (f == null)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Diese Fraktion existiert nicht (Liste: ~m~/factionlist~s~)");
|
||||
@@ -2854,7 +2856,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
Entities.FactionWeapon fw = dbContext.FactionWeapons.FirstOrDefault(w => w.FactionId == factionID && w.WeaponModel == weaponModel);
|
||||
FactionWeapon fw = dbContext.FactionWeapons.FirstOrDefault(w => w.FactionId == factionID && w.WeaponModel == weaponModel);
|
||||
if (fw != null)
|
||||
{
|
||||
dbContext.FactionWeapons.Remove(fw);
|
||||
@@ -2865,7 +2867,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
ChatService.ErrorMessage(player, "Diese Waffe befindet sich nicht im Waffenlager");
|
||||
return;
|
||||
}
|
||||
Entities.FactionWeapon fw2 = dbContext.FactionWeapons.FirstOrDefault(w => w.FactionId == factionID && w.WeaponModel == weaponModel);
|
||||
FactionWeapon fw2 = dbContext.FactionWeapons.FirstOrDefault(w => w.FactionId == factionID && w.WeaponModel == weaponModel);
|
||||
if (fw2 != null)
|
||||
{
|
||||
dbContext.FactionWeapons.Remove(fw2);
|
||||
|
||||
Reference in New Issue
Block a user