Skip to content

Commit

Permalink
Reboot this project again with thanks to a new API
Browse files Browse the repository at this point in the history
  • Loading branch information
ExcuseMi committed Aug 25, 2016
1 parent 5b7f74a commit 1677acf
Show file tree
Hide file tree
Showing 24 changed files with 282 additions and 615 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# rocketleaguelivestats

DOES NOT WORK ANYMORE!!!
Working again!

This awesome sauce tool allows you to checkout the ranks of your opponents while you play!

Expand Down
11 changes: 8 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.1</version>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.19.2</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.19.2</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package com.excuseme.rocketleaguelivestats.model;

public enum GamingSystem {
STEAM("steam","gamingsystem/steam.png"), PS4("ps4","gamingsystem/Ps4.png"), BOT("other");
STEAM("steam","gamingsystem/steam.png", 3), PS4("ps4","gamingsystem/Ps4.png",2), XBOX("xbox","",3), BOT("other", "", null);

private String qualifier;
private String iconPath;
private Integer apiId;

private GamingSystem(String qualifier) {
this.qualifier = qualifier;
this.iconPath = null;
}
private GamingSystem(String qualifier, String iconPath) {
private GamingSystem(String qualifier, String iconPath, Integer apiId) {
this.qualifier = qualifier;
this.iconPath = iconPath;
this.apiId = apiId;

}

public String getQualifier() {
Expand All @@ -22,4 +21,6 @@ public String getQualifier() {
public String getIconPath() {
return iconPath;
}

public Integer getApiId() { return apiId; }
}
30 changes: 8 additions & 22 deletions src/main/java/com/excuseme/rocketleaguelivestats/model/Rank.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package com.excuseme.rocketleaguelivestats.model;

import java.math.BigDecimal;

public class Rank implements Comparable<Rank>{
private Tier tier;
private Integer division;
private Skill skill;
private Integer rating;

public Rank(Tier tier, Integer division) {
public Rank(Tier tier, Integer division, Integer rating) {
this.tier = tier;
this.division = division;
this.rating = rating;
}

public Tier getTier() {
Expand All @@ -20,27 +19,14 @@ public Integer getDivision() {
return division;
}

public Skill getSkill() {
return skill;
}

public void setSkill(Skill skill) {
this.skill = skill;
}

@Override
public String toString() {
return "Rank{" +
"tier=" + tier +
", division=" + division +
", skill=" + skill +
'}';
public Integer getRating() {
return rating;
}

@Override
public int compareTo(Rank o) {
final BigDecimal mmr1 = getSkill() != null ? getSkill().getMmr() : new BigDecimal("0");
final BigDecimal mmr2 = o.getSkill() != null ? o.getSkill().getMmr() : new BigDecimal("0");
return mmr1.compareTo(mmr2);
final Integer rating1 = getRating() != null ? getRating() : 0;
final Integer rating2 = o.getRating() != null ? getRating() :0;
return rating1.compareTo(rating2);
}
}
40 changes: 0 additions & 40 deletions src/main/java/com/excuseme/rocketleaguelivestats/model/Skill.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.excuseme.rocketleaguelivestats.model.PlayerIdentifier;
import com.excuseme.rocketleaguelivestats.model.Statistics;
import com.excuseme.rocketleaguelivestats.repository.rocketleague.RocketLeagueAPI;
import com.excuseme.rocketleaguelivestats.repository.rocketleague.APIStatisticsRepository;
import com.excuseme.rocketleaguelivestats.scanner.model.SessionData;

import java.util.HashMap;
Expand All @@ -12,7 +12,7 @@

public class CachedStatisticsRepository {

private StatisticsRepository statisticsRepository;
private StatisticsRepository statisticsRepository = new APIStatisticsRepository();
private Map<GamePlayerIdentifier, Statistics> gamePlayerIdentifierStatisticsMap = new HashMap<GamePlayerIdentifier, Statistics>();

public CachedStatisticsRepository() {
Expand All @@ -28,7 +28,4 @@ public Map<PlayerIdentifier, Statistics> findAll(String gameIdentifier, List<Pla
return results;
}

public void updateSessionData(SessionData sessionData) {
statisticsRepository = new RocketLeagueAPI(sessionData);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
import com.excuseme.rocketleaguelivestats.scanner.model.SessionData;

public interface GameDataListener {
void sessionDataChanged(SessionData sessionData);
void gameDataChanged(GameData gameData);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public static Game map(GameData gameData) {
}
String identifier = gameData.getIdentifier();
Set<PlayerId> playerIds = gameData.getPlayerIds();
Set<NamePlate> namePlates = gameData.getNamePlates();
Set<PlayerName> playerNames = gameData.getPlayerNames();
Set<HandlePlayerRemoved> playerRemoveds = gameData.getPlayerRemoveds();
final GameType gameType = gameData.getGameType();
Expand All @@ -46,11 +45,6 @@ public static Game map(GameData gameData) {
boolean ownPlayer = calculateOwnPlayer(playerId, gameData.getOwnPlayer(), gamingSystem);
String nickName = playerName.getName();
int row = 0;
NamePlate namePlate = findNamePlate(namePlates, nickName);
if (namePlate != null) {
row = namePlate.getRow();
}

boolean active = isPlayerActive(playerRemoveds, playerName);
final Player player = new Player(number, row, nickName, new PlayerIdentifier(id, gamingSystem), active, ownPlayer);
players.add(player);
Expand Down Expand Up @@ -108,6 +102,8 @@ private static GamingSystem mapSystem(String system) {
return GamingSystem.STEAM;
} else if ("PS4".equalsIgnoreCase(system)) {
return GamingSystem.PS4;
} else if ("XBOX".equalsIgnoreCase(system)) {
return GamingSystem.XBOX;
} else {
return GamingSystem.BOT;
}
Expand All @@ -122,13 +118,4 @@ private static PlayerId findPlayerId(Set<PlayerId> playerIds, int number) {
}
return null;
}

private static NamePlate findNamePlate(Set<NamePlate> namePlates, String name) {
for (NamePlate namePlate : namePlates) {
if (name.equals(namePlate.getName())) {
return namePlate;
}
}
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.excuseme.rocketleaguelivestats.repository;

import com.excuseme.rocketleaguelivestats.model.GamingSystem;
import com.excuseme.rocketleaguelivestats.model.PlayerIdentifier;
import com.excuseme.rocketleaguelivestats.model.Statistics;

Expand All @@ -9,13 +10,13 @@
import java.util.Set;

public interface StatisticsRepository {
Statistics find(String playerId, String system);
Statistics find(String playerId, GamingSystem gamingSystem);

default Map<PlayerIdentifier,Statistics> find(List<PlayerIdentifier> playerIdentifiers) throws Exception {
Map<PlayerIdentifier,Statistics> map = new HashMap<>();
playerIdentifiers.forEach(p->map.put(p, find(p.getPlayerId(), p.getGamingSystem().getQualifier())));
playerIdentifiers.forEach(p->map.put(p, find(p.getPlayerId(), p.getGamingSystem())));
return map;
}

String createUrl(String playerId, String system);
String createUrl(String playerId, GamingSystem gamingSystem);
}
Loading

0 comments on commit 1677acf

Please sign in to comment.