Add faction rank management CEF
This commit is contained in:
1
Client/Dependences/jquery.tablednd.0.8.min.js
vendored
Normal file
1
Client/Dependences/jquery.tablednd.0.8.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
34
Client/FactionManagement/Ranks/index.html
Normal file
34
Client/FactionManagement/Ranks/index.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!--
|
||||
* @overview Life of German Reallife - Client Save.html
|
||||
* @author hydrant
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*-->
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="de" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table id="rank-table">
|
||||
<tr><td>some</td><td>entry</td></tr>
|
||||
</table>
|
||||
|
||||
<script src="../../Dependences/jquery-3.3.1.min.js"></script>
|
||||
<script src="../../Dependences/jquery.tablednd.0.8.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
mp.trigger("onManageFactionRanksLoaded");
|
||||
});
|
||||
|
||||
function loadData(rankData) {
|
||||
var obj = JSON.parse(rankData);
|
||||
obj.forEach(function (rank) {
|
||||
$("table#rank-table").append(rank);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
1
Client/FactionManagement/Ranks/script.js
Normal file
1
Client/FactionManagement/Ranks/script.js
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
3
Client/FactionManagement/Ranks/style.css
Normal file
3
Client/FactionManagement/Ranks/style.css
Normal file
@@ -0,0 +1,3 @@
|
||||
body
|
||||
{
|
||||
}
|
||||
25
Client/FactionManagement/main.js
Normal file
25
Client/FactionManagement/main.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @overview Life of German Reallife - Faction Manager Main (main.js)
|
||||
* @author hydrant
|
||||
* @copyright (c) 2008 - 2018 Life of German
|
||||
*/
|
||||
|
||||
var manageBrowser = null;
|
||||
var rankData = null;
|
||||
|
||||
mp.events.add('manageFactionRanks', (ranks) => {
|
||||
if (manageBrowser !== null) return;
|
||||
manageBrowser = mp.browsers.new('package://FactionManagement/Ranks/index.html');
|
||||
mp.gui.cursor.show(true, true);
|
||||
//mp.gui.chat.activate(false);
|
||||
mp.gui.chat.push(ranks);
|
||||
rankData = ranks;
|
||||
});
|
||||
|
||||
mp.events.add('onManageFactionRanksLoaded', () => {
|
||||
mp.gui.chat.push("loaded page");
|
||||
if (manageBrowser !== null) {
|
||||
manageBrowser.execute(`loadData(` + rankData + `)`);
|
||||
mp.gui.chat.push(rankData);
|
||||
}
|
||||
});
|
||||
@@ -7,3 +7,4 @@
|
||||
require('./Login/main.js');
|
||||
require('./Save/main.js');
|
||||
require('./Save/save.js');
|
||||
require('./FactionManagement/main.js');
|
||||
@@ -290,7 +290,6 @@ namespace reallife_gamemode.Server.Commands
|
||||
}
|
||||
else player.SendChatMessage("~m~Du sitzt in keinem Fahrzeug!");
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user