@Override
  public String onTalk(NpcInstance npc, QuestState st) {
    String htmltext = "noquest";
    int npcId = npc.getNpcId();
    int cond = st.getCond();

    if (npcId == Dilios) {
      if (cond == 0) {
        if (st.getPlayer().getLevel() >= 75) {
          htmltext = "dilios_q692_1.htm";
        } else {
          htmltext = "dilios_q692_0.htm";
          st.exitCurrentQuest(true);
        }
      }
    } else if (npcId == Kutran) {
      if (cond == 2) {
        htmltext = "kutran_q692_1.htm";
      } else if (cond == 3) {
        htmltext = "kutran_q692_3.htm";
      }
    } else if (npcId == Lekon) {
      if (cond == 1) {
        htmltext = "lekon_q692_1.htm";
      }
    }
    return htmltext;
  }
 @Override
 public String onKill(NpcInstance npc, QuestState st) {
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   if (cond == 3) {
     if (ArrayUtils.contains(SOD, npcId)) {
       st.rollAndGive(
           FleetSteedTroupsTotem,
           (int) Config.RATE_QUESTS_REWARD * 1,
           17); // Шанс на глаз и с потолка. Умножается на рейт квестов и делится на кол-во членов
       // группы. Для нас это (nRate*3)/9
     } else if (ArrayUtils.contains(SOI, npcId)) {
       st.rollAndGive(
           NucleusofanIncompleteSoul,
           (int) Config.RATE_QUESTS_REWARD * 1,
           17); // Шанс на глаз и с потолка. Умножается на рейт квестов и делится на кол-во членов
       // группы. Для нас это (nRate*3)/9
     } else if (ArrayUtils.contains(SOA, npcId)) {
       st.rollAndGive(
           SpiritStoneDust,
           (int) Config.RATE_QUESTS_REWARD * 1,
           20); // Шанс на глаз и с потолка. Умножается на рейт квестов и делится на кол-во членов
       // группы. Для нас это (nRate*3)/9
     }
   }
   return null;
 }
  @Override
  public String onTalk(NpcInstance npc, QuestState st) {
    String htmltext = "noquest";
    int cond = st.getCond();
    if (npc.getNpcId() == Roderik) {
      switch (st.getState()) {
        case CREATED:
          if (st.getPlayer().getLevel() >= 95) {
            if (st.isNowAvailableByTime()) {
              htmltext = "30631.htm";
            } else {
              htmltext = "30631-0.htm";
            }
          } else {
            htmltext = "lvl.htm";
            st.exitCurrentQuest(true);
          }
          break;
        case STARTED:
          if (cond == 1) {
            htmltext = "30631-3.htm";
          } else if (cond == 2) {
            htmltext = "30631-4.htm";
          }
          break;
      }
    }

    return htmltext;
  }
 @Override
 public String onKill(NpcInstance npc, QuestState st) {
   Player player = st.getPlayer();
   int npcId = npc.getNpcId();
   int refId = player.getReflectionId();
   if (npcId == KAMS && st.getQuestItemsCount(KDROP) == 0) {
     st.giveItems(KDROP, 1);
   } else if (npcId == ALKASO && st.getQuestItemsCount(ADROP) == 0) {
     st.giveItems(ADROP, 1);
   } else if (npcId == LEMATAN) {
     st.setCond(4);
     st.playSound(SOUND_MIDDLE);
     addSpawnToInstance(DADVENTURER2, new Location(84990, -208376, -3342, 55000), 0, refId);
   } else if (ArrayUtils.contains(Pailaka2nd, npcId)) {
     if (Rnd.get(100) < 80) {
       st.dropItem(npc, HERBS[Rnd.get(HERBS.length)], Rnd.get(1, 2));
     }
   } else if (npcId == CHEST) {
     if (Rnd.get(100) < 80) {
       st.dropItem(npc, CHESTDROP[Rnd.get(CHESTDROP.length)], Rnd.get(1, 10));
     }
   }
   // TODO вернуть когда будут работать двери
   // else
   //	dropItem(npc, KEY, 1);
   return null;
 }
  @Override
  protected void onEvtAttacked(Creature attacker, int damage) {
    NpcInstance actor = getActor();
    if (attacker == null) {
      return;
    }

    Player player = attacker.getPlayer();
    if (player != null) {
      List<QuestState> quests =
          player.getQuestsForEvent(actor, QuestEventType.ATTACKED_WITH_QUEST, false);
      if (quests != null) {
        for (QuestState qs : quests) {
          qs.getQuest().notifyAttack(actor, qs);
        }
      }
    }

    onEvtAggression(attacker, damage);
  }
 @Override
 public String onEvent(String event, QuestState st, NpcInstance npc) {
   String htmltext = event;
   if (event.equalsIgnoreCase("seer_moirase_q0113_0104.htm")) {
     st.setCond(1);
     st.giveItems(BOX, 1);
     st.setState(STARTED);
     st.playSound(SOUND_ACCEPT);
   } else if (event.equalsIgnoreCase("torant_q0113_0201.htm")) {
     st.giveItems(ADENA_ID, 154800);
     st.addExpAndSp(619300, 44200);
     st.takeItems(BOX, 1);
     st.playSound(SOUND_FINISH);
     st.exitCurrentQuest(false);
   }
   return htmltext;
 }
 @Override
 public String onEvent(String event, QuestState st, NpcInstance npc) {
   String htmltext = event;
   if (event.equalsIgnoreCase("30631-3.htm")) {
     st.setState(STARTED);
     st.setCond(1);
     st.playSound(SOUND_ACCEPT);
   } else if (event.equalsIgnoreCase("30631-5.htm")) {
     st.getPlayer().addExpAndSp(600000000, 0);
     st.takeItems(Deadmans_Flesh, 40);
     st.unset(SCALDISECT_KILL);
     st.setState(COMPLETED);
     st.playSound(SOUND_FINISH);
     st.exitCurrentQuest(this);
   }
   return htmltext;
 }
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   String htmltext = "noquest";
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   int id = st.getState();
   Player player = st.getPlayer();
   if (npcId == CROOP) {
     if (id == CREATED && player.getLevel() >= 79) {
       htmltext = "30676-01.htm";
     } else if (cond == 1) {
       htmltext = "30676-04.htm";
     } else if (cond == 2) {
       htmltext = "30676-05.htm";
       st.setCond(3);
       st.playSound(SOUND_MIDDLE);
       st.giveItems(CROOP_INTRO, 1);
     } else if (cond >= 3 && cond <= 5) {
       htmltext = "30676-06.htm";
     } else if (cond == 6) {
       htmltext = "30676-07.htm";
     } else if (id == COMPLETED) {
       htmltext = "30676-13.htm";
     } else if (player.getLevel() < 79) {
       htmltext = "30676-00.htm";
       st.exitCurrentQuest(true);
     }
   } else if (npcId == HECTOR) {
     if (cond == 3) {
       htmltext = "30197-01.htm";
     }
     if (cond >= 4 && cond <= 7) {
       htmltext = "30197-04.htm";
     }
   } else if (npcId == STAN) {
     if (cond == 4) {
       htmltext = "30200-01.htm";
     }
     if (cond >= 5 && cond <= 7) {
       htmltext = "30200-05.htm";
     }
   } else if (npcId == CORPSE) {
     if (cond == 5) {
       htmltext = "32568-01.htm";
     }
   } else if (npcId == HOLLINT) {
     if (cond == 7) {
       htmltext = "30191-01.htm";
     }
   }
   return htmltext;
 }
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   String htmltext = "noquest";
   int npcId = npc.getNpcId();
   int id = st.getState();
   int cond = st.getCond();
   if (id == COMPLETED) {
     htmltext = "completed";
   } else if (npcId == MOIRA) {
     if (id == CREATED) {
       if (st.getPlayer().getLevel() >= 40) {
         htmltext = "seer_moirase_q0113_0101.htm";
       } else {
         htmltext = "seer_moirase_q0113_0103.htm";
         st.exitCurrentQuest(true);
       }
     } else if (cond == 1) {
       htmltext = "seer_moirase_q0113_0105.htm";
     }
   } else if (npcId == TORRANT && st.getQuestItemsCount(BOX) == 1) {
     htmltext = "torant_q0113_0101.htm";
   }
   return htmltext;
 }
 @Override
 public String onEvent(String event, QuestState st, NpcInstance npc) {
   Player player = st.getPlayer();
   String htmltext = event;
   if (event.equalsIgnoreCase("Enter")) {
     enterInstance(player);
     return null;
   } else if (event.equalsIgnoreCase("32498-02.htm")) {
     st.setCond(1);
     st.setState(STARTED);
     st.playSound(SOUND_ACCEPT);
   } else if (event.equalsIgnoreCase("32498-05.htm")) {
     st.setCond(2);
     st.playSound(SOUND_ACCEPT);
   } else if (event.equalsIgnoreCase("32501-03.htm")) {
     st.setCond(3);
     st.playSound(SOUND_MIDDLE);
     st.giveItems(SWORD, 1);
   }
   return htmltext;
 }
 @Override
 public String onEvent(String event, QuestState st, NpcInstance npc) {
   String htmltext = event;
   int cond = st.getCond();
   if (event.equalsIgnoreCase("take_test") && cond == 0) {
     QuestState GoodDayToFly = st.getPlayer().getQuestState(_10273_GoodDayToFly.class);
     if (GoodDayToFly != null && GoodDayToFly.isCompleted()) {
       st.setCond(2);
       st.setState(STARTED);
       st.playSound(SOUND_ACCEPT);
       htmltext = "dilios_q692_4.htm";
     } else {
       st.setCond(1);
       st.setState(STARTED);
       st.playSound(SOUND_ACCEPT);
       htmltext = "dilios_q692_3.htm";
     }
   } else if (event.equalsIgnoreCase("lekon_q692_2.htm") && cond == 1) {
     st.exitCurrentQuest(true);
   } else if (event.equalsIgnoreCase("kutran_q692_2.htm") && cond == 2) {
     st.setCond(3);
     st.playSound(SOUND_MIDDLE);
   } else if (event.equalsIgnoreCase("exchange_sod") && cond == 3) {
     if (st.getQuestItemsCount(FleetSteedTroupsTotem) < 5) {
       htmltext = "kutran_q692_7.htm";
     } else {
       int _charmstogive = Math.round(st.getQuestItemsCount(FleetSteedTroupsTotem) / 5);
       st.takeItems(FleetSteedTroupsTotem, 5 * _charmstogive);
       st.giveItems(FleetSteedTroupsCharm, _charmstogive);
       htmltext = "kutran_q692_4.htm";
     }
   } else if (event.equalsIgnoreCase("exchange_soi") && cond == 3) {
     if (st.getQuestItemsCount(NucleusofanIncompleteSoul) < 5) {
       htmltext = "kutran_q692_7.htm";
     } else {
       int _soulstogive = Math.round(st.getQuestItemsCount(NucleusofanIncompleteSoul) / 5);
       st.takeItems(NucleusofanIncompleteSoul, 5 * _soulstogive);
       st.giveItems(NucleusofaFreedSoul, _soulstogive);
       htmltext = "kutran_q692_5.htm";
     }
   } else if (event.equalsIgnoreCase("exchange_soa") && cond == 3) {
     if (st.getQuestItemsCount(SpiritStoneDust) < 5) {
       htmltext = "kutran_q692_7.htm";
     } else {
       int _soulstogive = Math.round(st.getQuestItemsCount(SpiritStoneDust) / 5);
       st.takeItems(SpiritStoneDust, 5 * _soulstogive);
       st.giveItems(SpiritStoneFragment, _soulstogive);
       htmltext = "kutran_q692_5.htm";
     }
   } else if (event.equalsIgnoreCase("exchange_breath") && cond == 3) {
     if (st.getQuestItemsCount(BreathofTiat) == 0) {
       htmltext = "kutran_q692_7.htm";
     } else {
       st.giveItems(ADENA_ID, st.getQuestItemsCount(BreathofTiat) * 2500);
       st.takeItems(BreathofTiat, -1);
       htmltext = "kutran_q692_5.htm";
     }
   } else if (event.equalsIgnoreCase("exchange_portion") && cond == 3) {
     if (st.getQuestItemsCount(PortionofaSoul) == 0) {
       htmltext = "kutran_q692_7.htm";
     } else {
       st.giveItems(ADENA_ID, st.getQuestItemsCount(PortionofaSoul) * 2500);
       st.takeItems(PortionofaSoul, -1);
       htmltext = "kutran_q692_5.htm";
     }
   } else if (event.equalsIgnoreCase("exchange_energy") && cond == 3) {
     if (st.getQuestItemsCount(ConcentratedSpiritEnergy) == 0) {
       htmltext = "kutran_q692_7.htm";
     } else {
       st.giveItems(ADENA_ID, st.getQuestItemsCount(ConcentratedSpiritEnergy) * 25000);
       st.takeItems(ConcentratedSpiritEnergy, -1);
       htmltext = "kutran_q692_5.htm";
     }
   }
   return htmltext;
 }
 @Override
 public String onEvent(String event, QuestState st, NpcInstance npc) {
   Player player = st.getPlayer();
   String htmltext = event;
   if (event.equalsIgnoreCase("30676-03.htm")) {
     st.setCond(1);
     st.setState(STARTED);
     st.playSound(SOUND_ACCEPT);
   } else if (event.equalsIgnoreCase("8")) {
     st.setCond(2);
     st.playSound(SOUND_MIDDLE);
     player.showQuestMovie(ExStartScenePlayer.SCENE_SSQ_SUSPICIOUS_DEATH);
     return "";
   } else if (event.equalsIgnoreCase("30197-03.htm")) {
     st.setCond(4);
     st.takeItems(CROOP_INTRO, 1);
     st.playSound(SOUND_MIDDLE);
   } else if (event.equalsIgnoreCase("30200-04.htm")) {
     st.setCond(5);
     st.playSound(SOUND_MIDDLE);
   } else if (event.equalsIgnoreCase("32568-02.htm")) {
     st.setCond(6);
     st.giveItems(JACOB_NECK, 1);
     st.playSound(SOUND_MIDDLE);
   } else if (event.equalsIgnoreCase("30676-12.htm")) {
     st.setCond(7);
     st.takeItems(JACOB_NECK, 1);
     st.giveItems(CROOP_LETTER, 1);
     st.playSound(SOUND_MIDDLE);
   } else if (event.equalsIgnoreCase("30191-03.htm")) {
     if (player.getLevel() < 79) {
       htmltext =
           "<html><body>Only characters who are <font color=\"LEVEL\">level 79</font> or higher may complete this quest.</body></html>";
     } else if (player.getBaseClassId() == player.getActiveClassId()) {
       st.addExpAndSp(10000000, 2500000);
       st.setState(COMPLETED);
       st.exitCurrentQuest(false);
       st.playSound(SOUND_FINISH);
     } else {
       return "subclass_forbidden.htm";
     }
   }
   return htmltext;
 }
 @Override
 public String onEvent(String event, QuestState st, NpcInstance npc) {
   String htmltext = event;
   if (event.equalsIgnoreCase("30956_2.htm")) {
     st.setCond(1);
     st.setState(STARTED);
     st.playSound(SOUND_ACCEPT);
     st.takeItems(EVENT_CLOTHES, -1);
     st.takeItems(NANARINS_FLUTE, -1);
     st.takeItems(SABRINS_BLACK_BEER, -1);
   } else if (event.equalsIgnoreCase("30956_4.htm")) {
     st.giveItems(NANARINS_FLUTE, 1);
     st.playSound(SOUND_MIDDLE);
     st.setCond(3);
   } else if (event.equalsIgnoreCase("answer1")) {
     st.giveItems(EVENT_CLOTHES, 1);
     st.playSound(SOUND_MIDDLE);
     st.setCond(3);
     htmltext = "30956_6.htm";
   } else if (event.equalsIgnoreCase("answer2")) {
     st.giveItems(SABRINS_BLACK_BEER, 1);
     st.playSound(SOUND_MIDDLE);
     st.setCond(3);
     htmltext = "30956_6.htm";
   } else if (event.equalsIgnoreCase("30956_7.htm")) {
     st.giveItems(Musical_Score, 1);
     st.playSound(SOUND_FINISH);
     st.exitCurrentQuest(true);
   }
   return htmltext;
 }
 @Override
 public String onKill(NpcInstance npc, QuestState st) {
   int cond = st.getCond();
   boolean doneKill = updateKill(npc, st);
   if (cond == 1) {
     if (ArrayUtils.contains(Mobs, npc.getNpcId())) {
       Party party = st.getPlayer().getParty();
       if (party != null) {
         for (Player member : party.getPartyMembers()) {
           QuestState qs = member.getQuestState(getClass());
           if (qs != null && qs.isStarted()) {
             if (st.getQuestItemsCount(Deadmans_Flesh) < 40) {
               qs.giveItems(Deadmans_Flesh, 1);
               qs.playSound(SOUND_ITEMGET);
               if (doneKill && st.getQuestItemsCount(Deadmans_Flesh) == 40) {
                 st.setCond(2);
               }
             }
           }
         }
       } else {
         if (st.getQuestItemsCount(Deadmans_Flesh) < 50) {
           st.giveItems(Deadmans_Flesh, 1);
           st.playSound(SOUND_ITEMGET);
           if (doneKill && st.getQuestItemsCount(Deadmans_Flesh) == 40) {
             st.setCond(2);
           }
         }
       }
     }
     if (npc.getNpcId() == Scaldisect) {
       Party party = st.getPlayer().getParty();
       if (party != null) {
         for (Player member : party.getPartyMembers()) {
           QuestState qs = member.getQuestState(getClass());
           if (qs != null && qs.isStarted()) {
             updateKill(npc, st);
             if (st.getQuestItemsCount(Deadmans_Flesh) == 40) {
               st.setCond(2);
             }
           }
         }
       } else {
         updateKill(npc, st);
         if (st.getQuestItemsCount(Deadmans_Flesh) == 40) {
           st.setCond(2);
         }
       }
     }
   }
   return null;
 }
  @Override
  public String onTalk(NpcInstance npc, QuestState st) {
    int npcId = npc.getNpcId();
    Player player = st.getPlayer();
    String back = player.getVar("FestivalBackCoords");
    if (back == null) {
      back = "1";
    }

    // Dawn Locations

    String htmltext = "Started.htm";
    if (npcId == GLUDIN_DAWN) {
      player.teleToLocation(-80157, 111344, -4901);
      player.setVar("id", "1", -1);
      return htmltext;
    }

    if (npcId == GLUDIO_DAWN) {
      player.teleToLocation(-80157, 111344, -4901);
      player.setVar("id", "2", -1);
      return htmltext;
    }

    if (npcId == DION_DAWN) {
      player.teleToLocation(-80157, 111344, -4901);
      player.setVar("id", "3", -1);
      return htmltext;
    }

    if (npcId == GIRAN_DAWN) {
      player.teleToLocation(-80157, 111344, -4901);
      player.setVar("id", "4", -1);
      return htmltext;
    }

    if (npcId == OREN_DAWN) {
      player.teleToLocation(-80157, 111344, -4901);
      player.setVar("id", "5", -1);
      return htmltext;
    }

    if (npcId == ADEN_DAWN) {
      player.teleToLocation(-80157, 111344, -4901);
      player.setVar("id", "6", -1);
      return htmltext;
    }

    if (npcId == HEINE_DAWN) {
      player.teleToLocation(-80157, 111344, -4901);
      player.setVar("id", "7", -1);
      return htmltext;
    }

    if (npcId == GODDARD_DAWN) {
      player.teleToLocation(-80157, 111344, -4901);
      player.setVar("id", "8", -1);
      return htmltext;
    }

    if (npcId == RUNE_DAWN) {
      player.teleToLocation(-80157, 111344, -4901);
      player.setVar("id", "9", -1);
      return htmltext;
    }

    if (npcId == SCHUTTGART_DAWN) {
      player.teleToLocation(-80157, 111344, -4901);
      player.setVar("id", "10", -1);
      return htmltext;
    }

    if (npcId == HV_DAWN) {
      player.teleToLocation(-80157, 111344, -4901);
      player.setVar("id", "11", -1);
      return htmltext;
    }

    // Dusk Locations //

    if (npcId == GLUDIN_DUSK) {
      player.teleToLocation(-81261, 86531, -5157);
      player.setVar("id", "1", -1);
      return htmltext;
    }

    if (npcId == GLUDIO_DUSK) {
      player.teleToLocation(-81261, 86531, -5157);
      player.setVar("id", "2", -1);
      return htmltext;
    }

    if (npcId == DION_DUSK) {
      player.teleToLocation(-81261, 86531, -5157);
      player.setVar("id", "3", -1);
      return htmltext;
    }

    if (npcId == GIRAN_DUSK) {
      player.teleToLocation(-81261, 86531, -5157);
      player.setVar("id", "4", -1);
      return htmltext;
    }

    if (npcId == OREN_DUSK) {
      player.teleToLocation(-81261, 86531, -5157);
      player.setVar("id", "5", -1);
      return htmltext;
    }

    if (npcId == ADEN_DUSK) {
      player.teleToLocation(-81261, 86531, -5157);
      player.setVar("id", "6", -1);
      return htmltext;
    }

    if (npcId == HEINE_DUSK) {
      player.teleToLocation(-81261, 86531, -5157);
      player.setVar("id", "7", -1);
      return htmltext;
    }

    if (npcId == GODDARD_DUSK) {
      player.teleToLocation(-81261, 86531, -5157);
      player.setVar("id", "8", -1);
      return htmltext;
    }

    if (npcId == RUNE_DUSK) {
      player.teleToLocation(-81261, 86531, -5157);
      player.setVar("id", "9", -1);
      return htmltext;
    }

    if (npcId == SCHUTTGART_DUSK) {
      player.teleToLocation(-81261, 86531, -5157);
      player.setVar("id", "10", -1);
      return htmltext;
    }

    if (npcId == HV_DUSK) {
      player.teleToLocation(-81261, 86531, -5157);
      player.setVar("id", "11", -1);
      return htmltext;
    }

    // Oracle of Dusk/Dawn //

    htmltext = "Completed.htm";
    // back to Gludin Village
    if (back.equals("1")) {
      player.teleToLocation(-80826, 149775, -3043);
      return htmltext;
    }

    // back to Gludio Castle Town
    if (back.equals("2")) {
      player.teleToLocation(-12672, 122776, -3116);
      return htmltext;
    }

    // back to Dion Castle Town
    if (back.equals("3")) {
      player.teleToLocation(15670, 142983, -2705);
      return htmltext;
    }

    // back to Giran Castle Town
    if (back.equals("4")) {
      player.teleToLocation(83400, 147943, -3404);
      return htmltext;
    }

    // back to Town of Oren
    if (back.equals("5")) {
      player.teleToLocation(82956, 53162, -1495);
      return htmltext;
    }

    // back to Town of Aden
    if (back.equals("6")) {
      player.teleToLocation(146331, 25762, -2018);
      return htmltext;
    }

    // back to Heine
    if (back.equals("7")) {
      player.teleToLocation(111409, 219364, -3545);
      return htmltext;
    }

    // back to Goddard
    if (back.equals("8")) {
      player.teleToLocation(147928, -55273, -2734);
      return htmltext;
    }

    // back to Rune
    if (back.equals("9")) {
      player.teleToLocation(43799, -47727, -798);
      return htmltext;
    }

    // back to Schuttgart
    if (back.equals("10")) {
      player.teleToLocation(87386, -143246, -1293);
      return htmltext;
    }

    // back to Hunters Village
    if (back.equals("11")) {
      player.teleToLocation(116819, 76994, -2714);
      return htmltext;
    }
    return htmltext;
  }
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   String htmltext = "noquest";
   int npcId = npc.getNpcId();
   int cond = st.getCond();
   int id = st.getState();
   Player player = st.getPlayer();
   if (npcId == DISURVIVOR) {
     if (cond == 0) {
       if (player.getLevel() < 61 || player.getLevel() > 67) {
         htmltext = "32498-no.htm";
         st.exitCurrentQuest(true);
       } else {
         return "32498-01.htm";
       }
     } else if (id == COMPLETED) {
       htmltext = "32498-no.htm";
     } else if (cond == 1 || cond == 2) {
       htmltext = "32498-06.htm";
     } else {
       htmltext = "32498-07.htm";
     }
   } else if (npcId == SUPPORTER) {
     if (cond == 1 || cond == 2) {
       htmltext = "32501-01.htm";
     } else {
       htmltext = "32501-04.htm";
     }
   } else if (npcId == DADVENTURER) {
     if (st.getQuestItemsCount(SWORD) > 0 && st.getQuestItemsCount(KDROP) == 0) {
       htmltext = "32508-01.htm";
     }
     if (st.getQuestItemsCount(ENCHSWORD) > 0 && st.getQuestItemsCount(ADROP) == 0) {
       htmltext = "32508-01.htm";
     }
     if (st.getQuestItemsCount(SWORD) == 0 && st.getQuestItemsCount(KDROP) > 0) {
       htmltext = "32508-05.htm";
     }
     if (st.getQuestItemsCount(ENCHSWORD) == 0 && st.getQuestItemsCount(ADROP) > 0) {
       htmltext = "32508-05.htm";
     }
     if (st.getQuestItemsCount(SWORD) == 0 && st.getQuestItemsCount(ENCHSWORD) == 0) {
       htmltext = "32508-05.htm";
     }
     if (st.getQuestItemsCount(KDROP) == 0 && st.getQuestItemsCount(ADROP) == 0) {
       htmltext = "32508-01.htm";
     }
     if (player.getPets() != null) {
       htmltext = "32508-04.htm";
     }
     if (st.getQuestItemsCount(SWORD) > 0 && st.getQuestItemsCount(KDROP) > 0) {
       st.takeItems(SWORD, 1);
       st.takeItems(KDROP, 1);
       st.giveItems(ENCHSWORD, 1);
       htmltext = "32508-02.htm";
     }
     if (st.getQuestItemsCount(ENCHSWORD) > 0 && st.getQuestItemsCount(ADROP) > 0) {
       st.takeItems(ENCHSWORD, 1);
       st.takeItems(ADROP, 1);
       st.giveItems(LASTSWORD, 1);
       htmltext = "32508-03.htm";
     }
     if (st.getQuestItemsCount(LASTSWORD) > 0) {
       htmltext = "32508-03.htm";
     }
   } else if (npcId == DADVENTURER2) {
     if (cond == 4) {
       // if(player.getPets() != null)
       // htmltext = "32511-03.htm";
       // if(player.getPets() == null)
       // {
       st.giveItems(ScrollOfEscape, 1);
       st.giveItems(PBRACELET, 1);
       st.giveItems(57, 411500);
       st.addExpAndSp(4010000, 1235000);
       st.setCond(5);
       st.setState(COMPLETED);
       st.playSound(SOUND_FINISH);
       st.exitCurrentQuest(false);
       player.getReflection().startCollapseTimer(60000);
       htmltext = "32511-01.htm";
       // }
     } else if (id == COMPLETED) {
       htmltext = "32511-02.htm";
     }
   }
   return htmltext;
 }
 @Override
 public String onTalk(NpcInstance npc, QuestState st) {
   int npcId = npc.getNpcId();
   String htmltext = "noquest";
   int cond = st.getCond();
   if (npcId == NANARIN) {
     if (cond == 0) {
       if (st.getPlayer().getLevel() < 15) {
         htmltext = "30956-00.htm";
         st.exitCurrentQuest(true);
       } else {
         htmltext = "30956_1.htm";
       }
     } else if (cond == 1) {
       htmltext = "30956_8.htm";
     } else if (cond == 2) {
       htmltext = "30956_3.htm";
     } else if (cond == 3) {
       htmltext = "30956_6.htm";
     } else if (cond == 4) {
       htmltext = "30956_5.htm";
     }
   } else if (npcId == BARBADO) {
     if (cond == 3) {
       if (st.getQuestItemsCount(EVENT_CLOTHES) > 0) {
         st.takeItems(EVENT_CLOTHES, -1);
         htmltext = "30959_2.htm";
         st.exitCurrentQuest(true);
       } else if (st.getQuestItemsCount(SABRINS_BLACK_BEER) > 0) {
         st.takeItems(SABRINS_BLACK_BEER, -1);
         htmltext = "30959_2.htm";
         st.exitCurrentQuest(true);
       } else {
         st.takeItems(NANARINS_FLUTE, -1);
         st.setCond(4);
         st.playSound(SOUND_MIDDLE);
         htmltext = "30959_1.htm";
       }
     } else if (cond == 4) {
       htmltext = "30959_3.htm";
     }
   } else if (npcId == HOLVAS && (cond == 1 || cond == 2)) {
     st.setCond(2);
     if (Rnd.chance(60)) {
       htmltext = "30058_2.htm";
     } else {
       htmltext = "30058_1.htm";
     }
   } else if (npcId == POITAN && (cond == 1 || cond == 2)) {
     st.setCond(2);
     if (Rnd.chance(60)) {
       htmltext = "30458_2.htm";
     } else {
       htmltext = "30458_1.htm";
     }
   }
   return htmltext;
 }