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

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


      int type = Integer.parseInt(st.nextToken());
      int level = Integer.parseInt(st.nextToken());
      long price = getDoorCost(type, level);

      List<DoorObject> doorObjects = castle.getSiegeEvent().getObjects(SiegeEvent.DOORS);
      DoorObject targetDoorObject = null;
      for(DoorObject o : doorObjects)
        if(o.getUId() == id)
        {
          targetDoorObject = o;
          break;
        }

      DoorInstance door = targetDoorObject.getDoor();
      int upgradeHp = (door.getMaxHp() - door.getUpgradeHp()) * level - door.getMaxHp();

      if(price == 0 || upgradeHp < 0)
      {
        player.sendMessage(new CustomMessage("common.Error", player));
        return;
      }

      if(door.getUpgradeHp() >= upgradeHp)
      {
        int oldLevel = door.getUpgradeHp() / (door.getMaxHp() - door.getUpgradeHp()) + 1;
        NpcHtmlMessage html = new NpcHtmlMessage(player, this);
        html.setFile("castle/chamberlain/doorAlready.htm");
        html.replace("%level%", String.valueOf(oldLevel));
        player.sendPacket(html);
        return;
      }

      if(player.getClan().getAdenaCount() < price)
      {
        player.sendPacket(SystemMsg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
        return;
      }

      player.getClan().getWarehouse().destroyItemByItemId(ItemTemplate.ITEM_ID_ADENA, price);

      targetDoorObject.setUpgradeValue(castle.<SiegeEvent<?, ?>> getSiegeEvent(), upgradeHp);
      CastleDoorUpgradeDAO.getInstance().insert(door.getDoorId(), upgradeHp);
    }
    else if(actualCommand.equalsIgnoreCase("report")) // Report page
    {
      if(!isHaveRigths(player, Clan.CP_CS_USE_FUNCTIONS))
View Full Code Here


      {
        objects.add(new SpawnExObject(objectsElement.attributeValue("name")));
      }
      else if (nodeName.equalsIgnoreCase("door"))
      {
        objects.add(new DoorObject(Integer.parseInt(objectsElement.attributeValue("id"))));
      }
      else if (nodeName.equalsIgnoreCase("static_object"))
      {
        objects.add(new StaticObjectObject(Integer.parseInt(objectsElement.attributeValue("id"))));
      }
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

   * @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

TOP

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

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.