Skip to content

Commit

Permalink
Better ignoring of bots in kill stats.
Browse files Browse the repository at this point in the history
  • Loading branch information
sysrage committed Oct 13, 2015
1 parent 4174e82 commit 1046a23
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
9 changes: 9 additions & 0 deletions cu-chatbot.cfg.example
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ module.exports = {
'user'
],

// Names of bots to be ignored for leaderboard
botNames: [
'SuperFireBot',
'SuperWaterBot',
'SuperEarthBot',
'[Bot] WaterMage',
'[Bot] FireMage',
],

// Keyword regular expressions to watch for which match test CSE messages
testKeywords: [
".*impromptu.*",
Expand Down
6 changes: 3 additions & 3 deletions cu-chatbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ var chatCommands = [

// Remove bots from rankings
for (var i = 0; i < pStats.length; i++) {
if (['SuperFireBot','SuperWaterBot','SuperEarthBot','[Bot] WaterMage','[Bot] FireMage'].indexOf(pStats[i].playerName) > -1) {
if (config.botNames.indexOf(pStats[i].playerName) > -1) {
pStats.splice(i, 1);
i--;
}
Expand Down Expand Up @@ -1534,8 +1534,8 @@ function controlGame(server) {
getRoundKills(server, roundStartTime, roundEndTime, 0, function(roundKills) {
var playersInRound = [];
roundKills.forEach(function(rkEntry) {
// Skip suicides
if (rkEntry.killerName !== rkEntry.victimName) {
// Skip suicides and bot kills
if (rkEntry.killerName !== rkEntry.victimName && config.botNames.indexOf(rkEntry.victimName) === -1) {
// Check to see if these players already had their gameCount increased for this round.
var killerAlreadyCounted = false;
var victimAlreadyCounted = false;
Expand Down
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ var SampleApp = function() {

// Remove bots from rankings.
for (var i = 0; i < data.length; i++) {
if (['SuperFireBot','SuperWaterBot','SuperEarthBot','[Bot] WaterMage','[Bot] FireMage'].indexOf(data[i].playerName) > -1) {
if (config.botNames.indexOf(data[i].playerName) > -1) {
data.splice(i, 1);
i--;
}
Expand Down

0 comments on commit 1046a23

Please sign in to comment.