package custom.Nottingale;

import l2.universe.gameserver.model.actor.L2Npc;
import l2.universe.gameserver.model.actor.instance.L2PcInstance;
import l2.universe.gameserver.model.quest.Quest;
import l2.universe.gameserver.model.quest.QuestState;
import l2.universe.gameserver.network.serverpackets.RadarControl;

/**
 * 
 * @author ButterCup, Synerge
 */
public class Nottingale extends Quest
{
    private static String qn = "Nottingale";
    
    private static final int NOTTINGALE = 32627;
    
    public Nottingale(int id, String name, String descr)
	{
		super(id, name, descr);
		
        addStartNpc(NOTTINGALE);
        addFirstTalkId(NOTTINGALE);
        addTalkId(NOTTINGALE);
	}

    @Override
	public String onAdvEvent (String event, L2Npc npc, L2PcInstance player)
    {        
        final QuestState qs = player.getQuestState("10273_GoodDayToFly");
        if (qs == null || !qs.isCompleted())
        {
           player.sendPacket(new RadarControl(2, 2, 0, 0, 0));
           player.sendPacket(new RadarControl(0, 2, -184545, 243120, 1581));
           return "32627.htm";
        }
        
        if (event.equals("32627-3.htm"))
        {
           player.sendPacket(new RadarControl(2, 2, 0, 0, 0));
           player.sendPacket(new RadarControl(0, 2, -192361, 254528, 3598));
        }
        else if (event.equals("32627-4.htm"))
        {
           player.sendPacket(new RadarControl(2, 2, 0, 0, 0));
           player.sendPacket(new RadarControl(0, 2, -174600, 219711, 4424));
        }
        else if (event.equals("32627-5.htm"))
        {
           player.sendPacket(new RadarControl(2, 2, 0, 0, 0));
           player.sendPacket(new RadarControl(0, 2, -181989, 208968, 4424));
        }
        else if (event.equals("32627-6.htm"))
        {
           player.sendPacket(new RadarControl(2, 2, 0, 0, 0));
           player.sendPacket(new RadarControl(0, 2, -252898, 235845, 5343));
        }
        else if (event.equals("32627-8.htm"))
        {
           player.sendPacket(new RadarControl(2, 2, 0, 0, 0));
           player.sendPacket(new RadarControl(0, 2, -212819, 209813, 4288));
        }
        else if (event.equals("32627-9.htm"))
        {
           player.sendPacket(new RadarControl(2, 2, 0, 0, 0));
           player.sendPacket(new RadarControl(0, 2, -246899, 251918, 4352));
        }
        return event;
    }

    @Override
	public String onFirstTalk (L2Npc npc, L2PcInstance player)
    {
        QuestState st = player.getQuestState(qn);
        if (st == null)
            st = newQuestState(player);
        
        player.setLastQuestNpcObject(npc.getObjectId());
        npc.showChatWindow(player);
        return super.onFirstTalk(npc,player);
    }

    public static void main(String[] args)
	{
		new Nottingale(-1, qn, "custom");
	}
}
