From 2be29ab8dead7fc816d9dbd2393de3cf34d9959c Mon Sep 17 00:00:00 2001 From: Rajesh Kumar Date: Fri, 6 Sep 2024 14:16:31 +0530 Subject: [PATCH 1/2] hp required for creating highlights using arch1baald/woodota repo --- src/main/java/opendota/Parse.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/opendota/Parse.java b/src/main/java/opendota/Parse.java index 82922c29..2c1a4862 100644 --- a/src/main/java/opendota/Parse.java +++ b/src/main/java/opendota/Parse.java @@ -88,6 +88,7 @@ public class Entry { public Integer charges; public Integer secondary_charges; public Integer life_state; + public Integer hp; public Integer level; public Integer kills; public Integer deaths; @@ -756,6 +757,8 @@ public void onTickStart(Context ctx, boolean synthetic) { entry.hero_id = hero; entry.variant = variant; entry.life_state = getEntityProperty(e, "m_lifeState", null); + entry.hp = getEntityProperty(e, "m_iHealth", null); + // check if hero has been assigned to entity if (hero > 0) { // get the hero's entity name, ex: CDOTA_Hero_Zuus From d0590cb1100668a820567376410c992b00d22da3 Mon Sep 17 00:00:00 2001 From: Rajesh Kumar Date: Wed, 2 Oct 2024 22:43:38 +0530 Subject: [PATCH 2/2] tick time mismatch --- Dockerfile | 2 +- src/main/java/opendota/Parse.java | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b8266509..63713594 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,4 +15,4 @@ WORKDIR /usr/src/parser ADD . /usr/src/parser RUN mvn -q -f /usr/src/parser/pom.xml clean install -U -CMD ["java", "-jar", "/usr/src/parser/target/stats-0.1.0.jar", "5600"] +CMD ["java", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005", "-jar", "/usr/src/parser/target/stats-0.1.0.jar", "5600"] diff --git a/src/main/java/opendota/Parse.java b/src/main/java/opendota/Parse.java index 2c1a4862..0a8f3675 100644 --- a/src/main/java/opendota/Parse.java +++ b/src/main/java/opendota/Parse.java @@ -47,6 +47,9 @@ public class Parse { public class Entry { public Integer time = 0; + public Integer ticks = 0; + public Integer paused = 0; + public Float oldTime; public String type; public Integer team; public String unit; @@ -167,6 +170,7 @@ public UnknownAbilityFoundException(String message) { float INTERVAL = 1; float nextInterval = 0; Integer time = 0; + Integer pause = 0; int numPlayers = 10; int[] validIndices = new int[numPlayers]; boolean init = false; @@ -190,6 +194,7 @@ public UnknownAbilityFoundException(String message) { int pingCount = 0; private ArrayList logBuffer = new ArrayList(); int serverTick = 0; + int start = 0; // Draft stage variable boolean[] draftOrderProcessed = new boolean[24]; @@ -420,6 +425,14 @@ public void onCombatLogEntry(Context ctx, CombatLogEntry cle) { time = Math.round(cle.getTimestamp()); // create a new entry Entry combatLogEntry = new Entry(time); + if(start == 0) + { + start = serverTick; + } + else + { + combatLogEntry.ticks = serverTick-start; + } combatLogEntry.type = cle.getType().name(); // translate the fields using string tables if necessary (get*Name methods) combatLogEntry.attackername = cle.getAttackerName(); @@ -545,6 +558,7 @@ public void onTickStart(Context ctx, boolean synthetic) { boolean isPaused = getEntityProperty(grp, "m_pGameRules.m_bGamePaused", null); int timeTick = isPaused ? getEntityProperty(grp, "m_pGameRules.m_nPauseStartTick", null) : serverTick; int pausedTicks = getEntityProperty(grp, "m_pGameRules.m_nTotalPausedTicks", null); + pause = pausedTicks; time = Math.round((float) (timeTick - pausedTicks) / 30); } else { time = Math.round(oldTime); @@ -566,6 +580,7 @@ public void onTickStart(Context ctx, boolean synthetic) { boolean isDraftStarted = iPlayerIDsInControl.compareTo(Long.valueOf(0)) != 0; if (isDraftStarted) { Entry draftStartEntry = new Entry(time); + draftStartEntry.ticks = serverTick; draftStartEntry.type = "draft_start"; output(draftStartEntry); isDraftStartTimeProcessed = true; @@ -657,9 +672,11 @@ public void onTickStart(Context ctx, boolean synthetic) { // output the player_slot based on team and teamslot Entry entry = new Entry(time); entry.type = "player_slot"; + entry.ticks = serverTick; entry.key = String.valueOf(added); entry.value = (playerTeam == 2 ? 0 : 128) + teamSlot; playerEntries.add(entry); + if( start == 0) start = serverTick; // add it to validIndices, add 1 to added validIndices[added] = i; added += 1; @@ -758,6 +775,11 @@ public void onTickStart(Context ctx, boolean synthetic) { entry.variant = variant; entry.life_state = getEntityProperty(e, "m_lifeState", null); entry.hp = getEntityProperty(e, "m_iHealth", null); + entry.ticks = serverTick-start; + entry.paused = pause; + entry.oldTime = getEntityProperty(grp, "m_pGameRules.m_fGameTime", null); + + // check if hero has been assigned to entity if (hero > 0) {