List<OlympiadHistory> historyList = _historyOld.get(entry.getKey());
if (historyList == null)
{
historyList = Collections.emptyList();
}
NpcHtmlMessage html = new NpcHtmlMessage(player, null);
html.setFile("olympiad/monument_hero_info.htm");
html.replace("%title%", StringHolder.getInstance().getNotNull(player, "hero.history"));
int allStatWinner = 0;
int allStatLoss = 0;
int allStatTie = 0;
for (OlympiadHistory h : historyList)
{
if (h.getGameStatus() == 0)
{
allStatTie++;
}
else
{
int team = entry.getKey() == h.getObjectId1() ? 1 : 2;
if (h.getGameStatus() == team)
{
allStatWinner++;
}
else
{
allStatLoss++;
}
}
}
html.replace("%wins%", String.valueOf(allStatWinner));
html.replace("%ties%", String.valueOf(allStatTie));
html.replace("%losses%", String.valueOf(allStatLoss));
int min = perpage * (page - 1);
int max = perpage * page;
int currentWinner = 0;
int currentLoss = 0;
int currentTie = 0;
final StringBuilder b = new StringBuilder(500);
for (int i = 0; i < historyList.size(); i++)
{
OlympiadHistory history = historyList.get(i);
if (history.getGameStatus() == 0)
{
currentTie++;
}
else
{
int team = entry.getKey() == history.getObjectId1() ? 1 : 2;
if (history.getGameStatus() == team)
{
currentWinner++;
}
else
{
currentLoss++;
}
}
if (i < min)
{
continue;
}
if (i >= max)
{
break;
}
b.append("<tr><td>");
b.append(history.toString(player, entry.getKey(), currentWinner, currentLoss, currentTie));
b.append("</td></tr");
}
if (min > 0)
{
html.replace("%buttprev%", HtmlUtils.PREV_BUTTON);
html.replace("%prev_bypass%", "_match?class=" + targetClassId + "&page=" + (page - 1));
}
else
{
html.replace("%buttprev%", StringUtils.EMPTY);
}
if (historyList.size() > max)
{
html.replace("%buttnext%", HtmlUtils.NEXT_BUTTON);
html.replace("%prev_bypass%", "_match?class=" + targetClassId + "&page=" + (page + 1));
}
else
{
html.replace("%buttnext%", StringUtils.EMPTY);
}
html.replace("%list%", b.toString());
player.sendPacket(html);
}