if (!checkCond(player, false))
{
return;
}
List<CTBSiegeClanObject> siegeClans = siegeEvent.getObjects(SiegeEvent.ATTACKERS);
CTBSiegeClanObject siegeClan = siegeEvent.getSiegeClan(SiegeEvent.ATTACKERS, clan);
if (siegeClan != null)
{
showFlagInfo(player, siegeClans.indexOf(siegeClan));
return;
}
QuestState questState = player.getQuestState(_504_CompetitionForTheBanditStronghold.class);
if ((questState == null) || (questState.getQuestItemsCount(5009) != 1))
{
showChatWindow(player, "residence2/clanhall/agit_oel_mahum_messeger_24.htm");
return;
}
questState.exitCurrentQuest(true);
register(player);
}
else if (command.equalsIgnoreCase("registerByOffer"))
{
if (!checkCond(player, false))
{
return;
}
List<CTBSiegeClanObject> siegeClans = siegeEvent.getObjects(SiegeEvent.ATTACKERS);
CTBSiegeClanObject siegeClan = siegeEvent.getSiegeClan(SiegeEvent.ATTACKERS, clan);
if (siegeClan != null)
{
showFlagInfo(player, siegeClans.indexOf(siegeClan));
return;
}
if (!player.consumeItem(ItemTemplate.ITEM_ID_ADENA, 200000))
{
showChatWindow(player, "residence2/clanhall/agit_oel_mahum_messeger_26.htm");
return;
}
register(player);
}
else if (command.equalsIgnoreCase("viewNpc"))
{
CTBSiegeClanObject siegeClan = siegeEvent.getSiegeClan(SiegeEvent.ATTACKERS, player.getClan());
if (siegeClan == null)
{
showChatWindow(player, "residence2/clanhall/agit_oel_mahum_messeger_7.htm");
return;
}
String file;
switch ((int) siegeClan.getParam())
{
case 0:
file = "residence2/clanhall/agit_oel_mahum_messeger_10.htm";
break;
case 35428:
file = "residence2/clanhall/agit_oel_mahum_messeger_11.htm";
break;
case 35429:
file = "residence2/clanhall/agit_oel_mahum_messeger_12.htm";
break;
case 35430:
file = "residence2/clanhall/agit_oel_mahum_messeger_13.htm";
break;
case 35431:
file = "residence2/clanhall/agit_oel_mahum_messeger_14.htm";
break;
case 35432:
file = "residence2/clanhall/agit_oel_mahum_messeger_15.htm";
break;
default:
return;
}
showChatWindow(player, file);
}
else if (command.startsWith("formAlliance"))
{
CTBSiegeClanObject siegeClan = siegeEvent.getSiegeClan(SiegeEvent.ATTACKERS, player.getClan());
if (siegeClan == null)
{
showChatWindow(player, "residence2/clanhall/agit_oel_mahum_messeger_7.htm");
return;
}
if (siegeClan.getClan().getLeaderId() != player.getObjectId())
{
showChatWindow(player, "residence2/clanhall/agit_oel_mahum_messeger_10.htm");
return;
}
StringTokenizer t = new StringTokenizer(command);
t.nextToken();
int npcId = Integer.parseInt(t.nextToken());
siegeClan.setParam(npcId);
SiegeClanDAO.getInstance().update(clanHall, siegeClan);
showChatWindow(player, "residence2/clanhall/agit_oel_mahum_messeger_9.htm");
}
else if (command.equalsIgnoreCase("registerAsMember"))
{
CTBSiegeClanObject siegeClan = siegeEvent.getSiegeClan(SiegeEvent.ATTACKERS, player.getClan());
if (siegeClan == null)
{
showChatWindow(player, "residence2/clanhall/agit_oel_mahum_messeger_7.htm");
return;
}
if (siegeClan.getClan().getLeaderId() == player.getObjectId())
{
showChatWindow(player, "residence2/clanhall/agit_oel_mahum_messeger_5.htm");
return;
}
if (siegeClan.getPlayers().contains(player.getObjectId()))
{
showChatWindow(player, "residence2/clanhall/agit_oel_mahum_messeger_9.htm");
}
else
{
if (siegeClan.getPlayers().size() >= 18)
{
showChatWindow(player, "residence2/clanhall/agit_oel_mahum_messeger_8.htm");
return;
}
siegeClan.getPlayers().add(player.getObjectId());
SiegePlayerDAO.getInstance().insert(clanHall, clan.getClanId(), player.getObjectId());
showChatWindow(player, "residence2/clanhall/agit_oel_mahum_messeger_9.htm");
}
}
else if (command.equalsIgnoreCase("listClans"))
{
NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
msg.setFile("residence2/clanhall/azit_messenger003.htm");
List<CTBSiegeClanObject> siegeClans = siegeEvent.getObjects(SiegeEvent.ATTACKERS);
for (int i = 0; i < 5; i++)
{
CTBSiegeClanObject siegeClan = CollectionUtils.safeGet(siegeClans, i);
if (siegeClan != null)
{
msg.replace("%clan_" + i + "%", siegeClan.getClan().getName());
}
else
{
msg.replaceNpcString("%clan_" + i + "%", NpcString.__UNREGISTERED__);
}
msg.replace("%clan_count_" + i + "%", siegeClan == null ? StringUtils.EMPTY : String.valueOf(siegeClan.getPlayers().size()));
}
player.sendPacket(msg);
}
else
{