|
|
|
@ -11,6 +11,7 @@ import com.robrua.orianna.type.core.currentgame.Participant;
|
|
|
|
|
import com.robrua.orianna.type.core.league.League;
|
|
|
|
|
import com.robrua.orianna.type.core.staticdata.Champion;
|
|
|
|
|
import com.robrua.orianna.type.core.staticdata.Mastery;
|
|
|
|
|
import com.robrua.orianna.type.core.staticdata.SummonerSpell;
|
|
|
|
|
import com.robrua.orianna.type.core.summoner.Summoner;
|
|
|
|
|
import com.robrua.orianna.type.exception.APIException;
|
|
|
|
|
import net.pingex.discordbot.AbstractModule;
|
|
|
|
@ -194,6 +195,20 @@ public class LeagueOfDiscordModule extends AbstractModule
|
|
|
|
|
String timeStarted = String.format("%02d:%02d", TimeUnit.SECONDS.toMinutes(ginfo.getLength()+SPECTATE_TIMESHIFT), ginfo.getLength()+SPECTATE_TIMESHIFT - TimeUnit.MINUTES.toSeconds(TimeUnit.SECONDS.toMinutes(ginfo.getLength()+SPECTATE_TIMESHIFT)));
|
|
|
|
|
sb.append(ginfo.getQueueType()).append(" started ").append(timeStarted).append(" ago.\n\n");
|
|
|
|
|
|
|
|
|
|
// Evaluate max summoner+champ length for padding
|
|
|
|
|
int maxNameChampLength = 0;
|
|
|
|
|
for(Participant i : ginfo.getParticipants())
|
|
|
|
|
if((i.getSummonerName().length()+i.getChampion().getName().length()+3) > maxNameChampLength)
|
|
|
|
|
maxNameChampLength = i.getSummonerName().length()+i.getChampion().getName().length()+3;
|
|
|
|
|
|
|
|
|
|
// Evaluate sspells name length for padding
|
|
|
|
|
int maxSummonerSpellLength = 0;
|
|
|
|
|
for(SummonerSpell i : RiotAPI.getSummonerSpells())
|
|
|
|
|
if((i.getName().length()*2+1) > maxSummonerSpellLength)
|
|
|
|
|
maxSummonerSpellLength = i.getName().length()*2+1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loadingMessage.edit("Game found. Fetching summoners data...");
|
|
|
|
|
sb.append("Team Blue\n");
|
|
|
|
|
boolean swapped = false;
|
|
|
|
@ -206,7 +221,7 @@ public class LeagueOfDiscordModule extends AbstractModule
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Summoner Name + Champ
|
|
|
|
|
sb.append("* ").append(i.getSummonerName()).append(" (").append(i.getChampion().getName()).append(") - ");
|
|
|
|
|
sb.append("* ").append(String.format("%1$-" + maxNameChampLength + "s", i.getSummonerName() + " (" + i.getChampion().getName() + ")")).append(" - ");
|
|
|
|
|
|
|
|
|
|
// SoloQ Ranked stats
|
|
|
|
|
for(int count=1; count>0; count++)
|
|
|
|
@ -215,7 +230,7 @@ public class LeagueOfDiscordModule extends AbstractModule
|
|
|
|
|
for(League j : i.getSummoner().getLeagueEntries())
|
|
|
|
|
if(j.getQueueType().equals(QueueType.RANKED_SOLO_5x5))
|
|
|
|
|
{
|
|
|
|
|
sb.append(j.getTier().toString()).append(" ").append(j.getParticipantEntry().getDivision());
|
|
|
|
|
sb.append(String.format("%1$-" + 12 + "s", j.getTier().toString() + " " + j.getParticipantEntry().getDivision()));
|
|
|
|
|
count = -1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -225,7 +240,7 @@ public class LeagueOfDiscordModule extends AbstractModule
|
|
|
|
|
switch(e.getStatus())
|
|
|
|
|
{
|
|
|
|
|
case NOT_FOUND: // Silently ignore HTTP404 which is OK and means "Unranked"
|
|
|
|
|
sb.append("Unranked");
|
|
|
|
|
sb.append(String.format("%1$-" + 12 + "s", "Unranked"));
|
|
|
|
|
count = -1;
|
|
|
|
|
break;
|
|
|
|
|
case RATE_LIMIT_EXCEEDED:
|
|
|
|
@ -242,7 +257,7 @@ public class LeagueOfDiscordModule extends AbstractModule
|
|
|
|
|
sb.append(" - ");
|
|
|
|
|
|
|
|
|
|
// Summoner Spells
|
|
|
|
|
sb.append(i.getSummonerSpell1().getName()).append("/").append(i.getSummonerSpell2()).append(" - ");
|
|
|
|
|
sb.append(String.format("%1$-" + maxSummonerSpellLength + "s", i.getSummonerSpell1().getName() + "/" + i.getSummonerSpell2().getName())).append(" - ");
|
|
|
|
|
|
|
|
|
|
// Masteries
|
|
|
|
|
Mastery keystone = null;
|
|
|
|
|