/*
 * This file is part of the L2J Mobius project.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package ai.areas.GainakUnderground.Lezonne;

import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.skill.SkillCaster;

import ai.AbstractNpcAI;

/**
 * @author Notorion
 */
public class Lezonne extends AbstractNpcAI
{
	// NPC
	private static final int LEZONNE = 33834;
	// Items
	private static final int ADENA = 57;
	// Skills
	private static final SkillHolder[] DONATE_BUFFS =
	{
		new SkillHolder(11517, 1), // Horn Melody
		new SkillHolder(11518, 1), // Drum Melody
		new SkillHolder(11519, 1), // Pipe Organ Melody
		new SkillHolder(11520, 1), // Guitar Melody
		new SkillHolder(30812, 1), // Fantasia Harmony
	};
	
	private Lezonne()
	{
		addStartNpc(LEZONNE);
		addTalkId(LEZONNE);
		addFirstTalkId(LEZONNE);
	}
	
	@Override
	public String onEvent(String event, Npc npc, Player player)
	{
		String htmltext = null;
		switch (event)
		{
			case "index":
			{
				htmltext = npc.getId() + ".html";
				break;
			}
			
			case "donate_adena":
			{
				if (getQuestItemsCount(player, ADENA) >= 200000)
				{
					takeItems(player, ADENA, 200000);
					for (SkillHolder holder : DONATE_BUFFS)
					{
						SkillCaster.triggerCast(npc, player, holder.getSkill());
					}
				}
				else
				{
					htmltext = "noItems.html";
				}
				break;
			}
			
		}
		return htmltext;
	}
	
	public static void main(String[] args)
	{
		new Lezonne();
	}
}
