Finished faction system, slightly changed client files
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user