package quests.Q00001_Quest;
import gameserver.model.actor.instance.L2PcInstance;
import gameserver.util.Util;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jserver.gameserver.model.AggroInfo;
import com.l2jserver.gameserver.model.actor.L2Attackable;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.holders.ItemHolder;
import com.l2jserver.gameserver.model.quest.Quest;
/**
* @author LifeGame32
*/
public class Q00001_Quest extends Quest
{
private static final int RANGE = 2000;
private static final List<ItemHolder> REWARD_KILLER = new ArrayList<>();
{
REWARD_KILLER.add(new ItemHolder(57, 500));// 57 adena
}
private static final List<ItemHolder> REWARD_OTHER = new ArrayList<>();
{
REWARD_OTHER.add(new ItemHolder(57, 200));// 57 adena
}
public Q00001_Quest()
{
super(1, Q00001_Quest.class.getSimpleName(), "Q00001_Quest");
addKillId(20093); // npc
}
@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
Map<L2Character, AggroInfo> dmList = new ConcurrentHashMap<>(((L2Attackable) npc).getAggroList());
dmList.remove(killer);
// reward killer
for (ItemHolder item : REWARD_KILLER)
{
giveItems(killer, item);
}
// reward other
for (AggroInfo info : dmList.values())
{
if (info.getAttacker().isPlayer())
{
if ((info.getDamage() > 1) && Util.checkIfInRange(RANGE, npc, info.getAttacker(), true))
{
for (ItemHolder item : REWARD_OTHER)
{
giveItems(info.getAttacker().getActingPlayer(), item);
}
}
}
}
return super.onKill(npc, killer, isSummon);
}
}