Browse Source

BETA: Quest Sense for Business (328) in Java.

Patch by: xban1x
Reviewed by: Zoey76
Zoey76 12 years ago
parent
commit
e8e6392252

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts.cfg

@@ -538,7 +538,7 @@ quests/Q00324_SweetestVenom/Q00324_SweetestVenom.java
 quests/325_GrimCollector/__init__.py
 quests/326_VanquishRemnants/__init__.py
 quests/327_ReclaimTheLand/__init__.py
-quests/328_SenseForBusiness/__init__.py
+quests/Q00328_SenseForBusiness/Q00328_SenseForBusiness.java
 quests/329_CuriosityOfDwarf/__init__.py
 quests/330_AdeptOfTaste/__init__.py
 quests/331_ArrowForVengeance/__init__.py

+ 0 - 5
L2J_DataPack_BETA/dist/game/data/scripts/quests/328_SenseForBusiness/30436-04.htm

@@ -1,5 +0,0 @@
-<html><body>Trader Sarien:<br>
-Ho, why are your hands empty, partner? Were you not supposed to find me<font color="LEVEL"> monster eye carcasses</font> and<font color="LEVEL"> lenses</font>, and the<font color="LEVEL"> gizzards of the basilisk</font>? You aren't going to quit by any chance, are you?<br>
-<a action="bypass -h Quest 328_SenseForBusiness 30436-06.htm">Say you will quit</a><br>
-<a action="bypass -h Quest 328_SenseForBusiness 30436-07.htm">Say you will continue</a>
-</body></html>

+ 0 - 112
L2J_DataPack_BETA/dist/game/data/scripts/quests/328_SenseForBusiness/__init__.py

@@ -1,112 +0,0 @@
-# Made by Mr. Have fun! - Version 0.3 by Drlecter
-import sys
-from com.l2jserver.gameserver.model.quest import State
-from com.l2jserver.gameserver.model.quest import QuestState
-from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest
-
-qn = "328_SenseForBusiness"
-
-MONSTER_EYE_CARCASS = 1347
-MONSTER_EYE_LENS = 1366
-BASILISK_GIZZARD = 1348
-ADENA = 57
-
-class Quest (JQuest) :
-
- def __init__(self,id,name,descr):
-     JQuest.__init__(self,id,name,descr)
-     self.questItemIds = [MONSTER_EYE_CARCASS, MONSTER_EYE_LENS, BASILISK_GIZZARD]
-
- def onEvent (self,event,st) :
-    htmltext = event
-    if event == "30436-03.htm" :
-        st.set("cond","1")
-        st.setState(State.STARTED)
-        st.playSound("ItemSound.quest_accept")
-    elif event == "30436-06.htm" :
-        st.playSound("ItemSound.quest_finish")
-        st.exitQuest(1)
-    return htmltext
-
- def onTalk (self,npc,player):
-   htmltext = Quest.getNoQuestMsg(player)
-   st = player.getQuestState(qn)
-   if not st : return htmltext
-
-   npcId = npc.getNpcId()
-   id = st.getState()
-   if id == State.CREATED :
-     st.set("cond","0")
-   if st.getInt("cond")==0 :
-     if player.getLevel() >= 21 :
-        htmltext = "30436-02.htm"
-        return htmltext
-     else:
-        htmltext = "30436-01.htm"
-        st.exitQuest(1)
-   else :
-     carcass=st.getQuestItemsCount(MONSTER_EYE_CARCASS)
-     lenses=st.getQuestItemsCount(MONSTER_EYE_LENS)
-     gizzard=st.getQuestItemsCount(BASILISK_GIZZARD)
-     if carcass+lenses+gizzard > 0 :
-        st.giveItems(ADENA,30*carcass+2000*lenses+75*gizzard)
-        st.takeItems(MONSTER_EYE_CARCASS,-1)
-        st.takeItems(MONSTER_EYE_LENS,-1)
-        st.takeItems(BASILISK_GIZZARD,-1)
-        htmltext = "30436-05.htm"
-     else:
-        htmltext = "30436-04.htm"
-   return htmltext
-
- def onKill(self,npc,player,isPet):
-   st = player.getQuestState(qn)
-   if not st : return 
-   if st.getState() != State.STARTED : return 
-   
-   npcId = npc.getNpcId()
-   n = self.getRandom(100)
-   if npcId == 20055 :
-     if n<51 :
-      st.playSound("ItemSound.quest_itemget")
-      if n<50 :
-         st.giveItems(MONSTER_EYE_CARCASS,1)
-      else :
-         st.giveItems(MONSTER_EYE_LENS,1)
-   elif npcId == 20059 :
-     if n<55 :
-      st.playSound("ItemSound.quest_itemget")
-      if n<54 :
-         st.giveItems(MONSTER_EYE_CARCASS,1)
-      else :
-         st.giveItems(MONSTER_EYE_LENS,1)
-   elif npcId == 20067 :
-     if n<69 :
-      st.playSound("ItemSound.quest_itemget")
-      if n<67 :
-         st.giveItems(MONSTER_EYE_CARCASS,1)
-      else :
-         st.giveItems(MONSTER_EYE_LENS,1)
-   elif npcId == 20068 :
-     if n<74 :
-      st.playSound("ItemSound.quest_itemget")
-      if n<72 :
-         st.giveItems(MONSTER_EYE_CARCASS,1)
-      else :
-         st.giveItems(MONSTER_EYE_LENS,1)
-   elif npcId == 20070 :
-      if n<50 :
-         st.giveItems(BASILISK_GIZZARD,1)
-         st.playSound("ItemSound.quest_itemget")
-   elif npcId == 20072 :
-      if n<53 :
-         st.giveItems(BASILISK_GIZZARD,1)
-         st.playSound("ItemSound.quest_itemget")
-   return
-
-QUEST       = Quest(328,qn,"Sense For Business")
-
-QUEST.addStartNpc(30436)
-QUEST.addTalkId(30436)
-
-for i in [ 20055,20059,20067,20068,20070,20072 ] :
-    QUEST.addKillId(i)

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/328_SenseForBusiness/30436-01.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00328_SenseForBusiness/30436-01.htm

@@ -1,5 +1,5 @@
 <html><body>Trader Sarien:<br>
 I know it is hard to believe, but a long time ago southern Gludio also used to be fertile farmland. However, as you can see, now it is nothing more than barren wasteland. It may seem like barren land to normal people, but true businessmen like me find opportunities in any place.<br>
-I believe there are valuable commodities to be found here in the Wastelands that cannot be found elsewhere. If I am able to find them, I may begin a<font color="LEVEL"> new business</font> here. When that time comes, I may need your help.<br>
+I believe there are valuable commodities to be found here in the Wastelands that cannot be found elsewhere. If I am able to find them, I may begin a <font color="LEVEL">new business</font> here. When that time comes, I may need your help.<br>
 (Quest for characters level 21 and above.)
 </body></html>

+ 3 - 2
L2J_DataPack_BETA/dist/game/data/scripts/quests/328_SenseForBusiness/30436-02.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00328_SenseForBusiness/30436-02.htm

@@ -1,4 +1,5 @@
 <html><body>Trader Sarien:<br>
 I know it is hard to believe, but a long time ago southern Gludio also used to be fertile farmland. However, as you can see, now it is nothing more than barren wastelands. It may seem like barren land to normal people, but true businessmen like me find opportunities in any place.<br>
-In the end, I was able to find something valuable in these Wastelands that could not be found elsewhere. Therefore I have decided to begin a<font color="LEVEL"> new business</font> here. I would like to have a reliable partner. What do you think about working with me?<br>
-<a action="bypass -h Quest 328_SenseForBusiness 30436-03.htm">Accept proposal</a></body></html>
+In the end, I was able to find something valuable in these Wastelands that could not be found elsewhere. Therefore I have decided to begin a <font color="LEVEL">new business</font> here. I would like to have a reliable partner. What do you think about working with me?<br>
+<a action="bypass -h Quest Q00328_SenseForBusiness 30436-03.htm">Accept proposal</a>
+</body></html>

+ 4 - 3
L2J_DataPack_BETA/dist/game/data/scripts/quests/328_SenseForBusiness/30436-03.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00328_SenseForBusiness/30436-03.htm

@@ -1,6 +1,7 @@
 <html><body>Trader Sarien:<br>
 Good. Spit on the ground and shake on it. Now we have a contract with the goddess of earth, Maphr, as our witness. Now listen to what I have to say.<br>
-Do you remember the eight basic ingredients used for magic research I told you about earlier? We can find some of them in this area. If you'll hunt<font color="LEVEL"> monster eyes</font>, you can get their useful<font color="LEVEL"> monster eye carcasses,</font> and once in a while, you can even obtain a<font color="LEVEL">monster eye lens</font>, and this is a very valuable item. They say Dwarves use these to make something called "eye glasses."<br>
-Also, if you hunt the<font color="LEVEL"> basilisk</font>, you can get its gizzard. The basilisk swallows the pebbles of the wastelands to aid its digestion, but inside, they are mixed with jade shards. So we can obtain jade from the<font color="LEVEL"> basilisk gizzard</font>.<br>
+Do you remember the eight basic ingredients used for magic research I told you about earlier? We can find some of them in this area. If you'll hunt <font color="LEVEL">monster eyes</font>, you can get their useful <font color="LEVEL">monster eye carcasses,</font> and once in a while, you can even obtain a <font color="LEVEL">monster eye lens</font>, and this is a very valuable item. They say Dwarves use these to make something called "eye glasses."<br>
+Also, if you hunt the <font color="LEVEL">basilisk</font>, you can get its gizzard. The basilisk swallows the pebbles of the wastelands to aid its digestion, but inside, they are mixed with jade shards. So we can obtain jade from the <font color="LEVEL">basilisk gizzard</font>.<br>
 You can find monster eyes on the coast near here. The basilisk can be found within the Wastelands. There are also monster eyes in the Wastelands, but they are much more dangerous than those on the coast, so you must be careful. But you may be able to find items that are that much more precious, so it is worth taking the challenge to hunt<br>
-From now on, the items you bring to me I will sell to the Ivory Tower. I have already signed a contract with the magicians of the Ivory Tower and fixed the price as well. I will give you 30% of the item price I have agreed to take. So please bring back as much as possible. Well then, may the blessing of the earth be with you, partner.</body></html>
+From now on, the items you bring to me I will sell to the Ivory Tower. I have already signed a contract with the magicians of the Ivory Tower and fixed the price as well. I will give you 30% of the item price I have agreed to take. So please bring back as much as possible. Well then, may the blessing of the earth be with you, partner.
+</body></html>

+ 5 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00328_SenseForBusiness/30436-04.html

@@ -0,0 +1,5 @@
+<html><body>Trader Sarien:<br>
+Ho, why are your hands empty, partner? Were you not supposed to find me <font color="LEVEL">monster eye carcasses</font> and <font color="LEVEL">lenses</font>, and the <font color="LEVEL">gizzards of the basilisk</font>? You aren't going to quit by any chance, are you?<br>
+<a action="bypass -h Quest Q00328_SenseForBusiness 30436-06.html">Say you will quit</a><br>
+<a action="bypass -h Quest Q00328_SenseForBusiness 30436-07.html">Say you will continue</a>
+</body></html>

+ 3 - 2
L2J_DataPack_BETA/dist/game/data/scripts/quests/328_SenseForBusiness/30436-05.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00328_SenseForBusiness/30436-05.html

@@ -1,4 +1,5 @@
 <html><body>Trader Sarien:<br>
 Come, partner. I am glad you have returned safely from the rugged land. First, relax and catch your breath. As your sack is bulging, you must have gathered quite a few products. Let us take a look at the outcome of the hunt! As promised, I will pay you according to how many items you brought.<br>
-<a action="bypass -h Quest 328_SenseForBusiness 30436-06.htm">Say you will quit</a><br>
-<a action="bypass -h Quest 328_SenseForBusiness 30436-07.htm">Say you will continue</a></body></html>
+<a action="bypass -h Quest Q00328_SenseForBusiness 30436-06.html">Say you will quit</a><br>
+<a action="bypass -h Quest Q00328_SenseForBusiness 30436-07.html">Say you will continue</a>
+</body></html>

+ 2 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/328_SenseForBusiness/30436-06.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00328_SenseForBusiness/30436-06.html

@@ -1,2 +1,3 @@
 <html><body>Trader Sarien:<br>
-I am sorry to hear that. And there I was, thinking I had met a partner whom I could work with for a long time. However, I have no choice but to look for another partner ... Well, I wish you happiness in your future.</body></html>
+I am sorry to hear that. And there I was, thinking I had met a partner whom I could work with for a long time. However, I have no choice but to look for another partner... Well, I wish you happiness in your future.
+</body></html>

+ 2 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/328_SenseForBusiness/30436-07.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00328_SenseForBusiness/30436-07.html

@@ -1,2 +1,3 @@
 <html><body>Trader Sarien:<br>
-Then please continue your efforts. I must look for a coach that will deliver the products to Oren's Ivory Tower. I must earn more money to achieve the large business I have planned in my head.</body></html>
+Then please continue your efforts. I must look for a coach that will deliver the products to Oren's Ivory Tower. I must earn more money to achieve the large business I have planned in my head.
+</body></html>

+ 171 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00328_SenseForBusiness/Q00328_SenseForBusiness.java

@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2004-2013 L2J DataPack
+ * 
+ * This file is part of L2J DataPack.
+ * 
+ * L2J DataPack 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.
+ * 
+ * L2J DataPack 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.Q00328_SenseForBusiness;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.quest.Quest;
+import com.l2jserver.gameserver.model.quest.QuestState;
+import com.l2jserver.gameserver.model.quest.State;
+
+/**
+ * Sense for Business (328)
+ * @author xban1x
+ */
+public class Q00328_SenseForBusiness extends Quest
+{
+	// NPCs
+	private static final int SARIEN = 30436;
+	private static final Map<Integer, int[]> MONSTER_EYES = new HashMap<>();
+	private static final Map<Integer, Integer> MONSTER_BASILISKS = new HashMap<>();
+	// @formatter:off
+	static
+	{
+		MONSTER_EYES.put(20055, new int[] { 61, 62 });
+		MONSTER_EYES.put(20059, new int[] { 61, 62 });
+		MONSTER_EYES.put(20067, new int[] { 72, 74 });
+		MONSTER_EYES.put(20068, new int[] { 78, 79 });
+		MONSTER_BASILISKS.put(20070, 60);
+		MONSTER_BASILISKS.put(20072, 63);
+	}
+	// @formatter:on
+	// Items
+	private static final int MONSTER_EYE_CARCASS = 1347;
+	private static final int MONSTER_EYE_LENS = 1366;
+	private static final int BASILISK_GIZZARD = 1348;
+	// Misc
+	private static final int MONSTER_EYE_CARCASS_ADENA = 25;
+	private static final int MONSTER_EYE_LENS_ADENA = 1000;
+	private static final int BASILISK_GIZZARD_ADENA = 60;
+	private static final int BONUS = 618;
+	private static final int BONUS_COUNT = 10;
+	private static final int MIN_LVL = 21;
+	
+	public Q00328_SenseForBusiness(int questId, String name, String descr)
+	{
+		super(questId, name, descr);
+		addStartNpc(SARIEN);
+		addTalkId(SARIEN);
+		addKillId(MONSTER_EYES.keySet());
+		addKillId(MONSTER_BASILISKS.keySet());
+		registerQuestItems(MONSTER_EYE_CARCASS, MONSTER_EYE_LENS, BASILISK_GIZZARD);
+	}
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		final QuestState st = player.getQuestState(getName());
+		String htmltext = null;
+		if (st != null)
+		{
+			switch (event)
+			{
+				case "30436-03.htm":
+				{
+					st.startQuest();
+					htmltext = event;
+					break;
+				}
+				case "30436-06.html":
+				{
+					st.exitQuest(true, true);
+					htmltext = event;
+					break;
+				}
+			}
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onTalk(L2Npc npc, L2PcInstance player)
+	{
+		final QuestState st = player.getQuestState(getName());
+		String htmltext = getNoQuestMsg(player);
+		if (st != null)
+		{
+			switch (st.getState())
+			{
+				case State.CREATED:
+				{
+					htmltext = player.getLevel() < MIN_LVL ? "30436-01.htm" : "30436-02.htm";
+					break;
+				}
+				case State.STARTED:
+				{
+					final long carcass = st.getQuestItemsCount(MONSTER_EYE_CARCASS);
+					final long lens = st.getQuestItemsCount(MONSTER_EYE_LENS);
+					final long gizzards = st.getQuestItemsCount(BASILISK_GIZZARD);
+					if ((carcass + lens + gizzards) > 0)
+					{
+						st.giveAdena(((carcass * MONSTER_EYE_CARCASS_ADENA) + (lens * MONSTER_EYE_LENS_ADENA) + (gizzards * BASILISK_GIZZARD_ADENA) + ((carcass + lens + gizzards) >= BONUS_COUNT ? BONUS : 0)), true);
+						takeItems(player, -1, MONSTER_EYE_CARCASS, MONSTER_EYE_LENS, BASILISK_GIZZARD);
+						htmltext = "30436-05.html";
+					}
+					else
+					{
+						htmltext = "30436-04.html";
+					}
+					break;
+				}
+			}
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
+	{
+		final QuestState st = player.getQuestState(getName());
+		if ((st != null) && st.isStarted())
+		{
+			final int chance = getRandom(100);
+			if (MONSTER_EYES.containsKey(npc.getNpcId()))
+			{
+				if (chance < MONSTER_EYES.get(npc.getNpcId())[0])
+				{
+					st.giveItems(MONSTER_EYE_CARCASS, 1);
+					st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
+				}
+				else if (chance < MONSTER_EYES.get(npc.getNpcId())[1])
+				{
+					st.giveItems(MONSTER_EYE_LENS, 1);
+					st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
+				}
+			}
+			else if (MONSTER_BASILISKS.containsKey(npc.getNpcId()))
+			{
+				if (chance < MONSTER_BASILISKS.get(npc.getNpcId()))
+				{
+					st.giveItems(BASILISK_GIZZARD, 1);
+					st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
+				}
+			}
+		}
+		return super.onKill(npc, player, isPet);
+	}
+	
+	public static void main(String[] args)
+	{
+		new Q00328_SenseForBusiness(328, Q00328_SenseForBusiness.class.getSimpleName(), "Sense for Business");
+	}
+}