Matchübersicht ausgeben
parent
052b84c260
commit
d37495293f
|
|
@ -4,6 +4,8 @@ import java.util.Scanner;
|
|||
public class DotaMatchTracker {
|
||||
private static final String MATCH_ID = "9077739037";
|
||||
private static final String MATCH_URL = "https://overseerdota.com/api/matches/" + MATCH_ID;
|
||||
private static final String MATCH_PAGE =
|
||||
"https://overseerdota.com/profile?account=177203952&name=Yuma&match=" + MATCH_ID;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Scanner input = new Scanner(new URL(MATCH_URL).openStream(), "UTF-8");
|
||||
|
|
@ -18,6 +20,15 @@ public class DotaMatchTracker {
|
|||
return;
|
||||
}
|
||||
|
||||
String matchInfo = json.substring(playersEnd);
|
||||
int duration = Integer.parseInt(value(matchInfo, "duration"));
|
||||
String winner = value(matchInfo, "radiant_win").equals("true") ? "Radiant" : "Dire";
|
||||
System.out.println("Dota 2 match " + MATCH_ID);
|
||||
System.out.println("Source: " + MATCH_PAGE);
|
||||
System.out.println("Duration: " + duration / 60 + ":" + (duration % 60 < 10 ? "0" : "") + duration % 60);
|
||||
System.out.println("Winner: " + winner);
|
||||
System.out.println("Player | Side | Hero ID | K/D/A | KDA | Last Hits | Net Worth | GPM");
|
||||
|
||||
int radiantKills = 0, direKills = 0, playerCount = 0;
|
||||
int playerStart = json.indexOf("{\"player_slot\":", playersStart);
|
||||
while (playerStart >= 0 && playerStart < playersEnd) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue