Skip to content

Commit a09d4c9

Browse files
committed
from yasp to opendota package
cleaning house
1 parent ebdd7b4 commit a09d4c9

File tree

7 files changed

+50
-110
lines changed

7 files changed

+50
-110
lines changed

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,4 @@ WORKDIR /usr/src/parser
1212
ADD . /usr/src/parser
1313
RUN mvn -q -f /usr/src/parser/pom.xml clean install -U
1414

15-
EXPOSE 5600
16-
1715
CMD ["java", "-jar", "-Xmx256m", "/usr/src/parser/target/stats-0.1.0.jar", "5600"]

pom.xml

Lines changed: 6 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,7 @@
3939
</repository>
4040
</repositories>
4141
<dependencies>
42-
<!--
43-
<dependency>
44-
<groupId>com.github.skadistats</groupId>
45-
<artifactId>clarity</artifactId>
46-
<version>master-SNAPSHOT</version>
47-
</dependency>
48-
-->
49-
<!--
50-
<dependency>
51-
<groupId>com.github.skadistats</groupId>
52-
<artifactId>clarity</artifactId>
53-
<version>70956f5a89fca56f3a292e739ea3eda96a33fd8c</version>
54-
</dependency>
55-
-->
56-
42+
<!--
5743
<dependency>
5844
<groupId>com.github.skadistats</groupId>
5945
<artifactId>clarity</artifactId>
@@ -72,7 +58,7 @@
7258
<artifactId>clarity</artifactId>
7359
<version>2.3-SNAPSHOT</version>
7460
</dependency>
75-
61+
7662
<dependency>
7763
<groupId>com.google.code.gson</groupId>
7864
<artifactId>gson</artifactId>
@@ -83,27 +69,13 @@
8369
<plugins>
8470
<plugin>
8571
<groupId>org.apache.maven.plugins</groupId>
86-
<artifactId>maven-jar-plugin</artifactId>
87-
<version>3.0.2</version>
88-
<configuration>
89-
<archive>
90-
<manifest>
91-
<addClasspath>true</addClasspath>
92-
<mainClass>yasp.Main</mainClass>
93-
</manifest>
94-
</archive>
95-
<finalName>${project.build.finalName}-original</finalName>
96-
</configuration>
97-
</plugin>
98-
<!-- this is used by clarity-example and clarity-analyzer -->
99-
<plugin>
100-
<groupId>com.jolira</groupId>
101-
<artifactId>onejar-maven-plugin</artifactId>
102-
<version>1.4.4</version>
72+
<artifactId>maven-shade-plugin</artifactId>
73+
<version>2.2</version>
10374
<executions>
10475
<execution>
76+
<phase>package</phase>
10577
<goals>
106-
<goal>one-jar</goal>
78+
<goal>shade</goal>
10779
</goals>
10880
<configuration>
10981
<transformers>
@@ -114,32 +86,7 @@
11486
</configuration>
11587
</execution>
11688
</executions>
117-
<configuration>
118-
<filename>${project.build.finalName}.jar</filename>
119-
</configuration>
120-
</plugin>
121-
<!-- for some reason the shade-plugin doesn't work well with clarity processors.
122-
<plugin>
123-
<groupId>org.apache.maven.plugins</groupId>
124-
<artifactId>maven-shade-plugin</artifactId>
125-
<version>2.2</version>
126-
<executions>
127-
<execution>
128-
<phase>package</phase>
129-
<goals>
130-
<goal>shade</goal>
131-
</goals>
132-
<configuration>
133-
<transformers>
134-
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
135-
<mainClass>yasp.Main</mainClass>
136-
</transformer>
137-
</transformers>
138-
</configuration>
139-
</execution>
140-
</executions>
14189
</plugin>
142-
-->
14390
</plugins>
14491
</build>
14592
<name>opendota-parser</name>

src/main/java/opendota/Parse.java

Lines changed: 40 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
import opendota.combatlogvisitors.TrackVisitor;
3939
import opendota.combatlogvisitors.GreevilsGreedVisitor;
4040
import opendota.combatlogvisitors.TrackVisitor.TrackStatus;
41+
import opendota.processors.warding.OnWardExpired;
42+
import opendota.processors.warding.OnWardKilled;
43+
import opendota.processors.warding.OnWardPlaced;
4144

4245
public class Parse {
4346

@@ -401,7 +404,6 @@ else if (cle.getType() == DOTA_COMBATLOG_TYPES.DOTA_COMBATLOG_XP) {
401404

402405
@OnEntityEntered
403406
public void onEntityEntered(Context ctx, Entity e) {
404-
processEntity(ctx, e, false);
405407
if (e.getDtClass().getDtName().equals("CDOTAWearableItem")) {
406408
Integer accountId = getEntityProperty(e, "m_iAccountID", null);
407409
Integer itemDefinitionIndex = getEntityProperty(e, "m_iItemDefinitionIndex", null);
@@ -418,11 +420,6 @@ public void onEntityEntered(Context ctx, Entity e) {
418420
}
419421
}
420422
}
421-
422-
@OnEntityLeft
423-
public void onEntityLeft(Context ctx, Entity e) {
424-
processEntity(ctx, e, true);
425-
}
426423

427424
@UsesStringTable("EntityNames")
428425
@UsesEntities
@@ -727,45 +724,43 @@ public <T> T getEntityProperty(Entity e, String property, Integer idx) {
727724
}
728725
}
729726

730-
public void processEntity(Context ctx, Entity e, boolean entityLeft)
731-
{
732-
//CDOTA_NPC_Observer_Ward
733-
//CDOTA_NPC_Observer_Ward_TrueSight
734-
//s1 "DT_DOTA_NPC_Observer_Ward"
735-
//s1 "DT_DOTA_NPC_Observer_Ward_TrueSight"
736-
boolean isObserver = e.getDtClass().getDtName().equals("CDOTA_NPC_Observer_Ward");
737-
boolean isSentry = e.getDtClass().getDtName().equals("CDOTA_NPC_Observer_Ward_TrueSight");
738-
if (isObserver || isSentry) {
739-
//System.err.println(e);
740-
Entry entry = new Entry(time);
741-
Integer x = getEntityProperty(e, "CBodyComponent.m_cellX", null);
742-
Integer y = getEntityProperty(e, "CBodyComponent.m_cellY", null);
743-
Integer z = getEntityProperty(e, "CBodyComponent.m_cellZ", null);
744-
Integer[] pos = {x, y};
745-
entry.x = x;
746-
entry.y = y;
747-
entry.z = z;
748-
if (entityLeft)
749-
{
750-
entry.type = isObserver ? "obs_left" : "sen_left";
751-
}
752-
else
753-
{
754-
entry.type = isObserver ? "obs" : "sen";
755-
}
756-
entry.key = Arrays.toString(pos);
757-
entry.entityleft = entityLeft;
758-
entry.ehandle = e.getHandle();
759-
//System.err.println(entry.key);
760-
Integer owner = getEntityProperty(e, "m_hOwnerEntity", null);
761-
Entity ownerEntity = ctx.getProcessor(Entities.class).getByHandle(owner);
762-
entry.slot = ownerEntity != null ? (Integer) getEntityProperty(ownerEntity, "m_iPlayerID", null) : ward_ehandle_to_slot.get(entry.ehandle);
763-
if (entry.slot != null && !ward_ehandle_to_slot.containsKey(entry.ehandle)) {
764-
ward_ehandle_to_slot.put(entry.ehandle, entry.slot);
765-
}
766-
//2/3 radiant/dire
767-
//entry.team = e.getProperty("m_iTeamNum");
768-
output(entry);
727+
@OnWardKilled
728+
public void onWardKilled(Context ctx, Entity e, String killerHeroName) {
729+
Entry wardEntry = buildWardEntry(ctx, e);
730+
wardEntry.attackername = killerHeroName;
731+
output(wardEntry);
732+
}
733+
734+
@OnWardExpired
735+
@OnWardPlaced
736+
public void onWardExistenceChanged(Context ctx, Entity e) {
737+
output(buildWardEntry(ctx, e));
738+
}
739+
740+
private Entry buildWardEntry(Context ctx, Entity e) {
741+
Entry entry = new Entry(time);
742+
boolean isObserver = !e.getDtClass().getDtName().contains("TrueSight");
743+
Integer x = getEntityProperty(e, "CBodyComponent.m_cellX", null);
744+
Integer y = getEntityProperty(e, "CBodyComponent.m_cellY", null);
745+
Integer z = getEntityProperty(e, "CBodyComponent.m_cellZ", null);
746+
Integer life_state = getEntityProperty(e, "m_lifeState", null);
747+
Integer[] pos = {x, y};
748+
entry.x = x;
749+
entry.y = y;
750+
entry.z = z;
751+
entry.type = isObserver ? "obs" : "sen";
752+
entry.entityleft = life_state == 1;
753+
entry.key = Arrays.toString(pos);
754+
entry.ehandle = e.getHandle();
755+
756+
if (entry.entityleft) {
757+
entry.type += "_left";
769758
}
759+
760+
Integer owner = getEntityProperty(e, "m_hOwnerEntity", null);
761+
Entity ownerEntity = ctx.getProcessor(Entities.class).getByHandle(owner);
762+
entry.slot = ownerEntity != null ? (Integer) getEntityProperty(ownerEntity, "m_iPlayerID", null) : null;
763+
764+
return entry;
770765
}
771766
}

src/main/java/yasp/processors/warding/OnWardExpired.java renamed to src/main/java/opendota/processors/warding/OnWardExpired.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package yasp.processors.warding;
1+
package opendota.processors.warding;
22

33
import java.lang.annotation.Annotation;
44

src/main/java/yasp/processors/warding/OnWardKilled.java renamed to src/main/java/opendota/processors/warding/OnWardKilled.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package yasp.processors.warding;
1+
package opendota.processors.warding;
22

33
import java.lang.annotation.Annotation;
44

src/main/java/yasp/processors/warding/OnWardPlaced.java renamed to src/main/java/opendota/processors/warding/OnWardPlaced.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package yasp.processors.warding;
1+
package opendota.processors.warding;
22

33
import java.lang.annotation.Annotation;
44

src/main/java/yasp/processors/warding/Wards.java renamed to src/main/java/opendota/processors/warding/Wards.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package yasp.processors.warding;
1+
package opendota.processors.warding;
22

33
import java.util.ArrayDeque;
44
import java.util.Collections;

0 commit comments

Comments
 (0)