TerritorySiege.getClans().clear();
TerritorySiegeDatabase.saveSiegeMembers();
showTerritorySiegePage(activeChar);
return true;
}
Residence siegeUnit = null;
int siegeUnitId = 0;
if(st.hasMoreTokens())
{
siegeUnitId = Integer.parseInt(st.nextToken());
}
if(siegeUnitId != 0)
{
siegeUnit = CastleManager.getInstance().getCastleByIndex(siegeUnitId);
if(siegeUnit == null)
{
siegeUnit = FortressManager.getInstance().getFortressByIndex(siegeUnitId);
}
if(siegeUnit == null)
{
siegeUnit = ClanHallManager.getInstance().getClanHall(siegeUnitId);
}
}
if(siegeUnit == null || siegeUnit.getId() < 0 || siegeUnit.getSiege() == null)
{
showSiegeUnitSelectPage(activeChar);
}
else
{
if(fullString.equalsIgnoreCase("admin_add_attacker"))
{
siegeUnit.getSiege().registerAttacker(player, true);
}
else if(fullString.equalsIgnoreCase("admin_add_defender"))
{
siegeUnit.getSiege().registerDefender(player, true);
}
else if(fullString.equalsIgnoreCase("admin_add_guard"))
{
// Get value
String val = "";
if(st.hasMoreTokens())
{
val = st.nextToken();
}
if(!val.equals(""))
{
try
{
int npcId = Integer.parseInt(val);
siegeUnit.getSiege().getSiegeGuardManager().addSiegeGuard(activeChar, npcId);
}
catch(Exception e)
{
activeChar.sendMessage("Value entered for Npc Id wasn't an integer");
}
}
else
{
activeChar.sendMessage("Missing Npc Id");
}
}
else if(fullString.equalsIgnoreCase("admin_clear_siege_list"))
{
siegeUnit.getSiege().getDatabase().clearSiegeClan();
}
else if(fullString.equalsIgnoreCase("admin_endsiege"))
{
siegeUnit.getSiege().endSiege();
}
else if(fullString.equalsIgnoreCase("admin_list_siege_clans"))
{
siegeUnit.getSiege().listRegisterClan(activeChar);
return true;
}
else if(fullString.equalsIgnoreCase("admin_move_defenders"))
{
activeChar.sendPacket(Msg.NOT_WORKING_PLEASE_TRY_AGAIN_LATER);
}
else if(fullString.equalsIgnoreCase("admin_setcastle"))
{
if(player.getClan() == null)
{
activeChar.sendPacket(Msg.THAT_IS_THE_INCORRECT_TARGET);
}
else
{
siegeUnit.changeOwner(player.getClan());
_log.fine(siegeUnit.getName() + " owned by clan " + player.getClan().getName());
}
}
else if(fullString.equalsIgnoreCase("admin_castledel"))
{
siegeUnit.changeOwner(null);
}
else if(fullString.equalsIgnoreCase("admin_spawn_doors"))
{
siegeUnit.spawnDoor();
}
else if(fullString.equalsIgnoreCase("admin_startsiege"))
{
siegeUnit.getSiege().startSiege();
}
showSiegePage(activeChar, siegeUnit);
}
return true;
}