I tried to rewrite Quest 551_OlympiadStarter from l2rebellion to L2jserver.
I need help from users because i have some misunderstanding.
The Problem is that i cant remake st.setState(2); st.setState(3); st.setState(1);
Sorry Maby its wrong dissision.
L2Rebellion Quest Script
package l2r.scripts.quests;
import l2r.extensions.scripts.ScriptFile;
import l2r.gameserver.model.L2Player;
import l2r.gameserver.model.L2SubClass;
import l2r.gameserver.model.entity.olympiad.Olympiad;
import l2r.gameserver.model.instances.L2NpcInstance;
import l2r.gameserver.model.quest.Quest;
import l2r.gameserver.model.quest.QuestState;
public class _551_OlympiadStarter extends Quest
implements ScriptFile
{
private static final int _npc = 31688;
private static final int _olymp3 = 17238;
private static final int _olymp5 = 17239;
private static final int _olymp10 = 17240;
private static final int _olympChest = 17169;
public _551_OlympiadStarter()
{
super(false);
addStartNpc(31688);
addTalkId(new int[] { 31688 });
addQuestItem(new int[] { 17169 });
addQuestItem(new int[] { 17240 });
addQuestItem(new int[] { 17239 });
addQuestItem(new int[] { 17238 });
}
public String onEvent(String paramString, QuestState paramQuestState, L2NpcInstance paramL2NpcInstance)
{
L2Player localL2Player = paramQuestState.getPlayer();
int i = paramQuestState.getCond();
String str = paramString;
if (paramQuestState == null)
return str;
if (paramL2NpcInstance.getNpcId() == 31688)
{
if (i == 1)
if (paramString.equals("31688-03.htm"))
{
paramQuestState.setState(2);
paramQuestState.setCond(Olympiad.getCompetitionDone(localL2Player.getObjectId()));
paramQuestState.setCond(1);
paramQuestState.playSound(SOUND_ACCEPT);
}
else if (paramString.equals("exchange"))
{
if ((paramQuestState.getQuestItemsCount(17238) >= 1L) || (paramQuestState.getQuestItemsCount(17239) >= 1L) || (paramQuestState.getQuestItemsCount(17240) >= 1L))
{
if ((i == 2) && (paramQuestState.getQuestItemsCount(17238) >= 1L))
{
paramQuestState.giveItems(17169, 1L);
paramQuestState.takeItems(17238, 1L);
paramQuestState.playSound(SOUND_ITEMGET);
}
if ((i == 3) && (paramQuestState.getQuestItemsCount(17239) >= 1L))
{
paramQuestState.giveItems(17169, 2L);
paramQuestState.takeItems(17239, 1L);
paramQuestState.playSound(SOUND_ITEMGET);
}
if ((i == 4) && (paramQuestState.getQuestItemsCount(17240) >= 1L))
{
paramQuestState.giveItems(17169, 4L);
paramQuestState.takeItems(17240, 1L);
paramQuestState.playSound(SOUND_ITEMGET);
paramQuestState.setState(3);
paramQuestState.playSound(SOUND_FINISH);
paramQuestState.exitCurrentQuest(false);
}
return "31688-06.htm";
}
return "31688-07.htm";
}
return "31688-05.htm";
}
return str;
}
public String onTalk(L2NpcInstance paramL2NpcInstance, QuestState paramQuestState)
{
L2Player localL2Player = paramQuestState.getPlayer();
String str = "noquest";
if (paramQuestState == null)
return str;
if (Olympiad._inCompPeriod)
{
if ((localL2Player.getLevel() >= 75) && (localL2Player.getActiveClass().isBase()) && (localL2Player.isNoble()))
{
if (paramQuestState.getState() == 3)
return "31688-01.htm";
return "31688-00.htm";
}
return "31688-02.htm";
}
return "31688-08.htm";
}
}
L2jServer Quest Script
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.base.SubClass;
import com.l2jserver.gameserver.model.olympiad.Olympiad;
import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
public class Q551_OlympiadStarter extends Quest
{
private static final String qn = "Q551_OlympiadStarter";
//Npc
private static final int OlyManager = 31688;
//Items
private static final int _olymp3 = 17238;
private static final int _olymp5 = 17239;
private static final int _olymp10 = 17240;
private static final int _olympChest = 17169;
public String onEvent(String event, QuestState st, L2PcInstance player, L2NpcInstance npc)
{
String htmltext = event;
if (st == null)
htmltext = getNoQuestMsg(player);
if (npc.getNpcId() == 31688)
{
if (event.equals("31688-03.htm"))
{
st.setState(2);
st.set("cond","Olympiad.getCompetitionDone(Player.getObjectId())");
st.set("cond", "1");
st.playSound("ItemSound.quest_accept");
}
else if (event.equals("exchange"))
{
if ((st.getQuestItemsCount(17238) >= 1L) || (st.getQuestItemsCount(17239) >= 1L) || (st.getQuestItemsCount(17240) >= 1L))
{
if ((i == 2) && (st.getQuestItemsCount(17238) >= 1L))
{
st.giveItems(17169, 1L);
st.takeItems(17238, 1L);
st.playSound("ItemSound.quest_itemget");
}
if ((i == 3) && (st.getQuestItemsCount(17239) >= 1L))
{
st.giveItems(17169, 2L);
st.takeItems(17239, 1L);
st.playSound("ItemSound.quest_itemget");
}
if ((i == 4) && (st.getQuestItemsCount(17240) >= 1L))
{
st.giveItems(17169, 4L);
st.takeItems(17240, 1L);
st.playSound("ItemSound.quest_itemget");
st.setState(3);
st.playSound("ItemSound.quest_finish");
st.exitQuest(false);
}
return "31688-06.htm";
}
return "31688-07.htm";
}
return "31688-05.htm";
}
return htmltext;
}
public String onTalk(L2NpcInstance npc, L2PcInstance player)
{
String htmltext = getNoQuestMsg(player);
QuestState st = player.getQuestState(qn);
if (st == null)
return htmltext;
if (Olympiad._inCompPeriod)
{
if ((player.getLevel() >= 75) && (player.isNoble()))
{
if (st.getInt("cond") == 3)
htmltext ="31688-01.htm";
else
htmltext ="31688-00.htm";
}
else
htmltext ="31688-02.htm";
}
else
htmltext ="31688-08.htm";
return htmltext;
}
public Q551_OlympiadStarter(int questId, String name, String descr)
{
super(questId, name, descr);
addStartNpc(OlyManager);
addTalkId(OlyManager);
questItemIds = new int[] {_olymp3};
questItemIds = new int[] {_olymp5};
questItemIds = new int[] {_olymp10};
questItemIds = new int[] {_olympChest};
}
public static void main(String[] args)
{
new Q551_OlympiadStarter(551, qn, "Olympiad Starter");
}
}
Html Files
31688-01.htm
____________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Данное задание выполняется раз в сутки, по таймеру. Каждое утро в 6:30 таймер сбрасывается<br>
<br>
</body>
</html>
____________
31688-02.htm
___________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Я немогу позволить тебе выполнить это задание!<br>
(Этот квест могут выполнять только персонажи выше 75 уровня основным классом)<br>
<br>
</body>
</html>
___________
31688-03.htm
___________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Всё что тебе надо сделать - провести на олимпиаде 10 матчей. Мы не смотрим на исход, мы смотрим на твою смелость! Почему бы не подраться за хорошую награду?!<br>
Награда:<br>
Olympiad Match 3 Participation Certificate - за 3 проведенных матча.</br>
Olympiad Match 5 Participation Certificate - за 5 проведенных матчей.</br>
Olympiad Match 10 Participation Certificate- за 10 проведенных матчей.<br>
<a action="bypass -h Quest _551_OlympiadStarter 31688-05.htm">Я согласен.</a><br>
<br>
</body>
</html>
____________
31688-05.htm
____________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Ты готов доказать свою смелость?<br>
<a action="bypass -h Quest _551_OlympiadStarter exchange">Да</a><br>
<br>
</body>
</html>
____________
31688-06.htm
____________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Ты отлично справился, вот твоя награда!<br>
<br>
</body>
</html>
___________
31688-07.htm
___________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Тебе не обмануть меня!<br>
(У вас недостаточно квестовых предметов)
<br>
</body>
</html>
___________
31688-08.htm
___________
<html>
<body>
<font color="FFCC00">Менеджер великой олимпиады:</font><br>
Олимпиада ещё не началась!<br>
<br>
</body>
</html>
Question
janiko
Hi EveryOne.
I tried to rewrite Quest 551_OlympiadStarter from l2rebellion to L2jserver.
I need help from users because i have some misunderstanding.
The Problem is that i cant remake st.setState(2); st.setState(3); st.setState(1);
Sorry Maby its wrong dissision.
L2Rebellion Quest Script
package l2r.scripts.quests; import l2r.extensions.scripts.ScriptFile; import l2r.gameserver.model.L2Player; import l2r.gameserver.model.L2SubClass; import l2r.gameserver.model.entity.olympiad.Olympiad; import l2r.gameserver.model.instances.L2NpcInstance; import l2r.gameserver.model.quest.Quest; import l2r.gameserver.model.quest.QuestState; public class _551_OlympiadStarter extends Quest implements ScriptFile { private static final int _npc = 31688; private static final int _olymp3 = 17238; private static final int _olymp5 = 17239; private static final int _olymp10 = 17240; private static final int _olympChest = 17169; public _551_OlympiadStarter() { super(false); addStartNpc(31688); addTalkId(new int[] { 31688 }); addQuestItem(new int[] { 17169 }); addQuestItem(new int[] { 17240 }); addQuestItem(new int[] { 17239 }); addQuestItem(new int[] { 17238 }); } public String onEvent(String paramString, QuestState paramQuestState, L2NpcInstance paramL2NpcInstance) { L2Player localL2Player = paramQuestState.getPlayer(); int i = paramQuestState.getCond(); String str = paramString; if (paramQuestState == null) return str; if (paramL2NpcInstance.getNpcId() == 31688) { if (i == 1) if (paramString.equals("31688-03.htm")) { paramQuestState.setState(2); paramQuestState.setCond(Olympiad.getCompetitionDone(localL2Player.getObjectId())); paramQuestState.setCond(1); paramQuestState.playSound(SOUND_ACCEPT); } else if (paramString.equals("exchange")) { if ((paramQuestState.getQuestItemsCount(17238) >= 1L) || (paramQuestState.getQuestItemsCount(17239) >= 1L) || (paramQuestState.getQuestItemsCount(17240) >= 1L)) { if ((i == 2) && (paramQuestState.getQuestItemsCount(17238) >= 1L)) { paramQuestState.giveItems(17169, 1L); paramQuestState.takeItems(17238, 1L); paramQuestState.playSound(SOUND_ITEMGET); } if ((i == 3) && (paramQuestState.getQuestItemsCount(17239) >= 1L)) { paramQuestState.giveItems(17169, 2L); paramQuestState.takeItems(17239, 1L); paramQuestState.playSound(SOUND_ITEMGET); } if ((i == 4) && (paramQuestState.getQuestItemsCount(17240) >= 1L)) { paramQuestState.giveItems(17169, 4L); paramQuestState.takeItems(17240, 1L); paramQuestState.playSound(SOUND_ITEMGET); paramQuestState.setState(3); paramQuestState.playSound(SOUND_FINISH); paramQuestState.exitCurrentQuest(false); } return "31688-06.htm"; } return "31688-07.htm"; } return "31688-05.htm"; } return str; } public String onTalk(L2NpcInstance paramL2NpcInstance, QuestState paramQuestState) { L2Player localL2Player = paramQuestState.getPlayer(); String str = "noquest"; if (paramQuestState == null) return str; if (Olympiad._inCompPeriod) { if ((localL2Player.getLevel() >= 75) && (localL2Player.getActiveClass().isBase()) && (localL2Player.isNoble())) { if (paramQuestState.getState() == 3) return "31688-01.htm"; return "31688-00.htm"; } return "31688-02.htm"; } return "31688-08.htm"; } }L2jServer Quest Script
import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.base.SubClass; import com.l2jserver.gameserver.model.olympiad.Olympiad; import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.quest.QuestState; public class Q551_OlympiadStarter extends Quest { private static final String qn = "Q551_OlympiadStarter"; //Npc private static final int OlyManager = 31688; //Items private static final int _olymp3 = 17238; private static final int _olymp5 = 17239; private static final int _olymp10 = 17240; private static final int _olympChest = 17169; public String onEvent(String event, QuestState st, L2PcInstance player, L2NpcInstance npc) { String htmltext = event; if (st == null) htmltext = getNoQuestMsg(player); if (npc.getNpcId() == 31688) { if (event.equals("31688-03.htm")) { st.setState(2); st.set("cond","Olympiad.getCompetitionDone(Player.getObjectId())"); st.set("cond", "1"); st.playSound("ItemSound.quest_accept"); } else if (event.equals("exchange")) { if ((st.getQuestItemsCount(17238) >= 1L) || (st.getQuestItemsCount(17239) >= 1L) || (st.getQuestItemsCount(17240) >= 1L)) { if ((i == 2) && (st.getQuestItemsCount(17238) >= 1L)) { st.giveItems(17169, 1L); st.takeItems(17238, 1L); st.playSound("ItemSound.quest_itemget"); } if ((i == 3) && (st.getQuestItemsCount(17239) >= 1L)) { st.giveItems(17169, 2L); st.takeItems(17239, 1L); st.playSound("ItemSound.quest_itemget"); } if ((i == 4) && (st.getQuestItemsCount(17240) >= 1L)) { st.giveItems(17169, 4L); st.takeItems(17240, 1L); st.playSound("ItemSound.quest_itemget"); st.setState(3); st.playSound("ItemSound.quest_finish"); st.exitQuest(false); } return "31688-06.htm"; } return "31688-07.htm"; } return "31688-05.htm"; } return htmltext; } public String onTalk(L2NpcInstance npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); QuestState st = player.getQuestState(qn); if (st == null) return htmltext; if (Olympiad._inCompPeriod) { if ((player.getLevel() >= 75) && (player.isNoble())) { if (st.getInt("cond") == 3) htmltext ="31688-01.htm"; else htmltext ="31688-00.htm"; } else htmltext ="31688-02.htm"; } else htmltext ="31688-08.htm"; return htmltext; } public Q551_OlympiadStarter(int questId, String name, String descr) { super(questId, name, descr); addStartNpc(OlyManager); addTalkId(OlyManager); questItemIds = new int[] {_olymp3}; questItemIds = new int[] {_olymp5}; questItemIds = new int[] {_olymp10}; questItemIds = new int[] {_olympChest}; } public static void main(String[] args) { new Q551_OlympiadStarter(551, qn, "Olympiad Starter"); } }Html Files
1 answer to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now