Index: dist/game/data/scripts/quests/Q309_ForAGoodCause/32647-08.htm =================================================================== --- dist/game/data/scripts/quests/Q309_ForAGoodCause/32647-08.htm (revision 8398) +++ dist/game/data/scripts/quests/Q309_ForAGoodCause/32647-08.htm (working copy) @@ -1,6 +1,7 @@ Apprentice Atra:
Ah, you've finally returned! What would you like to do next?
-Receive rewards.
+Check reward list.
+Receive Moirai Robe Set ingredient item (requires 100 Mucrokian skins).
Continue with the task.
Stop the quest. \ No newline at end of file Index: dist/game/data/scripts/quests/Q309_ForAGoodCause/32647-10.htm =================================================================== --- dist/game/data/scripts/quests/Q309_ForAGoodCause/32647-10.htm (revision 8398) +++ dist/game/data/scripts/quests/Q309_ForAGoodCause/32647-10.htm (working copy) @@ -2,8 +2,31 @@ You must be in a hurry. Anyway, the reward items are as follows: You can choose an item of your choice if you have enough Mucrokian Hide or Contaminated Mucrokian Hide.
Contaminated Mucrokian Hide will be double the price of the other hides. Except, Contaminated Mucrokian Hide will be settled first during the settlement.
What would you like?
-Recipe - Sealed Dynasty Earring(70%)(Requires 346 Mucrokian Hides)
-Recipe - Sealed Dynasty Necklace(70%)(Requires 462 Mucrokian Hides)
-Recipe - Sealed Dynasty Ring(70%)(Requires 232 Mucrokian Hides)
-Recipe - Sealed Dynasty Sigil(60%)(Requires 372 Mucrokian Hides) +Recipe - Sealed Dynasty Earring(70%)(Requires 96 Fallen Mucrokian Hides)
+Recipe - Sealed Dynasty Earring(70%)(Requires 192 Mucrokian Hides)
346 +Recipe - Sealed Dynasty Necklace(70%)(Requires 128 Fallen Mucrokian Hides)
+Recipe - Sealed Dynasty Necklace(70%)(Requires 256 Mucrokian Hides)
462 +Recipe - Sealed Dynasty Ring(70%)(Requires 64 Fallen Mucrokian Hides)
+Recipe - Sealed Dynasty Ring(70%)(Requires 128 Mucrokian Hides)
232 +Recipe - Sealed Dynasty Sigil(60%)(Requires 103 Fallen Mucrokian Hides) +Recipe - Sealed Dynasty Sigil(60%)(Requires 206 Mucrokian Hides)372 + +Recipe - Sealed Morai Circlet (60%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Circlet (60%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Tunic (60%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Tunic (60%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Stockings (60%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Stockings (60%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Gloves (60%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Gloves (60%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Shoes (60%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Shoes (60%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Sigil (60%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Sigil (60%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Ring (70%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Ring (70%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Earring (70%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Earring (70%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Necklace (70%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Necklace (70%)(Requires 180 Mucrokian Hides) \ No newline at end of file Index: dist/game/data/scripts/quests/Q309_ForAGoodCause/32647-11.htm =================================================================== --- dist/game/data/scripts/quests/Q309_ForAGoodCause/32647-11.htm (revision 8398) +++ dist/game/data/scripts/quests/Q309_ForAGoodCause/32647-11.htm (working copy) @@ -2,8 +2,31 @@ You can choose an item of your choice if you have enough Mucrokian Hides or Contaminated Mucrokian Hides.
Contaminated Mucrokian Hide are worth more and count as much as double of a normal Mucrokian Hide. In fact, we tend to favor those more and they will be deducted first those first before accepting normal Mucrokian Hides.
What would you like?
-Recipe - Sealed Dynasty Earring(70%)(Requires 288 Mucrokian Hides)
-Recipe - Sealed Dynasty Necklace(70%)(Requires 384 Mucrokian Hides)
-Recipe - Sealed Dynasty Ring(70%)(Requires 192 Mucrokian Hides)
-Recipe - Sealed Dynasty Sigil(60%)(Requires 310 Mucrokian Hides) +Recipe - Sealed Dynasty Earring(70%)(Requires 96 Fallen Mucrokian Hides)
+Recipe - Sealed Dynasty Earring(70%)(Requires 192 Mucrokian Hides)
346 +Recipe - Sealed Dynasty Necklace(70%)(Requires 128 Fallen Mucrokian Hides)
+Recipe - Sealed Dynasty Necklace(70%)(Requires 256 Mucrokian Hides)
462 +Recipe - Sealed Dynasty Ring(70%)(Requires 64 Fallen Mucrokian Hides)
+Recipe - Sealed Dynasty Ring(70%)(Requires 128 Mucrokian Hides)
232 +Recipe - Sealed Dynasty Sigil(60%)(Requires 103 Fallen Mucrokian Hides) +Recipe - Sealed Dynasty Sigil(60%)(Requires 206 Mucrokian Hides)372 + +Recipe - Sealed Morai Circlet (60%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Circlet (60%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Tunic (60%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Tunic (60%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Stockings (60%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Stockings (60%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Gloves (60%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Gloves (60%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Shoes (60%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Shoes (60%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Sigil (60%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Sigil (60%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Ring (70%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Ring (70%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Earring (70%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Earring (70%)(Requires 180 Mucrokian Hides) +Recipe - Sealed Morai Necklace (70%)(Requires 90 Fallen Mucrokian Hides) +Recipe - Sealed Morai Necklace (70%)(Requires 180 Mucrokian Hides) \ No newline at end of file Index: dist/game/data/scripts/quests/Q309_ForAGoodCause/32647-13.htm =================================================================== --- dist/game/data/scripts/quests/Q309_ForAGoodCause/32647-13.htm (revision 8398) +++ dist/game/data/scripts/quests/Q309_ForAGoodCause/32647-13.htm (working copy) @@ -1,5 +1,6 @@ Apprentice Atra:
How about receiving the reward before you quit? I'm just letting you know since there is an evidence of hunting.
-Submit proofs.
+Check reward list.
+Receive Moirai Robe Set ingredient item (requires 100 Mucrokian skins).
Just quit the task. \ No newline at end of file Index: dist/game/data/scripts/quests/Q309_ForAGoodCause/Q309_ForAGoodCause.java =================================================================== --- dist/game/data/scripts/quests/Q309_ForAGoodCause/Q309_ForAGoodCause.java (revision 0) +++ dist/game/data/scripts/quests/Q309_ForAGoodCause/Q309_ForAGoodCause.java (revision 0) @@ -0,0 +1,348 @@ +/* + * 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 . + */ +package quests.Q309_ForAGoodCause; + +import com.l2jserver.gameserver.model.L2ItemInstance; +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; +import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate; +import com.l2jserver.gameserver.util.Util; +import com.l2jserver.util.Rnd; + +/** + * @author nonom + */ + +public class Q309_ForAGoodCause extends Quest +{ + private static final String qn = "309_ForAGoodCause"; + // NPC's + private static final int _atra = 32647; + + + /* + * Detailed H5 Retail info + * + Recipe - Sealed Dynasty Earrings 70% 96 Fallen Mucrokian Hide + Recipe - Sealed Dynasty Earrings 70% 192 Mucrokain Hide + Recipe - Sealed Dynasty Necklace 70% 128 Fallen Mucrokian Hide + Recipe - Sealed Dynasty Necklace 70% 256 Mucrokian Hide + Recipe - Sealed Dynasty Ring 70% 64 Fallen Muckrokian Hide + Recipe - Sealed Dynasty Ring 70% 128 Muckrokian Hide + Recipe - Sealed Dynasty Sigil 70% 103 Fallen Muckrokian Hide + Recipe - Sealed Dynasty Sigil 70% 206 Muckrokian Hide + + Recipe - Sealed Morai Circlet 60% 90 Fallen Muckrokian Hide + Recipe - Sealed Morai Circlet 60% 180 Muckrokian Hide + Recipe - Sealed Morai Tunic 60% 90 Fallen Muckrokian Hide + Recipe - Sealed Morai Tunic 60% 180 Muckrokian Hide + Recipe - Sealed Morai Stockings 60% 90 Fallen Muckrokian Hide + Recipe - Sealed Morai Stockings 60% 180 Muckrokian Hide + Recipe - Sealed Morai Gloves 60% 90 Fallen Muckrokian Hide + Recipe - Sealed Morai Gloves 60% 180 Muckrokian Hide + Recipe - Sealed Morai Shoes 60 % 90 Fallen Muckrokian Hide + Recipe - Sealed Morai Shoes 60% 180 Muckrokian Hide + Recipe - Sealed Morai Sigil 60% 90 Fallen Muckrokian Hide + Recipe - Sealed Morai Sigil 60% 180 Muckrokian Hide + Recipe - Sealed Morai Ring 70% 90 Fallen Muckrokian Hide + Recipe - Sealed Morai Ring 70% 180 Muckrokian Hide + Recipe - Sealed Morai Earring 70% 90 Fallen Muckrokian Hide + Recipe - Sealed Morai Earring 70% 180 Muckrokian Hide + Recipe - Sealed Morai Necklace 70% 90 Fallen Muckrokian Hide + Recipe - Sealed Morai Necklace 70% 180 Muckrokian Hide + + */ + + //Rewards + private static final int[] MUCROKIANS = {22650, 22651, 22652, 22653}; + private static final int MUCROKIAN_FANATIC = 22650; + private static final int MUCROKIAN_ASCETIC = 22651; + private static final int MUCROKIAN_SAVIOR = 22652; + private static final int MUCROKIAN_PREACHER = 22653; + private static final int CONTAMINATED_MUCROKIAN = 22654; + private static final int CHANGED_MUCROKIAN = 22655; + + private static final int MUCROKIAN_HIDE = 14873; + private static final int FALLEN_MUCROKIAN_HIDE = 14874; + + private static final int MUCROKIAN_HIDE_CHANCE = 85; + private static final int FALLEN_HIDE_CHANCE = 85; + + private static final int REC_DYNASTY_EARRINGS_70 = 9985; + private static final int REC_DYNASTY_NECKLACE_70 = 9986; + private static final int REC_DYNASTY_RING_70 = 9987; + private static final int REC_DYNASTY_SIGIL_60 = 10115; + + private static final int REC_MOIRAI_CIRCLET_60 = 15777; + private static final int REC_MOIRAI_TUNIC_60 = 15780; + private static final int REC_MOIRAI_STOCKINGS_60 = 15783; + private static final int REC_MOIRAI_GLOVES_60 = 15786; + private static final int REC_MOIRAI_SHOES_60 = 15789; + private static final int REC_MOIRAI_SIGIL_60 = 15790; + private static final int REC_MOIRAI_EARRING_70 = 15814; + private static final int REC_MOIRAI_NECKLACE_70 = 15813; + private static final int REC_MOIRAI_RING_70 = 15812; + + private static final int[] MOIRAI_PIECES = {15645,15646,15647,15648,15649,15650,15651,15652,15653,15654}; + + public Q309_ForAGoodCause(int questId, String name, String descr) + { + super(questId, name, descr); + + addStartNpc(_atra); + addTalkId(_atra); + + addKillId(MUCROKIAN_FANATIC); + addKillId(MUCROKIAN_ASCETIC); + addKillId(MUCROKIAN_SAVIOR); + addKillId(MUCROKIAN_PREACHER); + addKillId(CONTAMINATED_MUCROKIAN); + addKillId(CHANGED_MUCROKIAN); + } + + @Override + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) + { + String htmltext = event; + QuestState st = player.getQuestState(qn); + QuestState qs = player.getQuestState("239_WontYouJoinUs"); + + if (st == null || qs == null) + return htmltext; + + if (event.equalsIgnoreCase("32020-03.htm")) + { + st.setState(State.STARTED); + st.set("cond", "1"); + st.playSound("ItemSound.quest_accept"); + } + else if (event.equalsIgnoreCase("claimreward")) + { + if (qs != null) + if (qs.getState() == State.COMPLETED) + htmltext = "32647-11.htm"; + else + htmltext = "32647-10.htm"; + + htmltext = "32647-09.htm"; + } + else if (event.equalsIgnoreCase("claimreward")) + { + if (Integer.parseInt(event) == 288 || Integer.parseInt(event) == 346) + player.addItem("Quest Item", REC_DYNASTY_EARRINGS_70, 1, npc,false); + + htmltext = "32647-09.htm"; + } + else if (event.equalsIgnoreCase("receivepiece")) + { + //Guess 4 + exchangeQuesItems(player, npc, MOIRAI_PIECES[Rnd.get(MOIRAI_PIECES.length-1)], 4, MUCROKIAN_HIDE, 100); + } + else if(isIntNumber(event)) + { + if (Integer.parseInt(event) == 96) + exchangeQuesItems(player, npc, REC_DYNASTY_EARRINGS_70, 1, FALLEN_MUCROKIAN_HIDE, Integer.parseInt(event)); + else if (Integer.parseInt(event) == 192) + exchangeQuesItems(player, npc, REC_DYNASTY_EARRINGS_70, 1, MUCROKIAN_HIDE, Integer.parseInt(event)); + else if (Integer.parseInt(event) == 128) + exchangeQuesItems(player, npc, REC_DYNASTY_NECKLACE_70, 1, FALLEN_MUCROKIAN_HIDE, Integer.parseInt(event)); + else if (Integer.parseInt(event) == 256) + exchangeQuesItems(player, npc, REC_DYNASTY_NECKLACE_70, 1, MUCROKIAN_HIDE, Integer.parseInt(event)); + else if (Integer.parseInt(event) == 64) + exchangeQuesItems(player, npc, REC_DYNASTY_RING_70, 1, FALLEN_MUCROKIAN_HIDE, Integer.parseInt(event)); + else if (Integer.parseInt(event) == 128) + exchangeQuesItems(player, npc, REC_DYNASTY_RING_70, 1, MUCROKIAN_HIDE, Integer.parseInt(event)); + else if (Integer.parseInt(event) == 103) + exchangeQuesItems(player, npc, REC_DYNASTY_SIGIL_60, 1, FALLEN_MUCROKIAN_HIDE, Integer.parseInt(event)); + else if (Integer.parseInt(event) == 296) + exchangeQuesItems(player, npc, REC_DYNASTY_SIGIL_60, 1, MUCROKIAN_HIDE, Integer.parseInt(event)); + } + else if(event.startsWith("circlet")) + { + if (event.endsWith("90")) + exchangeQuesItems(player, npc, REC_MOIRAI_CIRCLET_60, 1, FALLEN_MUCROKIAN_HIDE, 90); + else if (event.endsWith("180")) + exchangeQuesItems(player, npc, REC_MOIRAI_CIRCLET_60, 1, MUCROKIAN_HIDE, 180); + } + else if(event.startsWith("stockings")) + { + if (event.endsWith("90")) + exchangeQuesItems(player, npc, REC_MOIRAI_STOCKINGS_60, 1, FALLEN_MUCROKIAN_HIDE, 90); + else if (event.endsWith("180")) + exchangeQuesItems(player, npc, REC_MOIRAI_STOCKINGS_60, 1, MUCROKIAN_HIDE, 180); + } + else if(event.startsWith("tunic")) + { + if (event.endsWith("90")) + exchangeQuesItems(player, npc, REC_MOIRAI_TUNIC_60, 1, FALLEN_MUCROKIAN_HIDE, 90); + else if (event.endsWith("180")) + exchangeQuesItems(player, npc, REC_MOIRAI_TUNIC_60, 1, MUCROKIAN_HIDE, 180); + } + else if(event.startsWith("gloves")) + { + if (event.endsWith("90")) + exchangeQuesItems(player, npc, REC_MOIRAI_GLOVES_60, 1, FALLEN_MUCROKIAN_HIDE, 90); + else if (event.endsWith("180")) + exchangeQuesItems(player, npc, REC_MOIRAI_GLOVES_60, 1, MUCROKIAN_HIDE, 180); + } + else if(event.startsWith("shoes")) + { + if (event.endsWith("90")) + exchangeQuesItems(player, npc, REC_MOIRAI_SHOES_60, 1, FALLEN_MUCROKIAN_HIDE, 90); + else if (event.endsWith("180")) + exchangeQuesItems(player, npc, REC_MOIRAI_SHOES_60, 1, MUCROKIAN_HIDE, 180); + } + else if(event.startsWith("sigil")) + { + if (event.endsWith("90")) + exchangeQuesItems(player, npc, REC_MOIRAI_SIGIL_60, 1, FALLEN_MUCROKIAN_HIDE, 90); + else if (event.endsWith("180")) + exchangeQuesItems(player, npc, REC_MOIRAI_SIGIL_60, 1, MUCROKIAN_HIDE, 180); + } + else if(event.startsWith("earring")) + { + if (event.endsWith("90")) + exchangeQuesItems(player, npc, REC_MOIRAI_EARRING_70, 1, FALLEN_MUCROKIAN_HIDE, 90); + else if (event.endsWith("180")) + exchangeQuesItems(player, npc, REC_MOIRAI_EARRING_70, 1, MUCROKIAN_HIDE, 180); + } + else if(event.startsWith("necklace")) + { + if (event.endsWith("90")) + exchangeQuesItems(player, npc, REC_MOIRAI_NECKLACE_70, 1, FALLEN_MUCROKIAN_HIDE, 90); + else if (event.endsWith("180")) + exchangeQuesItems(player, npc, REC_MOIRAI_NECKLACE_70, 1, MUCROKIAN_HIDE, 180); + } + else if(event.startsWith("ring")) + { + if (event.endsWith("90")) + exchangeQuesItems(player, npc, REC_MOIRAI_RING_70, 1, FALLEN_MUCROKIAN_HIDE, 90); + else if (event.endsWith("180")) + exchangeQuesItems(player, npc, REC_MOIRAI_RING_70, 1, MUCROKIAN_HIDE, 180); + } + else if (event.equalsIgnoreCase("32020-03.htm") || event.equalsIgnoreCase("32020-03.htm")) + { + st.exitQuest(true); + st.playSound("ItemSound.quest_finish"); + } + return htmltext; + } + + protected boolean isIntNumber(String num){ + try{ + Integer.parseInt(num); + } catch(NumberFormatException nfe) { + return false; + } + return true; + } + + + @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() == _atra) + { + switch (st.getState()) + { + case State.CREATED: + QuestState _prev = player.getQuestState("308_ReedFieldMaintenance"); + if ((_prev != null) && (_prev.getState() == State.COMPLETED)) + htmltext = "32647-17.htm"; + else + htmltext = "Miss HTM here"; + + case State.STARTED: + if (st.getInt("cond") == 0) + if (player.getLevel() >= 82) + htmltext = "32647-01.htm"; + else + htmltext = "32647-00.htm"; + else if (st.getQuestItemsCount(MUCROKIAN_HIDE) >= 1 || st.getQuestItemsCount(FALLEN_MUCROKIAN_HIDE) >= 1) + htmltext = "32647-08.htm"; + else + htmltext = "32647-06.htm"; + break; + case State.COMPLETED: + htmltext = "32647-15.htm"; + break; + } + } + return htmltext; + } + + public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) + { + + QuestState st = player.getQuestState(qn); + + if (st == null) + return null; + + if(st.getInt("cond") == 1) + { + if (Util.contains(MUCROKIANS,npc.getNpcId())) + if (st.getRandom(100) < MUCROKIAN_HIDE_CHANCE){ + st.giveItems(MUCROKIAN_HIDE,1); + st.playSound("ItemSound.quest_itemget"); + } + else if (npc.getNpcId()==CHANGED_MUCROKIAN) + if (st.getRandom(100) < FALLEN_HIDE_CHANCE){ + st.giveItems(FALLEN_MUCROKIAN_HIDE,1); + st.playSound("ItemSound.quest_itemget"); + } + else if (npc.getNpcId()==CONTAMINATED_MUCROKIAN) + if (st.getRandom(100) < 10){ + st.giveItems(MUCROKIAN_HIDE,1); + st.playSound("ItemSound.quest_itemget"); + } + } + + return super.onKill(npc, player, isPet); + } + + private void exchangeQuesItems(L2PcInstance player, L2Npc npc, int giveid, int givequanty, int takeid, int takequanty) + { + + L2ItemInstance Item = player.getInventory().destroyItemByItemId("MucrokianHide", takeid, takequanty, player, npc); + + if (Item != null) + { + // Prepare inventory update packet + InventoryUpdate playerIU = new InventoryUpdate(); + playerIU.addRemovedItem(Item); + + // Add new Item + Item = player.getInventory().addItem("Recipe", giveid, givequanty, player, npc); + playerIU.addItem(Item); + + // Send inventory update packet + player.sendPacket(playerIU); + } + } + + public static void main(String[] args) + { + new Q309_ForAGoodCause(309, qn, "For A Good Cause"); + } +} Index: dist/game/data/scripts/quests/Q309_ForAGoodCause/__init__.py =================================================================== --- dist/game/data/scripts/quests/Q309_ForAGoodCause/__init__.py (revision 8398) +++ dist/game/data/scripts/quests/Q309_ForAGoodCause/__init__.py (working copy) @@ -1,150 +0,0 @@ -#Created by Bloodshed -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 = "309_ForAGoodCause" - -ATRA = 32647 - -MUCROKIANS = [22650, 22651, 22652, 22653] -MUCROKIAN_FANATIC = 22650 -MUCROKIAN_ASCETIC = 22651 -MUCROKIAN_SAVIOR = 22652 -MUCROKIAN_PREACHER = 22653 -CONTAMINATED_MUCROKIAN = 22654 -CHANGED_MUCROKIAN = 22655 - -MUCROKIAN_HIDE = 14873 -FALLEN_MUCROKIAN_HIDE = 14874 - -MUCROKIAN_HIDE_CHANCE = 50 -FALLEN_HIDE_CHANCE = 50 - -REC_DYNASTY_EARRINGS_70 = 9985 -REC_DYNASTY_NECKLACE_70 = 9986 -REC_DYNASTY_RING_70 = 9987 -REC_DYNASTY_SIGIL_60 = 10115 - -class Quest (JQuest) : - - def __init__(self,id,name,descr): - JQuest.__init__(self,id,name,descr) - self.questItemIds = [MUCROKIAN_HIDE, FALLEN_MUCROKIAN_HIDE] - - def onRecipeExchangeRequest (self,event,st,recipe) : - h1 = st.getQuestItemsCount(MUCROKIAN_HIDE) - h2 = st.getQuestItemsCount(FALLEN_MUCROKIAN_HIDE) - if h2 >= 1: - if h2 >= (int(event)/2) : - st.giveItems(recipe,1) - st.takeItems(FALLEN_MUCROKIAN_HIDE,(int(event)/2)) - st.playSound("ItemSound.quest_finish") - return "32647-16.htm" - else : - h1a = int(event) - (h2*2) - if h1 >= h1a : - st.giveItems(recipe,1) - st.takeItems(FALLEN_MUCROKIAN_HIDE,h2) - st.takeItems(MUCROKIAN_HIDE,h1a) - st.playSound("ItemSound.quest_finish") - return "32647-16.htm" - else : - return "32647-15.htm" - elif h1 >= int(event) : - st.giveItems(recipe,1) - st.takeItems(MUCROKIAN_HIDE,int(event)) - st.playSound("ItemSound.quest_finish") - return "32647-16.htm" - else : - return "32647-15.htm" - - def onAdvEvent (self,event,npc,player) : - htmltext = event - st = player.getQuestState(qn) - qs = player.getQuestState("239_WontYouJoinUs") - if not st : return - if event == "32647-05.htm" : - self.questItemIds = [MUCROKIAN_HIDE, FALLEN_MUCROKIAN_HIDE] - st.set("cond","1") - st.setState(State.STARTED) - st.playSound("ItemSound.quest_accept") - elif event == "claimreward" : - if qs : - if qs.getState() == State.COMPLETED : - htmltext = "32647-11.htm" - else : - htmltext = "32647-10.htm" - else : - htmltext = "32647-09.htm" - elif event.isdigit() : - if int(event) == 288 or int(event) == 346 : - htmltext = self.onRecipeExchangeRequest(event,st,REC_DYNASTY_EARRINGS_70) - elif int(event) == 384 or int(event) == 462 : - htmltext = self.onRecipeExchangeRequest(event,st,REC_DYNASTY_NECKLACE_70) - elif int(event) == 192 or int(event) == 232 : - htmltext = self.onRecipeExchangeRequest(event,st,REC_DYNASTY_RING_70) - elif int(event) == 310 or int(event) == 372 : - htmltext = self.onRecipeExchangeRequest(event,st,REC_DYNASTY_SIGIL_60) - elif event == "32647-14.htm" or event == "32647-07.htm" : - self.questItemIds = [] #NPC Quest Cancel does not remove the collected Quest Items. - st.exitQuest(1) - st.playSound("ItemSound.quest_finish") - return htmltext - - def onTalk (self,npc,player) : - htmltext = Quest.getNoQuestMsg(player) - st = player.getQuestState(qn) - if not st : return htmltext - - npcId = npc.getNpcId() - cond = st.getInt("cond") - qs2 = player.getQuestState("308_ReedFieldMaintenance") - if npcId == ATRA : - if qs2 and qs2.getState() == State.STARTED : - htmltext = "32647-17.htm" - elif cond == 0 : - if player.getLevel() >= 82 : - htmltext = "32647-01.htm" - else : - htmltext = "32647-00.htm" - st.exitQuest(1) - elif st.getState() == State.STARTED : - if st.getQuestItemsCount(MUCROKIAN_HIDE) >= 1 or st.getQuestItemsCount(FALLEN_MUCROKIAN_HIDE) >= 1: - htmltext = "32647-08.htm" - else : - htmltext = "32647-06.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() - cond = st.getInt("cond") - if cond == 1 and npcId in MUCROKIANS : - if st.getRandom(100) < MUCROKIAN_HIDE_CHANCE : - st.giveItems(MUCROKIAN_HIDE,1) - st.playSound("ItemSound.quest_itemget") - elif cond == 1 and npcId == CHANGED_MUCROKIAN : - if st.getRandom(100) < FALLEN_HIDE_CHANCE : - st.giveItems(FALLEN_MUCROKIAN_HIDE,1) - st.playSound("ItemSound.quest_itemget") - elif cond == 1 and npcId == CONTAMINATED_MUCROKIAN : - if st.getRandom(100) < 10 : - st.giveItems(MUCROKIAN_HIDE,1) - st.playSound("ItemSound.quest_itemget") - return - -QUEST = Quest(309,qn,"For A Good Cause") - -QUEST.addStartNpc(ATRA) -QUEST.addTalkId(ATRA) - -QUEST.addKillId(MUCROKIAN_FANATIC) -QUEST.addKillId(MUCROKIAN_ASCETIC) -QUEST.addKillId(MUCROKIAN_SAVIOR) -QUEST.addKillId(MUCROKIAN_PREACHER) -QUEST.addKillId(CONTAMINATED_MUCROKIAN) -QUEST.addKillId(CHANGED_MUCROKIAN) \ No newline at end of file