Skip to content

Commit

Permalink
add alternate gamestarttime
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Nov 16, 2023
1 parent f677669 commit eb9f5bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
curl localhost:5600 --data-binary "@./7359804449_987225713.dem"
#curl localhost:5600 --data-binary "@/datadrive/odota-parser/7355186741_1742953546.dem"
curl localhost:5600 --data-binary "@/datadrive/odota-parser/7437280975_580771917.dem"
16 changes: 12 additions & 4 deletions src/main/java/opendota/Parse.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public Parse(InputStream input, OutputStream output) throws IOException

public void output(Entry e) {
try {
if (gameStartTime == 0) {
if (gameStartTime == 0 && logBuffer != null) {
logBuffer.add(e);
} else {
e.time -= gameStartTime;
Expand All @@ -221,6 +221,9 @@ public void output(Entry e) {
}

public void flushLogBuffer() {
if (logBuffer == null) {
return;
}
for (Entry e : logBuffer) {
output(e);
}
Expand Down Expand Up @@ -441,8 +444,7 @@ else if (cle.getType() == DOTA_COMBATLOG_TYPES.DOTA_COMBATLOG_XP) {
postGame = true;
}
if (combatLogEntry.type.equals("DOTA_COMBATLOG_GAME_STATE") && combatLogEntry.value == 5) {
//alternate to combat log for getting game zero time (looks like this is set at the same time as the game start, so it's not any better for streaming)
// int currGameStartTime = Math.round( (float) grp.getProperty("m_pGameRules.m_flGameStartTime"));
// See alternative gameStartTime from grp
if (gameStartTime == 0) {
gameStartTime = combatLogEntry.time;
flushLogBuffer();
Expand Down Expand Up @@ -528,7 +530,13 @@ public void onTickStart(Context ctx, boolean synthetic) {
} else {
time = Math.round(oldTime);
}
//draft timings
// alternate to combat log for getting game zero time (looks like this is set at the same time as the game start, so it's not any better for streaming)
// Some replays don't have the combat log event for some reason so also do this here
int currGameStartTime = Math.round( (float) grp.getProperty("m_pGameRules.m_flGameStartTime"));
if (gameStartTime == 0 && currGameStartTime != 0) {
gameStartTime = currGameStartTime;
flushLogBuffer();
}
if(draftStage == 2) {

//determine the time the draftings start
Expand Down

0 comments on commit eb9f5bf

Please sign in to comment.