QuestState qs = player.getQuestState(questId);
if (qs != null)
{
// If the quest is alreday started, no need to show a window
if (!qs.getQuest().notifyTalk(this, qs))
return;
}
else
{
Quest q = QuestManager.getInstance().getQuest(questId);
if (q != null)
{
// check for start point
Quest[] qlst = getTemplate().getStartQuests();
if (qlst != null && qlst.length > 0)
{
for (int i=0; i < qlst.length; i++)
{
if (qlst[i] == q)
{
qs = q.newQuestState(player);
//disabled by mr. becouse quest dialog only show on second click.
//if(qs.getState().getName().equalsIgnoreCase("completed"))
//{
if (!qs.getQuest().notifyTalk(this, qs))
return; // no need to show a window
//}
break;
}
}
}
}
}
if (qs == null)
{
// no quests found
content = "<html><body>I have no tasks for you right now.</body></html>";
}