Jump to content

Hiding Behind the Truth (Quest)


Zake
 Share

Recommended Posts

Since i got bored like hell today, i translated this one from python to java.

package quests.Q025_HidingBehindTheTruth;

import quests.Q024_InhabitantsOfTheForrestOfTheDead.Q024_InhabitantsOfTheForrestOfTheDead;
import net.sf.l2j.gameserver.ai.CtrlIntention;
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 Q025_HidingBehindTheTruth extends Quest
{
private final static String qn = "Q025_HidingBehindTheTruth";

//Items
private static final int Contract = 7066;
private static final int Dress = 7155;
private static final int SuspiciousTotem = 7156;
private static final int GemstoneKey = 7157;
private static final int TotemDoll = 7158;

//NPCs
private static final int Agripel = 31348;
private static final int Benedict = 31349;
private static final int Wizard = 31522;
private static final int Tombstone = 31531;
private static final int Lidia = 31532;
private static final int Bookshelf = 31533;
private static final int Bookshelf2 = 31534;
private static final int Bookshelf3 = 31535;
private static final int Coffin = 31536;
private static final int Triol = 27218;

public Q025_HidingBehindTheTruth(int questId, String name, String descr)
{
	super(questId, name, descr);
	questItemIds = new int[]
			{
			Contract,
			Dress,
			SuspiciousTotem,
			GemstoneKey,
			TotemDoll,
			};
	addStartNpc(Benedict);
	addTalkId(Agripel,Benedict,Wizard,Tombstone,Lidia,Bookshelf,Bookshelf2,Bookshelf3,Coffin,Triol);
}

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("31349-02.htm"))
	{
		st.playSound(QuestState.SOUND_ACCEPT);
		st.set("cond","1");
		st.setState(STATE_STARTED);
	}
	else if (event.equalsIgnoreCase("31349-03.htm"))
	{
		if (!st.hasQuestItems(SuspiciousTotem))
			htmltext = "31349-05.htm";
		else
		{
			st.playSound(QuestState.SOUND_MIDDLE);
			st.set("cond","2");
		}
	}
	else if (event.equalsIgnoreCase("31349-10.htm"))
	{
		st.playSound(QuestState.SOUND_MIDDLE);
		st.set("cond","4");
	}
	else if (event.equalsIgnoreCase("31348-02.htm"))
	{
		st.takeItems(SuspiciousTotem,-1);
	}
	else if (event.equalsIgnoreCase("31348-07.htm"))
	{
		st.playSound(QuestState.SOUND_MIDDLE);
		st.set("cond","5");
		st.giveItems(GemstoneKey,1);
	}
	else if (event.equalsIgnoreCase("31522-04.htm"))
	{
		st.playSound(QuestState.SOUND_MIDDLE);
		st.set("cond","6");
	}
	else if (event.equalsIgnoreCase("31535-03.htm"))
	{
		if (st.getInt("step") == 0)
		{
			st.set("step","1");
			L2Npc triol = addSpawn(Triol,59712,-47568,-2712,0,false,300000,true);
			triol.broadcastNpcSay( "That box was sealed by my master. Don't touch it!");
			triol.setRunning();
			triol.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
			st.playSound(QuestState.SOUND_MIDDLE);
			st.set("cond","7");
		}
		else if (st.getInt("step") == 2)
		{
				htmltext = "31535-04.htm";
		}
		else if (event.equalsIgnoreCase("31535-05.htm"))
		{
			st.giveItems(Contract,1);
			st.takeItems(GemstoneKey,-1);
			st.playSound(QuestState.SOUND_MIDDLE);
			st.set("cond","9");
		}
		else if (event.equalsIgnoreCase("31532-02.htm"))
		{
			st.takeItems(Contract,-1);
		}
		else if (event.equalsIgnoreCase("31532-06.htm"))
		{
			st.playSound(QuestState.SOUND_MIDDLE);
			st.set("cond","11");
		}
		else if (event.equalsIgnoreCase("31531-02.htm"))
		{
			st.playSound(QuestState.SOUND_MIDDLE);
			st.set("cond","12");
			addSpawn(Coffin,60104,-35820,-664,0,false,20000,true);
		}
		else if (event.equalsIgnoreCase("31532-18.htm"))
		{
			st.playSound(QuestState.SOUND_MIDDLE);
			st.set("cond","15");
		}
		else if (event.equalsIgnoreCase("31522-12.htm"))
		{
			st.playSound(QuestState.SOUND_MIDDLE);
			st.set("cond","16");
		}
		else if (event.equalsIgnoreCase("31348-10.htm"))
			st.takeItems(TotemDoll,-1);
		else if (event.equalsIgnoreCase("31348-15.htm"))
		{
			st.playSound(QuestState.SOUND_MIDDLE);
			st.set("cond","17");
		}
		else if (event.equalsIgnoreCase("31348-16.htm"))
		{
			st.playSound(QuestState.SOUND_MIDDLE);
			st.set("cond","18");
		}
		else if (event.equalsIgnoreCase("31532-20.htm"))
		{
			st.giveItems(905,2);
			st.giveItems(874,1);
			st.takeItems(7063,-1);
			st.rewardExpAndSp(572277,53750);
			st.unset("cond");
			st.exitQuest(false);
			st.playSound(QuestState.SOUND_FINISH);
		}
		else if (event.equalsIgnoreCase("31522-15.htm"))
		{
			st.giveItems(936,1);
			st.giveItems(874,1);
			st.takeItems(7063,-1);
			st.rewardExpAndSp(572277,53750);
			st.unset("cond");
			st.exitQuest(false);
			st.playSound(QuestState.SOUND_FINISH);
		}
	}
	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_COMPLETED:
		htmltext = getAlreadyCompletedMsg();
	case STATE_CREATED:
		QuestState st2 = player.getQuestState("Q025_HidingBehindTheTruth");
		if (npc.getNpcId() == Benedict)
		{
			st2 = st.getPlayer().getQuestState("Q025_HidingBehindTheTruth");
			if (st2!=null && st2.getState() == STATE_COMPLETED && player.getLevel() >= 66)
				htmltext = "31349-01.htm";
			else
				htmltext = "31349-00.htm";
		}
	case STATE_STARTED:
		int cond = st.getInt("cond");
		if (npc.getNpcId() == Benedict)
		{
			if (cond == 1)
				htmltext = "31349-02.htm";
				else if (cond==2 || cond ==3)
					htmltext = "31349-04.htm";
				else if (cond == 4)
					htmltext = "31349-10.htm";
		}
		else if (npc.getNpcId() == Wizard)
		{
			if (cond == 2)
			{
				htmltext = "31522-01.htm";
				st.playSound(QuestState.SOUND_MIDDLE);
				st.set("cond","3");
				st.giveItems(SuspiciousTotem,1);
			}
			else if (cond == 3)
				htmltext = "31522-02.htm";
			else if (cond == 5)
				htmltext = "31522-03.htm";
			else if (cond == 6)
				htmltext = "31522-04.htm";
			else if (cond == 9)
			{
				htmltext = "31522-05.htm";
				st.playSound(QuestState.SOUND_MIDDLE);
				st.set("cond","10");
			}
			else if (cond == 10)
				htmltext = "31522-05.htm";
			else if (cond == 15)
				htmltext = "31522-06.htm";
			else if (cond == 16)
				htmltext = "31522-13.htm";
			else if (cond == 17)
				htmltext = "31522-16.htm";
			else if (cond == 18)
				htmltext = "31522-14.htm";
		}
		else if (npc.getNpcId() == Agripel)
		{
			if (cond == 4 )	
				htmltext = "31348-01.htm";
			else if (cond == 5)
				htmltext = "31348-08.htm";
			else if (cond == 16)
				htmltext = "31348-09.htm";
			else if (cond == 17)
				htmltext = "31348-17.htm";
			else if (cond == 18)
				htmltext = "31348-18.htm";
		}
		else if (npc.getNpcId() == Bookshelf)
		{
			if (cond == 6)
				htmltext = "31533-01.htm";
		}
		else if (npc.getNpcId() == Bookshelf2)
		{
			if (cond == 6)
				htmltext = "31534-01.htm";
		}
		else if (npc.getNpcId() == Bookshelf3)
		{
			if (cond==6 || cond==7 || cond==8)
				htmltext = "31535-01.htm";
			else if (cond == 9)
				htmltext = "31535-06.htm";
		}
		else if (npc.getNpcId() == Lidia)
		{
			if (cond == 10)
				htmltext = "31532-01.htm";
			else if (cond==11 || cond==12)
				htmltext = "31532-06.htm";
			else if (cond == 13)
			{
				htmltext = "31532-07.htm";
				st.set("cond","14");
				st.takeItems(Dress,-1);
			}
			else if (cond == 14)
				htmltext = "31532-08.htm";
			else if (cond == 15)
				htmltext = "31532-18.htm";
			else if (cond == 17)
				htmltext = "31532-19.htm";
			else if (cond == 18)
				htmltext = "31532-21.htm";
		}
		else if (npc.getNpcId() == Tombstone)
		{
			if (cond == 11 || cond ==12)
				htmltext = "31531-01.htm";
			else if (cond == 13)
				htmltext = "31531-03.htm";
		}
		else if (npc.getNpcId() == Coffin)
			if (cond == 12)
			{
				htmltext = "31536-01.htm";
				st.giveItems(Dress,1);
				st.playSound(QuestState.SOUND_MIDDLE);
				st.set("cond","13");
				npc.deleteMe();
			}
	}

	return htmltext;
}

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

	if (st.getInt("cond") == 7)
	{
		st.playSound(QuestState.SOUND_ITEMGET);
		st.set("cond","8");
		npc.broadcastNpcSay("You've ended my immortal life! You've protected by the feudal lord, aren't you?");
		st.giveItems(TotemDoll,1);
		st.set("step","2");
	}

	return null;
}
public static void main(String[] args)
{
	new Q025_HidingBehindTheTruth(25, qn, "Hiding Before the Truth");
}
}

 

Html Part

Link to comment
Share on other sites

Hello Zake, you got errors and some others stuffs which can be improved, here's the list. Btw you should post directly on aCis board. The section is this one : http://acis.i-live.eu/index.php?board=35.0 SweeTs shared it on my boards, so if you manage to fix it with my suggestions, feel free to repost it.

 

else
st.playSound("ItemSound.quest_middle");
st.set("cond","2");

is wrong, you miss brackets. Currently your code means than cond 2 is applied for any case. Must be

else {
st.playSound("ItemSound.quest_middle");
st.set("cond","2");
}

  • st.getQuestItemsCount(SuspiciousTotem) ==0 can be replaced by (more sexy) !st.hasQuestItems(SuspiciousTotem). Use that way ONLY if the count doesn't care, and you only have to know if yes or no you got the given item. If you need to count items (== 10 for ex), then your first is ok.
  • All sounds have been finalized. Don't use "ItemSound.quest_middle", but use QuestState.SOUND_MIDDLE. Complete list can be found on QuestState.
  • You don't need to st.unset("cond"); as it is made automatically at exitQuest(param).
  • I doubt the rewards match IL criterias. Reward is generally 10 times lower.
  • htmltext = "<html><body>This quest has already been completed.</body></html>"; got also a finalized counterpart : getAlreadyCompletedMsg().
  • you could use a switch for npcIds in STARTED case (just the common way I use for aCis quests, no big deal)
  • onKill( section can be shortened, because you currently do checkPlayerCondition(player, npc, "cond", "1") - checking cond == 1, but if you change 1 to 7 you can drop if (st.getInt("cond") == 7) check.
  • "Hiding before the truth" name got typos for sure. NCSoft way is generally "Hiding Before the Truth". Verify fast on client side, in some rare cases they don't match their own criterias.
  • As reminder : spawns are (for speaking NPCs) instanced. It means you can have only one instance of the NPC living, if 2 players are doing the quest it can't spawn it. The other must wait. Some HTMs related to that NPC can also go in that sense.

 

I didn't test your quest, I just read it fast. I don't know if it is simply works, notably if you edited correctly HTM bypasses.

 

Finally, if you need stuff like L2OFF HTMs or particular retail behavior of a NPC, I can send you.

 

I hope you will keep the good work and take in consideration my suggestions for your future quests (if any), or the edition of this one.

 

Regards,

 

Tk.

Link to comment
Share on other sites

  • 2 weeks later...

Hello Zake, you got errors and some others stuffs which can be improved, here's the list. Btw you should post directly on aCis board. The section is this one : http://acis.i-live.eu/index.php?board=35.0 SweeTs shared it on my boards, so if you manage to fix it with my suggestions, feel free to repost it.

 

else
st.playSound("ItemSound.quest_middle");
st.set("cond","2");

is wrong, you miss brackets. Currently your code means than cond 2 is applied for any case. Must be

else {
st.playSound("ItemSound.quest_middle");
st.set("cond","2");
}

  • st.getQuestItemsCount(SuspiciousTotem) ==0 can be replaced by (more sexy) !st.hasQuestItems(SuspiciousTotem). Use that way ONLY if the count doesn't care, and you only have to know if yes or no you got the given item. If you need to count items (== 10 for ex), then your first is ok.
  • All sounds have been finalized. Don't use "ItemSound.quest_middle", but use QuestState.SOUND_MIDDLE. Complete list can be found on QuestState.
  • You don't need to st.unset("cond"); as it is made automatically at exitQuest(param).
  • I doubt the rewards match IL criterias. Reward is generally 10 times lower.
  • htmltext = "<html><body>This quest has already been completed.</body></html>"; got also a finalized counterpart : getAlreadyCompletedMsg().
  • you could use a switch for npcIds in STARTED case (just the common way I use for aCis quests, no big deal)
  • onKill( section can be shortened, because you currently do checkPlayerCondition(player, npc, "cond", "1") - checking cond == 1, but if you change 1 to 7 you can drop if (st.getInt("cond") == 7) check.
  • "Hiding before the truth" name got typos for sure. NCSoft way is generally "Hiding Before the Truth". Verify fast on client side, in some rare cases they don't match their own criterias.
  • As reminder : spawns are (for speaking NPCs) instanced. It means you can have only one instance of the NPC living, if 2 players are doing the quest it can't spawn it. The other must wait. Some HTMs related to that NPC can also go in that sense.

 

I didn't test your quest, I just read it fast. I don't know if it is simply works, notably if you edited correctly HTM bypasses.

 

Finally, if you need stuff like L2OFF HTMs or particular retail behavior of a NPC, I can send you.

 

I hope you will keep the good work and take in consideration my suggestions for your future quests (if any), or the edition of this one.

 

Regards,

 

Tk.

Hello Tryskell, i just found some time. I've implemented all of those stuff except the "switch" part, i'm bored to add cases :P I'll update the main post later or tomorrow and share it on aCis forum too. By the way, it would be helpful to send me the L2OFF html's of the quests that you're missing, maybe i'll find some more time to translate.

Regards,

Zake.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Posts

    • We have added few new features for Second Edition of L2Etina. Check them out:   While streaming L2Etina, you will now receive L2Coins automatically.   Dwarves who have set private workshop, now automatically sell Crystallization to nearby players. For this service, they receive 10% of created crystals.   Before closing game, you will now see amount of earned experience, adena, total play time and acquired items.   You can now check Ranking of current and previous edition. This window can be found in Main Menu.   Party Window now have a special spot, showing if member has Noble Blessing.   Players from South America will be able to connect to the server by proxy.   Players who have supported first edition by donation, will now 2 weeks of free premium.   We have rewritten description of every buff, so they are now clear and handy. Vote rewards will be different for new edition, but exact items are not decided yet.   When spoil is successfull, you will now see special popup window. When you target monster who has been spoiled, you will see Spoil as a debuff.   Buff Store now have possibility to refuse to buff someone. Retail version of party matching was added back. Offline private stores now automatically disappear after 5 days. There are plenty more improvements and fixes, like ability to disable skill bar, multiple fixes to epic bosses, adjustments to aggro.
    • First of all thank you for fast answer. I have changed internal as you said but didn't work sir.
    • The difference isn't paying upfront or at the end of each week. The major difference is that paying clans to join, leads to leaders making random weak sides who play just for money and creates an extremely toxic fake competition in-game (i.e. l2 dex, e-global, valhalla and this kind of servers). Paying clans just to join absolutely kills the rivalry between them as there are no real losers and winners. Everyone gets paid at the end of every week so who cares right ?   Rewarding the winners with cash gives a massive motive to the leaders to create strong sides and try their best to win without giving any advantage to any clan (unlike paying people to join and basically giving them free premiums and whatnot). In this case, there will always be losers and winners and the rivalry will be kept alive.   I hope that clears up the massive difference between the 2 scenarios. Look at all those big russian servers. No1 makes fraps flaming about which side is better. Everyone cares about daily 9v9s or organized ones. There is no clan identity anymore because leaders simply don't care. They have been so detached from the clan's identity that most of the times the leader's CP holds a different name to the side's. This is a very important point to think about. 
    • change the server.ini  InternalHostname = 127.0.0.1     and try
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disbaled AdBlock