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 pull request odota#1080 from yasp-dota/match_logs
Match logs
- Loading branch information
Showing
24 changed files
with
511 additions
and
155 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
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 |
---|---|---|
|
@@ -89,5 +89,4 @@ function populate(e, container) | |
break; | ||
} | ||
} | ||
|
||
module.exports = populate; |
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,85 @@ | ||
/** | ||
* 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++) | ||
//for now, disable log parsing for regular matches | ||
if (!match.doLogParse) | ||
{ | ||
//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; | ||
return; | ||
} | ||
//var fs = require('fs'); | ||
//fs.writeFileSync('./output3.json', JSON.stringify(reduceMap, null , 2)); | ||
var basicLogTypes = { | ||
"obs": 1, | ||
"sen": 1, | ||
"obs_left": 1, | ||
"sen_left": 1, | ||
}; | ||
var result = entries.filter(function(e) | ||
{ | ||
if (match.doLogParse) | ||
{ | ||
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; | ||
} | ||
else | ||
{ | ||
return (e.type in basicLogTypes); | ||
} | ||
}).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
Oops, something went wrong.