KDA und Teamkills berechnen
parent
606d61d438
commit
052b84c260
|
|
@ -18,7 +18,7 @@ public class DotaMatchTracker {
|
|||
return;
|
||||
}
|
||||
|
||||
int playerCount = 0;
|
||||
int radiantKills = 0, direKills = 0, playerCount = 0;
|
||||
int playerStart = json.indexOf("{\"player_slot\":", playersStart);
|
||||
while (playerStart >= 0 && playerStart < playersEnd) {
|
||||
int nextPlayer = json.indexOf("{\"player_slot\":", playerStart + 1);
|
||||
|
|
@ -34,13 +34,17 @@ public class DotaMatchTracker {
|
|||
int lastHits = Integer.parseInt(value(player, "last_hits"));
|
||||
int netWorth = Integer.parseInt(value(player, "net_worth"));
|
||||
int gpm = Integer.parseInt(value(player, "gold_per_min"));
|
||||
double kda = deaths == 0 ? kills + assists : (double) (kills + assists) / deaths;
|
||||
if (side.equals("Radiant")) radiantKills += kills;
|
||||
else direKills += kills;
|
||||
System.out.println(name + " | " + side + " | " + hero + " | "
|
||||
+ kills + "/" + deaths + "/" + assists + " | "
|
||||
+ kills + "/" + deaths + "/" + assists + " | " + kda + " | "
|
||||
+ lastHits + " | " + netWorth + " | " + gpm);
|
||||
playerCount++;
|
||||
playerStart = nextPlayer;
|
||||
}
|
||||
System.out.println("Players read: " + playerCount);
|
||||
System.out.println("Team kills: Radiant " + radiantKills + " | Dire " + direKills);
|
||||
}
|
||||
|
||||
private static String value(String json, String key) {
|
||||
|
|
@ -57,4 +61,4 @@ public class DotaMatchTracker {
|
|||
if (end < 0 || (objectEnd >= 0 && objectEnd < end)) end = objectEnd;
|
||||
return json.substring(start, end);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue