Search in sources :

Example 1 with PlayerStandardTip

use of fr.neamar.lolgamedata.tips.PlayerStandardTip 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;
}
Also used : Player(fr.neamar.lolgamedata.pojo.Player) PlayerStandardTip(fr.neamar.lolgamedata.tips.PlayerStandardTip) ArrayList(java.util.ArrayList) PlayerStandardTip(fr.neamar.lolgamedata.tips.PlayerStandardTip) Tip(fr.neamar.lolgamedata.tips.Tip) Team(fr.neamar.lolgamedata.pojo.Team)

Example 2 with PlayerStandardTip

use of fr.neamar.lolgamedata.tips.PlayerStandardTip 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;
}
Also used : Account(fr.neamar.lolgamedata.pojo.Account) Player(fr.neamar.lolgamedata.pojo.Player) PlayerStandardTip(fr.neamar.lolgamedata.tips.PlayerStandardTip) ArrayList(java.util.ArrayList) PlayerStandardTip(fr.neamar.lolgamedata.tips.PlayerStandardTip) Tip(fr.neamar.lolgamedata.tips.Tip)

Example 3 with PlayerStandardTip

use of fr.neamar.lolgamedata.tips.PlayerStandardTip 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;
}
Also used : Player(fr.neamar.lolgamedata.pojo.Player) PlayerStandardTip(fr.neamar.lolgamedata.tips.PlayerStandardTip) ArrayList(java.util.ArrayList) PlayerStandardTip(fr.neamar.lolgamedata.tips.PlayerStandardTip) Tip(fr.neamar.lolgamedata.tips.Tip) Team(fr.neamar.lolgamedata.pojo.Team)

Example 4 with PlayerStandardTip

use of fr.neamar.lolgamedata.tips.PlayerStandardTip in project teamward-client by Neamar.

the class PlayerStandardTipHolder method bind.

public void bind(Tip tip) {
    PlayerStandardTip playerStandardTip = (PlayerStandardTip) tip;
    if (!playerStandardTip.image.isEmpty()) {
        ImageLoader.getInstance().displayImage(playerStandardTip.image, championImage);
    } else {
        championImage.setImageResource(playerStandardTip.imageId);
    }
    titleText.setText(playerStandardTip.text);
    descriptionText.setText(playerStandardTip.description);
}
Also used : PlayerStandardTip(fr.neamar.lolgamedata.tips.PlayerStandardTip)

Example 5 with PlayerStandardTip

use of fr.neamar.lolgamedata.tips.PlayerStandardTip in project teamward-client by Neamar.

the class TryHarderTipBuilder method getTips.

@Override
public ArrayList<Tip> getTips(Game game, Context context) {
    ArrayList<Tip> tips = new ArrayList<>();
    for (Team team : game.teams) {
        int minMastery = 7;
        for (Player player : team.players) {
            minMastery = Math.min(player.champion.mastery, minMastery);
        }
        if (minMastery >= 4) {
            String description = context.getString(R.string.try_harder_desc);
            description = String.format(description, team.getName(context), minMastery);
            tips.add(new PlayerStandardTip(game, null, PlayerHolder.CHAMPION_MASTERIES_RESOURCES[minMastery], context.getString(R.string.try_harder), description));
        }
    }
    return tips;
}
Also used : Player(fr.neamar.lolgamedata.pojo.Player) PlayerStandardTip(fr.neamar.lolgamedata.tips.PlayerStandardTip) ArrayList(java.util.ArrayList) PlayerStandardTip(fr.neamar.lolgamedata.tips.PlayerStandardTip) Tip(fr.neamar.lolgamedata.tips.Tip) Team(fr.neamar.lolgamedata.pojo.Team)

Aggregations

PlayerStandardTip (fr.neamar.lolgamedata.tips.PlayerStandardTip)11 Player (fr.neamar.lolgamedata.pojo.Player)10 Tip (fr.neamar.lolgamedata.tips.Tip)10 ArrayList (java.util.ArrayList)10 Team (fr.neamar.lolgamedata.pojo.Team)9 Account (fr.neamar.lolgamedata.pojo.Account)1