@Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState st = getQuestState(player, true);
   String htmltext = null;
   if (st != null) {
     switch (st.getState()) {
       case State.CREATED:
         {
           htmltext =
               (player.getRace() == Race.ORC)
                   ? (player.getLevel() >= MIN_LVL)
                       ? (hasAtLeastOneQuestItem(player, NECKLACE_OF_VALOR, NECKLACE_OF_COURAGE))
                           ? "30577-07.htm"
                           : "30577-03.htm"
                       : "30577-02.htm"
                   : "30577-01.htm";
           break;
         }
       case State.STARTED:
         {
           switch (st.getCond()) {
             case 1:
               {
                 htmltext = "30577-05.html";
                 break;
               }
             case 2:
               {
                 if (st.getQuestItemsCount(KASHA_WOLF_FANG) >= 50) {
                   if (getRandom(100) <= 13) {
                     st.rewardItems(NECKLACE_OF_VALOR, 1);
                     st.rewardItems(HEALING_POTION, 10);
                   } else {
                     st.rewardItems(NECKLACE_OF_COURAGE, 1);
                   }
                   st.takeItems(KASHA_WOLF_FANG, -1);
                   st.exitQuest(true, true);
                   htmltext = "30577-06.html";
                 }
                 break;
               }
           }
           break;
         }
     }
   }
   return htmltext;
 }
  @Override
  public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) {
    if (player.getClan() == null) {
      return null;
    }

    QuestState st = null;
    if (player.isClanLeader()) {
      st = getQuestState(player, false);
    } else {
      L2PcInstance pleader = player.getClan().getLeader().getPlayerInstance();
      if ((pleader != null) && player.isInsideRadius(pleader, 1500, true, false)) {
        st = getQuestState(pleader, false);
      }
    }

    if ((st != null) && st.isStarted()) {
      st.rewardItems(TYRANNOSAURUS_CLAW, 1);
      st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
    }
    return null;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, false);
    if (st == null) {
      return null;
    }

    String htmltext = null;
    switch (event) {
      case "quest_accept":
        {
          if (player.getLevel() >= MIN_LEVEL) {
            st.startQuest();
            htmltext = "31537-02.html";
          } else {
            htmltext = "31537-03.html";
          }
          break;
        }
      case "31537-06.html":
        {
          if (st.isCond(2) && (getQuestItemsCount(player, PRIME_MEAT) >= PRIME_MEAT_COUNT)) {
            switch (getRandom(10)) {
              case 0:
                {
                  st.rewardItems(RECIPE[getRandom(RECIPE.length)], 1);
                  break;
                }
              case 1:
                {
                  st.rewardItems(PIECE[getRandom(PIECE.length)], 1);
                  break;
                }
              case 2:
                {
                  st.rewardItems(PIECE[getRandom(PIECE.length)], 2);
                  break;
                }
              case 3:
                {
                  st.rewardItems(PIECE[getRandom(PIECE.length)], 3);
                  break;
                }
              case 4:
                {
                  st.rewardItems(PIECE[getRandom(PIECE.length)], getRandom(5) + 2);
                  break;
                }
              case 5:
                {
                  st.rewardItems(PIECE[getRandom(PIECE.length)], getRandom(7) + 2);
                  break;
                }
              case 6:
                {
                  st.rewardItems(GOLDEN_SPICE_CRATE, 1);
                  break;
                }
              case 7:
                {
                  st.rewardItems(GOLDEN_SPICE_CRATE, 2);
                  break;
                }
              case 8:
                {
                  st.rewardItems(CRYSTAL_SPICE_COMPRESSED_PACK, 1);
                  break;
                }
              case 9:
                {
                  st.rewardItems(CRYSTAL_SPICE_COMPRESSED_PACK, 2);
                  break;
                }
            }
            st.exitQuest(true, true);
            htmltext = event;
          }
          break;
        }
    }
    return htmltext;
  }