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

@@ -25,7 +25,7 @@ namespace ReallifeGamemode.Server.Entities
public string Reason { get; set; }
public string BannedBy { get; set; }
public int Applied { get; set; }
public int UntilDateTime { get; set; }
}

View File

@@ -17,7 +17,8 @@ namespace ReallifeGamemode.Server.Entities
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public int Balance {
public int Balance
{
get => _balance;
set
{

View File

@@ -1,5 +1,8 @@
using System;
using ReallifeGamemode.Server.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
namespace ReallifeGamemode.Server.Entities
@@ -8,6 +11,17 @@ namespace ReallifeGamemode.Server.Entities
{
public Group Group { get; set; }
[ForeignKey("Group")]
public int? GroupId { get; set; }
public Group GetGroup()
{
using (var dbContext = new DatabaseContext())
{
return dbContext.Groups.Where(g => g.Id == GroupId).FirstOrDefault();
}
}
public override string ToString()
{
return "Gruppen Fahrzeug | Gruppe: " + Group.Name;

View File

@@ -18,7 +18,7 @@ namespace ReallifeGamemode.Server.Entities.Logs
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ForeignKey("Victim")]
public int VictimId { get; set; }
public User Victim { get; set; }
@@ -36,7 +36,7 @@ namespace ReallifeGamemode.Server.Entities.Logs
public float KillerPositionY { get; set; }
public float KillerPositionZ { get; set; }
public float KillerHeading { get; set; }
[StringLength(64)]
public string CauseOfDeath { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]

View File

@@ -34,5 +34,5 @@ namespace ReallifeGamemode.Server.Entities.Saves
public float Rotation { get; set; }
public byte Dimension { get; set; }
public bool Active { get; set; }
}
}
}

View File

@@ -48,7 +48,7 @@ namespace ReallifeGamemode.Server.Entities
string numberplate = $"{this.Id}";
if(this is FactionVehicle fV)
if (this is FactionVehicle fV)
{
numberplate = $"F{fV.FactionId} " + numberplate;
}
@@ -58,7 +58,7 @@ namespace ReallifeGamemode.Server.Entities
numberplate = $"U{uV.UserId} " + numberplate;
}
if(this is ShopVehicle sV)
if (this is ShopVehicle sV)
{
numberplate = "Shop";
VehicleStreaming.SetLockStatus(veh, false);
@@ -66,6 +66,11 @@ namespace ReallifeGamemode.Server.Entities
veh.Position.Add(new Vector3(0, 0, 1.3)), 10.0f, 1f, 1, new Color(255, 255, 255));
}
if (this is GroupVehicle gV)
{
numberplate = $"{gV.GroupId}" + numberplate;
}
veh.NumberPlate = numberplate;
return veh;

View File

@@ -49,7 +49,7 @@ namespace ReallifeGamemode.Server.Entities
[ForeignKey("Ban")]
public int? BanId { get; set; }
public Ban Ban { get; set; }
public int? FactionId { get; set; }
public Faction Faction { get; set; }
@@ -60,6 +60,8 @@ namespace ReallifeGamemode.Server.Entities
public Group Group { get; set; }
public GroupRank GroupRank { get; set; }
public FactionRank GetFactionRank()
{
using (var dbContext = new DatabaseContext())
@@ -97,7 +99,7 @@ namespace ReallifeGamemode.Server.Entities
banUser = new Ban { UserId = this.Id, Reason = reason, BannedBy = admin.Name, Applied = unixTimestamp, UntilDateTime = unixTimestamp };
this.Client?.Kick();
mins--;
}
else
@@ -128,7 +130,7 @@ namespace ReallifeGamemode.Server.Entities
public List<UserItem> GetItems()
{
using(var dbContext = new DatabaseContext())
using (var dbContext = new DatabaseContext())
{
return dbContext.UserItems.ToList().FindAll(u => u.UserId == this.Id);
}

View File

@@ -28,12 +28,13 @@ namespace ReallifeGamemode.Server.Entities
public string Bic { get; set; }
[StringLength(32)]
public string Iban { get; set; }
public int Balance {
public int Balance
{
get => _balance;
set
{
_balance = value;
using(var dbContext = new DatabaseContext())
using (var dbContext = new DatabaseContext())
{
ClientService.GetClientByNameOrId(dbContext.Users.First(u => u.Id == UserId).Name).TriggerEvent("updateMoney", value);
}