Examples of ResidenceFunction


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

      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

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

   * @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
TOP
Copyright © 2018 www.massapi.com. 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.