show(dialog.toString(), player, npc);
}
public void aggro() {
L2Player player = (L2Player) getSelf();
L2NpcInstance npc = getNpc();
if (player == null || npc == null) {
return;
}
StringBuilder dialog = new StringBuilder("<html><body><table width=\"80%\"><tr><td>Attacker</td><td>Damage</td><td>Hate</td></tr>");
// Сортировка аггролиста по хейту
TreeSet<AggroInfo> aggroList = new TreeSet<AggroInfo>(new Comparator<AggroInfo>() {
@Override
public int compare(AggroInfo o1, AggroInfo o2) {
int hateDiff = o1.hate - o2.hate;
if (hateDiff != 0) {
return hateDiff;
}
return o1.damage - o2.damage;
}
});
aggroList.addAll(npc.getAggroList());
// Вывод результата
for (AggroInfo aggroInfo : aggroList.descendingSet()) {
if (aggroInfo.attacker != null && (aggroInfo.attacker.isPlayer() || aggroInfo.attacker.isSummon() || aggroInfo.attacker.isPet())) {
dialog.append("<tr><td>" + aggroInfo.attacker.getName() + "</td><td>" + aggroInfo.damage + "</td><td>" + aggroInfo.hate + "</td></tr>");
}