Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added starting items to /matches endpoint #2254

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions CONTRIBUTORS.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ module.exports = {
81164255: {}, // jgalat
48990698: {}, // fcostantini
385676285: {}, // 102
89457522: {}, // 27bslash
};
2 changes: 1 addition & 1 deletion processors/createParsedDataBlob.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function getParseSchema() {
obs_left_log: [],
sen_left_log: [],
purchase_log: [],
starting_items: [],
kills_log: [],
buyback_log: [],
runes_log: [],
Expand Down Expand Up @@ -119,7 +120,6 @@ function createParsedDataBlob(entries, matchId, doLogParse) {
parsedData.logs = processLogParse(entries, meta);
}
logConsole.timeEnd('doLogParse');

return parsedData;
}

Expand Down
9 changes: 8 additions & 1 deletion processors/populate.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,18 @@ function populate(e, container) {
let arrEntry;
if (e.interval) {
arrEntry = e.value;
} else if (e.type === 'purchase_log' || e.type === 'kills_log' || e.type === 'runes_log') {
} else if (e.type === 'starting_items' || e.type === 'purchase_log' || e.type === 'kills_log' || e.type === 'runes_log') {
arrEntry = {
time: e.time,
key: e.key,
};
if (e.type === 'starting_items') {
arrEntry = {
key: e.key,
itemslot: e.itemslot,
charges: e.charges,
};
}
if (e.type === 'kills_log' && e.tracked_death) {
arrEntry = Object.assign({}, {
tracked_death: e.tracked_death,
Expand Down
14 changes: 14 additions & 0 deletions processors/processExpand.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,20 @@ function processExpand(entries, meta) {
type: 'xp_reasons',
});
},
STARTING_ITEM(e) {
// starting items
const unit = e.targetname;
const key = translate(e.valuename);
expand({
time: e.time,
value: 1,
unit,
key,
charges: e.charges,
itemslot: e.itemslot,
type: 'starting_items',
});
},
DOTA_COMBATLOG_PURCHASE(e) {
// purchase
const unit = e.targetname;
Expand Down
1 change: 0 additions & 1 deletion processors/processLogParse.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const insignificantDeaths = [
function translate(s) {
return s === 'dota_unknown' ? null : s;
}

/**
* A processor to reduce the event stream to only logs we want to persist
* */
Expand Down
23 changes: 22 additions & 1 deletion routes/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ You can find data that can be used to convert hero and ability IDs and other inf
type: 'integer',
},
key: {
description: 'Integer item ID',
description: 'String item name',
type: 'string',
},
},
Expand Down Expand Up @@ -677,6 +677,27 @@ You can find data that can be used to convert hero and ability IDs and other inf
description: 'How many sentries were placed by the player',
type: 'integer',
},
starting_items: {
description: 'Object containing information on items at the start of the game',
type: 'array',
items: {
type: 'object',
properties: {
key: {
description: 'Item name',
type: 'string',
},
itemslot: {
description: 'Inventory slot the item was in',
type: 'integer',
},
charges: {
description: 'Amount of charges an item has',
type: 'integer',
},
},
},
},
stuns: {
description: 'Total stun duration of all stuns by the player',
type: 'number',
Expand Down
1 change: 1 addition & 0 deletions sql/create_tables.cql
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ CREATE TABLE IF NOT EXISTS player_matches (
sen_log text,
obs_left_log text,
sen_left_log text,
starting_items text,
purchase_log text,
kills_log text,
buyback_log text,
Expand Down
1 change: 1 addition & 0 deletions sql/create_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ CREATE TABLE IF NOT EXISTS player_matches (
sen_log json[],
obs_left_log json[],
sen_left_log json[],
starting_items json[],
purchase_log json[],
kills_log json[],
buyback_log json[],
Expand Down