Finished faction system, slightly changed client files

This commit is contained in:
hydrant
2018-09-28 17:40:29 +02:00
parent cbc18734ca
commit d057140c32
13 changed files with 299 additions and 56 deletions

View File

@@ -36,6 +36,8 @@ namespace reallife_gamemode.Server.Entities
public int? FactionId { get; set; }
public Faction Faction { get; set; }
public bool FactionLeader { get; set; }
public int? FactionRankId { get; set; }
public FactionRank FactionRank { get;set; }
@@ -52,7 +54,21 @@ namespace reallife_gamemode.Server.Entities
{
using (var context = new DatabaseContext())
{
return context.FactionRanks.FirstOrDefault(fR => fR.Id == FactionRankId);
FactionRank toReturn = context.FactionRanks.FirstOrDefault(fR => fR.Id == FactionRankId);
if(toReturn == null)
{
toReturn = context.FactionRanks.OrderBy(f => f.Order).FirstOrDefault(f => f.FactionId == FactionId);
}
if(toReturn == null)
{
toReturn = new FactionRank
{
RankName = "Rang-Fehler"
};
}
return toReturn;
}
}