Арендую данную тему.
Работаю над Ertheia на основе l2-s, пишу заного большую часть квестов.
Буду выкладывать тут по очереди написания, если вам нужен какой либо квест пишите, перепишу раньше...
Работаю над Ertheia на основе l2-s, пишу заного большую часть квестов.
Буду выкладывать тут по очереди написания, если вам нужен какой либо квест пишите, перепишу раньше...
Код:
package quests;
import l2s.gameserver.instancemanager.QuestManager;
import l2s.gameserver.listener.actor.player.OnLevelChangeListener;
import l2s.gameserver.listener.actor.player.OnPlayerEnterListener;
import l2s.gameserver.model.Player;
import l2s.gameserver.model.actor.listener.CharListenerList;
import l2s.gameserver.model.base.Race;
import l2s.gameserver.model.instances.NpcInstance;
import l2s.gameserver.model.quest.Quest;
import l2s.gameserver.model.quest.QuestState;
import l2s.gameserver.network.l2.s2c.ExShowScreenMessage;
import l2s.gameserver.network.l2.s2c.TutorialCloseHtmlPacket;
import l2s.gameserver.scripts.ScriptFile;
/**
*
* @Rebuild Wolfer
*/
public class _10397_Kekropus_Letter_A_Suspicious_Badge extends Quest implements ScriptFile, OnPlayerEnterListener, OnLevelChangeListener
{
private static final int MIN_LEVEL = 52;
private static final int MAX_LEVEL = 57;
// Quest's NPCs
private static final int MOUEN = 30196;
private static final int ANDY = 33845;
// Quest's Items
private static final int SOE_OREN = 37114;
private static final int SOE_SEA_OF_SPORE = 37027;
// Quest's Reward
private static final int EXP = 635250;
private static final int SP = 152;
private static final int EWB = 947;
private static final int EWB_COUNT = 2;
private static final int STEEL_DOOR_GUILD_COIN = 37045;
private static final int STEEL_DOOR_GUILD_COIN_COUNT = 20;
private static final int QUEST_START_DELAY = 10000;
private static final String LETTER_ALERT_STRING = "Kekropus have a message for you.\nClick on the icon to see the Question-Mark.";
private static final String NEXT_LETTER_ALERT_STRING = "Be trained to become stronger until you get the next letter at level 52";
/**
*
*/
public _10397_Kekropus_Letter_A_Suspicious_Badge()
{
super(false);
this.addLevelCheck(MIN_LEVEL, MAX_LEVEL);
this.addRaceCheck(true,true,true,true,true,true,false);
CharListenerList.addGlobal(this);
this.addTalkId(MOUEN);
this.addTalkId(ANDY);
this.addQuestItem(SOE_OREN,SOE_SEA_OF_SPORE);
}
private void receivedLetter(final QuestState qs)
{
if(qs != null)
{
Player player = qs.getPlayer();
qs.showQuestionMark(_questId);
qs.playSound(SOUND_TUTORIAL);
if (player != null)
{
player.sendPacket(new ExShowScreenMessage(LETTER_ALERT_STRING, 10000, ExShowScreenMessage.ScreenMessageAlign.TOP_CENTER, true));
}
}
}
/**
*
* @param player
* @return
*/
@Override
public boolean checkStartCondition(final Player player)
{
boolean result = true;
if(player.getLevel() < MIN_LEVEL || player.getLevel() > MAX_LEVEL)
{
result = false;
}
if(player.getRace() == Race.ERTHEIA)
{
result = false;
}
QuestState state = player.getQuestState(this.getClass().getSimpleName());
if((state != null && state.getCond() > 0))
{
result = false;
}
return result;
}
/**
*
* @param event
* @param qs
* @param npc
* @return
*/
@Override
public String onEvent(final String event, final QuestState qs, final NpcInstance npc)
{
String htmlText = event;
if(event != null && qs != null)
{
Player player = qs.getPlayer();
if(player != null)
{
if(event.startsWith("QM"))
{
try
{
int id = Integer.valueOf(event.substring(2));
if(id == _questId)
{
if(player.getRace() != Race.ERTHEIA)
{
qs.giveItems(SOE_OREN,1);
qs.showQuestHTML(qs.getQuest(),"00.htm");
qs.setState(STARTED);
qs.setCond(1);
qs.playSound(SOUND_ACCEPT);
}
}
}
catch (Throwable t)
{
}
htmlText = null;
}
else if(event.startsWith("TE"))
{
htmlText = null;
}
else if(event.equalsIgnoreCase("Quest _10397_Kekropus_Letter_A_Suspicious_Badge to_oren"))
{
player.teleToLocation(80920, 56392, -1585);
player.sendPacket(TutorialCloseHtmlPacket.STATIC);
htmlText = null;
}
else if(event.equalsIgnoreCase("Quest _10397_Kekropus_Letter_A_Suspicious_Badge close_window"))
{
player.sendPacket(TutorialCloseHtmlPacket.STATIC);
htmlText = null;
}
else if(event.equalsIgnoreCase("start_quest_delay"))
{
qs.startQuestTimer("start_quest_timeout", QUEST_START_DELAY);
htmlText = null;
}
else if(event.equalsIgnoreCase("start_quest") || event.equalsIgnoreCase("start_quest_timeout"))
{
this.receivedLetter(qs);
htmlText = null;
}
else if(event.equalsIgnoreCase("accept_task"))
{
qs.setCond(2);
qs.playSound(SOUND_MIDDLE);
qs.giveItems(SOE_SEA_OF_SPORE,1);
htmlText = "03.htm";
}
else if(event.equalsIgnoreCase("get_reward"))
{
qs.setState(COMPLETED);
qs.exitCurrentQuest(false);
qs.playSound(SOUND_FINISH);
qs.takeAllItems(SOE_OREN, SOE_SEA_OF_SPORE);
qs.addExpAndSp(EXP,SP);
qs.giveItems(EWB,EWB_COUNT);
qs.giveItems(STEEL_DOOR_GUILD_COIN,STEEL_DOOR_GUILD_COIN_COUNT);
htmlText = "05.htm";
player.sendPacket(new ExShowScreenMessage(NEXT_LETTER_ALERT_STRING, 10000, ExShowScreenMessage.ScreenMessageAlign.TOP_CENTER, true));
}
}
}
return htmlText;
}
/**
*
* @param npc
* @param qs
* @return
*/
@Override
public String onTalk(final NpcInstance npc, final QuestState qs)
{
String htmlText = NO_QUEST_DIALOG;
if(npc != null && qs != null)
{
int npcId = npc.getNpcId();
int cond = qs.getCond();
Player player = qs.getPlayer();
if(player != null)
{
if(npcId == MOUEN)
{
if(cond == 1)
{
htmlText = "01.htm";
}
}
else if(npcId == ANDY)
{
if(cond == 2)
{
htmlText = "04.htm";
}
}
}
}
return htmlText;
}
/**
*
*/
@Override
public void onLoad()
{
}
/**
*
*/
@Override
public void onReload()
{
}
/**
*
*/
@Override
public void onShutdown()
{
}
/**
*
* @param player
* @param oldLvl
* @param newLvl
*/
@Override
public void onLevelChange(final Player player, final int oldLvl, final int newLvl)
{
if(player != null && checkStartCondition(player))
{
Quest quest = QuestManager.getQuest(this.getClass());
player.processQuestEvent(quest.getName(),"start_quest",null);
}
}
/**
*
* @param player
*/
@Override
public void onPlayerEnter(final Player player)
{
if (player != null && this.checkStartCondition(player))
{
Quest quest = QuestManager.getQuest(this.getClass());
player.processQuestEvent(quest.getName(),"start_quest_delay",null);
}
}
}
Чуть позже приложу htm
Код:
package quests;
import l2s.gameserver.model.Player;
import l2s.gameserver.model.instances.NpcInstance;
import l2s.gameserver.model.quest.Quest;
import l2s.gameserver.model.quest.QuestState;
import l2s.gameserver.scripts.ScriptFile;
/**
*
* @author Wolfer
*/
public class _10709_StolenSeed extends Quest implements ScriptFile
{
private static final int MIN_LEVEL = 58;
private static final int MAX_LEVEL = 61;
// Quest's NPCs
private static final int NOVAIN = 33866;
private static final int MAGIC_CIRCLE_CONTROL_DEVICE = 33961;
// Quest's Monster
private static final int CURSED_GIANT_AKUM = 27520;
// Quest's Items
private static final int AKUM_MEMORY_FRAGMENT = 39510;
private static final int NORMAL_FRAGMENT = 39511;
// Quest's Reward
private static final int EXP = 731010;
private static final int SP = 175;
private static final int EAB = 948;
private static final int EAB_COUNT = 5;
private static final int STEEL_DOOR_GUILD_COIN = 37045;
private static final int STEEL_DOOR_GUILD_COIN_COUNT = 30;
public _10709_StolenSeed()
{
super(false);
this.addLevelCheck(MIN_LEVEL, MAX_LEVEL);
this.addRaceCheck(true, true, true, true, true, true, false);
this.addStartNpc(NOVAIN);
this.addTalkId(MAGIC_CIRCLE_CONTROL_DEVICE);
this.addQuestItem(AKUM_MEMORY_FRAGMENT, NORMAL_FRAGMENT);
this.addKillId(CURSED_GIANT_AKUM);
}
/**
*
* @param event
* @param qs
* @param npc
* @return
*/
@Override
public String onEvent(final String event, final QuestState qs, final NpcInstance npc)
{
String htmlText = event;
if(event != null && qs != null)
{
if(event.equalsIgnoreCase("quest_accept"))
{
qs.setState(STARTED);
qs.setCond(1);
qs.playSound(SOUND_ACCEPT);
htmlText = "03.htm";
}
else if(event.equalsIgnoreCase("try_fragment"))
{
qs.setCond(2);
qs.playSound(SOUND_MIDDLE);
htmlText = null;
qs.addSpawn(CURSED_GIANT_AKUM);
}
else if(event.equalsIgnoreCase("get_reward"))
{
qs.addExpAndSp(EXP,SP);
qs.takeAllItems(AKUM_MEMORY_FRAGMENT,NORMAL_FRAGMENT);
qs.giveItems(EAB,EAB_COUNT);
qs.giveItems(STEEL_DOOR_GUILD_COIN,STEEL_DOOR_GUILD_COIN_COUNT);
qs.setState(COMPLETED);
qs.exitCurrentQuest(false);
qs.playSound(SOUND_FINISH);
htmlText = "06.htm";
}
}
return htmlText;
}
/**
*
* @param npc
* @param qs
* @return
*/
@Override
public String onTalk(final NpcInstance npc, final QuestState qs)
{
String htmlText = NO_QUEST_DIALOG;
if(npc != null && qs != null)
{
int npcId = npc.getNpcId();
int cond = qs.getCond();
Player player = qs.getPlayer();
if (player != null)
{
if(qs.isCompleted())
{
htmlText = "completed-quest.htm";
}
else
{
if(npcId == NOVAIN)
{
if(cond == 0)
{
htmlText = "00.htm";
}
else if(cond == 3)
{
htmlText = "05.htm";
}
}
else if(npcId == MAGIC_CIRCLE_CONTROL_DEVICE)
{
htmlText = "04.htm";
}
}
}
}
return htmlText;
}
/**
*
* @param npc
* @param qs
* @return
*/
@Override
public String onKill(final NpcInstance npc, final QuestState qs)
{
if(npc != null && qs != null)
{
int cond = qs.getCond();
if(cond == 2)
{
qs.giveItems(NORMAL_FRAGMENT,1);
qs.playSound(SOUND_MIDDLE);
qs.setCond(3);
}
}
return null;
}
}
Вложения
Последнее редактирование: