use of fr.neamar.lolgamedata.tips.Tip in project teamward-client by Neamar.
the class FullAPDTeamTipBuilder method getTips.
@Override
public ArrayList<Tip> getTips(Game game, Context context) {
ArrayList<Tip> tips = new ArrayList<>();
// Full AP
for (Team team : game.teams) {
Boolean fullAP = true;
for (Player player : team.players) {
if (!player.champion.isAp()) {
fullAP = false;
break;
}
}
if (fullAP) {
String description = context.getString(R.string.full_ap);
description = String.format(description, team.getName(context));
tips.add(new PlayerStandardTip(game, null, MAGIC_MANTLE_URL, context.getString(R.string.such_ability), description));
}
}
// Full AD
for (Team team : game.teams) {
Boolean fullAD = true;
for (Player player : team.players) {
if (!player.champion.isAd() && !player.champion.role.equals("SUPPORT")) {
fullAD = false;
break;
}
}
if (fullAD) {
String description = context.getString(R.string.full_ad);
description = String.format(description, team.getName(context));
tips.add(new PlayerStandardTip(game, null, CLOTH_ARMOR, context.getString(R.string.much_damage), description));
}
}
return tips;
}
use of fr.neamar.lolgamedata.tips.Tip in project teamward-client by Neamar.
the class MatchupsBuilder method getTips.
@Override
public ArrayList<Tip> getTips(Game game, Context context) {
ArrayList<Tip> tips = new ArrayList<>();
if (game.teams.size() != 2) {
return tips;
}
// Do not display on ARAM
if (game.mapId == 12) {
return tips;
}
Team playerTeam = game.getPlayerOwnTeam();
Team otherTeam = game.teams.get(0) == playerTeam ? game.teams.get(1) : game.teams.get(0);
ArrayList<MatchupsTip.Matchup> matchups = new ArrayList<>();
for (Player player : playerTeam.players) {
if (!player.champion.role.equals(ChampionInGame.UNKNOWN_ROLE)) {
// Does the other team have someone with this role too?
Player otherPlayer = getPlayerWithRole(otherTeam, player.champion.role);
if (otherPlayer != null) {
MatchupsTip.Matchup matchup = new MatchupsTip.Matchup(player, otherPlayer);
matchups.add(matchup);
}
}
}
if (matchups.size() > 0) {
MatchupsTip tip = new MatchupsTip(game, matchups);
tips.add(tip);
}
return tips;
}
use of fr.neamar.lolgamedata.tips.Tip in project teamward-client by Neamar.
the class PremadeNotUsingTeamwardTipBuilder method getTips.
@Override
public ArrayList<Tip> getTips(Game game, Context context) {
ArrayList<Tip> tips = new ArrayList<>();
Account mainAccount = game.associatedAccount;
Player mainPlayer = game.getPlayerByAccount(mainAccount);
if (mainPlayer == null) {
return tips;
}
List<Integer> premade = findPlayerPremade(game, mainPlayer);
if (premade == null) {
return tips;
}
List<String> playersNotUsingTeamward = new ArrayList<>();
for (Integer summonerId : premade) {
Player player = findPlayerById(game, summonerId);
if (player != null && !player.teamwardUser && player != mainPlayer) {
playersNotUsingTeamward.add(player.summoner.name);
}
}
if (!playersNotUsingTeamward.isEmpty()) {
String descriptionTemplate;
String description;
if (playersNotUsingTeamward.size() == 1) {
descriptionTemplate = context.getString(R.string.s_is_not_using_teamward);
description = String.format(descriptionTemplate, playersNotUsingTeamward.get(0));
} else {
descriptionTemplate = context.getString(R.string.s_are_not_using_teamward);
String lastPlayer = playersNotUsingTeamward.get(playersNotUsingTeamward.size() - 1);
playersNotUsingTeamward.remove(playersNotUsingTeamward.size() - 1);
String players = TextUtils.join(context.getString(R.string.standard_separator) + " ", playersNotUsingTeamward);
players += " " + context.getString(R.string.final_separator) + " " + lastPlayer;
description = String.format(descriptionTemplate, players);
}
tips.add(new PlayerStandardTip(game, null, R.mipmap.ic_launcher, context.getString(R.string.not_using_teamward), description));
}
return tips;
}
use of fr.neamar.lolgamedata.tips.Tip in project teamward-client by Neamar.
the class OtpTipBuilder method getTips.
@Override
public ArrayList<Tip> getTips(Game game, Context context) {
ArrayList<Tip> tips = new ArrayList<>();
for (Team team : game.teams) {
for (Player player : team.players) {
if (player.champion.mastery == 7 && player.champion.championRank == 1) {
String descriptionTemplate = context.getString(R.string.main_level_7);
String description = String.format(descriptionTemplate, player.summoner.name, player.champion.name);
tips.add(new PlayerStandardTip(game, player, player.champion.imageUrl, context.getString(R.string.otp), description));
}
}
}
return tips;
}
use of fr.neamar.lolgamedata.tips.Tip in project teamward-client by Neamar.
the class PremadeTipBuilder method getTips.
@Override
public ArrayList<Tip> getTips(Game game, Context context) {
ArrayList<Tip> tips = new ArrayList<>();
if (game.teams.get(0).premades.size() != 0) {
PremadeTip premadeTip = new PremadeTip(game);
tips.add(premadeTip);
}
return tips;
}
Aggregations