Jump to content

Inhabitants of the forrest of the dead (Quest)


Recommended Posts

Well, since i found some free time and aCis runs it's quests in java (plus many quests are missing) i have translated this quest from Python to Java. So...

 

Q024_InhabitantsOfTheForrestOfTheDead.java

package quests.Q024_InhabitantsOfTheForrestOfTheDead;

import quests.Q023_LidiasHeart.Q023_LidiasHeart;
import net.sf.l2j.gameserver.datatables.SpawnTable;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.model.quest.QuestState;

public class Q024_InhabitantsOfTheForrestOfTheDead extends Quest
{
private final static String qn = "Q024_InhabitantsOfTheForrestOfTheDead";

//Items
private static final int Letter = 7065;
private static final int Hairpin = 7148;
private static final int Totem = 7151;
private static final int Flower = 7152;
private static final int SilverCross = 7153;
private static final int BrokenSilverCross = 7154;
private static final int SuspiciousTotem = 7156;

//NPCs
private static final int Dorian = 31389;
private static final int Wizard = 31522;
private static final int Tombstone = 31531;
private static final int MaidOfLidia = 31532;


public Q024_InhabitantsOfTheForrestOfTheDead(int questId, String name, String descr)
{
	super(questId, name, descr);
	questItemIds = new int[]
			{
			Letter,
			Hairpin,
			Totem,
			Flower,
			SilverCross,
			BrokenSilverCross,
			SuspiciousTotem
			};
	addStartNpc(Dorian);
	addTalkId(Dorian,Wizard,Tombstone,MaidOfLidia);
}

public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
	String htmltext = event;
	QuestState st = player.getQuestState(qn);
	if (st == null)
		return htmltext;
	if (event.equalsIgnoreCase("31389-02.htm"))
	{
		st.giveItems(Flower,1);
		st.set("cond","1");
		st.playSound("ItemSound.quest_accept");
		st.setState(STATE_STARTED);
	}
	else if (event.equalsIgnoreCase("31389-11.htm"))
	{
		st.set("cond","3");
		st.playSound("ItemSound.quest_middle");
		st.giveItems(SilverCross,1);
	}
	else if (event.equalsIgnoreCase("31389-16.htm"))
	{
		st.playSound("InterfaceSound.charstat_open_01");
	}
	else if (event.equalsIgnoreCase("31389-17.htm"))
	{
		st.takeItems(BrokenSilverCross,-1);
		st.giveItems(Hairpin,1);
		st.set("cond","5");
	}
	else if (event.equalsIgnoreCase("31522-03.htm"))
	{
		st.takeItems(Totem,-1);
	}
	else if (event.equalsIgnoreCase("31522-07.htm"))
	{
		st.set("cond","11");
	}
	else if (event.equalsIgnoreCase("31522-19.htm"))
	{
		st.giveItems(SuspiciousTotem,1);
		st.rewardExpAndSp(242105,22529);
		st.exitQuest(false);
		st.playSound("ItemSound.quest_finish");
	}
	else if (event.equalsIgnoreCase("31531-02.htm"))
	{
		st.playSound("ItemSound.quest_middle");
		st.set("cond","2");
		st.takeItems(Flower,-1);
	}
	else if (event.equalsIgnoreCase("31532-04.htm"))
	{
		st.playSound("ItemSound.quest_middle");
		st.giveItems(Letter,1);
		st.set("cond","6");
	}
	else if (event.equalsIgnoreCase("31532-06.htm"))
	{
		st.takeItems(Hairpin,-1);
		st.takeItems(Letter,-1);
	}
	else if (event.equalsIgnoreCase("31532-16.htm"))
	{
		st.playSound("ItemSound.quest_middle");
		st.set("cond","9");
	}

	return htmltext;
}

public String onTalk(L2Npc npc, L2PcInstance player)
{
	String htmltext = getNoQuestMsg();
	QuestState st = player.getQuestState(qn);
	if (st == null)
		return htmltext;
	switch (st.getState())
	{
	case STATE_CREATED: //0
		QuestState st2 = player.getQuestState("Q023_LidiasHeart");
		if (st2 != null && st2.isCompleted())
		{
			if (player.getLevel() >= 65)
				htmltext = "31389-01.htm";
			else
			{
				htmltext = "31389-00.htm";
				st.exitQuest(true);
			}
		}
			else
			{
				htmltext = "31389-00.htm";
				st.exitQuest(true);
			}
			break;

case STATE_STARTED:
	int cond = st.getInt("cond");
	switch (npc.getNpcId())
	{
	case Dorian:
		if (cond == 1)
			htmltext = "31389-03.htm";
		else if (cond == 2)
			htmltext = "31389-04.htm";
		else if (cond == 3)
			htmltext = "31389-12.htm";
		else if (cond >= 4)
			htmltext = "31389-13.htm";
		else if (cond >= 4)
			htmltext = "31389-18.htm";
		break;
	case Tombstone:
		if (cond == 1)
		{
			st.playSound("AmdSound.d_wind_loot_02");
			htmltext = "31531-01.htm";
		}
		if (cond == 2)
		{
			htmltext = "31531-03.htm";
		}
	case MaidOfLidia:
		if (cond == 5)
			htmltext = "31532-01.htm";
		else if (cond ==6)
		{
			//if (st.getQuestItemsCount(Letter) && st.getQuestItemsCount(Hairpin))
			if (st.getQuestItemsCount(Letter) == st.getQuestItemsCount(Hairpin))	
				htmltext = "31532-05.htm";
			else
				htmltext = "31532-07.htm";
		}
		else if (cond ==9)
		{
			htmltext = "31532-16.htm";
		}
	case Wizard:
		if (cond==10)
			htmltext = "31522-01.htm";
		else if (cond == 11)
			htmltext = "31522-08.htm";
	}

	}
	return htmltext;
}
public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
{
	QuestState st = checkPlayerCondition(player, npc, "cond", "1");
	if (st == null)
		return null;

	switch (npc.getNpcId())
	{
	case 21557:
	case 21558:
	case 21560:
	case 21563:
	case 21564:	
	case 21565:
	case 21566:
	case 21567:
		st.giveItems(Totem,1);
		st.set("cond","10");
		st.playSound("ItemSound.quest_middle");
		break;
	}

	return null;
}
public static void main(String[] args)
{
	new Q024_InhabitantsOfTheForrestOfTheDead(24, qn, "Inhabitants of the forrest of the dead");
}
}

 

For those who can't find the html part here you are.

 

PS: I 'll translate more quests when i find some free time, HF.

Link to comment
Share on other sites

Guest Elfocrash

They dont translate Python to Java. They find retail info in the web with retail rates and then they recode the quests from scratch. A python l2j quest for IL most

of the times does not have retail info in it like htmls, rates and stuff.

Link to comment
Share on other sites

They dont translate Python to Java. They find retail info in the web with retail rates and then they recode the quests from scratch. A python l2j quest for IL most

of the times does not have retail info in it like htmls, rates and stuff.

 

Yep thats true. We rewrite it from scratch based on freya AI :)

Link to comment
Share on other sites

They dont translate Python to Java. They find retail info in the web with retail rates and then they recode the quests from scratch. A python l2j quest for IL most

of the times does not have retail info in it like htmls, rates and stuff.

This way should be better but have a look at their quests. Each and everyone seems to be translated (same methods, coding style, etc).

All quests can be found at l2jserver, because they already started recoding them in java.

 

By the way, you did great job.

If this is the right DP svn, then no. They're all written in python.
Link to comment
Share on other sites

This way should be better but have a look at their quests. Each and everyone seems to be translated (same methods, coding style, etc).If this is the right DP svn, then no. They're all written in python.

 

Not all of them.

 

By the way, hit meh!

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...