@Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    QuestState st = player.getQuestState(getClass());
    if (st == null || player.getLevel() < 79) {
      return htmltext;
    }
    int cond = st.getCond();

    if (npc.getNpcId() == WOOD) {
      QuestState first = player.getQuestState(_00196_SevenSignSealOfTheEmperor.class);
      if (first != null
          && first.getState() == COMPLETED
          && st.getState() == CREATED
          && player.getLevel() >= 79) {
        htmltext = "32593-01.htm";
      } else if (cond == 0) {
        htmltext = "32593-00.htm";
        st.exitQuest(QuestType.REPEATABLE);
      } else if (cond == 1) {
        htmltext = "32593-05.htm";
      } else if (cond == 6) {
        htmltext = "32593-06.htm";
      }
    } else if (npc.getNpcId() == ORVEN) {
      if (cond == 1) {
        htmltext = "30857-01.htm";
      } else if (cond == 2) {
        htmltext = "30857-05.htm";
      }
    } else if (npc.getNpcId() == LEOPARD) {
      if (cond == 2) {
        htmltext = "32594-01.htm";
      } else if (cond == 3) {
        htmltext = "32594-04.htm";
      }
    } else if (npc.getNpcId() == LAWRENCE) {
      if (cond == 3) {
        htmltext = "32595-01.htm";
      } else if (cond == 4) {
        htmltext = "32595-05.htm";
      } else if (cond == 5) {
        htmltext = "32595-09.htm";
      }
    } else if (npc.getNpcId() == SOFIA) {
      if (cond == 5) {
        htmltext = "32596-01.htm";
      } else if (cond == 6) {
        htmltext = "32596-05.htm";
      }
    }
    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    L2PcInstance player = st.getPlayer();

    if (npc.getNpcId() == Типия) {
      switch (st.getState()) {
        case COMPLETED:
          return "orbis_typia_q10318_03.htm";
        case CREATED:
          QuestState previous = player.getQuestState(_10317_OrbisWitch.class);
          if (previous == null || !previous.isCompleted() || player.getLevel() < 95) {
            st.exitQuest(QuestType.REPEATABLE);
            return "orbis_typia_q10318_02.htm";
          } else {
            return "orbis_typia_q10318_01.htm";
          }
        case STARTED:
          if (st.getCond() == 1) {
            return !st.hasQuestItems(ПроклятаяСлизь)
                ? "orbis_typia_q10318_08.htm"
                : "orbis_typia_q10318_09.htm";
          } else if (st.getCond() == 2 && st.getQuestItemsCount(ПроклятаяСлизь) >= 8) {
            st.addExpAndSp(79260650, 36253450);
            st.giveAdena(5427900, true);
            st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
            st.exitQuest(QuestType.ONE_TIME);
            return "orbis_typia_q10318_10.htm";
          }
      }
    }
    return getNoQuestMsg(player);
  }
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    int npcId = npc.getNpcId();
    int cond = st.getCond();
    L2PcInstance player = st.getPlayer();

    if (npcId == Rafforty) {
      switch (st.getState()) {
        case COMPLETED:
          return "repre_q10283_02.htm";
        case CREATED:
          QuestState prevst = player.getQuestState(_00115_TheOtherSideOfTruth.class);
          return player.getLevel() < 82 || prevst == null || !prevst.isCompleted()
              ? "repre_q10283_03.htm"
              : "repre_q10283_01.htm";
        case STARTED:
          switch (cond) {
            case 1:
              return "repre_q10283_06.htm";
            case 2:
              return "repre_q10283_10.htm";
          }
      }
    }
    return getNoQuestMsg(player);
  }
  public void setPlayerInstance(L2PcInstance player) {
    if (player == null && _player != null) {
      // this is here to keep the data when the player logs off
      _name = _player.getName();
      _level = _player.getLevel();
      _classId = _player.getBaseClassId();
      _objectId = _player.getObjectId();
      _powerGrade = _player.getPowerGrade();
      _pledgeType = _player.getPledgeType();
      _title = _player.getTitle();
      _apprentice = _player.getApprentice();
      _sponsor = _player.getSponsor();
      _sex = _player.getAppearance().getSex();
      _raceOrdinal = _player.getRace().ordinal();
    }

    if (player != null) {
      _clan.addSkillEffects(player);
      if (_clan.getLevel() > 3 && player.isClanLeader()) {
        CastleSiegeManager.getInstance().addSiegeSkills(player);
      }
      if (player.isClanLeader()) {
        _clan.setLeader(this);
      }
    }

    _player = player;
  }
 public L2ClanMember(L2Clan clan, L2PcInstance player) {
   _clan = clan;
   _name = player.getName();
   _level = player.getLevel();
   _classId = player.getBaseClassId();
   _objectId = player.getObjectId();
   _pledgeType = player.getPledgeType();
   _powerGrade = player.getPowerGrade();
   _title = player.getTitle();
   _sponsor = 0;
   _apprentice = 0;
   _sex = player.getAppearance().getSex();
   _raceOrdinal = player.getRace().ordinal();
 }
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    L2PcInstance player = st.getPlayer();

    if (npc.getNpcId() == EDRIC) {
      if (player.getLevel() < 75) {
        return "32527-00.htm";
      } else if (st.isCreated()) {
        return "32527-01.htm";
      } else if (player.isGM()) {
        st.startQuest();
        return "32527-10.html";
      } else if (st.getCond() == 1) {
        L2Party party = player.getParty();
        if (st.getInt("timeDiff") > 0) {
          if (giveReward(st, st.getInt("timeDiff"))) {
            // Clear quest
            st.unset("timeDiff");
            st.unset("cond");
            st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
            st.exitQuest(QuestType.REPEATABLE);
            return "32527-reward.html";
          } else {
            // Clear quest
            st.unset("timeDiff");
            st.unset("cond");
            st.playSound(QuestSound.ITEMSOUND_QUEST_FINISH);
            st.exitQuest(QuestType.REPEATABLE);
            return "32527-noreward.html";
          }
        } else if (party == null) {
          return "32527-noparty.html";
        } else if (!party.getLeader().equals(player)) {
          return prepareHtml(player, "32527-noleader.html", party.getLeader().getName());
        } else {
          for (L2PcInstance pm : party.getMembers()) {
            QuestState state = pm.getQuestState(getClass());
            if (state == null || state.getCond() != 1) {
              return prepareHtml(player, "32527-noquest.html", pm.getName());
            }
          }
          return "32527-10.html";
        }
      }
    }
    return null;
  }
 public L2ClanMember(L2PcInstance player) {
   if (player.getClan() == null) {
     throw new IllegalArgumentException("Can not create a ClanMember if player has a null clan.");
   }
   _clan = player.getClan();
   _player = player;
   _name = _player.getName();
   _level = _player.getLevel();
   _classId = _player.getBaseClassId();
   _objectId = _player.getObjectId();
   _powerGrade = _player.getPowerGrade();
   _pledgeType = _player.getPledgeType();
   _title = _player.getTitle();
   _apprentice = 0;
   _sponsor = 0;
   _sex = _player.getAppearance().getSex();
   _raceOrdinal = _player.getRace().ordinal();
 }
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    L2PcInstance player = st.getPlayer();
    int npcId = npc.getNpcId();
    QuestStateType id = st.getState();
    if (npcId == WILBERT && id == CREATED) {
      if (player.getLevel() >= 50) {
        return "Wilbert_start.htm";
      } else {

        st.exitQuest(QuestType.REPEATABLE);
        return "<html><body>Этот квест доступен персонажам, достигшим 50 уровня.</body></html>";
      }
    }
    if (npcId == WILBERT && id == STARTED) {
      return "Wilbert_QuestInProgress.htm";
    }
    return null;
  }
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    L2PcInstance player = st.getPlayer();

    if (st.isNowAvailable() && st.isCompleted()) {
      st.setState(CREATED);
    }
    switch (st.getState()) {
      case CREATED:
        return player.getLevel() >= 82 ? "32768-01.htm" : "32768-nolvl.htm";
      case STARTED:
        if (st.getCond() == 1) {
          return "32768-12.htm";
        }
        if (st.getCond() == 2) {
          return "32768-13.htm";
        }
        break;
      case COMPLETED:
        return "32768-noday.htm";
    }
    return null;
  }
  @Override
  public String onAsk(L2PcInstance player, L2Npc npc, int ask, int reply) {
    int ownerId;
    if (ask == -1724) {
      switch (reply) {
        case 1: // Взойти на корабль
          if (player.isTransformed()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_TRANSFORMED);
            return null;
          }
          if (player.isParalyzed()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_PETRIFIED);
            return null;
          }
          if (player.isDead() || player.isFakeDeath()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_DEAD);
            return null;
          }
          if (player.isFishing()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_FISHING);
            return null;
          }
          if (player.isInCombat()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_IN_BATTLE);
            return null;
          }
          if (player.isInDuel()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_IN_A_DUEL);
            return null;
          }
          if (player.isSitting()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_SITTING);
            return null;
          }
          if (player.isCastingNow()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_CASTING);
            return null;
          }
          if (player.isCursedWeaponEquipped()) {
            player.sendPacket(
                SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_CURSED_WEAPON_IS_EQUIPPED);
            return null;
          }
          if (player.isCombatFlagEquipped()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_HOLDING_A_FLAG);
            return null;
          }
          if (!player.getPets().isEmpty() || player.isMounted()) {
            player.sendPacket(
                SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
            return null;
          }
          if (player.isFlyingMounted()) {
            player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_NOT_MEET_REQUEIREMENTS);
            return null;
          }

          if (_dockedShip != null) {
            _dockedShip.addPassenger(player);
          }
          break;
        case 2: // Призвать корабль
          if (_dockedShip != null) {
            if (_dockedShip.isOwner(player)) {
              player.sendPacket(SystemMessageId.THE_AIRSHIP_IS_ALREADY_EXISTS);
            }
            return null;
          }
          if (_isBusy) {
            player.sendPacket(SystemMessageId.ANOTHER_AIRSHIP_ALREADY_SUMMONED);
            return null;
          }
          if ((player.getClanPrivileges() & L2Clan.CP_CL_SUMMON_AIRSHIP)
              != L2Clan.CP_CL_SUMMON_AIRSHIP) {
            player.sendPacket(SystemMessageId.THE_AIRSHIP_NO_PRIVILEGES);
            return null;
          }
          ownerId = player.getClanId();
          if (!AirShipManager.getInstance().hasAirShipLicense(ownerId)) {
            player.sendPacket(SystemMessageId.THE_AIRSHIP_NEED_LICENSE_TO_SUMMON);
            return null;
          }
          if (AirShipManager.getInstance().hasAirShip(ownerId)) {
            player.sendPacket(SystemMessageId.THE_AIRSHIP_ALREADY_USED);
            return null;
          }
          if (!player.destroyItemByItemId(ProcessType.CONSUME, STARSTONE, SUMMON_COST, npc, true)) {
            player.sendPacket(
                SystemMessage.getSystemMessage(SystemMessageId.THE_AIRSHIP_NEED_MORE_S1)
                    .addItemName(STARSTONE));
            return null;
          }

          _isBusy = true;
          L2AirShipInstance ship =
              AirShipManager.getInstance()
                  .getNewAirShip(_shipSpawnX, _shipSpawnY, _shipSpawnZ, _shipHeading, ownerId);
          if (ship != null) {
            if (_arrivalPath != null) {
              ship.executePath(_arrivalPath);
            }

            if (_arrivalMessage == null) {
              _arrivalMessage =
                  new NS(
                      npc.getObjectId(),
                      ChatType.SHOUT,
                      npc.getNpcId(),
                      NpcStringId
                          .THE_AIRSHIP_HAS_BEEN_SUMMONED_IT_WILL_AUTOMATICALLY_DEPART_IN_5_MINUTES);
            }

            npc.broadcastPacket(_arrivalMessage);
          } else {
            _isBusy = false;
          }
          break;
        case 3: // Подать заявку
          if (player.getClan() == null || player.getClan().getLevel() < 5) {
            player.sendPacket(SystemMessageId.THE_AIRSHIP_NEED_CLANLVL_5_TO_SUMMON);
            return null;
          }
          if (!player.isClanLeader()) {
            player.sendPacket(SystemMessageId.THE_AIRSHIP_NO_PRIVILEGES);
            return null;
          }
          ownerId = player.getClanId();
          if (AirShipManager.getInstance().hasAirShipLicense(ownerId)) {
            player.sendPacket(SystemMessageId.THE_AIRSHIP_SUMMON_LICENSE_ALREADY_ACQUIRED);
            return null;
          }
          if (!player.destroyItemByItemId(ProcessType.CONSUME, LICENSE, 1, npc, true)) {
            player.sendPacket(
                SystemMessage.getSystemMessage(SystemMessageId.THE_AIRSHIP_NEED_MORE_S1)
                    .addItemName(STARSTONE));
            return null;
          }

          AirShipManager.getInstance().registerLicense(ownerId);
          player.sendPacket(SystemMessageId.THE_AIRSHIP_SUMMON_LICENSE_ENTERED);
          break;
      }
    } else if (ask == -2011) {
      switch (reply) {
        case 1: // Отправиться в Семя Бессмертия
          player.teleToLocation(-212808, 209672, 4257);
          return null;
        case 2: // Отправиться в Семя Разрушения
          player.teleToLocation(-248536, 250280, 4311);
          return null;
        case 3: // Отправиться в Семя Уничтожения
          player.teleToLocation(-175512, 154488, 2689);
          return null;
        case 4:
          player.teleToLocation(-149406, 255247, -80);
          return null;
        case 5: // Отправиться в Семя Индустриализции
          if (player.getLevel() >= 95) {
            player.teleToLocation(-147348, 152615, -14048);
            return null;
          }
      }
    }
    return null;
  }
 @Override
 public boolean canBeStarted(L2PcInstance player) {
   QuestState pqs = player.getQuestState(_00187_NikolasHeart.class);
   return player.getLevel() >= 42 && pqs != null && pqs.isCompleted();
 }
 @Override
 public boolean canBeStarted(L2PcInstance player) {
   QuestState previous = player.getQuestState(_10317_OrbisWitch.class);
   return previous != null && previous.isCompleted() && player.getLevel() >= 95;
 }
 @Override
 public boolean canBeStarted(L2PcInstance player) {
   QuestState pst = player.getQuestState(_00115_TheOtherSideOfTruth.class);
   return !(player.getLevel() < 82 || pst == null || !pst.isCompleted());
 }
 /** @return the level. */
 public int getLevel() {
   if (_player != null) {
     return _player.getLevel();
   }
   return _level;
 }
  @Override
  public String onTalk(L2Npc npc, QuestState st) {
    L2PcInstance player = st.getPlayer();

    if (st.getState() == COMPLETED) {
      return getAlreadyCompletedMsg(player, QuestType.ONE_TIME);
    }

    int npcId = npc.getNpcId();
    if (st.getState() == CREATED) {
      if (npcId != Glyvka) {
        return getNoQuestMsg(player);
      }
      if (player.getLevel() < 35) {
        st.exitQuest(QuestType.REPEATABLE);
        return "glyvka_q0134_02.htm";
      }
      st.setCond(0);
      return "glyvka_q0134_01.htm";
    }

    int cond = st.getCond();

    if (npcId == Glyvka && st.getState() == STARTED) {
      if (cond == 1) {
        return "glyvka_q0134_03.htm";
      }
      if (cond == 5) {
        if (st.getInt("Report") == 1) {
          return "glyvka_q0134_09.htm";
        }
        if (st.getQuestItemsCount(Roukes_Report) > 0) {
          st.takeItems(Roukes_Report, -1);
          st.set("Report", "1");
          return "glyvka_q0134_08.htm";
        }
        return getNoQuestMsg(player);
      }
      return "glyvka_q0134_07.htm";
    }

    if (npcId == Rouke && st.getState() == STARTED) {
      if (cond == 2) {
        return "scroll_seller_rouke_q0134_02.htm";
      }
      if (cond == 5) {
        return "scroll_seller_rouke_q0134_10.htm";
      }
      if (cond == 3) {
        long Tools = st.getQuestItemsCount(Giants_Experimental_Tool_Fragment) / 10;
        if (Tools < 1) {
          return "scroll_seller_rouke_q0134_04.htm";
        }
        st.takeItems(Giants_Experimental_Tool_Fragment, Tools * 10);
        st.giveItems(Giants_Experimental_Tool, Tools);
        return "scroll_seller_rouke_q0134_05.htm";
      }
      if (cond == 4) {
        if (st.getInt("Report") == 1) {
          return "scroll_seller_rouke_q0134_07.htm";
        }
        if (st.getQuestItemsCount(Giants_Technology_Report) > 2) {
          st.takeItems(Giants_Experimental_Tool_Fragment, -1);
          st.takeItems(Giants_Experimental_Tool, -1);
          st.takeItems(Giants_Technology_Report, -1);
          st.set("Report", "1");
          return "scroll_seller_rouke_q0134_06.htm";
        }
        return getNoQuestMsg(player);
      }
    }
    return getNoQuestMsg(player);
  }
 @Override
 public boolean canBeStarted(L2PcInstance player) {
   return player.getLevel() >= 97;
 }