Package l2p.gameserver.model.instances

Examples of l2p.gameserver.model.instances.L2DoorInstance


              npcDat.set("name", name);
              npcDat.set("baseHpMax", hp);
              npcDat.set("basePDef", pdef);
              npcDat.set("baseMDef", mdef);
              L2CharTemplate template = new L2CharTemplate(npcDat);
              L2DoorInstance door = new L2DoorInstance(IdFactory.getInstance().getNextId(), template, id, name, unlockable, showHp);
              _staticItems.put(id, door);
              L2Territory pos = new L2Territory(id);
              door.setGeoPos(pos);
              pos.add(ax, ay, minz, maxz);
              pos.add(bx, by, minz, maxz);
              pos.add(cx, cy, minz, maxz);
              pos.add(dx, dy, minz, maxz);
              door.getTemplate().collisionHeight = maxz - minz & 0xfff0;
              door.getTemplate().collisionRadius = Math.max(50, Math.min(posx - pos.getXmin(), posy - pos.getYmin()));
              door.setXYZInvisible(posx, posy, minz + 32);
              door.setCurrentHpMp(door.getMaxHp(), door.getMaxMp(), true);
              door.setOpen(false);
              door.level = level;
              door.key = key;
              // Дверь/стена может быть атакована только осадным оружием
              door.setSiegeWeaponOlnyAttackable(siege_weapon);
              door.setGeodata(geodata);
              door.spawnMe(door.getLoc());
              if(Config.debugDoor)
              {
                if(door.getTemplate().collisionRadius > 200)
                {
                  System.out.println("DoorId: " + id + ", collision: " + door.getTemplate().collisionRadius + ", posx: " + posx + ", posy: " + posy + ", xMin: " + pos.getXmin() + ", yMin: " + pos.getYmin());
                }
                if(pos.getXmin() == pos.getXmax())
                {
                  _log.warning("door " + id + " has zero size");
                }
View Full Code Here


  private mEvent()
  {
    for(int doorId : doorIds)
    {
      L2DoorInstance door = DoorTable.getInstance().getDoor(doorId).clone();
      door.setOpen(false);
      door.setGeodata(false);
      door.setHPVisible(false);
      door.setIsInvul(true);
      doors.add(door);
    }
    if(Config.eventEngine)
    {
      ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new runEvents(), 1000, Config.runEveryNMinutes * 60 * 1000);
 
View Full Code Here

      }
      if(i.getDoors() != null)
      {
        for(L2DoorInstance d : i.getDoors())
        {
          L2DoorInstance door = d.clone();
          r.addDoor(door);
          door.setReflection(r);
          door.spawnMe();
          if(d.isOpen())
          {
            door.openMe();
          }
        }
      }
    }
    World world = new World();
View Full Code Here

  private static int siegeHourOfDay = 0;

  @Override
  public void onLoad()
  {
    L2DoorInstance door = DoorTable.getInstance().getDoor(21150003);
    clanHall.getDoors().add(door);
    door = DoorTable.getInstance().getDoor(21150004);
    clanHall.getDoors().add(door);
    startAutoTask();
  }
View Full Code Here

    if(!target.isDoor() || _unlockPower == 0)
    {
      activeChar.sendPacket(Msg.INVALID_TARGET);
      return false;
    }
    L2DoorInstance door = (L2DoorInstance) target;
    if(door.isOpen())
    {
      activeChar.sendPacket(Msg.IT_IS_NOT_LOCKED);
      return false;
    }
    if(!door.isUnlockable() || door.getSiegeUnit() != null)
    {
      activeChar.sendPacket(Msg.YOU_ARE_UNABLE_TO_UNLOCK_THE_DOOR);
      return false;
    }
    if(door.key > 0) // ключ не подходит к двери
    {
      activeChar.sendPacket(Msg.YOU_ARE_UNABLE_TO_UNLOCK_THE_DOOR);
      return false;
    }
    if(_unlockPower - door.getLevel() * 100 < 0) // Дверь слишком высокого уровня
    {
      activeChar.sendPacket(Msg.YOU_ARE_UNABLE_TO_UNLOCK_THE_DOOR);
      return false;
    }
    return super.checkCondition(activeChar, target, forceUse, dontMove, first);
View Full Code Here

    {
      if(targ != null)
      {
        if(targ.isDoor())
        {
          L2DoorInstance target = (L2DoorInstance) targ;
          if(!target.isOpen() && (target.key > 0 || Rnd.chance(_unlockPower - target.level * 100)))
          {
            target.openMe();
            target.onOpen();
          }
          else
          {
            activeChar.sendPacket(Msg.YOU_HAVE_FAILED_TO_UNLOCK_THE_DOOR);
          }
          return;
        }
        L2ChestInstance target = (L2ChestInstance) targ;
        if(target.isDead())
        {
          return;
        }
        if(target.isFake())
        {
          target.onOpen((L2Player) activeChar);
          return;
        }
        double chance = getActivateRate();
        double levelmod = (double) getMagicLevel() - target.getLevel();
        chance += levelmod * getLevelModifier();
        if(chance < 0)
        {
          chance = 1;
        }
        if(chance < 100)
        {
          activeChar.sendMessage(new CustomMessage("l2p.gameserver.skills.skillclasses.Unlock.Chance", activeChar).addString(getName()).addNumber((long) chance));
        }
        if(Rnd.chance(chance))
        {
          activeChar.sendMessage(new CustomMessage("l2p.gameserver.skills.skillclasses.Unlock.Success", activeChar));
          target.onOpen((L2Player) activeChar);
        }
        else
        {
          activeChar.sendPacket(new SystemMessage(SystemMessage.S1_HAS_FAILED).addString(getName()));
          target.doDie(activeChar);
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.instances.L2DoorInstance

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.