/** * Creates a new <code>AlienSwarmStats</code> instance by calling the super constructor with the * game name <code>"alienswarm"</code> * * @param steamId The custom URL or the 64bit Steam ID of the user * @throws SteamCondenserException if an error occurs while fetching the stats data */ public AlienSwarmStats(Object steamId) throws SteamCondenserException { super(steamId, "alienswarm"); if (this.isPublic()) { XMLData lifetimeStats = this.xmlData.getElement("stats", "lifetime"); this.hoursPlayed = lifetimeStats.getString("timeplayed"); this.lifetimeStats = new HashMap<String, Object>(); this.lifetimeStats.put("accuracy", lifetimeStats.getFloat("accuracy")); this.lifetimeStats.put("aliensBurned", lifetimeStats.getInteger("aliensburned")); this.lifetimeStats.put("aliensKilled", lifetimeStats.getInteger("alienskilled")); this.lifetimeStats.put("campaigns", lifetimeStats.getInteger("campaigns")); this.lifetimeStats.put("damageTaken", lifetimeStats.getInteger("damagetaken")); this.lifetimeStats.put("experience", lifetimeStats.getInteger("experience")); this.lifetimeStats.put("experienceRequired", lifetimeStats.getInteger("xprequired")); this.lifetimeStats.put("fastHacks", lifetimeStats.getInteger("fasthacks")); this.lifetimeStats.put("friendlyFire", lifetimeStats.getInteger("friendlyfire")); this.lifetimeStats.put("gamesSuccessful", lifetimeStats.getInteger("gamessuccess")); this.lifetimeStats.put("healing", lifetimeStats.getInteger("healing")); this.lifetimeStats.put("killsPerHour", lifetimeStats.getFloat("killsperhour")); this.lifetimeStats.put("level", lifetimeStats.getInteger("level")); this.lifetimeStats.put("promotion", lifetimeStats.getInteger("promotion")); this.lifetimeStats.put("nextUnlock", lifetimeStats.getString("nextunlock")); this.lifetimeStats.put("nextUnlockImg", BASE_URL + lifetimeStats.getString("nextunlockimg")); this.lifetimeStats.put("shotsFired", lifetimeStats.getInteger("shotsfired")); this.lifetimeStats.put("totalGames", lifetimeStats.getInteger("totalgames")); if ((Integer) this.lifetimeStats.get("promotion") > 0) { this.lifetimeStats.put("promotionImg", BASE_URL + lifetimeStats.getString("promotionpic")); } this.lifetimeStats.put( "games_successful_percentage", ((Integer) this.lifetimeStats.get("totalGames") > 0) ? ((Integer) this.lifetimeStats.get("gamesSuccessful")).floatValue() / (Integer) this.lifetimeStats.get("totalGames") : 0); } }
/** * Returns the favorites of this user like weapons and marine * * <p>If the favorites haven't been parsed already, parsing is done now. * * @return The favorites of this player */ public Map<String, Object> getFavorites() { if (!this.isPublic()) { return null; } if (this.favorites == null) { XMLData favoritesData = this.xmlData.getElement("stats", "favorites"); this.favorites = new HashMap<String, Object>(); this.favorites.put("class", favoritesData.getString("class")); this.favorites.put("classImg", favoritesData.getString("classimg")); this.favorites.put("classPercentage", favoritesData.getFloat("classpct")); this.favorites.put("difficulty", favoritesData.getString("difficulty")); this.favorites.put("difficultyPercentage", favoritesData.getFloat("difficultypct")); this.favorites.put("extra", favoritesData.getString("extra")); this.favorites.put("extraImg", favoritesData.getString("extraimg")); this.favorites.put("extraPercentage", favoritesData.getFloat("extrapct")); this.favorites.put("marine", favoritesData.getString("marine")); this.favorites.put("marineImg", favoritesData.getString("marineimg")); this.favorites.put("marinePercentage", favoritesData.getFloat("marinepct")); this.favorites.put("mission", favoritesData.getString("mission")); this.favorites.put("missionImg", favoritesData.getString("missionimg")); this.favorites.put("missionPercentage", favoritesData.getFloat("missionpct")); this.favorites.put("primaryWeapon", favoritesData.getString("primary")); this.favorites.put("primaryWeaponImg", favoritesData.getString("primaryimg")); this.favorites.put("primaryWeaponPercentage", favoritesData.getFloat("primarypct")); this.favorites.put("secondaryWeapon", favoritesData.getString("secondary")); this.favorites.put("secondaryWeaponImg", favoritesData.getString("secondaryimg")); this.favorites.put("secondaryWeapon_Percentage", favoritesData.getFloat("secondarypct")); } return this.favorites; }