Example #1
0
  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) {
        allPowerDisabled = false;
      }
    }

    if (allPowerDisabled) {
      if (player.getInventory().getCountOf(ITEM_ID) > 0) {
        return COND_CAN_OPEN;
      } else {
        return COND_NO_ITEM;
      }
    } else {
      return COND_POWER;
    }
  }
Example #2
0
 public NpcInstance findTemplate(int npcId) {
   for (Spawner spawn : SpawnManager.getInstance().getSpawners(PeriodOfDay.NONE.name())) {
     if ((spawn != null) && (spawn.getCurrentNpcId() == npcId)) {
       return spawn.getLastSpawn();
     }
   }
   return null;
 }