forked from odota/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'match_logs' into ward_log
- Loading branch information
Showing
17 changed files
with
360 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,67 @@ | ||
/** | ||
* A processor to reduce the event stream by grouping similar events. | ||
* NOT CURRENTLY IN PRODUCTION USE | ||
* A processor to reduce the event stream to only logs we want to persist | ||
**/ | ||
function processReduce(entries) | ||
function processReduce(entries, match, meta) | ||
{ | ||
var reduceMap = {}; | ||
//group by player_slot, type, targethero, targetillusion | ||
for (var i = 0; i < entries.length; i++) | ||
var result = entries.filter(function(e) | ||
{ | ||
//group big categories: actions, combat log damage | ||
var e = entries[i]; | ||
var identifier = [e.player_slot, e.type, e.key].join(":"); | ||
e.value = e.value || 1; | ||
//var identifier = e.type; | ||
//e.value = 1; | ||
reduceMap[identifier] = reduceMap[identifier] ? reduceMap[identifier] + e.value : e.value || 1; | ||
} | ||
//var fs = require('fs'); | ||
//fs.writeFileSync('./output3.json', JSON.stringify(reduceMap, null , 2)); | ||
if (e.type === "actions") | ||
{ | ||
return false; | ||
} | ||
if (e.type === "DOTA_COMBATLOG_MODIFIER_REMOVE") | ||
{ | ||
return false; | ||
} | ||
if (e.type === "DOTA_COMBATLOG_DAMAGE" || e.type === "DOTA_COMBATLOG_MODIFIER_ADD" || e.type === "DOTA_COMBATLOG_HEAL") | ||
{ | ||
if (!e.targethero || e.targetillusion) | ||
{ | ||
return false; | ||
} | ||
} | ||
if (e.type === "interval" && e.time % 60 !== 0) | ||
{ | ||
return false; | ||
} | ||
if (!e.time) | ||
{ | ||
return false; | ||
} | ||
return true; | ||
}).map(function(e) | ||
{ | ||
var e2 = Object.assign( | ||
{}, e, | ||
{ | ||
match_id: match.match_id, | ||
attackername_slot: meta.hero_to_slot[e.attackername], | ||
targetname_slot: meta.hero_to_slot[e.targetname], | ||
sourcename_slot: meta.hero_to_slot[e.sourcename], | ||
targetsourcename_slot: meta.hero_to_slot[e.targetname], | ||
player1_slot: meta.slot_to_playerslot[e.player1], | ||
player_slot: e.player_slot || meta.slot_to_playerslot[e.slot], | ||
inflictor: translate(e.inflictor), | ||
}); | ||
delete e2.attackername; | ||
delete e2.targetname; | ||
delete e2.sourcename; | ||
delete e2.targetsourcename; | ||
return e2; | ||
}); | ||
/* | ||
var count = {}; | ||
result.forEach(function(r) | ||
{ | ||
count[r.type] = (count[r.type] || 0) + 1; | ||
}); | ||
console.log(count); | ||
*/ | ||
return result; | ||
} | ||
|
||
function translate(s) | ||
{ | ||
return s === "dota_unknown" ? null : s; | ||
} | ||
module.exports = processReduce; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.