Package lineage2.gameserver.model.entity.events.objects

Examples of lineage2.gameserver.model.entity.events.objects.CTBSiegeClanObject


  private void register(Player player)
  {
    Clan clan = player.getClan();
    ClanHall clanHall = getClanHall();
    ClanHallTeamBattleEvent siegeEvent = clanHall.getSiegeEvent();
    CTBSiegeClanObject siegeClan = new CTBSiegeClanObject(SiegeEvent.ATTACKERS, clan, 0);
    siegeClan.getPlayers().add(player.getObjectId());
    siegeEvent.addObject(SiegeEvent.ATTACKERS, siegeClan);
    SiegeClanDAO.getInstance().insert(clanHall, siegeClan);
    SiegePlayerDAO.getInstance().insert(clanHall, clan.getClanId(), player.getObjectId());
    List<CTBSiegeClanObject> siegeClans = siegeEvent.getObjects(SiegeEvent.ATTACKERS);
    showFlagInfo(player, siegeClans.indexOf(siegeClan));
View Full Code Here


      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
    {
View Full Code Here

  private void register(Player player)
  {
    Clan clan = player.getClan();
    ClanHall clanHall = getClanHall();
    ClanHallTeamBattleEvent siegeEvent = clanHall.getSiegeEvent();
    CTBSiegeClanObject siegeClan = new CTBSiegeClanObject(SiegeEvent.ATTACKERS, clan, 0);
    siegeClan.getPlayers().add(player.getObjectId());
    siegeEvent.addObject(SiegeEvent.ATTACKERS, siegeClan);
    SiegeClanDAO.getInstance().insert(clanHall, siegeClan);
    SiegePlayerDAO.getInstance().insert(clanHall, clan.getClanId(), player.getObjectId());
    List<CTBSiegeClanObject> siegeClans = siegeEvent.getObjects(SiegeEvent.ATTACKERS);
    showFlagInfo(player, siegeClans.indexOf(siegeClan));
View Full Code Here

   * @return boolean
   */
  @Override
  public boolean isAttackable(Creature attacker)
  {
    CTBSiegeClanObject clan = _matchTeamObject.getSiegeClan();
    if ((clan != null) && attacker.isPlayable())
    {
      Player player = attacker.getPlayer();
      if (player.getClan() == clan.getClan())
      {
        return false;
      }
    }
    return true;
View Full Code Here

   * @return String
   */
  @Override
  public String getTitle()
  {
    CTBSiegeClanObject clan = _matchTeamObject.getSiegeClan();
    return clan == null ? StringUtils.EMPTY : clan.getClan().getName();
  }
View Full Code Here

    final int y = Integer.parseInt(param[1]);
    final int z = Integer.parseInt(param[2]);
    final int castleId = (param.length > 4) ? Integer.parseInt(param[3]) : 0;
    if (player.getReflection().isDefault())
    {
      final Castle castle = (castleId > 0) ? ResidenceHolder.getInstance().getResidence(Castle.class, castleId) : null;
      if ((castle != null) && castle.getSiegeEvent().isInProgress())
      {
        player.sendPacket(Msg.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
        return;
      }
    }
View Full Code Here

    public void onZoneEnter(Zone zone, Creature cha)
    {
      if (zone.getParams() == null || !cha.isPlayer())
        return;

      Castle castle = ResidenceHolder.getInstance().getResidence(zone.getTemplate().getIndex());

      if (castle != null)
      { 
        if(_side.ordinal()==1 || _side.ordinal()==0)
        {
View Full Code Here

   * Method enter_dc.
   */
  public void enter_dc()
  {
    final Player player = getSelf();
    final NpcInstance npc = getNpc();
    if ((player == null) || (npc == null))
    {
      return;
    }
    if (!NpcInstance.canBypassCheck(player, npc))
View Full Code Here

   * Method exit_dc.
   */
  public void exit_dc()
  {
    final Player player = getSelf();
    final NpcInstance npc = getNpc();
    if ((player == null) || (npc == null))
    {
      return;
    }
    if (!NpcInstance.canBypassCheck(player, npc))
View Full Code Here

   * @return boolean
   */
  @Override
  protected boolean thinkActive()
  {
    final NpcInstance actor = getActor();
    if (actor == null)
    {
      return true;
    }
    for (Player player : World.getAroundPlayers(actor, 200, 200))
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.entity.events.objects.CTBSiegeClanObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.