Chat history stuff

fixed kills not saving
This commit is contained in:
RaidMax 2017-11-04 18:42:31 -05:00
parent 308427e662
commit 07e3c61e98
13 changed files with 2648 additions and 143 deletions

View File

@ -165,6 +165,9 @@
<Content Include="webfront\images\minimap_mp_terminal.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="webfront\scripts\wordcloud2.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="webfront\stats.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -363,7 +366,6 @@ copy /Y "$(ProjectDir)lib\Kayak.dll" "$(SolutionDir)BUILD\lib"
xcopy /Y /I /E "$(ProjectDir)webfront\*" "$(SolutionDir)BUILD\Webfront"
if $(ConfigurationName) == Release-Nightly powershell.exe -file "$(SolutionDir)DEPLOY\publish_nightly.ps1" 1.4
if $(ConfigurationName) == Release-Stable powershell.exe -file "$(SolutionDir)DEPLOY\publish_stable.ps1" 1.4</PostBuildEvent>
</PropertyGroup>

View File

@ -593,8 +593,9 @@ namespace IW4MAdmin
else // Not a command
{
E.Data = E.Data.StripColors().CleanChars();
if (E.Data.Length > 50)
E.Data = E.Data.Substring(0, 50) + "...";
// this should not be done for all messages.
//if (E.Data.Length > 50)
// E.Data = E.Data.Substring(0, 50) + "...";
ChatHistory.Add(new Chat(E.Origin.Name, E.Data, DateTime.Now));
}

Binary file not shown.

View File

@ -1 +1,31 @@

<script src="/webfront/scripts/wordcloud2.js"></script>
<div class="chat-history"></div>
<canvas id="chat-word-cloud" width="625" height="625"></canvas>
<script>
if (parseGet("clientid") == "undefined") {
$.getJSON("/_words", function (result) {
var wordList = [];
$.each(result, function (i, word) {
wordList.push([word.Word, word.Count]);
});
WordCloud(document.getElementById('chat-word-cloud'), { list: wordList, backgroundColor: "rgb(34,34,34)", minSize: "14pt", color: "rgb(0, 122, 204)", wait: 20, weightFactor: 2 });
});
}
else {
$.getJSON("/_clientchat?clientid=" + parseGet("clientid"), function (result) {
result = result.sort(function (a, b) {
// Turn your strings into dates, and then subtract them
// to get a value that is either negative, positive, or zero.
return new Date(b.TimeSent) - new Date(a.TimeSent);
});
$.each(result, function (i, chat) {
var date = new Date(chat.TimeSent);
$('.chat-history').append("<div><span>" + date.toLocaleString() + " &mdash; </span><span><b>" + chat.Client.Name + "</b></span>: <span>" + chat.Message + "</span></div>");
});
});
}
</script>

View File

@ -1,16 +1,13 @@
<script>
var curFrom = 0;
function getNextPage()
{
function getNextPage() {
curFrom += 15;
return curFrom;
}
function getPrevPage()
{
if ((curFrom - 15) >= 0)
{
function getPrevPage() {
if ((curFrom - 15) >= 0) {
curFrom -= 15;
return (curFrom - 15);
}
@ -18,8 +15,7 @@ function getPrevPage()
return 0;
}
function formatHidden(data, authed)
{
function formatHidden(data, authed) {
var p = "<div class=\"hiddenWrapper\"><span>Expand</span><div class=\"hiddenElements\">";
if (authed) {
@ -36,8 +32,7 @@ function formatHidden(data, authed)
return p;
}
function printPlayer(player, i)
{
function printPlayer(player, i) {
var p = "";
p +=
"<div class=\"playerInfo table alternate_" + i % 2 + "\"> \
@ -47,24 +42,9 @@ function printPlayer(player, i)
<div class=\"tableCell\">" + getColorForLevel(player['playerLevel'], player['playerLevel']) + "</div> \
<div class=\"tableCell\">" + player['playerConnections'] + "</div>";
if (player.showV2Features)
{
p +=
"<div class=\"tableCell actionButton\" style='width: 2em;'> \
<a target=\"_blank\" href='http://server.nbsclan.org/screen.php?id=" + player.forumID + "&name=" + player.playerName + "'> \
<i class=\"fa fa-camera\" aria-hidden=\"true\"></i> \
</a> \
<a target=\"_blank\" href='https://v2.mcsebi.ru/memberlist.php?mode=viewprofile&u=" + player.forumID + "'> \
<i class=\"fa fa-user tableCell\" aria-hidden=\"true\"></i> \
</a> \
</div> ";
}
else
{
p +=
"<div class=\"tableCell\" style='width: 2em;'><i class=\"fa fa-ban\" aria-hidden=\"true\"></i></div>"
}
"<div class=\"tableCell\" style='width: 2em;'><a href=\"/chat?clientid=" + player.playerID + "\"><i class=\"fa fa-comments\" aria-hidden=\"true\"></i></a></div>"
p +=
"<div class=\"tableCell alignRight\">" + checkJustNow(player['lastSeen']) + "</div> \
@ -74,8 +54,7 @@ function printPlayer(player, i)
}
function getPlayer(ident, identValue)
{
function getPlayer(ident, identValue) {
$("#playersTable").html("");
$(".loader").fadeIn();
@ -113,7 +92,7 @@ $('#content').on('click', 'div.hiddenWrapper span', function(){
<div class="contentColumn tableCell">IP</div>
<div class="contentColumn tableCell">Level</div>
<div class="contentColumn tableCell">Connections</div>
<div class="contentColumn tableCell" style="width: 1em;">V2</div>
<div class="contentColumn tableCell" style="width: 1em;">Chat</div>
<div class="contentColumn tableCell alignRight">Last Seen</div>
</div>
<div id="playersTable">

File diff suppressed because it is too large Load Diff

View File

@ -75,8 +75,8 @@ Global
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Stable|Any CPU.Build.0 = Debug|Any CPU
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
@ -99,8 +99,8 @@ Global
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|Any CPU.Build.0 = Debug|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
@ -123,8 +123,8 @@ Global
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Any CPU.Build.0 = Debug|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
@ -147,8 +147,8 @@ Global
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Stable|Any CPU.Build.0 = Debug|Any CPU
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
{AF097E6B-48D5-4452-9CCF-0A81A21F341D}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
@ -164,14 +164,13 @@ Global
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Debug|x86.ActiveCfg = Debug|x86
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Debug|x86.Build.0 = Debug|x86
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|Any CPU.ActiveCfg = Release-Nightly|Any CPU
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|Any CPU.Build.0 = Release-Nightly|Any CPU
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|Mixed Platforms.ActiveCfg = Release-Nightly|x86
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|Mixed Platforms.Build.0 = Release-Nightly|x86
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|x64.ActiveCfg = Release-Nightly|Any CPU
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
{428D8EB9-ECA3-4A66-AA59-3A944378C33F}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
@ -184,13 +183,12 @@ Global
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Debug|x64.ActiveCfg = Release-Stable|Any CPU
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Debug|x86.ActiveCfg = Debug|x86
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Debug|x86.Build.0 = Debug|x86
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|Any CPU.ActiveCfg = Release-Stable|Any CPU
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|Any CPU.Build.0 = Release-Stable|Any CPU
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|Any CPU.ActiveCfg = Release-Nightly|Any CPU
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|Mixed Platforms.ActiveCfg = Release-Stable|Any CPU
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|x64.ActiveCfg = Release-Stable|Any CPU
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|Any CPU
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
{E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|x86.ActiveCfg = Release-Stable|Any CPU
@ -211,8 +209,8 @@ Global
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Any CPU.Build.0 = Debug|Any CPU
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
@ -228,14 +226,13 @@ Global
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Debug|x86.ActiveCfg = Debug|x86
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Debug|x86.Build.0 = Debug|x86
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Nightly|Any CPU.ActiveCfg = Release-Nightly|Any CPU
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Nightly|Any CPU.Build.0 = Release-Nightly|Any CPU
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Nightly|Mixed Platforms.ActiveCfg = Release-Nightly|x86
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Nightly|Mixed Platforms.Build.0 = Release-Nightly|x86
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Nightly|x64.ActiveCfg = Release-Nightly|Any CPU
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
{1479DE87-ACB5-4046-81C8-A0BA5041227D}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU
@ -251,15 +248,13 @@ Global
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Debug|x86.ActiveCfg = Debug|x86
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Debug|x86.Build.0 = Debug|x86
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Nightly|Any CPU.ActiveCfg = Release-Nightly|Any CPU
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Nightly|Any CPU.Build.0 = Release-Nightly|Any CPU
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Nightly|Mixed Platforms.ActiveCfg = Release-Nightly|x86
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Nightly|Mixed Platforms.Build.0 = Release-Nightly|x86
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Nightly|x64.ActiveCfg = Release-Nightly|Any CPU
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Stable|Any CPU.ActiveCfg = Debug|Any CPU
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86
{B8C2A759-8663-4F6F-9BA4-19595F5E12C1}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU

View File

@ -12,6 +12,86 @@ namespace StatsPlugin
{
public class ChatDatabase : Database
{
private string[] CommonWords = new string[] { "for",
"with",
"from",
"about",
"into",
"over",
"after",
"that",
"not",
"you",
"this",
"but",
"his",
"they",
"her",
"she",
"will",
"one",
"all",
"would",
"there",
"their",
"have",
"say",
"get",
"make",
"know",
"take",
"see",
"come",
"think",
"look",
"want",
"give",
"use",
"find",
"tell",
"ask",
"work",
"seem",
"feel",
"try",
"leave",
"call",
"good",
"new",
"first",
"last",
"long",
"great",
"little",
"own",
"other",
"old",
"right",
"big",
"high",
"small",
"large",
"next",
"early",
"young",
"important",
"few",
"public",
"same",
"able",
"the",
"and",
"that",
"have",
"this",
"one",
"would",
"yeah",
"yah",
"why",
"who" ,
"when"};
public ChatDatabase(string FN) : base(FN)
{
}
@ -65,6 +145,9 @@ namespace StatsPlugin
public void AddChatHistory(int clientID, int serverID, string message)
{
if (message.Length < 3)
return;
var chat = new Dictionary<string, object>()
{
{ "ClientID", clientID },
@ -75,20 +158,22 @@ namespace StatsPlugin
Insert("CHATHISTORY", chat);
message.Split(' ').Where(word => word.Length >= 3).Any(word =>
var eachWord = message.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
.Where (word => word.Length >= 3)
.Where(word => CommonWords.FirstOrDefault(c => c == word.ToLower()) == null)
.ToList();
foreach (string _word in eachWord)
{
word = word.ToLower();
string word = _word.ToLower();
Insert("WORDSTATS", new Dictionary<string, object>() { { "Word", word } }, true);
// shush :^)
ExecuteNonQuery($"UPDATE WORDSTATS SET Count = Count + 1 WHERE Word='{word.CleanChars()}'");
return true;
UpdateIncrement("WORDSTATS", "Count", new Dictionary<string, object>() { { "Count", 1 } }, new KeyValuePair<string, object>("Word", word));
}
);
}
public KeyValuePair<string, int>[] GetWords()
{
var result = GetDataTable("SELECT * FROM WORDSTATS ORDER BY Count desc LIMIT 100");
var result = GetDataTable("SELECT * FROM WORDSTATS ORDER BY Count desc LIMIT 200");
return result.Select().Select(w => new KeyValuePair<string, int>(w["Word"].ToString(), Convert.ToInt32(w["Count"].ToString()))).ToArray();
}
}

View File

@ -11,8 +11,6 @@ namespace StatsPlugin.Chat
{
public class ChatPage : HTMLPage
{
public ChatPage() : base(false) { }
public override string GetContent(NameValueCollection querySet, IDictionary<string, string> headers)
{
StringBuilder S = new StringBuilder();
@ -27,7 +25,7 @@ namespace StatsPlugin.Chat
return S.ToString();
}
public override string GetName() => "Chat Stats";
public override string GetName() => "Word Cloud";
public override string GetPath() => "/chat";
}
@ -68,11 +66,20 @@ namespace StatsPlugin.Chat
public HttpResponse GetPage(NameValueCollection querySet, IDictionary<string, string> headers)
{
int clientID = Convert.ToInt32(querySet["clientid"]);
var client = Stats.ManagerInstance.GetClientDatabase().GetPlayer(clientID);
HttpResponse resp = new HttpResponse()
{
contentType = GetContentType(),
content = Stats.ChatDB.GetChatForPlayer(Convert.ToInt32(querySet["clientid"])).ToArray(),
content = Stats.ChatDB.GetChatForPlayer(clientID).ToArray().Select(c => new
{
ClientID = c.ClientID,
ServerID = c.ServerID,
Message = c.Message,
TimeSent = c.TimeSent,
Client = client
}),
additionalHeaders = new Dictionary<string, string>()
};

View File

@ -316,7 +316,6 @@ namespace StatsPlugin
//S.Logger.WriteInfo($"{E.Origin.Name} killed {E.Target.Name} with a {killEvent.Weapon} from a distance of {Vector3.Distance(killEvent.KillOrigin, killEvent.DeathOrigin)} with {killEvent.Damage} damage, at {killEvent.HitLoc}");
var cs = statLists.Find(x => x.Port == S.GetPort());
cs.playerStats.AddKill(killEvent);
return;
}
Player Killer = E.Origin;

View File

@ -91,6 +91,6 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if $(ConfigurationName) == Debug copy /Y "$(TargetDir)$(TargetName).dll" "$(SolutionDir)BUILD\plugins\"</PostBuildEvent>
<PostBuildEvent>if $(ConfigurationName) == Debug (copy /Y "$(TargetDir)$(TargetName).dll" "$(SolutionDir)BUILD\plugins\")</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -64,6 +64,42 @@ namespace SharedLibrary
}
protected void UpdateIncrement(String tableName, string columnName, Dictionary<String, object> data, KeyValuePair<string, object> where)
{
string parameters = "";
foreach (string key in data.Keys)
{
parameters += $"{key}={key}+1,";
}
parameters = parameters.Substring(0, parameters.Length - 1);
var Con = GetNewConnection();
SQLiteCommand updatecmd = new SQLiteCommand()
{
Connection = Con,
CommandText = String.Format("UPDATE `{0}` SET {1} WHERE {2}=@{2}", tableName, parameters, where.Key)
};
foreach (string key in data.Keys)
{
updatecmd.Parameters.AddWithValue('@' + key, data[key]);
}
updatecmd.Parameters.AddWithValue('@' + where.Key, where.Value);
try
{
Con.Open();
updatecmd.ExecuteNonQuery();
Con.Close();
}
catch (Exception E)
{
Console.WriteLine($"Line 96: {E.Message}");
}
}
protected bool Update(String tableName, Dictionary<String, object> data, KeyValuePair<string, object> where)
{
string parameters = "";

View File

@ -143,9 +143,11 @@ copy /Y "$(TargetDir)Newtonsoft.Json.dll" "$(SolutionDir)Admin\lib"</PostBuildEv
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.105.1\build\net45\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.105.1\build\net45\System.Data.SQLite.Core.targets'))" />
</Target>
<PropertyGroup>
<PreBuildEvent>if not exist "$(SolutionDir)BUILD" mkdir "$(SolutionDir)BUILD"
<PreBuildEvent>if exist "$(SolutionDir)BUILD\Plugins" rmdir /Q /S "$(SolutionDir)BUILD\Plugins"
mkdir "$(SolutionDir)BUILD\Plugins"
if not exist "$(SolutionDir)BUILD" mkdir "$(SolutionDir)BUILD"
if not exist "$(SolutionDir)BUILD\Lib" mkdir "$(SolutionDir)BUILD\Lib"
if not exist "$(SolutionDir)BUILD\Plugins" mkdir "$(SolutionDir)BUILD\Plugins"
if not exist "$(SolutionDir)BUILD\userraw\scripts" mkdir "$(SolutionDir)BUILD\userraw\scripts"</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.