1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

deleted localization files as they're now generated during release

reintroduce throttling for servers that are unreachable (defaults to 60 seconds between polls)
small revert to the RektT5M parser contell -> tell
add migration to introduce gamename to server
impllement quickmessage mapping
This commit is contained in:
RaidMax
2019-04-23 17:27:20 -05:00
parent 5a0b2ff169
commit 3488bc5d15
22 changed files with 833 additions and 1118 deletions

View File

@ -71,15 +71,32 @@ namespace IW4MAdmin.Plugins.Stats.Web.Controllers
ClientId = message.ClientId,
Message = message.Message,
Name = message.Client.CurrentAlias.Name,
Time = message.TimeSent
Time = message.TimeSent,
ServerGame = message.Server.GameName ?? Server.Game.IW4
};
#if DEBUG == true
var messagesSql = iqMessages.ToSql();
#endif
var messages = await iqMessages.ToListAsync();
foreach (var message in messages)
{
if (message.Message.IsQuickMessage())
{
try
{
var quickMessages = Manager.GetApplicationSettings().Configuration()
.QuickMessages
.First(_qm => _qm.Game == message.ServerGame);
message.Message = quickMessages.Messages[message.Message.Substring(1)];
message.IsQuickMessage = true;
}
catch { }
}
}
return View("_MessageContext", messages);
}
}

View File

@ -222,13 +222,22 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
{
Port = sv.GetPort(),
EndPoint = sv.ToString(),
ServerId = serverId
ServerId = serverId,
GameName = sv.GameName
};
server = serverSet.Add(server).Entity;
// this doesn't need to be async as it's during initialization
ctx.SaveChanges();
}
// we want to set the gamename up if it's never been set, or it changed
else if (!server.GameName.HasValue || server.GameName.HasValue && server.GameName.Value != sv.GameName)
{
server.GameName = sv.GameName;
ctx.Entry(server).Property(_prop => _prop.GameName).IsModified = true;
ctx.SaveChanges();
}
}
// check to see if the stats have ever been initialized

View File

@ -2,6 +2,7 @@
using SharedLibraryCore.Database.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static SharedLibraryCore.Server;
namespace IW4MAdmin.Plugins.Stats.Models
{
@ -13,5 +14,6 @@ namespace IW4MAdmin.Plugins.Stats.Models
[Required]
public int Port { get; set; }
public string EndPoint { get; set; }
public Game? GameName { get; set; }
}
}

View File

@ -408,11 +408,36 @@ namespace IW4MAdmin.Plugins.Stats
messageMeta = await messages.Select(m => new ProfileMeta()
{
Key = null,
Value = m.Message,
Value = new { m.Message, m.Server.GameName },
When = m.TimeSent,
Extra = m.ServerId.ToString(),
Type = ProfileMeta.MetaType.ChatMessage
}).ToListAsync();
foreach (var message in messageMeta)
{
if ((message.Value.Message as string).IsQuickMessage())
{
try
{
var quickMessages = ServerManager.GetApplicationSettings().Configuration()
.QuickMessages
.First(_qm => _qm.Game == message.Value.GameName);
message.Value = quickMessages.Messages[(message.Value.Message as string).Substring(1)];
message.Type = ProfileMeta.MetaType.QuickMessage;
}
catch
{
message.Value = message.Value.Message;
}
}
else
{
message.Value = message.Value.Message;
}
}
}
return messageMeta;