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

hp required for creating highlights using arch1baald/woodota repo #74

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
25 changes: 25 additions & 0 deletions src/main/java/opendota/Parse.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -88,6 +91,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;
Expand Down Expand Up @@ -166,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;
Expand All @@ -189,6 +194,7 @@ public UnknownAbilityFoundException(String message) {
int pingCount = 0;
private ArrayList<Entry> logBuffer = new ArrayList<Entry>();
int serverTick = 0;
int start = 0;

// Draft stage variable
boolean[] draftOrderProcessed = new boolean[24];
Expand Down Expand Up @@ -419,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();
Expand Down Expand Up @@ -544,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);
Expand All @@ -565,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;
Expand Down Expand Up @@ -656,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;
Expand Down Expand Up @@ -756,6 +774,13 @@ 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);
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) {
// get the hero's entity name, ex: CDOTA_Hero_Zuus
Expand Down