Open alexalperov opened 7 years ago
Do we know how to read it? Watching the player entities and check the order in which selectedheroid changes?
I am not sure how to read it. Can we verify that the heroid isn't applied to all players at roughly the same during the load in?
Actually someone posted some code in the odota/core repo that might be adaptable: https://github.com/odota/core/issues/1531
Wouldn't it be possible to just pull these variables? pick0 = getEntityProperty(grp, "m_pGameRules.m_SelectedHeroes.0000", null); pick1 = getEntityProperty(grp, "m_pGameRules.m_SelectedHeroes.0001", null);
I haven't tried, but feel free to download clarity-analyzer and check
When I wrote that code the picks and bans didn't have an order (the changing orders between patches). So the code has to wait until a pick or ban has occured then grabs the time taken for the pick or ban. The problem is that I didnt understand what JSON was so I wrote the code to output csv.
Heres the code Ive fixed up so far. Im trying to get it into the parser. Now the code only reads 10 entries so i think it might be missing the banned heroes.
edit: I just checked the code is only picking up the selected heroes.
edit: just checked with another replay and it is working fine. So tomorrow and try to git pull or push however that works and send through the changes. It adds 20 lines of out put in the 'parsedump' with 6 variables Time, Pick/Ban order (1-20), hero ids, , active team, extra time remaing team 0, extra time remaining team 1. Tomorrow I try to write something in the parse of the the parsedump to assign players to their hero ids, teams ids to the active team, and the separate the banned heroes from the picked heroes, and then easy to calculate how much time was taken for each ban and pick.
Preview of output:
{"time":545,"type":"PicksAndBans","PicksAndBans":15,"PicksAndBansOrder":17,"PicksAndBansActiveTeam":2,"PicksAndBansTime":545.0,"PicksAndBansExTime0":26.0,"PicksAndBansExTime1":45.0}
code: ` draftstage = getEntityProperty(grp, "m_pGameRules.m_nGameState", null);
if (grp != null)
{
//System.err.println(grp);
//dota_gamerules_data.m_iGameMode = 22
//dota_gamerules_data.m_unMatchID64 = 1193091757
time = Math.round((float) getEntityProperty(grp, "m_pGameRules.m_fGameTime", null));
//draft timings
if(draftstage == 2) {
//Picks and ban are not in order due to draft change rules changes between patches
// Need to listen for the picks and ban to change
PicksAndBans[0] = getEntityProperty(grp, "m_pGameRules.m_BannedHeroes.0000", null);
PicksAndBans[1] = getEntityProperty(grp, "m_pGameRules.m_BannedHeroes.0001", null);
PicksAndBans[2] = getEntityProperty(grp, "m_pGameRules.m_BannedHeroes.0002", null);
PicksAndBans[3] = getEntityProperty(grp, "m_pGameRules.m_BannedHeroes.0003", null);
PicksAndBans[4] = getEntityProperty(grp, "m_pGameRules.m_BannedHeroes.0004", null);
PicksAndBans[5] = getEntityProperty(grp, "m_pGameRules.m_BannedHeroes.0005", null);
PicksAndBans[6] = getEntityProperty(grp, "m_pGameRules.m_BannedHeroes.0006", null);
PicksAndBans[7] = getEntityProperty(grp, "m_pGameRules.m_BannedHeroes.0007", null);
PicksAndBans[8] = getEntityProperty(grp, "m_pGameRules.m_BannedHeroes.0008", null);
PicksAndBans[9] = getEntityProperty(grp, "m_pGameRules.m_BannedHeroes.0009", null);
PicksAndBans[10] = getEntityProperty(grp, "m_pGameRules.m_SelectedHeroes.0000", null);
PicksAndBans[11] = getEntityProperty(grp, "m_pGameRules.m_SelectedHeroes.0001", null);
PicksAndBans[12] = getEntityProperty(grp, "m_pGameRules.m_SelectedHeroes.0002", null);
PicksAndBans[13] = getEntityProperty(grp, "m_pGameRules.m_SelectedHeroes.0003", null);
PicksAndBans[14] = getEntityProperty(grp, "m_pGameRules.m_SelectedHeroes.0004", null);
PicksAndBans[15] = getEntityProperty(grp, "m_pGameRules.m_SelectedHeroes.0005", null);
PicksAndBans[16] = getEntityProperty(grp, "m_pGameRules.m_SelectedHeroes.0006", null);
PicksAndBans[17] = getEntityProperty(grp, "m_pGameRules.m_SelectedHeroes.0007", null);
PicksAndBans[18] = getEntityProperty(grp, "m_pGameRules.m_SelectedHeroes.0008", null);
PicksAndBans[19] = getEntityProperty(grp, "m_pGameRules.m_SelectedHeroes.0009", null);
//Once a pick or ban happens grab the time and extra time remaining for both teams
for(int i =0; i < 20; i++) {
if(PicksAndBans[i] > 0 && PicksAndBansTime[i] == 0) {
PicksAndBansOrder[i] = order;
PicksAndBansActiveTeam[i] = getEntityProperty(grp, "m_pGameRules.m_iActiveTeam", null);
PicksAndBansTime[i] = Math.round((float) getEntityProperty(grp, "m_pGameRules.m_fGameTime", null));
PicksAndBansExTime0[i] = Math.round((float) getEntityProperty(grp, "m_pGameRules.m_fExtraTimeRemaining.0000", null));
PicksAndBansExTime1[i] = Math.round((float) getEntityProperty(grp, "m_pGameRules.m_fExtraTimeRemaining.0001", null));
order = order + 1;
Entry PicksAndBansEntry = new Entry(time);
PicksAndBansEntry.type = "PicksAndBans";
PicksAndBansEntry.PicksAndBansTime = PicksAndBansTime[i];
PicksAndBansEntry.PicksAndBansOrder = PicksAndBansOrder[i];
PicksAndBansEntry.PicksAndBans = PicksAndBans[i];
PicksAndBansEntry.PicksAndBansActiveTeam = PicksAndBansActiveTeam[i];
PicksAndBansEntry.PicksAndBansExTime0 = PicksAndBansExTime0[i];
PicksAndBansEntry.PicksAndBansExTime1 = PicksAndBansExTime1[i];
output(PicksAndBansEntry);
}
}
}`
The information on pick order seems to be in the replay now. Feature request for adding hero pick order to the JSON log events. This is something that could be added to the web UI at some point as well.