diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-01.htm b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-01.htm new file mode 100644 index 0000000000..ab2283a9fa --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-01.htm @@ -0,0 +1,6 @@ +Wilbert:
+Hey, you, traveler! Come over here, my friend.
+You look a little bored. Not sure how what to do with yourself?
+How about we play a little game that's pretty popular in these parts? I think you'll enjoy it.
+ + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-02.htm b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-02.htm new file mode 100644 index 0000000000..9ecdc53349 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-02.htm @@ -0,0 +1,4 @@ +Wilbert:
+From times to time, we enjoy a duel game called The Battle of Sun and Moon. It's pretty popular in these parts, in case you haven't heard of it. I've found it a great way to pass the time when you're between jobs. Just say the word and I'll teach you everything you need to know. What do you say?
+ + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-03.htm b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-03.htm new file mode 100644 index 0000000000..6016fd2bd8 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-03.htm @@ -0,0 +1,7 @@ +Wilbert:
+All right! If that's what you want, I'll let you join in.
+You can't be ready for the game already, can you? You're not thinking of joining in without bringing anything to the table, are you? You have to get one item if you want to enjoy a game with us. It's not so hard to find, but we need to have Spirit Beads to make weapons. I'll give you the details another time, but for now, go to the Ancient Battleground and the Field of Massacre and get some Spirit Beads from the undead and the demons.
+Didn't I explain it well enough?
+ + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-04.htm b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-04.htm new file mode 100644 index 0000000000..65356056d2 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-04.htm @@ -0,0 +1,10 @@ +Wilbert:
+When a being's thought or spirit energy comes together into the shape of a bead, we call that a Spirit Bead. Artisans like me need them to make good weapons. That's why we gamble with them -- as they're worth a lot to us. In this area, they say that you can easily get Spirit Beads if uou fo to the Ancient Battleground and the Field of Massacre.
+At the Ancient Battleground, you can obtain Spirit Beads from the undead known as Knights of the Past, Ghostly Warriors, Starving Corpses, Dark Guards, Death Agents and Nihil Invaders and from the demons known as Bloody Loards, Bloody Priests, Bloody Knights and Bloody Ghosts.
+At the Field of Massacre, you can obtain Spirit Beads from the undead known as Doom Scouts, Doom Servants, Doom Guards, Doom Archers, Doom Troopers, Doom Warriors, Doom Knights, Archers of Destruction, Spiteful Soul Leaders, Spiteful Soul Wizards and Spiteful Soul Fighters.
+I think that's enough information for you to get started. Is there anything else you'd like to know?
+ + + + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-05.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-05.html new file mode 100644 index 0000000000..be15023fd0 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-05.html @@ -0,0 +1,12 @@ +Wilbert:
+Actually, we once played this game using the images on the Spirit Beads themselves, but it became easier to just use cards marked with images of Suns or Moons. Listen up! There are 10 types of cards, each marked with 1 to 5 pictures of the Sun or Moon. here's how to play.
+First, xards are deatl to each person in order. The last card drawn is placed face up.
+Check how many pictures your cards have on them.
+If there is more than one more card with 5 pictures on it, the person who got the card last wins.
+Simple, eh ?
+Anything else you'd like to know?
+ + + + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-06.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-06.html new file mode 100644 index 0000000000..c827931938 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-06.html @@ -0,0 +1,5 @@ +Wilbert:
+Let's start then! First, give me 1 Spirit Bead. Now pick any card you want from this box. You know the rules, right?
+When you're ready, go ahead and draw a card.
+ + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-07.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-07.html new file mode 100644 index 0000000000..a53a2998b1 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-07.html @@ -0,0 +1,9 @@ +Wilbert:
+The card that you took out is: %player_card%.
+%table% +
+So that's how you play the game. Pretty simple, eh? If you want to join a real game, let me know.
+ + + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-08.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-08.html new file mode 100644 index 0000000000..feb8019690 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-08.html @@ -0,0 +1,3 @@ +Wilbert:
+You need 50 spirit beads to play. I can plaintly see that you don't have enough; why don't you go get some more and come back? + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-09.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-09.html new file mode 100644 index 0000000000..2e974740c5 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-09.html @@ -0,0 +1,8 @@ +Wilbert:
+You know that you need a Spirit Bead to play the game, right? Now, why you don't you go get some so we can get started?
+Go to the Ancient Battleground and the Fields of Massacre and get some Spirit Bead from the undead and the demons.
+ + + + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-10.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-10.html new file mode 100644 index 0000000000..af001a3218 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-10.html @@ -0,0 +1,3 @@ +Wilbert:
+Well, it's a shame that you want to stop. if you want to play again, come by any time. I certanly enjoyed it! + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-11.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-11.html new file mode 100644 index 0000000000..f6ce1a7c55 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-11.html @@ -0,0 +1,5 @@ +Wilbert:
+What's he matter? You started the game, so you should finish it. Are you really going to quit now?
+ + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-12.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-12.html new file mode 100644 index 0000000000..fea69d0671 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-12.html @@ -0,0 +1,4 @@ +Wilbert:
+Very well. You look very tired.
+Come back when you are rested. I'll be waiting for you here. + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-13.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-13.html new file mode 100644 index 0000000000..878ea5a45e --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-13.html @@ -0,0 +1,3 @@ +Wilbert:
+Don't even think about coming over here if you don't have any beads! + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-14.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-14.html new file mode 100644 index 0000000000..591afe4d7d --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-14.html @@ -0,0 +1,17 @@ +Wilbert:
+If you win the game, the master running it owes you the appropriate amount. The higher the round, the bigger the payout. That's why the game only allows you to win up to 8 rounds in a row. If -- and that's a big if -- you manage to win 8 straight times, the game will end.
+Keep in mind that if you lose any of the rounds, you get nothing. That's fair warning, my friend. Here's how the prize system works:
+1 winning round: 40,000 Adena +2 winning rounds: 80,000 Adena +3 winning rounds: 110,000 Adena, D-grade Enchant Weapon Scroll +4 winning rounds: 199,000 Adena, C-grade Enchant Weapon Scroll +5 winning rounds: 388,000 Adena, 1 recipe for a B-grade Weapon +6 winning rounds: 675,000 Adena, 1 essential ingredient for a B-grade Weapon +7 winning rounds: 1,284,000 Adena, 2 B-grade Enchant Weapon Scrolls, 2 B-grade Enchant Armor Scrolls +8 winning rounds: 2,384,000 Adena, 1 A-grade Enchant Weapon Scroll, 2 A-grade Enchant Armor Scrolls
+My advice is to identify what you'd like to win and then to play for that prize. Any questions?
+ + + + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-15.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-15.html new file mode 100644 index 0000000000..d9b761b106 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-15.html @@ -0,0 +1,5 @@ +Wilbert:
+Well then, ready to get started? I see you've already put in the 50 spirit beads you need to play. Excellent!
+Whenever you're ready, my friend, draw your card.
+ + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-16.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-16.html new file mode 100644 index 0000000000..7625262ffe --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-16.html @@ -0,0 +1,8 @@ +Wilbert:
+Ah! Thank the gods, it's my turn again. You drew: %player_card%.
+The cards on the table are:
+%table% +
+Can I draw my card now?
+ + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-17.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-17.html new file mode 100644 index 0000000000..a64cfb1ca5 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-17.html @@ -0,0 +1,8 @@ +Wilbert:
+Oh well... Ah, it's your turn again. I drew: %npc_card%
+The cards on the table are:
+%table% +
+Draw a card.
+ + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-18.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-18.html new file mode 100644 index 0000000000..b3b10a5261 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-18.html @@ -0,0 +1,10 @@ +Wilbert:>
+Let's see, now... The card you drew is %player_card%.
+The cards on the table are:
+%table% +
+Dragons spore! You've won. If my luck stays this bad, I'm going to have a lot of explaining to do to the missus!
+By my reckonin', you have %win_count% consecutive wins. Do you want to quit? Or would you like to keep playing?
+ + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-19.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-19.html new file mode 100644 index 0000000000..fc4812cfe0 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-19.html @@ -0,0 +1,5 @@ +Wilbert:
+First just let me warm up a little. Ah... that's better. Let's play! Whenever you're ready, my friend...
+ + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-20.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-20.html new file mode 100644 index 0000000000..9ed8f78fde --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-20.html @@ -0,0 +1,6 @@ +Wilbert:
+My my, you're doing very well, aren't you? I bet you could take everything I have if this keeps up! Well, here are your winnings.
+Say, how about we keep playing?
+ + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-21.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-21.html new file mode 100644 index 0000000000..9dcf1ab03e --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-21.html @@ -0,0 +1,7 @@ +Wilbert:
+Let's see here... The card I took out is: %npc_card%.
+%table% +
+Luck! Looks like I win. It was a good game, though, eh? If you'd like to play again, feel free to challenge me.
+ + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-22.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-22.html new file mode 100644 index 0000000000..a493cc46a4 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-22.html @@ -0,0 +1,7 @@ +Wilbert:
+Whew! Thankfully, it's my turn again. The card you drew is: %player_card%. The cards on table are:
+Can I draw my card now?
+ + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-23.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-23.html new file mode 100644 index 0000000000..6ca32783b1 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-23.html @@ -0,0 +1,7 @@ +Wilbert:
+Ok, now it's your turn. I drew: %npc_card%. The cards on the table are:
+%table% +
+Can I draw my card now?
+ + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-24.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-24.html new file mode 100644 index 0000000000..ae5ba128c1 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-24.html @@ -0,0 +1,9 @@ +Wilbert:
+I drew %npc_card%. The cards on the table are:
+%table% +
+What luck! Looks like I win. Still, it was a pretty exciting practice run, eh? If you want to play again, feel free to challenge me.
+ + + + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-lvl.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-lvl.html new file mode 100644 index 0000000000..2f94c39128 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/30846-lvl.html @@ -0,0 +1,4 @@ +Wilbert:
+Hey there! Yeah, you, traveler! When you're a little less gree, come see me for some excitement you won't soon forget.
+(You must be level 50 or abve to start this quest.) + \ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/Q00663_SeductiveWhispers.java b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/Q00663_SeductiveWhispers.java new file mode 100644 index 0000000000..d0e95de970 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/Q00663_SeductiveWhispers.java @@ -0,0 +1,543 @@ +/* + * This file is part of the L2J Mobius project. + * + * 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.Q00663_SeductiveWhispers; + +import java.util.Arrays; +import java.util.stream.Collectors; + +import com.l2jmobius.commons.util.Rnd; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.quest.Quest; +import com.l2jmobius.gameserver.model.quest.QuestState; +import com.l2jmobius.gameserver.model.quest.State; + +/** + * @author Mathael + */ +public class Q00663_SeductiveWhispers extends Quest +{ + // NPC + private static final int WILBERT = 30846; + // Item + private static final int SPIRIT_BEAD = 8766; + // Monsters + private static final int[] MOBS = + { + 20956, + 20955, + 20954, + 20959, + 20958, + 20957, + 20963, + 20962, + 20961, + 20960, + 20976, + 20974, + 20975, + 21006, + 20674, + 21010, + 21009, + 21001, + 21002 + }; + // Rewards + private static final int[] RECIPES_B_GRADE = + { + 5000, + 4966, + 4967, + 4963, + 4968, + 5005, + 4969, + 5007, + 4971, + 5008, + 4970, + 5006, + 5001, + 4972, + 4964, + 5002, + 5003, + 4965, + 5004 + }; + private static final int[] PART_B_GRADE = + { + 4114, + 4107, + 4108, + 1104, + 4109, + 4119, + 4110, + 4121, + 4112, + 2120, + 4111, + 4120, + 4115, + 4113, + 4105, + 4116, + 4117, + 4106, + 4118 + }; + // Misc + private static final Card[] cards = new Card[10]; + static + { + cards[0] = new Card(Side.MOON, 1); + cards[1] = new Card(Side.SUN, 1); + cards[2] = new Card(Side.MOON, 2); + cards[3] = new Card(Side.SUN, 2); + cards[4] = new Card(Side.MOON, 3); + cards[5] = new Card(Side.SUN, 3); + cards[6] = new Card(Side.MOON, 4); + cards[7] = new Card(Side.SUN, 4); + cards[8] = new Card(Side.MOON, 5); + cards[9] = new Card(Side.SUN, 5); + } + private int winCount = 0; + private Card playerCard = null; + private Card npcCard = null; + + public Q00663_SeductiveWhispers() + { + super(663); + addStartNpc(WILBERT); + addTalkId(WILBERT); + addKillId(MOBS); + addCondMinLevel(50, "30846-lvl.html"); + } + + @Override + public String onTalk(L2Npc npc, L2PcInstance talker) + { + String htmltext = getNoQuestMsg(talker); + final QuestState qs = getQuestState(talker, true); + if (qs == null) + { + return htmltext; + } + + switch (qs.getState()) + { + case State.CREATED: + { + htmltext = "30846-01.htm"; + break; + } + case State.STARTED: + { + htmltext = "30846-09.html"; + break; + } + } + + return htmltext; + } + + @Override + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) + { + final QuestState qs = getQuestState(player, false); + if (qs == null) + { + return getNoQuestMsg(player); + } + + switch (event) + { + case "30846-02.htm": + case "30846-04.htm": + case "30846-05.html": + case "30846-11.html": + case "30846-12.html": + case "30846-14.html": + case "30846-19.html": + { + break; + } + case "30846-03.htm": + { + qs.startQuest(); + break; + } + case "30846-10.html": + { + qs.exitQuest(true, true); + break; + } + case "30846-06.html": + { + // practice + if (getQuestItemsCount(player, SPIRIT_BEAD) < 1) + { + event = "30846-13.html"; + } + else + { + takeItems(player, SPIRIT_BEAD, 1); + } + break; + } + case "30846-22.html": + { + if (playerCard == null) + { + playerCard = cards[Rnd.get(0, 9)]; + } + else + { + playerCard = getRandomCard(); + } + event = play(player, true, true); + break; + } + case "30846-23.html": + { + if (npcCard == null) + { + npcCard = playerCard; // to avoid same card when getRandomCard() + npcCard = getRandomCard(); + } + else + { + npcCard = getRandomCard(); + } + event = play(player, false, true); + break; + } + case "30846-15.html": + { + if (getQuestItemsCount(player, SPIRIT_BEAD) < 50) + { + event = "30846-08.html"; + } + else + { + takeItems(player, SPIRIT_BEAD, 50); + } + break; + } + case "30846-16.html": + { + // Player draw a card (Always player start first !!) + if (playerCard == null) + { + playerCard = cards[Rnd.get(0, 9)]; + } + else + { + playerCard = getRandomCard(); + } + event = play(player, true, false); + break; + } + case "30846-17.html": + { + // npc draw card + if (npcCard == null) + { + npcCard = playerCard; // to avoid same card when getRandomCard() + npcCard = getRandomCard(); + } + else + { + npcCard = getRandomCard(); + } + + event = play(player, false, false); + break; + } + case "30846-20.html": + { + if (winCount > 0) + { + giveRewards(player, winCount); + winCount = 0; + } + reset(false); + break; + } + case "30846-21.html": + { + reset(true); + break; + } + } + + return event; + } + + public String play(L2PcInstance player, boolean isPlayerTurn, boolean isPractice) + { + boolean isPlayerWin = false; + boolean isNpcWin = false; + String htmltext; + String table = getHtm(player.getHtmlPrefix(), "table.html"); + + if (isPlayerTurn) + { + if ((playerCard != null) && isWinner(playerCard, npcCard, true)) + { + if (isPractice) + { + rewardItems(player, 57, 800); + } + else + { + winCount++; + } + + if (winCount == 8) + { + // Cant win more than 8 consecutive game (I don't know html after 8 wins (too hard) -> give reward and show main page) + giveRewards(player, winCount); + reset(true); + return "30846-05.html"; + } + + isPlayerWin = true; + htmltext = getHtm(player.getHtmlPrefix(), isPractice ? "30846-07.html" : "30846-18.html"); + htmltext = htmltext.replace("%table%", table); + htmltext = htmltext.replaceAll("%win_count%", "" + winCount); + } + else + { + htmltext = getHtm(player.getHtmlPrefix(), isPractice ? "30846-22.html" : "30846-16.html"); + htmltext = htmltext.replace("%table%", table); + } + } + else + { + if ((playerCard != null) && (npcCard != null) && isWinner(playerCard, npcCard, false)) + { + htmltext = getHtm(player.getHtmlPrefix(), isPractice ? "30846-24.html" : "30846-21.html"); + htmltext = htmltext.replace("%table%", table); + isNpcWin = true; + } + else + { + htmltext = getHtm(player.getHtmlPrefix(), isPractice ? "30846-23.html" : "30846-17.html"); + htmltext = htmltext.replace("%table%", table); + } + } + + htmltext = htmltext.replaceAll("%player_name%", player.getName()); + htmltext = htmltext.replaceAll("%player_card%", playerCard.toString()); + htmltext = npcCard == null ? htmltext.replaceAll("%npc_card%", "No such card") : htmltext.replaceAll("%npc_card%", npcCard.toString()); + + if (isPlayerWin) + { + reset(false); + } + if (isNpcWin) + { + reset(true); + } + + return htmltext; + } + + @Override + public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) + { + final QuestState qs = getQuestState(killer, false); + if ((qs != null) && qs.isCond(1)) + { + switch (Rnd.get(0, 5)) + { + case 0: + case 1: + { + break; + } + case 5: + { + giveItems(killer, SPIRIT_BEAD, 2); + break; + } + default: + { + giveItems(killer, SPIRIT_BEAD, 1); + } + } + } + return super.onKill(npc, killer, isSummon); + } + + private void reset(boolean resetCounter) + { + playerCard = null; + npcCard = null; + if (resetCounter) + { + winCount = 0; + } + } + + private Card getRandomCard() + { + final int index = Rnd.get(0, 7); + return Arrays.stream(cards).filter(card -> (!card.equals(playerCard)) && (!card.equals(npcCard))).collect(Collectors.toList()).get(index); + } + + private boolean isWinner(Card playerCard, Card npcCard, boolean playerIsLastDraw) + { + if ((npcCard == null) && playerIsLastDraw && (playerCard.getNumber() == 5)) + { + return true; + } + if ((npcCard != null) && (playerCard.getSide().ordinal() == npcCard.getSide().ordinal())) + { + return (playerCard.getNumber() + npcCard.getNumber()) == 5; + } + else if (playerIsLastDraw) + { + return playerCard.getNumber() == 5; + } + else if (npcCard != null) + { + return npcCard.getNumber() == 5; + } + return false; + } + + private void giveRewards(L2PcInstance player, int consecutiveWin) + { + switch (consecutiveWin) + { + case 1: + { + rewardItems(player, 57, 40000); + break; + } + case 2: + { + rewardItems(player, 57, 80000); + break; + } + case 3: + { + rewardItems(player, 57, 110000); + rewardItems(player, 955, 1); // Enchant Weapon D + break; + } + case 4: + { + rewardItems(player, 57, 199000); + rewardItems(player, 951, 1); // Enchant Weapon C + break; + } + case 5: + { + rewardItems(player, 57, 388000); + rewardItems(player, getRandomRecipeBGrade(), 1); // Recipe Weapon B grade 60% + break; + } + case 6: + { + rewardItems(player, 57, 675000); + rewardItems(player, getRandomPartBGrade(), 1); // one part for making weapon b grade + break; + } + case 7: + { + rewardItems(player, 57, 1284000); + rewardItems(player, 947, 2); // Enchant Weapon B + rewardItems(player, 948, 2); // Enchant Armor B + break; + } + case 8: + { + rewardItems(player, 57, 2384000); + rewardItems(player, 729, 1); // Enchant Weapon A + rewardItems(player, 730, 2); // Enchant Armor A + break; + } + } + } + + private int getRandomRecipeBGrade() + { + return RECIPES_B_GRADE[Rnd.get(0, RECIPES_B_GRADE.length - 1)]; + } + + private int getRandomPartBGrade() + { + return PART_B_GRADE[Rnd.get(0, PART_B_GRADE.length - 1)]; + } + + private enum Side + { + SUN("Sun card"), + MOON("Moon card"); + private String _name; + + Side(String name) + { + _name = name; + } + + public String getName() + { + return _name; + } + } + + private static final class Card + { + private final int _number; + private final Side _side; + + public Card(Side side, int number) + { + _side = side; + _number = number; + } + + public Side getSide() + { + return _side; + } + + public int getNumber() + { + return _number; + } + + @Override + public boolean equals(Object o) + { + return (o instanceof Card) && (((Card) o).getNumber() == _number) && (((Card) o).getSide().ordinal() == _side.ordinal()); + } + + @Override + public String toString() + { + return getSide() == Side.MOON ? "" + getSide().getName() + ": " + getNumber() + "" : "" + getSide().getName() + ": " + getNumber() + ""; + } + } +} diff --git a/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/table.html b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/table.html new file mode 100644 index 0000000000..d1263f2258 --- /dev/null +++ b/trunk/dist/game/data/scripts/quests/Q00663_SeductiveWhispers/table.html @@ -0,0 +1,10 @@ + + + + + + + + + +
[Wilbert][%player_name%]
%npc_card%%player_card%
\ No newline at end of file diff --git a/trunk/dist/game/data/scripts/quests/QuestMasterHandler.java b/trunk/dist/game/data/scripts/quests/QuestMasterHandler.java index 112c861813..33217805c4 100644 --- a/trunk/dist/game/data/scripts/quests/QuestMasterHandler.java +++ b/trunk/dist/game/data/scripts/quests/QuestMasterHandler.java @@ -156,6 +156,7 @@ import quests.Q00648_AnIceMerchantsDream.Q00648_AnIceMerchantsDream; import quests.Q00650_ABrokenDream.Q00650_ABrokenDream; import quests.Q00652_AnAgedExAdventurer.Q00652_AnAgedExAdventurer; import quests.Q00662_AGameOfCards.Q00662_AGameOfCards; +import quests.Q00663_SeductiveWhispers.Q00663_SeductiveWhispers; import quests.Q00688_DefeatTheElrokianRaiders.Q00688_DefeatTheElrokianRaiders; import quests.Q00757_TriolsMovement.Q00757_TriolsMovement; import quests.Q00760_BlockTheExit.Q00760_BlockTheExit; @@ -479,6 +480,7 @@ public class QuestMasterHandler Q00650_ABrokenDream.class, Q00652_AnAgedExAdventurer.class, Q00662_AGameOfCards.class, + Q00663_SeductiveWhispers.class, Q00688_DefeatTheElrokianRaiders.class, Q00757_TriolsMovement.class, Q00760_BlockTheExit.class,