fixed !setlevel
fixed previous alias displayed on welcome announcement fixed duplicate events on profile page tweaked display of non event meta on mobile you can view other's stats from the webconsole penalties show privileged client's level don't have commands to chat history
This commit is contained in:
parent
9ee39b5260
commit
442569b339
@ -70,12 +70,16 @@ namespace IW4MAdmin
|
|||||||
|
|
||||||
if (!aliasExists)
|
if (!aliasExists)
|
||||||
{
|
{
|
||||||
Logger.WriteDebug($"Client {polledPlayer} has connected previously under a different alias");
|
Logger.WriteDebug($"Client {polledPlayer} has connected previously under a different ip/name");
|
||||||
client.CurrentAlias = new SharedLibrary.Database.Models.EFAlias()
|
client.CurrentAlias = new SharedLibrary.Database.Models.EFAlias()
|
||||||
{
|
{
|
||||||
IPAddress = polledPlayer.IPAddress,
|
IPAddress = polledPlayer.IPAddress,
|
||||||
Name = polledPlayer.Name,
|
Name = polledPlayer.Name,
|
||||||
};
|
};
|
||||||
|
// we need to update their new ip and name to the virtual property
|
||||||
|
client.Name = polledPlayer.Name;
|
||||||
|
client.IPAddress = polledPlayer.IPAddress;
|
||||||
|
|
||||||
await Manager.GetClientService().Update(client);
|
await Manager.GetClientService().Update(client);
|
||||||
}
|
}
|
||||||
player = client.AsPlayer();
|
player = client.AsPlayer();
|
||||||
|
@ -24,8 +24,13 @@ namespace StatsPlugin.Commands
|
|||||||
|
|
||||||
public override async Task ExecuteAsync(Event E)
|
public override async Task ExecuteAsync(Event E)
|
||||||
{
|
{
|
||||||
|
if (E.Target?.ClientNumber < 0)
|
||||||
|
{
|
||||||
|
await E.Origin.Tell("The specified player must be ingame");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (E.Origin.ClientNumber < 0)
|
if (E.Origin.ClientNumber < 0 && E.Target == null)
|
||||||
{
|
{
|
||||||
await E.Origin.Tell("You must be ingame to view your stats");
|
await E.Origin.Tell("You must be ingame to view your stats");
|
||||||
return;
|
return;
|
||||||
@ -45,7 +50,7 @@ namespace StatsPlugin.Commands
|
|||||||
|
|
||||||
if (E.Target != null)
|
if (E.Target != null)
|
||||||
{
|
{
|
||||||
pStats = clientStats.Find(c => c.ServerId ==serverId && c.ClientId == E.Target.ClientId).First();
|
pStats = clientStats.Find(c => c.ServerId == serverId && c.ClientId == E.Target.ClientId).First();
|
||||||
statLine = String.Format("^5{0} ^7KILLS | ^5{1} ^7DEATHS | ^5{2} ^7KDR | ^5{3} ^7SKILL", pStats.Kills, pStats.Deaths, pStats.KDR, pStats.Skill);
|
statLine = String.Format("^5{0} ^7KILLS | ^5{1} ^7DEATHS | ^5{2} ^7KDR | ^5{3} ^7SKILL", pStats.Kills, pStats.Deaths, pStats.KDR, pStats.Skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ namespace StatsPlugin
|
|||||||
await Manager.RemovePlayer(E.Origin);
|
await Manager.RemovePlayer(E.Origin);
|
||||||
break;
|
break;
|
||||||
case Event.GType.Say:
|
case Event.GType.Say:
|
||||||
if (E.Data != string.Empty && E.Data.Trim().Length > 0)
|
if (E.Data != string.Empty && E.Data.Trim().Length > 0 && E.Data[0] != '!')
|
||||||
await Manager.AddMessageAsync(E.Origin.ClientId, E.Owner.GetHashCode(), E.Data);
|
await Manager.AddMessageAsync(E.Origin.ClientId, E.Owner.GetHashCode(), E.Data);
|
||||||
break;
|
break;
|
||||||
case Event.GType.MapChange:
|
case Event.GType.MapChange:
|
||||||
|
@ -429,15 +429,22 @@ namespace SharedLibrary.Commands
|
|||||||
if (newPerm > Player.Permission.Banned)
|
if (newPerm > Player.Permission.Banned)
|
||||||
{
|
{
|
||||||
var ActiveClient = E.Owner.Manager.GetActiveClients().FirstOrDefault(p => p.NetworkId == E.Target.NetworkId);
|
var ActiveClient = E.Owner.Manager.GetActiveClients().FirstOrDefault(p => p.NetworkId == E.Target.NetworkId);
|
||||||
ActiveClient.Level = newPerm;
|
|
||||||
|
|
||||||
if (ActiveClient != null)
|
if (ActiveClient != null)
|
||||||
|
{
|
||||||
|
ActiveClient.Level = newPerm;
|
||||||
await ActiveClient.Tell("Congratulations! You have been promoted to ^3" + newPerm);
|
await ActiveClient.Tell("Congratulations! You have been promoted to ^3" + newPerm);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
E.Target.Level = newPerm;
|
||||||
|
await E.Owner.Manager.GetClientService().Update(E.Target);
|
||||||
|
}
|
||||||
|
|
||||||
await E.Origin.Tell($"{E.Target.Name} was successfully promoted!");
|
await E.Origin.Tell($"{E.Target.Name} was successfully promoted!");
|
||||||
|
|
||||||
E.Target.Level = newPerm;
|
|
||||||
await E.Owner.Manager.GetClientService().Update(E.Target);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -12,6 +12,7 @@ namespace SharedLibrary.Dtos
|
|||||||
public int OffenderId { get; set; }
|
public int OffenderId { get; set; }
|
||||||
public string PunisherName { get; set; }
|
public string PunisherName { get; set; }
|
||||||
public int PunisherId { get; set; }
|
public int PunisherId { get; set; }
|
||||||
|
public string PunisherLevel { get; set; }
|
||||||
public string Offense { get; set; }
|
public string Offense { get; set; }
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
public string TimePunished { get; set; }
|
public string TimePunished { get; set; }
|
||||||
|
@ -44,6 +44,8 @@ namespace WebfrontCore.Controllers
|
|||||||
clientDto.Meta.AddRange(await IW4MAdmin.ApplicationManager.GetInstance().GetPenaltyService().ReadGetClientPenaltiesAsync(client.ClientId, false));
|
clientDto.Meta.AddRange(await IW4MAdmin.ApplicationManager.GetInstance().GetPenaltyService().ReadGetClientPenaltiesAsync(client.ClientId, false));
|
||||||
clientDto.Meta = clientDto.Meta.OrderByDescending(m => m.When).ToList();
|
clientDto.Meta = clientDto.Meta.OrderByDescending(m => m.When).ToList();
|
||||||
|
|
||||||
|
ViewBag.Title = clientDto.Name;
|
||||||
|
|
||||||
return View("Profile/Index", clientDto);
|
return View("Profile/Index", clientDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ namespace WebfrontCore.Controllers
|
|||||||
var requestIPAddress = Request.HttpContext.Connection.RemoteIpAddress;
|
var requestIPAddress = Request.HttpContext.Connection.RemoteIpAddress;
|
||||||
var intIP = requestIPAddress.ToString().ConvertToIP();
|
var intIP = requestIPAddress.ToString().ConvertToIP();
|
||||||
|
|
||||||
|
#if !DEBUG
|
||||||
var origin = (await IW4MAdmin.ApplicationManager.GetInstance().GetClientService().GetClientByIP(intIP))
|
var origin = (await IW4MAdmin.ApplicationManager.GetInstance().GetClientService().GetClientByIP(intIP))
|
||||||
.OrderByDescending(c => c.Level)
|
.OrderByDescending(c => c.Level)
|
||||||
.FirstOrDefault()?.AsPlayer() ?? new Player()
|
.FirstOrDefault()?.AsPlayer() ?? new Player()
|
||||||
@ -36,6 +37,9 @@ namespace WebfrontCore.Controllers
|
|||||||
Level = Player.Permission.User,
|
Level = Player.Permission.User,
|
||||||
IPAddress = intIP
|
IPAddress = intIP
|
||||||
};
|
};
|
||||||
|
#else
|
||||||
|
var origin = (await IW4MAdmin.ApplicationManager.GetInstance().GetClientService().GetUnique(0)).AsPlayer();
|
||||||
|
#endif
|
||||||
|
|
||||||
var server = IW4MAdmin.ApplicationManager.GetInstance().Servers.First(s => s.GetHashCode() == serverId);
|
var server = IW4MAdmin.ApplicationManager.GetInstance().Servers.First(s => s.GetHashCode() == serverId);
|
||||||
origin.CurrentServer = server;
|
origin.CurrentServer = server;
|
||||||
|
@ -19,7 +19,7 @@ namespace WebfrontCore
|
|||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
.UseUrls("http://server.nbsclan.org:8080")
|
.UseUrls("http://server.nbsclan.org:8080")
|
||||||
#else
|
#else
|
||||||
.UseUrls("http://192.168.88.254:5000")
|
.UseUrls("http://127.0.0.1:5000;http://192.168.88.254:5000")
|
||||||
#endif
|
#endif
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ namespace WebfrontCore.ViewComponents
|
|||||||
OffenderName = p.Offender.Name,
|
OffenderName = p.Offender.Name,
|
||||||
PunisherId = p.PunisherId,
|
PunisherId = p.PunisherId,
|
||||||
PunisherName = p.Punisher.Name,
|
PunisherName = p.Punisher.Name,
|
||||||
|
PunisherLevel = p.Punisher.Level.ToString(),
|
||||||
Offense = p.Offense,
|
Offense = p.Offense,
|
||||||
Type = p.Type.ToString(),
|
Type = p.Type.ToString(),
|
||||||
TimePunished = Utilities.GetTimePassed(p.When, false),
|
TimePunished = Utilities.GetTimePassed(p.When, false),
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="profile_info" class="text-center text-sm-left pr-3 pl-3">
|
<div id="profile_info" class="text-center text-sm-left pr-3 pl-3">
|
||||||
<div id="profile_name">
|
<div id="profile_name">
|
||||||
<h1><span class="client-name">@Model.Name<span id="profile_aliases_btn" class="oi oi-caret-bottom pl-2"></span></span></h1>
|
<h1><span class="client-name mr-4">@Model.Name<span id="profile_aliases_btn" class="oi oi-caret-bottom pl-2"></span></span></h1>
|
||||||
<div id="profile_aliases" class="pr-0 pr-sm-4 pb-2 mb-2 text-muted">
|
<div id="profile_aliases" class="pr-0 pr-sm-4 pb-2 mb-2 text-muted">
|
||||||
@{
|
@{
|
||||||
foreach (string alias in Model.Aliases)
|
foreach (string alias in Model.Aliases)
|
||||||
@ -31,10 +31,11 @@
|
|||||||
Last seen <span class="text-primary">@Model.LastSeen</span> ago
|
Last seen <span class="text-primary">@Model.LastSeen</span> ago
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="profile_meta" class="text-center text-sm-right pt-2 mt-md-4 pt-md-3">
|
<div id="profile_meta" class="text-center text-sm-right pt-2 mt-md-4 pt-md-3 mr-4 pr-4 mr-md-0 ml-4 pl-4 ml-md-0 pr-md-0 pl-md-0">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row d-md-flex pt-2">
|
<div class="row d-md-flex pt-2">
|
||||||
<div id="profile_events" class="text-muted text-left ml-sm-0">
|
<div id="profile_events" class="text-muted text-left ml-sm-0">
|
||||||
@{
|
@{
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<tr class="d-table-row d-md-none bg-dark">
|
<tr class="d-table-row d-md-none bg-dark">
|
||||||
<th scope="row" class="bg-primary">Admin</th>
|
<th scope="row" class="bg-primary">Admin</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.ActionLink(Model.PunisherName, "ProfileAsync", "Client", new { id = Model.PunisherId }, new { @class = "link-inverse" })
|
@Html.ActionLink(Model.PunisherName, "ProfileAsync", "Client", new { id = Model.PunisherId }, new { @class = "level-color-" + Model.PunisherLevel.ToLower() })
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -60,7 +60,7 @@
|
|||||||
@Model.Offense
|
@Model.Offense
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.ActionLink(Model.PunisherName, "ProfileAsync", "Client", new { id = Model.PunisherId }, new { @class = "link-inverse" })
|
@Html.ActionLink(Model.PunisherName, "ProfileAsync", "Client", new { id = Model.PunisherId }, new { @class = "level-color-" + Model.PunisherLevel.ToLower() })
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right text-light">
|
<td class="text-right text-light">
|
||||||
@{
|
@{
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
|
.level-bgcolor-console {
|
||||||
|
background-color: grey;
|
||||||
|
}
|
||||||
|
|
||||||
.level-color-user, .level-color-guest {
|
.level-color-user, .level-color-guest {
|
||||||
color: rgba(255, 255, 255, 0.85);
|
color: rgba(255, 255, 255, 0.85);
|
||||||
}
|
}
|
||||||
@ -23,7 +26,7 @@
|
|||||||
background-color: rgba(253, 139, 22, 0.85);
|
background-color: rgba(253, 139, 22, 0.85);
|
||||||
}
|
}
|
||||||
|
|
||||||
.level-color-banned {
|
.level-color-banned, .level-color-console {
|
||||||
color: rgba(255, 69, 69, 0.85);
|
color: rgba(255, 69, 69, 0.85);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
function executeCommand() {
|
function executeCommand() {
|
||||||
const serverId = $('#console_server_select').val();
|
const serverId = $('#console_server_select').val();
|
||||||
const command = $('#console_command_value').val();
|
const command = $('#console_command_value').val();
|
||||||
|
|
||||||
|
if (command.length === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (command[0] !== '!') {
|
||||||
|
$('#console_command_response').text('All commands must start with !').addClass('text-danger');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$.get('/Console/ExecuteAsync', { serverId: serverId, command: command })
|
$.get('/Console/ExecuteAsync', { serverId: serverId, command: command })
|
||||||
.done(function (response) {
|
.done(function (response) {
|
||||||
$('#console_command_response').html(response);
|
$('#console_command_response').html(response);
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
$(document).ready(function () {
|
// keeps track of how many events have been displayed
|
||||||
|
let count = 1;
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
/*
|
/*
|
||||||
Expand alias tab if they have any
|
Expand alias tab if they have any
|
||||||
*/
|
*/
|
||||||
@ -9,14 +12,43 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
load the initial 40 events
|
||||||
|
*/
|
||||||
$.each(clientInfo.Meta, function (index, meta) {
|
$.each(clientInfo.Meta, function (index, meta) {
|
||||||
loadMeta(meta);
|
if (meta.key.includes("Event")) {
|
||||||
if (count % 40 === 0) {
|
loadMeta(meta);
|
||||||
count++;
|
if (count % 40 === 0) {
|
||||||
return false;
|
count++;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
count++
|
||||||
}
|
}
|
||||||
count++
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
load additional events on scroll
|
||||||
|
*/
|
||||||
|
$(window).scroll(function () {
|
||||||
|
if ($(window).scrollTop() === $(document).height() - $(window).height() || $(document).height() === $(window).height()) {
|
||||||
|
while (count % 40 !== 0 && count < clientInfo.Meta.length) {
|
||||||
|
loadMeta(clientInfo.Meta[count - 1]);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
load meta thats not an event
|
||||||
|
*/
|
||||||
|
$.each(clientInfo.Meta, function (index, meta) {
|
||||||
|
if (!meta.key.includes("Event")) {
|
||||||
|
let metaString = `<div class="profile-meta-entry"><span class="profile-meta-value text-primary">${meta.value}</span><span class="profile-meta-title text-muted"> ${meta.key}</span></div>`;
|
||||||
|
$("#profile_meta").append(metaString);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function penaltyToName(penaltyName) {
|
function penaltyToName(penaltyName) {
|
||||||
@ -55,34 +87,3 @@ function loadMeta(meta) {
|
|||||||
}
|
}
|
||||||
$('#profile_events').append(eventString);
|
$('#profile_events').append(eventString);
|
||||||
}
|
}
|
||||||
|
|
||||||
let count = 1;
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
|
||||||
$(window).scroll(function () {
|
|
||||||
if ($(window).scrollTop() === $(document).height() - $(window).height() || $(document).height() === $(window).height()) {
|
|
||||||
while (count % 40 !== 0 && count < clientInfo.Meta.length) {
|
|
||||||
loadMeta(clientInfo.Meta[count - 1]);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$.each(clientInfo.Meta, function (index, meta) {
|
|
||||||
if (!meta.key.includes("Event")) {
|
|
||||||
let metaString = `<div class="profile-meta-entry"><span class="profile-meta-value text-primary">${meta.value}</span><span class="profile-meta-title text-muted"> ${meta.key}</span></div>`;
|
|
||||||
$("#profile_meta").append(metaString);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$.each(clientInfo.Meta, function (index, meta) {
|
|
||||||
loadMeta(meta);
|
|
||||||
|
|
||||||
if (count % 40 === 0) {
|
|
||||||
count++;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
count++;
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
Reference in New Issue
Block a user