use of com.ebicep.warlords.database.repositories.games.pojos.DatabaseGamePlayerResult in project Warlords by ebicep.
the class AbstractDatabaseStatInformation method updateStats.
public void updateStats(DatabaseGameBase databaseGame, DatabaseGamePlayerBase gamePlayer, boolean add) {
DatabaseGamePlayerResult result = databaseGame.getPlayerGameResult(gamePlayer);
int operation = add ? 1 : -1;
this.kills += gamePlayer.getTotalKills() * operation;
this.assists += gamePlayer.getTotalAssists() * operation;
this.deaths += gamePlayer.getTotalDeaths() * operation;
switch(result) {
case WON:
this.wins += operation;
break;
case LOST:
case DRAW:
this.losses += operation;
break;
case NONE:
break;
}
this.plays += operation;
this.damage += gamePlayer.getTotalDamage() * operation;
this.healing += gamePlayer.getTotalHealing() * operation;
this.absorbed += gamePlayer.getTotalAbsorbed() * operation;
this.updateCustomStats(databaseGame, databaseGame.getGameMode(), gamePlayer, result, databaseGame.getGameAddons().contains(GameAddon.PRIVATE_GAME), add);
}
Aggregations