* @param event the event
* @return the quest state
*/
public QuestState processQuestEvent(String quest, String event)
{
QuestState retval = null;
if (event == null)
{
event = "";
}
if (!_quests.containsKey(quest))
{
return retval;
}
QuestState qs = getQuestState(quest);
if ((qs == null) && (event.length() == 0))
{
return retval;
}
if (qs == null)
{
Quest q = QuestManager.getInstance().getQuest(quest);
if (q == null)
{
return retval;
}
qs = q.newQuestState(this);
}
if (qs != null)
{
if (getLastQuestNpcObject() > 0)
{
L2Object object = L2World.getInstance().findObject(getLastQuestNpcObject());
if ((object instanceof L2NpcInstance) && isInsideRadius(object, L2NpcInstance.INTERACTION_DISTANCE, false, false))
{
L2NpcInstance npc = (L2NpcInstance) object;
QuestState[] states = getQuestsForTalk(npc.getNpcId());
if (states != null)
{
for (QuestState state : states)
{
if ((state.getQuest().getQuestIntId() == qs.getQuest().getQuestIntId()) && !qs.isCompleted())
{
if (qs.getQuest().notifyEvent(event, npc, this))
{
showQuestWindow(quest, qs.getStateId());
}
retval = qs;
}
}