@Override
public String onFirstTalk(NpcInstance npc, Player player)
{
String htmltext = "";
QuestState qs = player.getQuestState(_255_Tutorial.class);
if (qs == null)
{
return htmltext;
}
QuestState st = player.getQuestState(getClass());
if (st == null)
{
newQuestState(player, CREATED);
st = player.getQuestState(getClass());
}
int Ex = qs.getInt("Ex");
int npcId = npc.getNpcId();
int step = st.getInt("step");
int onlyone = st.getInt("onlyone");
int level = player.getLevel();
boolean isMage = (player.getRace() != Race.orc) && player.getClassId().isMage();
Talk t = talks.get(npcId);
if (t == null)
{
return "";
}
if (((level >= 10) || (onlyone == 1)) && (t.npcTyp == 1))
{
htmltext = "30575-05.htm";
}
else if ((onlyone == 0) && (level < 10))
{
if (player.getRace().ordinal() == t.raceId)
{
htmltext = t.htmlfiles[0];
}
if (t.npcTyp == 1)
{
if ((step == 0) && (Ex < 0))
{
qs.set("Ex", "0");
st.startQuestTimer("TimerEx_NewbieHelper", 30000);
if (isMage)
{
st.set("step", "1");
st.setState(STARTED);
}
else
{
htmltext = "30530-01.htm";
st.set("step", "1");
st.setState(STARTED);
}
}
else if ((step == 1) && (st.getQuestItemsCount(t.item) == 0) && (Ex <= 2))
{
if (st.getQuestItemsCount(BLUE_GEM) > 0)
{
st.takeItems(BLUE_GEM, st.getQuestItemsCount(BLUE_GEM));
st.giveItems(t.item, 1);
st.set("step", "2");
qs.set("Ex", "3");
st.startQuestTimer("TimerEx_NewbieHelper", 30000);
qs.set("ucMemo", "3");
if (isMage)
{
st.playTutorialVoice("tutorial_voice_027");
st.giveItems(SPIRITSHOT_NOVICE, 100);
htmltext = t.htmlfiles[2];
if (htmltext.isEmpty())
{
htmltext = "<html><body>" + (npc.getTitle().isEmpty() ? "" : npc.getTitle() + " ") + npc.getName() + "<br>I am sorry. I only help warriors. Please go to another Newbie Helper who may assist you.</body></html>";
}
}
else
{
st.playTutorialVoice("tutorial_voice_026");
st.giveItems(SOULSHOT_NOVICE, 200);
htmltext = t.htmlfiles[1];
if (htmltext.isEmpty())
{
htmltext = "<html><body>" + (npc.getTitle().isEmpty() ? "" : npc.getTitle() + " ") + npc.getName() + "<br>I am sorry. I only help mystics. Please go to another Newbie Helper who may assist you.</body></html>";
}