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

@@ -4,6 +4,7 @@ using reallife_gamemode.Model;
using reallife_gamemode.Server.Entities;
using reallife_gamemode.Server.Extensions;
using reallife_gamemode.Server.Services;
using reallife_gamemode.Server.Util;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -29,7 +30,7 @@ namespace reallife_gamemode.Server.Commands
return;
}
string broadcastMessage = "!{02FCFF}** " + player.Name + ": " + message + " )) **";
string broadcastMessage = "!{02FCFF}** " + player.GetUser().GetFactionRank().RankName + " " + player.Name + ": " + message + " )) **";
ChatService.BroadcastFaction(broadcastMessage, f);
}
@@ -43,7 +44,7 @@ namespace reallife_gamemode.Server.Commands
return;
}
string broadcastMessage = "!{33AA33}** " + player.Name + ": " + message + ", over **";
string broadcastMessage = "!{33AA33}** " + player.GetUser().GetFactionRank().RankName + " " + player.Name + ": " + message + ", over **";
ChatService.BroadcastFaction(broadcastMessage, f);
}
@@ -57,30 +58,11 @@ namespace reallife_gamemode.Server.Commands
return;
}
string broadcastMessage = "!{CC3333}** " + player.Name + ": " + message + ", over **";
string broadcastMessage = "!{CC3333}** " + player.GetUser().GetFactionRank().RankName + " " + player.Name + ": " + message + ", over **";
using(var context = new DatabaseContext())
{
ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.StateOwned));
}
}
[Command("managefactionranks")]
public void CmdFactionManageFactionRanks(Client player)
{
Entities.Faction f = player.GetFaction();
if (f == null)
{
ChatService.NotAuthorized(player);
return;
}
using(var context = new DatabaseContext())
{
List<FactionRank> factionRanks = context.FactionRanks.ToList().FindAll(r => r.FactionId == f.Id).OrderByDescending(o => o.Order).ToList();
string json = JsonConvert.SerializeObject(factionRanks, Formatting.None);
player.TriggerEvent("manageFactionRanks", json);
}
}
}
}