Пример #1
0
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) {
      return;
    }

    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();
  }
Пример #2
0
  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);
  }
Пример #3
0
  @Override
  public void onSpawn() {
    super.onSpawn();

    FortressSiegeEvent siegeEvent = getEvent(FortressSiegeEvent.class);
    if (siegeEvent == null) {
      return;
    }

    siegeEvent.barrackAction(3, false);
  }