{
final int perpage = 10;
List<HeroDiary> mainlist = _herodiary.get(charid);
if (mainlist != null)
{
NpcHtmlMessage html = new NpcHtmlMessage(activeChar, null);
html.setFile("olympiad/monument_hero_info.htm");
html.replace("%title%", StringHolder.getInstance().getNotNull(activeChar, "hero.diary"));
html.replace("%heroname%", Olympiad.getNobleName(charid));
html.replace("%message%", _heroMessage.get(charid));
List<HeroDiary> list = new ArrayList<>(mainlist);
Collections.reverse(list);
boolean color = true;
final StringBuilder fList = new StringBuilder(500);
int counter = 0;
int breakat = 0;
for (int i = (page - 1) * perpage; i < list.size(); i++)
{
breakat = i;
HeroDiary diary = list.get(i);
Map.Entry<String, String> entry = diary.toString(activeChar);
fList.append("<tr><td>");
if (color)
{
fList.append("<table width=270 bgcolor=\"131210\">");
}
else
{
fList.append("<table width=270>");
}
fList.append("<tr><td width=270><font color=\"LEVEL\">" + entry.getKey() + "</font></td></tr>");
fList.append("<tr><td width=270>" + entry.getValue() + "</td></tr>");
fList.append("<tr><td> </td></tr></table>");
fList.append("</td></tr>");
color = !color;
counter++;
if (counter >= perpage)
{
break;
}
}
if (breakat < (list.size() - 1))
{
html.replace("%buttprev%", HtmlUtils.PREV_BUTTON);
html.replace("%prev_bypass%", "_diary?class=" + heroclass + "&page=" + (page + 1));
}
else
{
html.replace("%buttprev%", StringUtils.EMPTY);
}
if (page > 1)
{
html.replace("%buttnext%", HtmlUtils.NEXT_BUTTON);
html.replace("%next_bypass%", "_diary?class=" + heroclass + "&page=" + (page - 1));
}
else
{
html.replace("%buttnext%", StringUtils.EMPTY);
}
html.replace("%list%", fList.toString());
activeChar.sendPacket(html);
}
}