Procházet zdrojové kódy

BETA: Quest Sweetest Venom(324) in Java.

Patch by: xban1x
Reviewed by: Zoey76
Zoey76 před 12 roky
rodič
revize
40599d4963

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

@@ -534,7 +534,7 @@ quests/316_DestroyPlaguebringers/__init__.py
 quests/317_CatchTheWind/__init__.py
 quests/319_ScentOfDeath/__init__.py
 quests/320_BonesTellFuture/__init__.py
-quests/324_SweetestVenom/__init__.py
+quests/Q00324_SweetestVenom/Q00324_SweetestVenom.java
 quests/325_GrimCollector/__init__.py
 quests/326_VanquishRemnants/__init__.py
 quests/327_ReclaimTheLand/__init__.py

+ 0 - 3
L2J_DataPack_BETA/dist/game/data/scripts/quests/324_SweetestVenom/30351-04.htm

@@ -1,3 +0,0 @@
-<html><body>Astaron:<br>
-While travelling southwest from the village, you will encounter the<font color="LEVEL"> Altar of Passage</font> of the Dark Elves. There are many<font color="LEVEL"> poison spiders</font> living in the nearby woods. Hunt the spiders and bring me their poison sacs. If you bring me<font color="LEVEL"> ten poison sacs</font>, I will reward you generously.
-</body></html>

+ 0 - 3
L2J_DataPack_BETA/dist/game/data/scripts/quests/324_SweetestVenom/30351-06.htm

@@ -1,3 +0,0 @@
-<html><body>Astaron:<br>
-So you have brought me all ten poison sacs. Thank you. This should be enough to make three or four bottles of the finest dreviant wine. When the wine ages in a few years, I will let you sample it, so don't forget and come see me again. Now, here is the compensation I promised you.
-</body></html>

+ 0 - 77
L2J_DataPack_BETA/dist/game/data/scripts/quests/324_SweetestVenom/__init__.py

@@ -1,77 +0,0 @@
-# Made by Mr. - 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 = "324_SweetestVenom"
-
-VENOM_SAC = 1077
-ADENA = 57
-
-class Quest (JQuest) :
-
- def __init__(self,id,name,descr):
-     JQuest.__init__(self,id,name,descr)
-     self.questItemIds = [VENOM_SAC]
-
- def onEvent (self,event,st) :
-    htmltext = event
-    if event == "30351-04.htm" :
-      st.set("cond","1")
-      st.setState(State.STARTED)
-      st.playSound("ItemSound.quest_accept")
-    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() >= 18 :
-       htmltext = "30351-03.htm"
-     else:
-       htmltext = "30351-02.htm"
-       st.exitQuest(1)
-   else :
-     if st.getQuestItemsCount(VENOM_SAC)<10 :
-       htmltext = "30351-05.htm"
-     else :
-       st.takeItems(VENOM_SAC,-1)
-       st.giveItems(ADENA,5810)
-       st.exitQuest(1)
-       st.playSound("ItemSound.quest_finish")
-       htmltext = "30351-06.htm"
-   return htmltext
-
- def onKill(self,npc,player,isPet):
-   st = player.getQuestState(qn)
-   if not st : return 
-   if st.getState() != State.STARTED : return 
-   
-   chance=22+(((npc.getNpcId()-20000)^34)/4)
-   count=st.getQuestItemsCount(VENOM_SAC)
-   if count < 10 and self.getRandom(100) < chance :
-     st.giveItems(VENOM_SAC,1)
-     if count == 9 :
-       st.playSound("ItemSound.quest_middle")
-       st.set("cond","2")
-     else :
-       st.playSound("ItemSound.quest_itemget")
-   return
-
-QUEST       = Quest(324,qn,"Sweetest Venom")
-
-
-QUEST.addStartNpc(30351)
-
-QUEST.addTalkId(30351)
-
-QUEST.addKillId(20034)
-QUEST.addKillId(20038)
-QUEST.addKillId(20043)

+ 3 - 3
L2J_DataPack_BETA/dist/game/data/scripts/quests/324_SweetestVenom/30351-02.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00324_SweetestVenom/30351-02.html

@@ -1,6 +1,6 @@
 <html><body>Astaron:<br>
-Have you ever tried<font color="LEVEL"> dreviant wine</font>? It's the sweetest, but most dangerous wine that those of my race enjoy drinking. The wine is made from the distilled poison of spiders, you see. Only a few people in the entire continent, including myself, know how to make this wine. I had the opportunity to learn this skill before Patriarch Mitraell was entrapped by that seal. Rumor has it that the drevanul whispered into the Patriarch's ear how to make this precious wine.<br>
-Perhaps it is because the secret has been passed down from the drevanul, but when our brothers who practice the dark arts drink this wine, their understanding of magic is heightened momentarily. Since I am not well versed in magic, I do not know if this is true or not.<br>
-In a few weeks Mr. Vollodos will be importing an order of grapes cultivated from the land of Gludio, and I plan to purchase them and try making a few bottles of dreviant wine for myself. The most difficult ingredient to find is the spider's poison. I may have to ask your help for that...<br>
+Have you ever tried <font color="LEVEL">Dreviant Wine</font>? It's the sweetest, but most dangerous wine that those of my race enjoy drinking. The wine is made from the distilled poison of spiders, you see. Only a few people in the entire continent, including myself, know how to make this wine. I had the opportunity to learn this skill before Hierarch Mitraell was entrapped by that seal. Rumor has it that the Drevanul whispered into the Hierarch's ear how to make this precious wine.<br>
+Perhaps it is because the secret has been passed down from the Drevanul, but when our brothers who practice the dark arts drink this wine, their understanding of magic is heightened momentarily. Since I am not well versed in magic, I do not know if this is true or not.<br>
+In a few weeks Mr. Vollodos will be importing an order of grapes cultivated from the land of Gludio, and I plan to purchase them and try making a few bottles of Dreviant Wine for myself. The most difficult ingredient to find is the spider's poison. I may have to ask your help for that...<br>
 (Quest for characters level 18 and above.)
 </body></html>

+ 4 - 4
L2J_DataPack_BETA/dist/game/data/scripts/quests/324_SweetestVenom/30351-03.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00324_SweetestVenom/30351-03.htm

@@ -1,6 +1,6 @@
 <html><body>Astaron:<br>
-Have you ever tried<font color="LEVEL"> dreviant wine</font>? It's the sweetest, but most dangerous wine that those of my race enjoy drinking. The wine is made from the distilled poison of spiders, you see. Only a few people in the entire continent, including myself, know how to make this wine. I had the opportunity to learn this skill before Patriarch Mitraell was entrapped by that seal. Rumor has it that the drevanul whispered into the Patriarch's ear how to make this precious wine.<br>
-Perhaps it is because the secret has been passed down from the drevanuls, but when our brothers who practice the dark arts drink this wine, their understanding of magic is heightened momentarily. Since I am not well versed in magic, I do not know if this is true or not.<br>
-A few days ago Trader Vollodos received a shipment of grapes cultivated in the Human land of Gludio, and I am thinking of purchasing them to make a few bottles of dreviant wine. The most difficult ingredient to find is the<font color="LEVEL"> spider's poison</font>, and I would like you to take care of that for me. Can you help me?<br>
-<a action="bypass -h Quest 324_SweetestVenom 30351-04.htm">Say you will help</a>
+Have you ever tried <font color="LEVEL">Dreviant Wine</font>? It's the sweetest, but most dangerous wine that those of my race enjoy drinking. The wine is made from the distilled poison of spiders, you see. Only a few people in the entire continent, including myself, know how to make this wine. I had the opportunity to learn this skill before Hierarch Mitraell was entrapped by that seal. Rumor has it that the Drevanul whispered into the Hierarch's ear how to make this precious wine.<br>
+Perhaps it is because the secret has been passed down from the Drevanuls, but when our brothers who practice the dark arts drink this wine, their understanding of magic is heightened momentarily. Since I am not well versed in magic, I do not know if this is true or not.<br>
+A few days ago Trader Vollodos received a shipment of grapes cultivated in the Human land of Gludio, and I am thinking of purchasing them to make a few bottles of Dreviant Wine. The most difficult ingredient to find is the <font color="LEVEL">spider's poison</font>, and I would like you to take care of that for me. Can you help me?<br>
+<a action="bypass -h Quest Q00324_SweetestVenom 30351-04.htm">Say you will help</a>
 </body></html>

+ 3 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00324_SweetestVenom/30351-04.htm

@@ -0,0 +1,3 @@
+<html><body>Astaron:<br>
+While travelling southwest from the village, you will encounter the <font color="LEVEL">Altar of Passage</font> of the Dark Elves. There are many <font color="LEVEL">poison spiders</font> living in the nearby woods. Hunt the spiders and bring me their Poison Sacs. If you bring me <font color="LEVEL">ten Poison Sacs</font>, I will reward you generously.
+</body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/324_SweetestVenom/30351-05.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00324_SweetestVenom/30351-05.html

@@ -1,3 +1,3 @@
 <html><body>Astaron:<br>
-You agreed to collect<font color="LEVEL"> ten poison sacs</font> for me, right? Have you found them all yet? Well, there's no need to rush. They say there are many poison spiders near the Altar of Passage of the Dark Elves.
+You agreed to collect <font color="LEVEL">ten Poison Sacs</font> for me, right? Have you found them all yet? Well, there's no need to rush. They say there are many poison spiders near the Altar of Passage of the Dark Elves.
 </body></html>

+ 3 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00324_SweetestVenom/30351-06.html

@@ -0,0 +1,3 @@
+<html><body>Astaron:<br>
+So you have brought me all ten Poison Sacs. Thank you. This should be enough to make three or four bottles of the finest Dreviant Wine. When the wine ages in a few years, I will let you sample it, so don't forget and come see me again. Now, here is the compensation I promised you.
+</body></html>

+ 141 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q00324_SweetestVenom/Q00324_SweetestVenom.java

@@ -0,0 +1,141 @@
+/*
+ * 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.Q00324_SweetestVenom;
+
+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;
+
+/**
+ * Sweetest Venom (324)
+ * @author xban1x
+ */
+public class Q00324_SweetestVenom extends Quest
+{
+	// NPCs
+	private static final int ASTARON = 30351;
+	// Monsters
+	private static final Map<Integer, Integer> MONSTERS = new HashMap<>();
+	static
+	{
+		MONSTERS.put(20034, 26);
+		MONSTERS.put(20038, 29);
+		MONSTERS.put(20043, 30);
+	}
+	// Items
+	private static final int VENOM_SAC = 1077;
+	// Misc
+	private static final int MIN_LVL = 18;
+	private static final int REQUIRED_COUNT = 10;
+	private static final int ADENA_COUNT = 5810;
+	
+	public Q00324_SweetestVenom(int questId, String name, String descr)
+	{
+		super(questId, name, descr);
+		addStartNpc(ASTARON);
+		addTalkId(ASTARON);
+		addKillId(MONSTERS.keySet());
+		registerQuestItems(VENOM_SAC);
+	}
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		final QuestState st = player.getQuestState(getName());
+		String htmltext = null;
+		if (st != null)
+		{
+			if (event.equals("30351-04.htm"))
+			{
+				st.startQuest();
+				htmltext = event;
+			}
+		}
+		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 ? "30351-02.html" : "30351-03.htm";
+					break;
+				}
+				case State.STARTED:
+				{
+					if (st.isCond(2))
+					{
+						st.giveAdena(ADENA_COUNT, true);
+						st.exitQuest(true, true);
+						htmltext = "30351-06.html";
+					}
+					else
+					{
+						htmltext = "30351-05.html";
+					}
+					break;
+				}
+			}
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
+	{
+		final QuestState st = player.getQuestState(getName());
+		if ((st != null) && st.isCond(1))
+		{
+			long sacs = st.getQuestItemsCount(VENOM_SAC);
+			if (sacs < REQUIRED_COUNT)
+			{
+				if (getRandom(100) < MONSTERS.get(npc.getNpcId()))
+				{
+					st.giveItems(VENOM_SAC, 1);
+					if ((++sacs) < REQUIRED_COUNT)
+					{
+						st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
+					}
+					else
+					{
+						st.setCond(2, true);
+					}
+				}
+			}
+		}
+		return super.onKill(npc, player, isPet);
+	}
+	
+	public static void main(String[] args)
+	{
+		new Q00324_SweetestVenom(324, Q00324_SweetestVenom.class.getSimpleName(), "Sweetest Venom");
+	}
+}