Add faction rank management CEF

This commit is contained in:
Lennart Kampshoff
2018-09-23 22:30:42 +02:00
parent 33ec0887e7
commit d9789b7525
8 changed files with 86 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
using GTANetworkAPI;
using Newtonsoft.Json;
using reallife_gamemode.Model;
using reallife_gamemode.Server.Entities;
using reallife_gamemode.Server.Extensions;
@@ -62,5 +63,24 @@ namespace reallife_gamemode.Server.Commands
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);
string json = JsonConvert.SerializeObject(factionRanks, Formatting.Indented);
player.TriggerEvent("manageFactionRanks", json);
}
}
}
}