- Хроники
- Prelude
- Исходники
- Присутствуют
- Сборка
- L2jMobius
Код:
/*
package quests.Q10127_LeanHowtoFight;
import org.l2jmobius.gameserver.data.xml.TeleportListData;
import org.l2jmobius.gameserver.enums.ClassId;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.quest.QuestDialogType;
import org.l2jmobius.gameserver.model.quest.QuestState;
import org.l2jmobius.gameserver.model.quest.newquestdata.NewQuestLocation;
import org.l2jmobius.gameserver.model.quest.newquestdata.QuestCondType;
import org.l2jmobius.gameserver.network.serverpackets.quest.ExQuestDialog;
import org.l2jmobius.gameserver.network.serverpackets.quest.ExQuestNotification;
import quests.Q10128_ExperiencethePowerofSoulshots.Q10128_ExperiencethePowerofSoulshots;
import quests.Q10129_ExpeiencethePowerofBlessedSpiritshots.Q10129_ExpeiencethePowerofBlessedSpiritshots;
/**
* @author Magik
*/
public class Q10127_LeanHowtoFight extends Quest
{
private static final int QUEST_ID = 10127;
private static final int[] MONSTERS =
{
22324 // Training dummy
};
public Q10127_LeanHowtoFight()
{
super(QUEST_ID);
addKillId(MONSTERS);
}
@Override
public String onAdvEvent(String event, Npc npc, Player player)
{
switch (event)
{
case "ACCEPT":
{
if (!canStartQuest(player))
{
break;
}
final QuestState questState = getQuestState(player, true);
if (!questState.isStarted() && !questState.isCompleted())
{
questState.startQuest();
}
break;
}
case "TELEPORT":
{
final QuestState questState = getQuestState(player, false);
if (questState == null)
{
break;
}
final NewQuestLocation questLocation = getQuestData().getLocation();
if (questState.isCond(QuestCondType.STARTED))
{
if (questLocation.getStartLocationId() > 0)
{
final Location location = TeleportListData.getInstance().getTeleport(questLocation.getStartLocationId()).getLocation();
teleportToQuestLocation(player, location);
}
}
else if (questState.isCond(QuestCondType.DONE) && !questState.isCompleted())
{
if (questLocation.getEndLocationId() > 0)
{
final Location location = TeleportListData.getInstance().getTeleport(questLocation.getEndLocationId()).getLocation();
teleportToQuestLocation(player, location);
}
}
break;
}
case "COMPLETE":
{
final QuestState questState = getQuestState(player, false);
if (questState == null)
{
break;
}
if (questState.isCond(QuestCondType.DONE) && !questState.isCompleted())
{
questState.exitQuest(false, true);
if ((player.getClassId().getId() >= ClassId.SACRED_TEMPLAR_00.getId()) && (player.getClassId().getId() < ClassId.HIGH_ELF_SPIRIT_00.getId()))
{
final QuestState nextQuestState = player.getQuestState(Q10128_ExperiencethePowerofSoulshots.class.getSimpleName());
if (nextQuestState == null)
{
player.sendPacket(new ExQuestDialog(10128, QuestDialogType.ACCEPT));
}
}
else
{
final QuestState nextQuestState = player.getQuestState(Q10129_ExpeiencethePowerofBlessedSpiritshots.class.getSimpleName());
if (nextQuestState == null)
{
player.sendPacket(new ExQuestDialog(10129, QuestDialogType.ACCEPT));
}
}
}
break;
}
}
return null;
}
@Override
public String onFirstTalk(Npc npc, Player player)
{
final QuestState questState = getQuestState(player, false);
if ((questState != null) && !questState.isCompleted())
{
if (questState.isCond(QuestCondType.STARTED))
{
if (questState.isStarted())
{
questState.setCount(getQuestData().getGoal().getCount());
questState.setCond(QuestCondType.DONE);
player.sendPacket(new ExQuestDialog(questState.getQuest().getId(), QuestDialogType.END));
}
}
else if (questState.isCond(QuestCondType.DONE))
{
player.sendPacket(new ExQuestDialog(questState.getQuest().getId(), QuestDialogType.END));
}
}
npc.showChatWindow(player);
return null;
}
@Override
public String onKill(Npc npc, Player killer, boolean isSummon)
{
final QuestState questState = getQuestState(killer, false);
if ((questState != null) && questState.isCond(QuestCondType.STARTED))
{
questState.setCount(getQuestData().getGoal().getCount());
questState.setCond(QuestCondType.DONE);
killer.sendPacket(new ExQuestNotification(questState));
}
return super.onKill(npc, killer, isSummon);
}
}
Can anyone help me?
The code has to read the quest and identify when 1 class goes to a quest, and when another class goes to another quest...
But this is not happening, can anyone help me find out what the error is?