From 5ba730689316d766a0ead1c5d0c17fb5f8727f32 Mon Sep 17 00:00:00 2001 From: Rumen Nikiforov <unafraid89@gmail.com> Date: Sun, 13 Nov 2011 13:37:11 +0000 Subject: [PATCH] BETA: Updating quest 252 It Smells Delicious by corbin12 and thanks to Zoey76 and VLight. --- .../Q252_ItSmellsDelicious/30200-01.htm | 8 +- .../Q252_ItSmellsDelicious/30200-02.htm | 9 +- .../Q252_ItSmellsDelicious/30200-03.htm | 8 +- .../Q252_ItSmellsDelicious/30200-04.htm | 8 +- .../Q252_ItSmellsDelicious/30200-05.htm | 14 +- .../Q252_ItSmellsDelicious/30200-06.htm | 9 +- .../Q252_ItSmellsDelicious/30200-07.htm | 8 +- .../Q252_ItSmellsDelicious/30200-08.htm | 9 +- .../Q252_ItSmellsDelicious.java | 169 +++++++++++++----- 9 files changed, 142 insertions(+), 100 deletions(-) diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-01.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-01.htm index 1ad1ed502d..676abe28f7 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-01.htm +++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-01.htm @@ -1,11 +1,7 @@ -<html><head> -<body> -Guard Stan:<br> +<html><head><body>Guard Stan:<br> Smell that? Sweet salvation, that's what it smells like to me. Like a juicy slice of heaven, wrapped in honey by angels and turned into an aroma. Hm... I smell it every Thursday. Sadly, I've never tasted it. A lesser man would have gone mad by now. MAD I say!!<br> I don't know what it is, but they cook it over at the Sel Mahum Training Grounds. When I close my eyes I dream of this smell.<br> -<a action="bypass -h Quest 252_ItSmellsDelicious 30200-04.htm">Ask about the Sel Mahum Training Grounds.</a> -</body> -</html> \ No newline at end of file +<a action="bypass -h Quest Q252_ItSmellsDelicious 30200-04.htm">Ask about the Sel Mahum Training Grounds.</a></body></html> diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-02.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-02.htm index 1b0d80e4e1..fcc3379009 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-02.htm +++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-02.htm @@ -1,7 +1,2 @@ -<html><head> -<body> -Guard Stan:<br> -Hmm… I don't think you have the nose to track down this delicious smell for me.<br> -(Only characters level 82 or above can take this quest.) -</body> -</html> \ No newline at end of file +<html><head><body>Guard Stan:<br>Hmm… I don't think you have the nose to track down this delicious smell for me.<br> +(Only characters level 82 or above can take this quest.)</body></html> diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-03.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-03.htm index 8fdd729d65..f9759b5564 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-03.htm +++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-03.htm @@ -1,7 +1,3 @@ -<html><head> -<body> -Guard Stan:<br> +<html><head><body>Guard Stan:<br> My love affair with salmon soup is all because of you. And so is this incremental weight gain in my thighs and midsection. But still, thanks! <br> -(You have already completed this quest.) -</body> -</html> \ No newline at end of file +(You have already completed this quest.)</body></html> diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-04.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-04.htm index 6c28ef18f3..92bc67cf74 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-04.htm +++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-04.htm @@ -1,12 +1,8 @@ -<html><head> -<body> -Guard Stan:<br> +<html><head><body>Guard Stan:<br> What? Oh, sorry. It's just... Someone cooked something and it smells REALLY good. But yes, we called it Skyshadow Meadow until the Sel Mahums started using it for battle training. Gave it some goofy name… Sel Mahum Training Grounds I think. Should have named it 'What the hell is that delicious smell??'.<br> Hey, good buddy of mine, how about a little adventure? Find what is making that yummy smell and bring it to me? PLEASE?<br> -<a action="bypass -h Quest 252_ItSmellsDelicious 30200-05.htm">Sure, I like smell games.</a> -</body> -</html> +<a action="bypass -h Quest Q252_ItSmellsDelicious 30200-05.htm">Sure, I like smell games.</a></body></html> diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-05.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-05.htm index 5ae96945ae..af19b45fe5 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-05.htm +++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-05.htm @@ -1,13 +1,7 @@ -<html><head> -<body> -Guard Stan:<br> +<html><head><body>Guard Stan:<br> As I expected, they're cooking the dish over their campfires. The soup will -soon be mine!<br> -Search their pockets for the recipe. I think the <font color="LEVEL">Sel Mahum Squad Leaders</font> +soon be mine!<br>Search their pockets for the recipe. I think the <font color="LEVEL">Sel Mahum Squad Leaders</font> might keep it with them. They tend to hang around the campfires gobbling up soup. The <font color="LEVEL"> Sel Mahum Chef</font> is another possibility. He carries around the soup and serves it to the squad leaders. -I can taste victory already... it will be ours and so will the soup!<br> -Some of the Sel Mahum Squad -Leaders doze off around the fires, careful not to wake them. I'll wait right here. Be careful! -</body> -</html> \ No newline at end of file +I can taste victory already... it will be ours and so will the soup!<br>Some of the Sel Mahum Squad +Leaders doze off around the fires, careful not to wake them. I'll wait right here. Be careful!</body></html> diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-06.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-06.htm index 08402eb248..9982be838d 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-06.htm +++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-06.htm @@ -1,8 +1,5 @@ -<html><head> -<body> -Guard Stan:<br> +<html><head><body>Guard Stan:<br> Did you find it?! But I'm starving!! Man, I am THIS close to abandoning my post and gobbling whatever is making that smell. Just find it and bring it here, please!! I haven't eaten all day and -it smells Y-U-M-M-M-Y!! -</body> -</html> \ No newline at end of file +it smells y-u-m-m-m-y!! +</body></html> diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-07.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-07.htm index 410e7491b4..e393008370 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-07.htm +++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-07.htm @@ -1,11 +1,7 @@ -<html><head> -<body> -Guard Stan:<br> +<html><head><body>Guard Stan:<br> Well?! I'm dying here! Smells so good! I should've eaten breakfast but I slept in. Let me see what you found.<br> Hm these recipe notes are torn, they're hard to read. Maybe if I hm AHA! Salmon soup? That smell was from salmon soup? Hey, help me put these pieces together. I will learn this recipe or DIE TRYING!<br> Grr... wait. Soup like that would have to be... ah, you found some Diary entries too! Let's have a look.<br> -<a action="bypass -h Quest 252_ItSmellsDelicious 30200-08.htm">Ask about the diary.</a> -</body> -</html> \ No newline at end of file +<a action="bypass -h Quest Q252_ItSmellsDelicious 30200-08.htm">Ask about the diary.</a></body></html> diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-08.htm b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-08.htm index bdd6626b43..d2379d4dc2 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-08.htm +++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/30200-08.htm @@ -1,7 +1,5 @@ -<html><head> -<body> -Guard Stan:<br> -<font color="LEVEL">'I LOVE SALMON SOUP!'<br1>' Man, warms you right up! +<html><head><body>Guard Stan:<br> +<font color="LEVEL">'I LOVE SALMON SOUP!'<br1>'Man, warms you right up! I need a napkin.. Nah I'll just lick my face!'<br> 'Salmon soup.. Hmm... my newest favorite of everything...'<br> 'Oohh, I don't feel so good. That campfire is making me nauseous...'</font><br> @@ -9,5 +7,4 @@ Well, it looks like Sel Mahum Squad Leaders are so busy eating soup and resting that they're not training. Thought you should know. Anyway, thank you. In a minute, I'll belch, and taste that salmon soup one more time. MM-mmm. Take this, it's for the soup. -</body> -</html> \ No newline at end of file +</body></html> diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/Q252_ItSmellsDelicious.java b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/Q252_ItSmellsDelicious.java index 1f7606dfe8..6ee2f03e1f 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/Q252_ItSmellsDelicious.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/Q252_ItSmellsDelicious/Q252_ItSmellsDelicious.java @@ -14,6 +14,10 @@ */ package quests.Q252_ItSmellsDelicious; +import javolution.util.FastList; + +import com.l2jserver.gameserver.model.L2Object; +import com.l2jserver.gameserver.model.L2Party; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.quest.Quest; @@ -22,85 +26,105 @@ import com.l2jserver.gameserver.model.quest.State; import com.l2jserver.gameserver.util.Util; import com.l2jserver.util.Rnd; +/** + * @author Dumpster Updated by corbin12 Thanks VLight for help. + */ public class Q252_ItSmellsDelicious extends Quest { - public static final int STAN = 30200; - public static final int MAHUM_DIARY = 15500; - public static final int MAHUM_COOKBOOKP = 15501; - - public static final String qn = "252_ItSmellsDelicious"; + public static final int STAN = 30200; + public static final int MAHUM_DIARY = 15500; + public static final int MAHUM_COOKBOOK = 15501; + + public static final String qn = "Q252_ItSmellsDelicious"; private static final int[] MOBS = - {22786,22787,22788}; - - private static final int CHIEF = 18908; + { + 22786, 22787, 22788 + }; + + private static final int CHEF = 18908; public Q252_ItSmellsDelicious(int id, String name, String descr) { - super(id,name,descr); + super(id, name, descr); addStartNpc(STAN); addTalkId(STAN); - addKillId(CHIEF); - for (int i : MOBS) + addKillId(CHEF); + for (final int i : MOBS) + { addKillId(i); + } } @Override - public String onAdvEvent (String event, L2Npc npc, L2PcInstance player) + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - String htmltext = event; - QuestState st = player.getQuestState(qn); + final String htmltext = event; + final QuestState st = player.getQuestState(qn); if (st == null) + { return htmltext; - + } + if (npc.getNpcId() == STAN) { if (event.equalsIgnoreCase("30200-05.htm")) { - st.set("cond","1"); + st.set("cond", "1"); st.setState(State.STARTED); st.playSound("ItemSound.quest_accept"); } else if (event.equalsIgnoreCase("30200-08.htm")) { st.takeItems(MAHUM_DIARY, -1); - st.takeItems(MAHUM_COOKBOOKP, -1); - st.giveAdena(313355, true); - st.addExpAndSp(56787, 160578); + st.takeItems(MAHUM_COOKBOOK, -1); + st.giveItems(57, 147656); + st.addExpAndSp(716238, 78324); st.playSound("ItemSound.quest_finish"); st.exitQuest(false); - st.setState(State.COMPLETED); } } return htmltext; } @Override - public String onTalk(L2Npc npc,L2PcInstance player) + public String onTalk(L2Npc npc, L2PcInstance player) { String htmltext = getNoQuestMsg(player); - QuestState st = player.getQuestState(qn); + final QuestState st = player.getQuestState(qn); if (st == null) + { return htmltext; + } - if(npc.getNpcId() == STAN) + if (npc.getNpcId() == STAN) { switch (st.getState()) { case State.CREATED: if (player.getLevel() >= 82) + { htmltext = "30200-01.htm"; + } else + { htmltext = "30200-02.htm"; - break; + } + break; case State.STARTED: if (st.getInt("cond") == 1) + { htmltext = "30200-06.htm"; + } else if (st.getInt("cond") == 2) - if ((st.getQuestItemsCount(MAHUM_DIARY) >= 10) && (st.getQuestItemsCount(MAHUM_COOKBOOKP) >= 5)) + { + if ((st.getQuestItemsCount(MAHUM_DIARY) >= 10) && (st.getQuestItemsCount(MAHUM_COOKBOOK) >= 5)) + { htmltext = "30200-07.htm"; - break; + } + } + break; case State.COMPLETED: htmltext = "30200-03.htm"; } @@ -109,40 +133,91 @@ public class Q252_ItSmellsDelicious extends Quest } @Override - public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) + public String onKill(L2Npc npc, L2PcInstance player, boolean isPet) { - QuestState st = player.getQuestState(getName()); - int npcId = npc.getNpcId(); - if (st == null || st.getState() != State.STARTED) - return null; - if (st.getInt("cond") == 1) + final int npcId = npc.getNpcId(); + QuestState st; + if (Util.contains(MOBS, npcId) && (Rnd.get(1000) < 599)) { - if ((Util.contains(MOBS, npcId)) && (Rnd.get(100) < 10) && (st.getQuestItemsCount(MAHUM_DIARY) < 10)) + st = getRandomPartyMemberQuestState(player); + if (st != null) { - st.giveItems(MAHUM_DIARY, 1); - st.playSound("ItemSound.quest_itemget"); - if ((st.getQuestItemsCount(MAHUM_DIARY) >= 10) && (st.getQuestItemsCount(MAHUM_COOKBOOKP) >= 5)) - { - st.set("cond", "2"); - st.playSound("ItemSound.quest_itemget"); - } + st.giveItems(MAHUM_DIARY, 1); + st.playSound("ItemSound.quest_itemget"); + + if ((st.getQuestItemsCount(MAHUM_DIARY) >= 10) && (st.getQuestItemsCount(MAHUM_COOKBOOK) >= 5)) + { + st.set("cond", "2"); + st.playSound("ItemSound.quest_middle"); + } } - else if ((npcId == CHIEF) && (Rnd.get(100) < 5) && (st.getQuestItemsCount(MAHUM_COOKBOOKP) < 5)) + } + else if (npcId == CHEF) + { + st = player.getQuestState(qn); + if ((st != null) && st.isStarted() && (st.getInt("cond") == 1) && (st.getQuestItemsCount(MAHUM_COOKBOOK) < 5) && (Rnd.get(1000) < 360)) { - st.giveItems(MAHUM_COOKBOOKP, 1); + st.giveItems(MAHUM_COOKBOOK, 1); st.playSound("ItemSound.quest_itemget"); - if ((st.getQuestItemsCount(MAHUM_DIARY) >= 10) && (st.getQuestItemsCount(MAHUM_COOKBOOKP) >= 5)) + + if ((st.getQuestItemsCount(MAHUM_DIARY) >= 10) && (st.getQuestItemsCount(MAHUM_COOKBOOK) >= 5)) { st.set("cond", "2"); - st.playSound("ItemSound.quest_itemget"); + st.playSound("ItemSound.quest_middle"); } } } return super.onKill(npc, player, isPet); } - + + private QuestState getRandomPartyMemberQuestState(L2PcInstance player) + { + if (player == null) + { + return null; + } + + final L2Party party = player.getParty(); + QuestState st; + + if ((party == null) || party.getPartyMembers().isEmpty()) + { + st = player.getQuestState(qn); + if ((st == null) || st.isStarted() || (st.getInt("cond") != 1) || (st.getQuestItemsCount(MAHUM_DIARY) >= 10)) + { + return null; + } + return st; + } + + final FastList<QuestState> candidates = new FastList<QuestState>(); + // get the target for enforcing distance limitations. + L2Object target = player.getTarget(); + + if (target == null) + { + target = player; + } + + for (final L2PcInstance partyMember : party.getPartyMembers()) + { + if (partyMember.isDead() || !partyMember.isInsideRadius(target, 1500, true, false)) + { + continue; + } + + st = partyMember.getQuestState(qn); + if ((st == null) || (st.getState() != State.STARTED) || (st.getInt("cond") != 1) || (st.getQuestItemsCount(MAHUM_DIARY) >= 10)) + { + continue; + } + candidates.add(st); + } + return candidates.isEmpty() ? null : candidates.get(Rnd.get(candidates.size())); + } + public static void main(String[] args) { - new Q252_ItSmellsDelicious(252, qn, "It Smells Delicious"); + new Q252_ItSmellsDelicious(252, qn, "It Smells Delicious!"); } -} \ No newline at end of file +} -- GitLab