Package lineage2.gameserver.model.entity.events.impl

Examples of lineage2.gameserver.model.entity.events.impl.FortressSiegeEvent


    if (_powerUnits != 0)
    {
      return;
    }
    Functions.npcShout(this, NpcString.FORTRESS_POWER_DISABLED);
    FortressSiegeEvent siegeEvent = getEvent(FortressSiegeEvent.class);
    if (siegeEvent == null)
    {
      return;
    }
    siegeEvent.spawnAction(FortressSiegeEvent.IN_POWER_UNITS, false);
    siegeEvent.barrackAction(3, true);
    siegeEvent.broadcastTo(SystemMsg.THE_BARRACKS_HAVE_BEEN_SEIZED, SiegeEvent.ATTACKERS, SiegeEvent.DEFENDERS);
    onDecay();
    siegeEvent.checkBarracks();
  }
View Full Code Here


   * Method powerOff.
   * @param powerUnit PowerControlUnitInstance
   */
  public void powerOff(PowerControlUnitInstance powerUnit)
  {
    FortressSiegeEvent event = getEvent(FortressSiegeEvent.class);
    SpawnExObject exObject = event.getFirstObject(FortressSiegeEvent.IN_POWER_UNITS);
    int machineNumber = -1;
    for (int i = 0; i < 3; i++)
    {
      Spawner spawn = exObject.getSpawns().get(i);
      if (spawn == powerUnit.getSpawn())
      {
        machineNumber = i;
      }
    }
    NpcString msg = null;
    switch (machineNumber)
    {
      case 0:
        msg = NpcString.MACHINE_NO_1_POWER_OFF;
        break;
      case 1:
        msg = NpcString.MACHINE_NO_2_POWER_OFF;
        break;
      case 2:
        msg = NpcString.MACHINE_NO_3_POWER_OFF;
        break;
      default:
        throw new IllegalArgumentException("Wrong spawn at fortress: " + event.getName());
    }
    _powerUnits--;
    Functions.npcShout(this, msg);
  }
View Full Code Here

    int cond = getCond(player);
    if (cond == COND_CAN_OPEN)
    {
      if (player.consumeItem(ITEM_ID, 1))
      {
        FortressSiegeEvent event = getEvent(FortressSiegeEvent.class);
        event.doorAction(FortressSiegeEvent.MACHINE_DOORS, true);
        event.spawnAction(FortressSiegeEvent.OUT_POWER_UNITS, false);
      }
      else
      {
        showChatWindow(player, "residence2/fortress/fortress_controller002.htm");
      }
View Full Code Here

   * @param player Player
   * @return int
   */
  private int getCond(Player player)
  {
    FortressSiegeEvent event = getEvent(FortressSiegeEvent.class);
    if (event == null)
    {
      return COND_POWER;
    }
    SpawnExObject object = event.getFirstObject(FortressSiegeEvent.OUT_POWER_UNITS);
    boolean allPowerDisabled = true;
    for (int i = 0; i < 4; i++)
    {
      Spawner spawn = object.getSpawns().get(i);
      if (spawn.getFirstSpawned() != null)
View Full Code Here

    int cond = getCond();
    switch (cond)
    {
      case COND_ALL_OK:
        message.setFile("residence2/fortress/fortress_inner_controller002.htm");
        FortressSiegeEvent event = getEvent(FortressSiegeEvent.class);
        if (event != null)
        {
          SpawnExObject exObject = event.getFirstObject(FortressSiegeEvent.SIEGE_COMMANDERS);
          Spawner spawn = exObject.getSpawns().get(3);
          MainMachineInstance machineInstance = (MainMachineInstance) spawn.getFirstSpawned();
          machineInstance.powerOff(this);
          onDecay();
        }
View Full Code Here

        final Fortress fortress = ResidenceHolder.getInstance().getResidence(Fortress.class, Integer.parseInt(wordList[1]));
        if (fortress == null)
        {
          return false;
        }
        final FortressSiegeEvent siegeEvent = fortress.getSiegeEvent();
        if (!siegeEvent.isInProgress())
        {
          return false;
        }
        final boolean[] f = siegeEvent.getBarrackStatus();
        for (int i = 0; i < f.length; i++)
        {
          siegeEvent.barrackAction(i, true);
        }
        siegeEvent.spawnFlags();
        return true;
    }
    return true;
  }
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

TOP

Related Classes of lineage2.gameserver.model.entity.events.impl.FortressSiegeEvent

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.