Package lineage2.gameserver.model.entity.residence

Examples of lineage2.gameserver.model.entity.residence.ResidenceFunction


    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


      String nodeName = element.getName();
      int level = element.attributeValue("level") == null ? 0 : Integer.valueOf(element.attributeValue("level"));
      int lease = (int) ((element.attributeValue("lease") == null ? 0 : Integer.valueOf(element.attributeValue("lease"))) * Config.RESIDENCE_LEASE_FUNC_MULTIPLIER);
      int npcId = element.attributeValue("npcId") == null ? 0 : Integer.valueOf(element.attributeValue("npcId"));
      int listId = element.attributeValue("listId") == null ? 0 : Integer.valueOf(element.attributeValue("listId"));
      ResidenceFunction function = null;
      if (nodeName.equalsIgnoreCase("teleport"))
      {
        function = checkAndGetFunction(residence, ResidenceFunction.TELEPORT);
        List<TeleportLocation> targets = new ArrayList<>();
        for (Iterator<Element> it2 = element.elementIterator(); it2.hasNext();)
        {
          Element teleportElement = it2.next();
          if ("target".equalsIgnoreCase(teleportElement.getName()))
          {
            int npcStringId = Integer.parseInt(teleportElement.attributeValue("name"));
            long price = Long.parseLong(teleportElement.attributeValue("price"));
            int itemId = teleportElement.attributeValue("item") == null ? ItemTemplate.ITEM_ID_ADENA : Integer.parseInt(teleportElement.attributeValue("item"));
            TeleportLocation loc = new TeleportLocation(itemId, price, npcStringId, 0);
            loc.set(Location.parseLoc(teleportElement.attributeValue("loc")));
            targets.add(loc);
          }
        }
        function.addTeleports(level, targets.toArray(new TeleportLocation[targets.size()]));
      }
      else if (nodeName.equalsIgnoreCase("support"))
      {
        if ((level > 9) && !Config.ALT_CH_ALLOW_1H_BUFFS)
        {
          continue;
        }
        function = checkAndGetFunction(residence, ResidenceFunction.SUPPORT);
        function.addBuffs(level);
      }
      else if (nodeName.equalsIgnoreCase("item_create"))
      {
        function = checkAndGetFunction(residence, ResidenceFunction.ITEM_CREATE);
        function.addBuylist(level, new int[]
        {
          npcId,
          listId
        });
      }
      else if (nodeName.equalsIgnoreCase("curtain"))
      {
        function = checkAndGetFunction(residence, ResidenceFunction.CURTAIN);
      }
      else if (nodeName.equalsIgnoreCase("platform"))
      {
        function = checkAndGetFunction(residence, ResidenceFunction.PLATFORM);
      }
      else if (nodeName.equalsIgnoreCase("restore_exp"))
      {
        function = checkAndGetFunction(residence, ResidenceFunction.RESTORE_EXP);
      }
      else if (nodeName.equalsIgnoreCase("restore_hp"))
      {
        function = checkAndGetFunction(residence, ResidenceFunction.RESTORE_HP);
      }
      else if (nodeName.equalsIgnoreCase("restore_mp"))
      {
        function = checkAndGetFunction(residence, ResidenceFunction.RESTORE_MP);
      }
      else if (nodeName.equalsIgnoreCase("skills"))
      {
        for (Iterator<Element> nextIterator = element.elementIterator(); nextIterator.hasNext();)
        {
          Element nextElement = nextIterator.next();
          int id2 = Integer.parseInt(nextElement.attributeValue("id"));
          int level2 = Integer.parseInt(nextElement.attributeValue("level"));
          Skill skill = SkillTable.getInstance().getInfo(id2, level2);
          if (skill != null)
          {
            residence.addSkill(skill);
          }
        }
      }
      else if (nodeName.equalsIgnoreCase("banish_points"))
      {
        for (Iterator<Element> banishPointsIterator = element.elementIterator(); banishPointsIterator.hasNext();)
        {
          Location loc = Location.parse(banishPointsIterator.next());
          residence.addBanishPoint(loc);
        }
      }
      else if (nodeName.equalsIgnoreCase("owner_restart_points"))
      {
        for (Iterator<Element> ownerRestartPointsIterator = element.elementIterator(); ownerRestartPointsIterator.hasNext();)
        {
          Location loc = Location.parse(ownerRestartPointsIterator.next());
          residence.addOwnerRestartPoint(loc);
        }
      }
      else if (nodeName.equalsIgnoreCase("other_restart_points"))
      {
        for (Iterator<Element> otherRestartPointsIterator = element.elementIterator(); otherRestartPointsIterator.hasNext();)
        {
          Location loc = Location.parse(otherRestartPointsIterator.next());
          residence.addOtherRestartPoint(loc);
        }
      }
      else if (nodeName.equalsIgnoreCase("chaos_restart_points"))
      {
        for (Iterator<Element> chaosRestartPointsIterator = element.elementIterator(); chaosRestartPointsIterator.hasNext();)
        {
          Location loc = Location.parse(chaosRestartPointsIterator.next());
          residence.addChaosRestartPoint(loc);
        }
      }
      else if (nodeName.equalsIgnoreCase("related_fortresses"))
      {
        for (Iterator<Element> subElementIterator = element.elementIterator(); subElementIterator.hasNext();)
        {
          Element subElement = subElementIterator.next();
          if (subElement.getName().equalsIgnoreCase("domain"))
          {
            ((Castle) residence).addRelatedFortress(Fortress.DOMAIN, Integer.parseInt(subElement.attributeValue("fortress")));
          }
          else if (subElement.getName().equalsIgnoreCase("boundary"))
          {
            ((Castle) residence).addRelatedFortress(Fortress.BOUNDARY, Integer.parseInt(subElement.attributeValue("fortress")));
          }
        }
      }
      else if (nodeName.equalsIgnoreCase("merchant_guards"))
      {
        for (Iterator<Element> subElementIterator = element.elementIterator(); subElementIterator.hasNext();)
        {
          Element subElement = subElementIterator.next();
          int itemId = Integer.parseInt(subElement.attributeValue("item_id"));
          int npcId2 = Integer.parseInt(subElement.attributeValue("npc_id"));
          int maxGuard = Integer.parseInt(subElement.attributeValue("max"));
          IntSet intSet = new HashIntSet(3);
          String[] ssq = subElement.attributeValue("ssq").split(";");
          for (String q : ssq)
          {
            if (q.equalsIgnoreCase("cabal_null"))
            {
              intSet.add(0);
            }
          }
          ((Castle) residence).addMerchantGuard(new MerchantGuard(itemId, npcId2, maxGuard, intSet));
        }
      }
      if (function != null)
      {
        function.addLease(level, lease);
      }
    }
  }
View Full Code Here

   * @param type int
   * @return ResidenceFunction
   */
  private ResidenceFunction checkAndGetFunction(Residence residence, int type)
  {
    ResidenceFunction function = residence.getFunction(type);
    if (function == null)
    {
      function = new ResidenceFunction(residence.getId(), type);
      residence.addFunction(function);
    }
    return function;
  }
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

   * @param damage int
   */
  @Override
  protected void onEvtAttacked(Creature attacker, int damage)
  {
    final NpcInstance actor = getActor();
    if (_firstTimeAttacked)
    {
      _firstTimeAttacked = false;
      if (Rnd.chance(25))
      {
View Full Code Here

   * @param damage int
   */
  @Override
  protected void onEvtAttacked(Creature attacker, int damage)
  {
    final NpcInstance actor = getActor();
    if ((attacker == null) || (attacker.getPlayer() == null))
    {
      return;
    }
    if ((System.currentTimeMillis() - _lastAction) > 15000)
    {
      _lastAction = System.currentTimeMillis();
      Functions.npcSayCustomMessage(actor, "scripts.ai.FieldMachine." + actor.getNpcId());
      final List<NpcInstance> around = actor.getAroundNpc(1500, 300);
      if ((around != null) && !around.isEmpty())
      {
        for (NpcInstance npc : around)
        {
          if (npc.isMonster() && (npc.getNpcId() >= 22656) && (npc.getNpcId() <= 22659))
View Full Code Here

   * @return boolean
   */
  @Override
  protected boolean thinkActive()
  {
    final NpcInstance actor = getActor();
    if (actor.isDead())
    {
      return true;
    }
    if (_def_think)
    {
View Full Code Here

  {
    BaiumManager.setLastAttackTime();
    if (_firstTimeAttacked)
    {
      _firstTimeAttacked = false;
      final NpcInstance actor = getActor();
      if (attacker == null)
      {
        return;
      }
      if (attacker.isPlayer())
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.entity.residence.ResidenceFunction

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.