Приветствую, проблемка:
насобирал по форуму лыжы квесты на фрею и столкнулся с проблемой, при обращение к JINIA не чего не происходит в логе :
[Character: ххххх[хххххххх] - Account: ххххх - IP: ххххххх] sent not handled RequestBypassToServer: [talk_select]
сам скрипт грузится без ошибок...
ну и сам скрипт:
в дефаулт хтмлке
<html><head><body>
Jinia:<br>I'm busy. Not now.<br>
<a action="bypass -h npc_%objectId%_Quest">Quest</a>
</body></html>
может у кого есть какие идеи что такое...
сборка разумеется лыжа
насобирал по форуму лыжы квесты на фрею и столкнулся с проблемой, при обращение к JINIA не чего не происходит в логе :
[Character: ххххх[хххххххх] - Account: ххххх - IP: ххххххх] sent not handled RequestBypassToServer: [talk_select]
сам скрипт грузится без ошибок...
ну и сам скрипт:
скрипт
package instances.Freya.JiniasHideout;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.instancemanager.InstanceManager.InstanceWorld;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.quest.State;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.clientpackets.Say2;
import com.l2jserver.gameserver.network.serverpackets.NpcSay;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
public class JiniasHideout extends Quest
{
private class JiniasWorld extends InstanceWorld
{
public long[] storeTime = {0,0};
public int questId;
public JiniasWorld()
{
}
}
private static final String qn = "JiniasHideout";
private static final int RAFFORTY = 32020;
private static final int JINIA = 32760;
private static final int SIRRA = 32762;
private static final int[] ENTRY_POINT = { -23530, -8963, -5413 };
private class teleCoord {int instanceId; int x; int y; int z;}
private void teleportplayer(L2PcInstance player, teleCoord teleto)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
player.setInstanceId(teleto.instanceId);
player.teleToLocation(teleto.x, teleto.y, teleto.z);
return;
}
private boolean checkConditions(L2PcInstance player)
{
if (player.getLevel() < 82 || player.getLevel() > 85)
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT);
sm.addPcName(player);
player.sendPacket(sm);
return false;
}
return true;
}
protected void exitInstance(L2PcInstance player, teleCoord tele)
{
player.setInstanceId(0);
player.teleToLocation(tele.x, tele.y, tele.z);
}
protected int enterInstance(L2PcInstance player, String template, teleCoord teleto, int questId)
{
int instanceId = 0;
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
//existing instance
if (world != null)
{
//this instance
if (!(world instanceof JiniasWorld))
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER));
return 0;
}
teleto.instanceId = world.instanceId;
teleportplayer(player,teleto);
return instanceId;
}
else
{
//New instance
if (!checkConditions(player))
return 0;
instanceId = InstanceManager.getInstance().createDynamicInstance(template);
final Instance inst = InstanceManager.getInstance().getInstance(instanceId);
inst.setSpawnLoc(new int[] { player.getX(), player.getY(), player.getZ() });
world = new JiniasWorld();
world.instanceId = instanceId;
((JiniasWorld)world).questId = questId;
//Template id depends of quest
switch(questId)
{
case 10284:
world.templateId = 140;
break;
case 10285:
world.templateId = 141;
break;
case 10286:
world.templateId = 145;
break;
case 10287:
world.templateId = 146;
break;
}
world.status = 0;
((JiniasWorld)world).storeTime[0] = System.currentTimeMillis();
InstanceManager.getInstance().addWorld(world);
_log.info("JiniasWorld started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
teleto.instanceId = instanceId;
teleportplayer(player, teleto);
world.allowed.add(player.getObjectId());
return instanceId;
}
}
@Override
public String onAdvEvent (String event, L2Npc npc, L2PcInstance player)
{
String htmltext = null;
System.out.println("Here");
if (event.startsWith("enterInstance_") && npc.getNpcId() == RAFFORTY)
{
int questId = -1;
String tmpl = null;
QuestState hostQuest = null;
try
{
System.out.println(event.substring(14));
questId = Integer.parseInt(event.substring(14));
teleCoord tele = new teleCoord();
tele.x = ENTRY_POINT[0];
tele.y = ENTRY_POINT[1];
tele.z = ENTRY_POINT[2];
switch(questId)
{
case 10284:
hostQuest = player.getQuestState("Q10284_AcquisitionOfDivineSword");
tmpl = "JiniasHideout1.xml";
htmltext = "10284_failed.htm";
break;
case 10285:
hostQuest = player.getQuestState("Q10285_MeetingSirra");
tmpl = "JiniasHideout2.xml";
htmltext = "10285_failed.htm";
break;
case 10286:
hostQuest = player.getQuestState("Q10286_ReunionWithSirra");
tmpl = "JiniasHideout2.xml";
htmltext = "10286_failed.htm";
break;
case 10287:
hostQuest = player.getQuestState("Q10287_StoryOfThoseLeft");
tmpl = "JiniasHideout2.xml";
htmltext = "10287_failed.htm";
break;
}
if (hostQuest != null && hostQuest.getState() == State.STARTED && hostQuest.getInt("progress") == 1)
{
hostQuest.playSound("ItemSound.quest_middle");
hostQuest.set("cond", "2");
}
if (tmpl != null)
{
if (enterInstance(player, tmpl, tele, questId) > 0)
htmltext = null;
}
}
catch (Exception e)
{
}
}
else if (event.equalsIgnoreCase("leaveInstance") && npc.getNpcId() == JINIA)
{
QuestState hostQuest = null;
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
final Instance inst = InstanceManager.getInstance().getInstance(world.instanceId);
world.allowed.remove(world.allowed.indexOf(player.getObjectId()));
teleCoord tele = new teleCoord();
tele.instanceId = 0;
tele.x = inst.getSpawnLoc()[0];
tele.y = inst.getSpawnLoc()[1];
tele.z = inst.getSpawnLoc()[2];
exitInstance(player, tele);
switch (((JiniasWorld)world).questId)
{
case 10285:
hostQuest = player.getQuestState("Q10285_MeetingSirra");
break;
case 10286:
hostQuest = player.getQuestState("Q10286_ReunionWithSirra");
break;
case 10287:
hostQuest = player.getQuestState("Q10287_StoryOfThoseLeft");
break;
}
if (hostQuest != null && hostQuest.getState() == State.STARTED && hostQuest.getInt("progress") == 2)
{
switch (((JiniasWorld)world).questId)
{
case 10285:
htmltext = "10285_goodbye.htm";
break;
case 10286:
htmltext = "10286_goodbye.htm";
hostQuest.playSound("ItemSound.quest_middle");
hostQuest.set("cond", "5");
break;
case 10287:
htmltext = "10287_goodbye.htm";
hostQuest.playSound("ItemSound.quest_middle");
hostQuest.set("cond", "5");
}
}
}
return htmltext;
}
@Override
public final String onSpawn(L2Npc npc)
{
if (npc.getNpcId() == SIRRA)
{
InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
if (tmpworld != null && tmpworld instanceof JiniasWorld)
{
/*
//My client crashes on these fstring IDs, so I use String
int fstringId = -1;
switch tmpworld.templateId
{
case 141:
fstringId = 528551;
break;
case 145:
fstringId = 528651;
}
if fstringId > 0
npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getNpcId(), 528551));
*/
String msg = null;
switch(tmpworld.templateId)
{
case 141:
msg = "There's nothing you can't say. I can't listen to you anymore!";
break;
case 145:
msg = "You advanced bravely but got such a tiny result. Hohoho.";
}
if (msg != null)
npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getNpcId(), msg));
}
}
return null;
}
public JiniasHideout(int questId, String name, String descr)
{
super(questId, name, descr);
addStartNpc(RAFFORTY);
addTalkId(RAFFORTY);
addTalkId(JINIA);
addSpawnId(SIRRA);
}
public static void main(String[] args)
{
new JiniasHideout(-1,qn,"instances/Freya");
_log.info("Loaded Freya: Jinias Hideout");
}
}
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.instancemanager.InstanceManager.InstanceWorld;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.quest.State;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.clientpackets.Say2;
import com.l2jserver.gameserver.network.serverpackets.NpcSay;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
public class JiniasHideout extends Quest
{
private class JiniasWorld extends InstanceWorld
{
public long[] storeTime = {0,0};
public int questId;
public JiniasWorld()
{
}
}
private static final String qn = "JiniasHideout";
private static final int RAFFORTY = 32020;
private static final int JINIA = 32760;
private static final int SIRRA = 32762;
private static final int[] ENTRY_POINT = { -23530, -8963, -5413 };
private class teleCoord {int instanceId; int x; int y; int z;}
private void teleportplayer(L2PcInstance player, teleCoord teleto)
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
player.setInstanceId(teleto.instanceId);
player.teleToLocation(teleto.x, teleto.y, teleto.z);
return;
}
private boolean checkConditions(L2PcInstance player)
{
if (player.getLevel() < 82 || player.getLevel() > 85)
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT);
sm.addPcName(player);
player.sendPacket(sm);
return false;
}
return true;
}
protected void exitInstance(L2PcInstance player, teleCoord tele)
{
player.setInstanceId(0);
player.teleToLocation(tele.x, tele.y, tele.z);
}
protected int enterInstance(L2PcInstance player, String template, teleCoord teleto, int questId)
{
int instanceId = 0;
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
//existing instance
if (world != null)
{
//this instance
if (!(world instanceof JiniasWorld))
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER));
return 0;
}
teleto.instanceId = world.instanceId;
teleportplayer(player,teleto);
return instanceId;
}
else
{
//New instance
if (!checkConditions(player))
return 0;
instanceId = InstanceManager.getInstance().createDynamicInstance(template);
final Instance inst = InstanceManager.getInstance().getInstance(instanceId);
inst.setSpawnLoc(new int[] { player.getX(), player.getY(), player.getZ() });
world = new JiniasWorld();
world.instanceId = instanceId;
((JiniasWorld)world).questId = questId;
//Template id depends of quest
switch(questId)
{
case 10284:
world.templateId = 140;
break;
case 10285:
world.templateId = 141;
break;
case 10286:
world.templateId = 145;
break;
case 10287:
world.templateId = 146;
break;
}
world.status = 0;
((JiniasWorld)world).storeTime[0] = System.currentTimeMillis();
InstanceManager.getInstance().addWorld(world);
_log.info("JiniasWorld started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
teleto.instanceId = instanceId;
teleportplayer(player, teleto);
world.allowed.add(player.getObjectId());
return instanceId;
}
}
@Override
public String onAdvEvent (String event, L2Npc npc, L2PcInstance player)
{
String htmltext = null;
System.out.println("Here");
if (event.startsWith("enterInstance_") && npc.getNpcId() == RAFFORTY)
{
int questId = -1;
String tmpl = null;
QuestState hostQuest = null;
try
{
System.out.println(event.substring(14));
questId = Integer.parseInt(event.substring(14));
teleCoord tele = new teleCoord();
tele.x = ENTRY_POINT[0];
tele.y = ENTRY_POINT[1];
tele.z = ENTRY_POINT[2];
switch(questId)
{
case 10284:
hostQuest = player.getQuestState("Q10284_AcquisitionOfDivineSword");
tmpl = "JiniasHideout1.xml";
htmltext = "10284_failed.htm";
break;
case 10285:
hostQuest = player.getQuestState("Q10285_MeetingSirra");
tmpl = "JiniasHideout2.xml";
htmltext = "10285_failed.htm";
break;
case 10286:
hostQuest = player.getQuestState("Q10286_ReunionWithSirra");
tmpl = "JiniasHideout2.xml";
htmltext = "10286_failed.htm";
break;
case 10287:
hostQuest = player.getQuestState("Q10287_StoryOfThoseLeft");
tmpl = "JiniasHideout2.xml";
htmltext = "10287_failed.htm";
break;
}
if (hostQuest != null && hostQuest.getState() == State.STARTED && hostQuest.getInt("progress") == 1)
{
hostQuest.playSound("ItemSound.quest_middle");
hostQuest.set("cond", "2");
}
if (tmpl != null)
{
if (enterInstance(player, tmpl, tele, questId) > 0)
htmltext = null;
}
}
catch (Exception e)
{
}
}
else if (event.equalsIgnoreCase("leaveInstance") && npc.getNpcId() == JINIA)
{
QuestState hostQuest = null;
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
final Instance inst = InstanceManager.getInstance().getInstance(world.instanceId);
world.allowed.remove(world.allowed.indexOf(player.getObjectId()));
teleCoord tele = new teleCoord();
tele.instanceId = 0;
tele.x = inst.getSpawnLoc()[0];
tele.y = inst.getSpawnLoc()[1];
tele.z = inst.getSpawnLoc()[2];
exitInstance(player, tele);
switch (((JiniasWorld)world).questId)
{
case 10285:
hostQuest = player.getQuestState("Q10285_MeetingSirra");
break;
case 10286:
hostQuest = player.getQuestState("Q10286_ReunionWithSirra");
break;
case 10287:
hostQuest = player.getQuestState("Q10287_StoryOfThoseLeft");
break;
}
if (hostQuest != null && hostQuest.getState() == State.STARTED && hostQuest.getInt("progress") == 2)
{
switch (((JiniasWorld)world).questId)
{
case 10285:
htmltext = "10285_goodbye.htm";
break;
case 10286:
htmltext = "10286_goodbye.htm";
hostQuest.playSound("ItemSound.quest_middle");
hostQuest.set("cond", "5");
break;
case 10287:
htmltext = "10287_goodbye.htm";
hostQuest.playSound("ItemSound.quest_middle");
hostQuest.set("cond", "5");
}
}
}
return htmltext;
}
@Override
public final String onSpawn(L2Npc npc)
{
if (npc.getNpcId() == SIRRA)
{
InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
if (tmpworld != null && tmpworld instanceof JiniasWorld)
{
/*
//My client crashes on these fstring IDs, so I use String
int fstringId = -1;
switch tmpworld.templateId
{
case 141:
fstringId = 528551;
break;
case 145:
fstringId = 528651;
}
if fstringId > 0
npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getNpcId(), 528551));
*/
String msg = null;
switch(tmpworld.templateId)
{
case 141:
msg = "There's nothing you can't say. I can't listen to you anymore!";
break;
case 145:
msg = "You advanced bravely but got such a tiny result. Hohoho.";
}
if (msg != null)
npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.ALL, npc.getNpcId(), msg));
}
}
return null;
}
public JiniasHideout(int questId, String name, String descr)
{
super(questId, name, descr);
addStartNpc(RAFFORTY);
addTalkId(RAFFORTY);
addTalkId(JINIA);
addSpawnId(SIRRA);
}
public static void main(String[] args)
{
new JiniasHideout(-1,qn,"instances/Freya");
_log.info("Loaded Freya: Jinias Hideout");
}
}
и вот квест
/*
* This program 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.
*
* This program 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 quests.Q10284_AcquisitionOfDivineSword;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.quest.State;
/**
** @author GKR
**
** 2011-03-24
*/
public class Q10284_AcquisitionOfDivineSword extends Quest
{
private static final String qn = "10284_AcquisitionOfDivineSword";
// NPC's
private static final int _rafforty = 32020;
private static final int _jinia = 32760;
private static final int _kroon = 32653;
private static final int _taroon = 32654;
public Q10284_AcquisitionOfDivineSword(int questId, String name, String descr)
{
super(questId, name, descr);
addStartNpc(_rafforty);
addTalkId(_rafforty);
addTalkId(_jinia);
addTalkId(_kroon);
addTalkId(_taroon);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = event;
QuestState st = player.getQuestState(qn);
if (st == null)
return htmltext;
if (npc.getNpcId() == _rafforty)
{
if (event.equalsIgnoreCase("32020-04.htm"))
{
st.setState(State.STARTED);
st.set("progress", "1");
st.set("cond", "1");
st.set("jinia_themes", "102030"); //theme ID - state - something like 1-0, 2-0, 3-0
st.playSound("ItemSound.quest_accept");
}
}
else if (npc.getNpcId() == _jinia)
{
if (event.equalsIgnoreCase("32760-05.htm"))
{
switch(st.getInt("jinia_themes"))
{
case 112030: //1st theme have been readed
htmltext = "32760-05a.htm";
break;
case 102130: //2nd theme have been readed
htmltext = "32760-05b.htm";
break;
case 102031: //3rd theme have been readed
htmltext = "32760-05c.htm";
break;
case 102131: //2nd and 3rd theme have been readed
htmltext = "32760-05d.htm";
break;
case 112031: //1st and 3rd theme have been readed
htmltext = "32760-05e.htm";
break;
case 112130: //1st and 2nd theme have been readed
htmltext = "32760-05f.htm";
break;
case 112131: //all three themes have been readed
htmltext = "32760-05g.htm";
}
}
else if (event.equalsIgnoreCase("32760-02c.htm"))
{
int jinia_themes = st.getInt("jinia_themes");
jinia_themes += 10000; //mark 1st theme as readed
st.set("jinia_themes", Integer.toString(jinia_themes));
}
else if (event.equalsIgnoreCase("32760-03c.htm"))
{
int jinia_themes = st.getInt("jinia_themes");
jinia_themes += 100; //mark 2nd theme as readed
st.set("jinia_themes", Integer.toString(jinia_themes));
}
else if (event.equalsIgnoreCase("32760-04c.htm"))
{
int jinia_themes = st.getInt("jinia_themes");
jinia_themes += 1; //mark 3rd theme as readed
st.set("jinia_themes", Integer.toString(jinia_themes));
}
else if (event.equalsIgnoreCase("32760-07.htm"))
{
st.set("jinia_themes","102030");
st.set("progress", "2");
st.set("cond", "3");
st.playSound("ItemSound.quest_middle");
// destroy instance after 1 min
Instance inst = InstanceManager.getInstance().getInstance(player.getInstanceId());
inst.setDuration(60000);
inst.setEmptyDestroyTime(0);
}
}
return htmltext;
}
@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
String htmltext = getNoQuestMsg(player);
QuestState st = player.getQuestState(qn);
if (st == null)
return htmltext;
if (npc.getNpcId() == _rafforty)
{
switch (st.getState())
{
case State.CREATED:
QuestState _prev = player.getQuestState("10283_RequestOfIceMerchant");
if ((_prev != null) && (_prev.getState() == State.COMPLETED) && (player.getLevel() >= 82))
htmltext = "32020-01.htm";
else
htmltext = "32020-03.htm";
break;
case State.STARTED:
if (st.getInt("progress") == 1)
htmltext = "32020-05.htm";
else if (st.getInt("progress") == 2)
htmltext = "32020-09.htm";
break;
case State.COMPLETED:
htmltext = "32020-02.htm";
break;
}
}
else if (npc.getNpcId() == _jinia)
{
if (st.getState() != State.STARTED)
return getNoQuestMsg(player);
if (st.getInt("progress") == 1)
{
int jinia_themes = st.getInt("jinia_themes");
//look above for explanation
switch(jinia_themes)
{
case 102030:
htmltext = "32760-01.htm";
break;
case 112030:
htmltext = "32760-01a.htm";
break;
case 102130:
htmltext = "32760-01b.htm";
break;
case 102031:
htmltext = "32760-01c.htm";
break;
case 102131:
htmltext = "32760-01d.htm";
break;
case 112031:
htmltext = "32760-01e.htm";
break;
case 112130:
htmltext = "32760-01f.htm";
break;
case 112131:
htmltext = "32760-01g.htm";
break;
}
}
}
else if (npc.getNpcId() == _kroon || npc.getNpcId() == _taroon)
{
if (st.getState() != State.STARTED)
return getNoQuestMsg(player);
if (st.getInt("progress") == 2)
htmltext = npc.getNpcId() == _kroon ? "32653-01.htm" : "32654-01.htm";
else if (st.getInt("progress") == 3)
{
st.set("jinia_themes","102030");
st.giveItems(57, 296425);
st.addExpAndSp(921805, 82230);
st.playSound("ItemSound.quest_finish");
htmltext = npc.getNpcId() == _kroon ? "32653-05.htm" : "32654-05.htm";
st.exitQuest(false);
}
}
return htmltext;
}
public static void main(String[] args)
{
new Q10284_AcquisitionOfDivineSword(10284, qn, "Acquisition of Divine Sword");
}
}
* This program 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.
*
* This program 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 quests.Q10284_AcquisitionOfDivineSword;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.quest.State;
/**
** @author GKR
**
** 2011-03-24
*/
public class Q10284_AcquisitionOfDivineSword extends Quest
{
private static final String qn = "10284_AcquisitionOfDivineSword";
// NPC's
private static final int _rafforty = 32020;
private static final int _jinia = 32760;
private static final int _kroon = 32653;
private static final int _taroon = 32654;
public Q10284_AcquisitionOfDivineSword(int questId, String name, String descr)
{
super(questId, name, descr);
addStartNpc(_rafforty);
addTalkId(_rafforty);
addTalkId(_jinia);
addTalkId(_kroon);
addTalkId(_taroon);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = event;
QuestState st = player.getQuestState(qn);
if (st == null)
return htmltext;
if (npc.getNpcId() == _rafforty)
{
if (event.equalsIgnoreCase("32020-04.htm"))
{
st.setState(State.STARTED);
st.set("progress", "1");
st.set("cond", "1");
st.set("jinia_themes", "102030"); //theme ID - state - something like 1-0, 2-0, 3-0
st.playSound("ItemSound.quest_accept");
}
}
else if (npc.getNpcId() == _jinia)
{
if (event.equalsIgnoreCase("32760-05.htm"))
{
switch(st.getInt("jinia_themes"))
{
case 112030: //1st theme have been readed
htmltext = "32760-05a.htm";
break;
case 102130: //2nd theme have been readed
htmltext = "32760-05b.htm";
break;
case 102031: //3rd theme have been readed
htmltext = "32760-05c.htm";
break;
case 102131: //2nd and 3rd theme have been readed
htmltext = "32760-05d.htm";
break;
case 112031: //1st and 3rd theme have been readed
htmltext = "32760-05e.htm";
break;
case 112130: //1st and 2nd theme have been readed
htmltext = "32760-05f.htm";
break;
case 112131: //all three themes have been readed
htmltext = "32760-05g.htm";
}
}
else if (event.equalsIgnoreCase("32760-02c.htm"))
{
int jinia_themes = st.getInt("jinia_themes");
jinia_themes += 10000; //mark 1st theme as readed
st.set("jinia_themes", Integer.toString(jinia_themes));
}
else if (event.equalsIgnoreCase("32760-03c.htm"))
{
int jinia_themes = st.getInt("jinia_themes");
jinia_themes += 100; //mark 2nd theme as readed
st.set("jinia_themes", Integer.toString(jinia_themes));
}
else if (event.equalsIgnoreCase("32760-04c.htm"))
{
int jinia_themes = st.getInt("jinia_themes");
jinia_themes += 1; //mark 3rd theme as readed
st.set("jinia_themes", Integer.toString(jinia_themes));
}
else if (event.equalsIgnoreCase("32760-07.htm"))
{
st.set("jinia_themes","102030");
st.set("progress", "2");
st.set("cond", "3");
st.playSound("ItemSound.quest_middle");
// destroy instance after 1 min
Instance inst = InstanceManager.getInstance().getInstance(player.getInstanceId());
inst.setDuration(60000);
inst.setEmptyDestroyTime(0);
}
}
return htmltext;
}
@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
String htmltext = getNoQuestMsg(player);
QuestState st = player.getQuestState(qn);
if (st == null)
return htmltext;
if (npc.getNpcId() == _rafforty)
{
switch (st.getState())
{
case State.CREATED:
QuestState _prev = player.getQuestState("10283_RequestOfIceMerchant");
if ((_prev != null) && (_prev.getState() == State.COMPLETED) && (player.getLevel() >= 82))
htmltext = "32020-01.htm";
else
htmltext = "32020-03.htm";
break;
case State.STARTED:
if (st.getInt("progress") == 1)
htmltext = "32020-05.htm";
else if (st.getInt("progress") == 2)
htmltext = "32020-09.htm";
break;
case State.COMPLETED:
htmltext = "32020-02.htm";
break;
}
}
else if (npc.getNpcId() == _jinia)
{
if (st.getState() != State.STARTED)
return getNoQuestMsg(player);
if (st.getInt("progress") == 1)
{
int jinia_themes = st.getInt("jinia_themes");
//look above for explanation
switch(jinia_themes)
{
case 102030:
htmltext = "32760-01.htm";
break;
case 112030:
htmltext = "32760-01a.htm";
break;
case 102130:
htmltext = "32760-01b.htm";
break;
case 102031:
htmltext = "32760-01c.htm";
break;
case 102131:
htmltext = "32760-01d.htm";
break;
case 112031:
htmltext = "32760-01e.htm";
break;
case 112130:
htmltext = "32760-01f.htm";
break;
case 112131:
htmltext = "32760-01g.htm";
break;
}
}
}
else if (npc.getNpcId() == _kroon || npc.getNpcId() == _taroon)
{
if (st.getState() != State.STARTED)
return getNoQuestMsg(player);
if (st.getInt("progress") == 2)
htmltext = npc.getNpcId() == _kroon ? "32653-01.htm" : "32654-01.htm";
else if (st.getInt("progress") == 3)
{
st.set("jinia_themes","102030");
st.giveItems(57, 296425);
st.addExpAndSp(921805, 82230);
st.playSound("ItemSound.quest_finish");
htmltext = npc.getNpcId() == _kroon ? "32653-05.htm" : "32654-05.htm";
st.exitQuest(false);
}
}
return htmltext;
}
public static void main(String[] args)
{
new Q10284_AcquisitionOfDivineSword(10284, qn, "Acquisition of Divine Sword");
}
}
<html><head><body>
Jinia:<br>I'm busy. Not now.<br>
<a action="bypass -h npc_%objectId%_Quest">Quest</a>
</body></html>
может у кого есть какие идеи что такое...
сборка разумеется лыжа