Package l2p.gameserver.model.entity.residence

Examples of l2p.gameserver.model.entity.residence.Residence$AutoTaskForFunctions


    // Check if the player has a clan
    if(activeChar.getClan() == null)
    {
      return;
    }
    Residence unit = CastleManager.getInstance().getCastleByIndex(_UnitId);
    if(unit == null)
    {
      unit = FortressManager.getInstance().getFortressByIndex(_UnitId);
    }
    if(unit == null)
    {
      activeChar.sendActionFailed();
      return;
    }
    // Check if leader of the clan who owns the castle?
    if(unit.getOwnerId() != activeChar.getClanId() || !activeChar.isClanLeader())
    {
      activeChar.sendActionFailed();
      return;
    }
    L2Clan clan = ClanTable.getInstance().getClan(_ClanId);
    if(clan == null)
    {
      return;
    }
    if(!unit.getSiege().isRegistrationOver())
    {
      if(_Approved == 1)
      {
        if(unit.getSiege().checkIsDefenderWaiting(clan) || unit.getSiege().checkIsDefenderRefused(clan))
        {
          unit.getSiege().approveSiegeDefenderClan(_ClanId);
        }
        else
        {
          return;
        }
      }
      else if(unit.getSiege().checkIsDefenderWaiting(clan) || unit.getSiege().checkIsDefender(clan))
      {
        unit.getSiege().refuseSiegeDefenderClan(_ClanId);
      }
    }
    // Update the defender list
    activeChar.sendPacket(new SiegeDefenderList(unit));
  }
View Full Code Here


  }

  public void addTicket(int itemId, L2Player activeChar)
  {
    Location loc = new Location(activeChar.getX(), activeChar.getY(), activeChar.getZ(), activeChar.getHeading());
    Residence castle = CastleManager.getInstance().getCastleByObject(activeChar);
    if(castle == null)
    {
      return;
    }
    int npcId = getNpcId(itemId);
    if(npcId <= 0)
    {
      return;
    }
    L2ItemInstance dropticket = ItemTable.getInstance().createItem(itemId);
    dropticket.setLocation(L2ItemInstance.ItemLocation.INVENTORY);
    dropticket.dropMe(null, loc);
    castle.getSiege().getSiegeGuardManager().hireMerc(loc, npcId);
    dropticket.setDropTime(0); // avoids it from beeing removed by the auto item destroyer
    getDroppedTickets().add(dropticket);
  }
View Full Code Here

    }
  }

  public void removeTicket(L2ItemInstance item)
  {
    Residence castle = CastleManager.getInstance().getCastleByObject(item);
    int itemId = item.getItemId();
    int npcId = getNpcId(itemId);
    if(npcId > 0 && castle != null)
    {
      castle.getSiege().getSiegeGuardManager().removeMerc(npcId, item.getLoc());
    }
    getDroppedTickets().remove(item);
  }
View Full Code Here

        if(player.isFlying() && !player.isBlocked() && player.getMountNpcId() == PetDataTable.WYVERN_ID)
        {
          Siege siege = SiegeManager.getSiege(player, false);
          if(siege != null)
          {
            Residence unit = siege.getSiegeUnit();
            if(unit != null && player.getClan() != null && player.isClanLeader() && (player.getClan().getHasCastle() == unit.getId() || player.getClan().getHasFortress() == unit.getId()))
            {
              return;
            }
          }
          player.stopMove();
View Full Code Here

      return false;
    }
    Siege siege = SiegeManager.getSiege(this, false);
    if(siege != null)
    {
      Residence unit = siege.getSiegeUnit();
      if(unit != null && getClan() != null && isClanLeader() && (getClan().getHasCastle() == unit.getId() || getClan().getHasFortress() == unit.getId()))
      {
        return true;
      }
      return false;
    }
View Full Code Here

  }

  @Override
  public void runImpl()
  {
    Residence unit = CastleManager.getInstance().getCastleByIndex(_unitId);
    if(unit == null)
    {
      unit = FortressManager.getInstance().getFortressByIndex(_unitId);
    }
    if(unit == null)
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.entity.residence.Residence$AutoTaskForFunctions

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.