Свернуть ↑
*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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.
*
* L2J DataPack 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 autoQuest;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcIns tance;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.model.quest.QuestState;
public class KillMobsCount extends Quest
{
private final static int MIN_LEVEL = 32;
private final static int MOBS = 20432;
private final static int MOBS_COUNT = 20;
private final static int REWARD_ITEM_ID = 57;
private final static int REWARD_COUNT = 500000;
final private static String qn = "KillMobsCounts";
public KillMobsCount(int questId, String name, String descr)
{
super(questId, name, descr);
addKillId(MOBS);
}
@Override
public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
{
if (player.getLevel() >= MIN_LEVEL)
{
QuestState st = player.getQuestState(qn);
if (st == null)
{
st = newQuestState(player);
}
int stat = st.getInt("KM");
if (stat == 0)
{
st.playSound("ItemSound.quest_accept");
player.sendMessage("You got the quest. Kill " + MOBS_COUNT + " " + npc.getName() + ".");
st.set("KM", "1");
}
else if (stat == 1)
{
int mc = st.getInt("MC");
if (mc >= MOBS_COUNT)
{
st.playSound("ItemSound.quest_finish");
st.giveItems(REWARD_ITEM_ID, REWARD_COUNT);
st.set("KM", "2");
st.unset("MC");
}
else
{
st.playSound("ItemSound.quest_itemget");
mc++;
player.sendMessage("You killed: " + npc.getName() + " " + mc + " time(s) of " + MOBS_COUNT + ".");
st.set("MC", Integer.toString(mc));
if (mc == MOBS_COUNT)
{
st.getQuest().notifyKill(npc, player, isSummon);
}
}
}
}
return super.onKill(npc, player, isSummon);
}
public static void main(String[] args)
{
_log.info("Loaded Kill Mobs Count.");
new KillMobsCount(-1,qn,"KillMobsCount");
}
}