This commit is contained in:
mobius
2015-01-01 20:02:50 +00:00
parent eeae660458
commit a6a3718849
17894 changed files with 2818932 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
<html><body>Warehouse Chief Klump:<br>
Are you here because you heard the rumor, too? These days, I spend a lot of my time playing cards with the travelers who pass this way. Naturally, there's plenty of reward for those who play a good game. Feel up to a game?<br>
Of course, since you stand to win a fair amount, you can't play for free. That's why it's a game of chance, eh? If you want to play with me, bring me some of those red gems that have recently caught my eye. What do you say? Will you bring me the gems so we can begin?<br>
<a action="bypass -h Quest Q00662_AGameOfCards 30845-03.htm">Say yes.</a>
</body></html>

View File

@@ -0,0 +1,5 @@
<html><body>Warehouse Chief Klump:<br>
Are you here because you heard the rumor, too? These days, I spend a lot of my time playing cards with the travelers who pass this way. Naturally, there's plenty of reward for those who play a good game. Feel up to a game?<br>
Of course, since you stand to win a fair amount, you can't play for free. That's why it's a game of chance, eh? If you want to play with me, bring me some of those red gems that have recently caught my eye. Ahh, but I think this task might be a little to much for you to take on right now. Perhaps another time, eh?<br>
(Only characters level 61 and above are permitted to take on this quest.)
</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Warehouse Chief Klump:<br>
Good! Then collect the Red Beads and bring them to me. There are many monsters from whom you can get get Red Beads, so listen carefully. You can get them by defeating the <font color="LEVEL">Tulben, Hames Orc Scout, Hames Orc Footman, Cursed Guardian, Hames Orc Overlord, Doom Scout, Dismal Pole, Doom Servant, Doom Archer, Doom Warrior, Bloody Queen, Trives, Falibati, Doom Knight, Ghostly Warrior,Bloody Priest, Bloody Knight, Dark Gaurd, Death Agent, Changed Creation, Chimera Piece, Nonexistent Man, Forgotten Ancient People, Shaman of Ancient Times, Antelope, Baffalo, Eye of Splendor, Wisdom of Splendor, Victory of Splendor, Signet of Splendor, Splinter Stakato, Splinter Stakato Soldier, Needle Stakato and Needle Stakato Soldier. To play one game of cards, bring <font color="LEVEL">50 Red Beads</font>. Good luck!
</body></html>

View File

@@ -0,0 +1,7 @@
<html><body>Warehouse Chief Klump:<br>
You haven't collected 50 Red Beads yet. You can get them by defeating the <font color="LEVEL">Tulben, Hames Orc Scout, Hames Orc Footman, Cursed Guardian, Hames Orc Overlord, Doom Scout, Dismal Pole, Doom Servant, Doom Archer, Doom Warrior, Bloody Queen, Trives, Falibati, Doom Knight, Ghostly Warrior,Bloody Priest, Bloody Knight, Dark Gaurd, Death Agent, Changed Creation, Chimera Piece, Nonexistent Man, Forgotten Ancient People, Shaman of Ancient Times, Antelope, Baffalo, Eye of Splendor, Wisdom of Splendor, Victory of Splendor, Signet of Splendor, Splinter Stakato, Splinter Stakato Soldier, Needle Stakato and Needle Stakato Soldier</font>.<br>
<a action="bypass -h Quest Q00662_AGameOfCards 30845-06.html">"I'll come back later."</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards 30845-07.html">"I think I'll quit."</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards 30845-09.html">Listen to an explanation of the rules.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards 30845-09a.html">Learn about the cards.</a>
</body></html>

View File

@@ -0,0 +1,8 @@
<html><body>Warehouse Chief Klump:<br>
Hey, you've brought all 50 red gems. Terrific! What do say? Ready to play some cards?<br>
<a action="bypass -h Quest Q00662_AGameOfCards 30845-10.html">Play cards.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards 30845-08.html">Play next time.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards 30845-09.html">Listen to the explanation of the rules.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards 30845-09a.html">Listen to the story about the cards.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards 30845-09b.html">Ask about evil creatures that you can collect red gems from.</a>
</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Warehouse Chief Klump:<br>
Okay, then. Once you collect all 50 red gems, come back.
</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Warehouse Chief Klump:<br>
Are you quitting? If you ever change your mind, come back any time.
</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Warehouse Chief Klump:<br>
Oh yeah? You're very cautious, I see. This game largely depends on luck, so I think it's a good idea to trust your intuition. When you feel like it, come back and challenge me again.
</body></html>

View File

@@ -0,0 +1,11 @@
<html><body>Warehouse Chief Klump:<br>
It's very simple. There are 70 cards, made up of 5 suits with 14 characters in each suit. You draw 5 cards from the lot, and if you get one of the combination of cards below, you can be rewarded.<br>
Five of a kind: Five cards containing the same character.<br1>
Four of a kind: Four cards containing the same character.<br1>
Full house: Three cards with the same character aLong with two cards with the same character.<br1>
Three of a kind: Three cards with the same character.<br1>
Two pairs: Two pairs of cards with the same characters in each pair.<br1>
One pair: Two cards with the same character.<br>
If you don't have any of the hands I just mentioned, it's called having "no pair", and you don't get anything. Of course, a five of a kind is rare, so the reward for getting it is high; on the other hand, one pair is the easiest hand to get, so you'll receive only the lowest reward.<br>
<a action="bypass -h Quest Q00662_AGameOfCards return">Return.</a>
</body></html>

View File

@@ -0,0 +1,4 @@
<html><body>Warehouse Chief Klump:<br>
Actually, a fellow named Hindemith left these cards. Looks like they have some kind of message on them, but I have no idea what that means... I just use them to play cards... Ha ha ha!<br>
<a action="bypass -h Quest Q00662_AGameOfCards return">Return.</a>
</body></html>

View File

@@ -0,0 +1,4 @@
<html><body>Warehouse Chief Klump:<br>
You can obtain red gems from many evil creatures. Get them by slaying the <font color="LEVEL">Tulben, Hames Orc Scout, Hames Orc Footman, Cursed Guardian, Hames Orc Overlord, Doom Scout, Dismal Pole, Doom Servant, Doom Archer, Doom Warrior, Blood Queen, Trives, Falibati, Doom Knight, Ghostly Warrior, Bloody Priest, Bloody Knight, Dark Guard, Death Agent, Black Shadow, Chimera Piece, Nonexistent Man, Forgotten Ancient People, Shaman of Ancient Times, Antelope, Buffalo, Eye of Splendor, Wisdom of Splendor, Victory of Splendor, Signet of Splendor, Splinter Stakato, Splinter Stakato Soldier, Needle Stakato and Needle Stakato Soldier.</font> To play the card game once, you'll need to bring me <font color="LEVEL">50 red gems</font>.<br>
<a action="bypass -h Quest Q00662_AGameOfCards return">Go back.</a>
</body></html>

View File

@@ -0,0 +1,8 @@
<html><body>Warehouse Chief Klump:<br>
Good thinking! Just let me shuffle the cards...<br>
.<br>
.<br>
.<br>
Ah, there we go! Would you like to cut the deck?<br>
<a action="bypass -h Quest Q00662_AGameOfCards 30845-11.html">Cut the card deck.</a>
</body></html>

View File

@@ -0,0 +1,29 @@
<html><body>Warehouse Chief Klump:<br>
Alrighty, time to play!<br>
Here are your 5 cards, face down. Check all 5 of your cards first, and then show them to me.<br>
<table border="1" border color="white" width=170>
<tr>
<td align="center" width=15>
<font color="ffff00">?</font>
</td>
<td align="center" width=15>
<font color="ffff00">?</font>
</td>
<td align="center" width=15>
<font color="ffff00">?</font>
</td>
<td align="center" width=15>
<font color="ffff00">?</font>
</td>
<td align="center" width=15>
<font color="ffff00">?</font>
</td>
</tr>
</table>
<br>
<a action="bypass -h Quest Q00662_AGameOfCards turncard1">Put the first card face up.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards turncard2">Put the second card face up.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards turncard3">Put the third card face up.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards turncard4">Put the fourth card face up.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards turncard5">Put the fifth card face up.</a>
</body></html>

View File

@@ -0,0 +1,29 @@
<html><body>Warehouse Chief Klump:<br>
Hey, I thought you were checking your cards! Where did you go? Your cards are untouched!<br>
Check all 5 of them and then show them to me.<br>
<table border="1" border color="white" width=170>
<tr>
<td align="center" width=15>
<font color="FontColor1">Cell1</font>
</td>
<td align="center" width=15>
<font color="FontColor2">Cell2</font>
</td>
<td align="center" width=15>
<font color="FontColor3">Cell3</font>
</td>
<td align="center" width=15>
<font color="FontColor4">Cell4</font>
</td>
<td align="center" width=15>
<font color="FontColor5">Cell5</font>
</td>
</tr>
</table>
<br>
<a action="bypass -h Quest Q00662_AGameOfCards turncard1">Put the first card face up.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards turncard2">Put the second card face up.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards turncard3">Put the third card face up.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards turncard4">Put the fourth card face up.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards turncard5">Put the fifth card face up.</a>
</body></html>

View File

@@ -0,0 +1,28 @@
<html><body>Warehouse Chief Klump:<br>
Check all 5 of your cards and then show them to me.<br>
<table border="1" border color="white" width=170>
<tr>
<td align="center" width=15>
<font color="FontColor1">Cell1</font>
</td>
<td align="center" width=15>
<font color="FontColor2">Cell2</font>
</td>
<td align="center" width=15>
<font color="FontColor3">Cell3</font>
</td>
<td align="center" width=15>
<font color="FontColor4">Cell4</font>
</td>
<td align="center" width=15>
<font color="FontColor5">Cell5</font>
</td>
</tr>
</table>
<br>
<a action="bypass -h Quest Q00662_AGameOfCards turncard1">Put the first card face up.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards turncard2">Put the second card face up.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards turncard3">Put the third card face up.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards turncard4">Put the fourth card face up.</a><br>
<a action="bypass -h Quest Q00662_AGameOfCards turncard5">Put the fifth card face up.</a>
</body></html>

View File

@@ -0,0 +1,25 @@
<html><body>Warehouse Chief Klump:<br>
Did you have a look at your cards? Show them to me.<br>
<table border="1" border color="white" width=170>
<tr>
<td align="center" width=15>
<font color="FontColor1">Cell1</font>
</td>
<td align="center" width=15>
<font color="FontColor2">Cell2</font>
</td>
<td align="center" width=15>
<font color="FontColor3">Cell3</font>
</td>
<td align="center" width=15>
<font color="FontColor4">Cell4</font>
</td>
<td align="center" width=15>
<font color="FontColor5">Cell5</font>
</td>
</tr>
</table>
<br>
Hmmmm....? This is... Five of a kind! What luck! The goddess of victory must be with you! Here is your prize! Well earned, well played!<br>
<a action="bypass -h Quest Q00662_AGameOfCards playagain">Play again.</a>
</body></html>

View File

@@ -0,0 +1,25 @@
<html><body>Warehouse Chief Klump:<br>
Did you have a look at your cards? Show them to me.<br>
<table border="1" border color="white" width=170>
<tr>
<td align="center" width=15>
<font color="FontColor1">Cell1</font>
</td>
<td align="center" width=15>
<font color="FontColor2">Cell2</font>
</td>
<td align="center" width=15>
<font color="FontColor3">Cell3</font>
</td>
<td align="center" width=15>
<font color="FontColor4">Cell4</font>
</td>
<td align="center" width=15>
<font color="FontColor5">Cell5</font>
</td>
</tr>
</table>
<br>
Hmmmm...? This is... Four of a kind! Well done, my young friend! That sort of hand doesn't come up very often, that's for sure. Here's your prize.<br>
<a action="bypass -h Quest Q00662_AGameOfCards playagain">Play again.</a>
</body></html>

View File

@@ -0,0 +1,25 @@
<html><body>Warehouse Chief Klump:<br>
Did you have a look at your cards? Show them to me.<br>
<table border="1" border color="white" width=170>
<tr>
<td align="center" width=15>
<font color="FontColor1">Cell1</font>
</td>
<td align="center" width=15>
<font color="FontColor2">Cell2</font>
</td>
<td align="center" width=15>
<font color="FontColor3">Cell3</font>
</td>
<td align="center" width=15>
<font color="FontColor4">Cell4</font>
</td>
<td align="center" width=15>
<font color="FontColor5">Cell5</font>
</td>
</tr>
</table>
<br>
Hmmmm...? This is... A full house? Excellent! You're better than I thought. Here's your prize.<br>
<a action="bypass -h Quest Q00662_AGameOfCards playagain">Play again.</a>
</body></html>

View File

@@ -0,0 +1,25 @@
<html><body>Warehouse Chief Klump:<br>
Did you have a look at your cards? Show them to me.<br>
<table border="1" border color="white" width=170>
<tr>
<td align="center" width=15>
<font color="FontColor1">Cell1</font>
</td>
<td align="center" width=15>
<font color="FontColor2">Cell2</font>
</td>
<td align="center" width=15>
<font color="FontColor3">Cell3</font>
</td>
<td align="center" width=15>
<font color="FontColor4">Cell4</font>
</td>
<td align="center" width=15>
<font color="FontColor5">Cell5</font>
</td>
</tr>
</table>
<br>
Hmmmm...? This is... Three of a kind? You're lucky, I'll say that for you! Here's your prize.<br>
<a action="bypass -h Quest Q00662_AGameOfCards playagain">Play again.</a>
</body></html>

View File

@@ -0,0 +1,25 @@
<html><body>Warehouse Chief Klump:<br>
Did you have a look at your cards? Show them to me.<br>
<table border="1" border color="white" width=170>
<tr>
<td align="center" width=15>
<font color="FontColor1">Cell1</font>
</td>
<td align="center" width=15>
<font color="FontColor2">Cell2</font>
</td>
<td align="center" width=15>
<font color="FontColor3">Cell3</font>
</td>
<td align="center" width=15>
<font color="FontColor4">Cell4</font>
</td>
<td align="center" width=15>
<font color="FontColor5">Cell5</font>
</td>
</tr>
</table>
<br>
Hmmmm...? This is... Two pair? Not bad. Here's your prize.<br>
<a action="bypass -h Quest Q00662_AGameOfCards playagain">Play again.</a>
</body></html>

View File

@@ -0,0 +1,25 @@
<html><body>Warehouse Chief Klump:<br>
Did you have a look at your cards? Show them to me.<br>
<table border="1" border color="white" width=170>
<tr>
<td align="center" width=15>
<font color="FontColor1">Cell1</font>
</td>
<td align="center" width=15>
<font color="FontColor2">Cell2</font>
</td>
<td align="center" width=15>
<font color="FontColor3">Cell3</font>
</td>
<td align="center" width=15>
<font color="FontColor4">Cell4</font>
</td>
<td align="center" width=15>
<font color="FontColor5">Cell5</font>
</td>
</tr>
</table>
<br>
Hmmmm...? This is... One pair? You got lucky this time, but I wonder if it'll last. Here's your prize.<br>
<a action="bypass -h Quest Q00662_AGameOfCards playagain">Play again.</a>
</body></html>

View File

@@ -0,0 +1,25 @@
<html><body>Warehouse Chief Klump:<br>
Did you have a look at your cards? Show them to me.<br>
<table border="1" border color="white" width=170>
<tr>
<td align="center" width=15>
<font color="FontColor1">Cell1</font>
</td>
<td align="center" width=15>
<font color="FontColor2">Cell2</font>
</td>
<td align="center" width=15>
<font color="FontColor3">Cell3</font>
</td>
<td align="center" width=15>
<font color="FontColor4">Cell4</font>
</td>
<td align="center" width=15>
<font color="FontColor5">Cell5</font>
</td>
</tr>
</table>
<br>
Hmmmm...? This is... No pair? Tough luck, my friend! Want to try again? Perhaps your luck will take a turn for the better...<br>
<a action="bypass -h Quest Q00662_AGameOfCards playagain">Play again.</a>
</body></html>

View File

@@ -0,0 +1,8 @@
<html><body>Warehouse Chief Klump:<br>
How about another game? Just let me reshuffle these cards...<br>
.<br>
.<br>
.<br>
Ah, all set. Cut the deck, if you please.<br>
<a action="bypass -h Quest Q00662_AGameOfCards 30845-11.html">Cut the card deck.</a>
</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Warehouse Chief Klump:<br>
Huh? Looks like you've run out of red gems. Too bad! Why don't you collect another 50 red gems and come back, eh?
</body></html>

View File

@@ -0,0 +1,827 @@
/*
* Copyright (C) 2004-2014 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.Q00662_AGameOfCards;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.l2jserver.gameserver.enums.QuestSound;
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.util.Util;
import com.l2jserver.util.Rnd;
/**
* A Game of Cards (662)
* @author Zoey76
*/
public final class Q00662_AGameOfCards extends Quest
{
// NPC
private static final int KLUMP = 30845;
// Items
private static final int RED_GEM = 8765;
private static final int ZIGGOS_GEMSTONE = 8868;
// Misc
private static final int MIN_LEVEL = 61;
private static final int REQUIRED_CHIP_COUNT = 50;
// Monsters
private static final Map<Integer, Integer> MONSTERS = new HashMap<>();
static
{
MONSTERS.put(20672, 357); // Trives
MONSTERS.put(20673, 357); // Falibati
MONSTERS.put(20674, 583); // Doom Knight
MONSTERS.put(20677, 435); // Tulben
MONSTERS.put(20955, 358); // Ghostly Warrior
MONSTERS.put(20958, 283); // Death Agent
MONSTERS.put(20959, 455); // Dark Guard
MONSTERS.put(20961, 365); // Bloody Knight
MONSTERS.put(20962, 348); // Bloody Priest
MONSTERS.put(20965, 457); // Chimera Piece
MONSTERS.put(20966, 493); // Changed Creation
MONSTERS.put(20968, 418); // Nonexistent Man
MONSTERS.put(20972, 350); // Shaman of Ancient Times
MONSTERS.put(20973, 453); // Forgotten Ancient People
MONSTERS.put(21002, 315); // Doom Scout
MONSTERS.put(21004, 320); // Dismal Pole
MONSTERS.put(21006, 335); // Doom Servant
MONSTERS.put(21008, 462); // Doom Archer
MONSTERS.put(21010, 397); // Doom Warrior
MONSTERS.put(21109, 507); // Hames Orc Scout
MONSTERS.put(21112, 552); // Hames Orc Footman
MONSTERS.put(21114, 587); // Cursed Guardian
MONSTERS.put(21116, 812); // Hames Orc Overlord
MONSTERS.put(21278, 483); // Antelope
MONSTERS.put(21279, 483); // Antelope
MONSTERS.put(21280, 483); // Antelope
MONSTERS.put(21286, 515); // Buffalo
MONSTERS.put(21287, 515); // Buffalo
MONSTERS.put(21288, 515); // Buffalo
MONSTERS.put(21508, 493); // Splinter Stakato
MONSTERS.put(21510, 527); // Splinter Stakato Soldier
MONSTERS.put(21513, 562); // Needle Stakato
MONSTERS.put(21515, 598); // Needle Stakato Soldier
MONSTERS.put(21520, 458); // Eye of Splendor
MONSTERS.put(21526, 552); // Wisdom of Splendor
MONSTERS.put(21530, 488); // Victory of Splendor
MONSTERS.put(21535, 573); // Signet of Splendor
MONSTERS.put(18001, 232); // Blood Queen
}
public Q00662_AGameOfCards()
{
super(662, Q00662_AGameOfCards.class.getSimpleName(), "A Game of Cards");
addStartNpc(KLUMP);
addTalkId(KLUMP);
addKillId(MONSTERS.keySet());
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
final QuestState st = getQuestState(player, false);
String htmltext = null;
if (st == null)
{
return htmltext;
}
switch (event)
{
case "30845-03.htm":
{
if (player.getLevel() >= MIN_LEVEL)
{
st.setState(State.STARTED);
st.playSound(QuestSound.ITEMSOUND_QUEST_ACCEPT);
htmltext = event;
}
break;
}
case "30845-06.html":
case "30845-08.html":
case "30845-09.html":
case "30845-09a.html":
case "30845-09b.html":
case "30845-10.html":
{
htmltext = event;
break;
}
case "30845-07.html":
{
st.exitQuest(true, true);
htmltext = event;
break;
}
case "return":
{
htmltext = st.getQuestItemsCount(RED_GEM) < REQUIRED_CHIP_COUNT ? "30845-04.html" : "30845-05.html";
break;
}
case "30845-11.html":
{
if (st.getQuestItemsCount(RED_GEM) >= REQUIRED_CHIP_COUNT)
{
int i1 = 0;
int i2 = 0;
int i3 = 0;
int i4 = 0;
int i5 = 0;
while ((i1 == i2) || (i1 == i3) || (i1 == i4) || (i1 == i5) || (i2 == i3) || (i2 == i4) || (i2 == i5) || (i3 == i4) || (i3 == i5) || (i4 == i5))
{
i1 = getRandom(70) + 1;
i2 = getRandom(70) + 1;
i3 = getRandom(70) + 1;
i4 = getRandom(70) + 1;
i5 = getRandom(70) + 1;
}
if (i1 >= 57)
{
i1 = i1 - 56;
}
else if (i1 >= 43)
{
i1 = i1 - 42;
}
else if (i1 >= 29)
{
i1 = i1 - 28;
}
else if (i1 >= 15)
{
i1 = i1 - 14;
}
if (i2 >= 57)
{
i2 = i2 - 56;
}
else if (i2 >= 43)
{
i2 = i2 - 42;
}
else if (i2 >= 29)
{
i2 = i2 - 28;
}
else if (i2 >= 15)
{
i2 = i2 - 14;
}
if (i3 >= 57)
{
i3 = i3 - 56;
}
else if (i3 >= 43)
{
i3 = i3 - 42;
}
else if (i3 >= 29)
{
i3 = i3 - 28;
}
else if (i3 >= 15)
{
i3 = i3 - 14;
}
if (i4 >= 57)
{
i4 = i4 - 56;
}
else if (i4 >= 43)
{
i4 = i4 - 42;
}
else if (i4 >= 29)
{
i4 = i4 - 28;
}
else if (i4 >= 15)
{
i4 = i4 - 14;
}
if (i5 >= 57)
{
i5 = i5 - 56;
}
else if (i5 >= 43)
{
i5 = i5 - 42;
}
else if (i5 >= 29)
{
i5 = i5 - 28;
}
else if (i5 >= 15)
{
i5 = i5 - 14;
}
st.setCond((i4 * 1000000) + (i3 * 10000) + (i2 * 100) + i1);
st.set("ex", i5);
st.takeItems(RED_GEM, REQUIRED_CHIP_COUNT);
htmltext = event;
}
break;
}
case "turncard1":
case "turncard2":
case "turncard3":
case "turncard4":
case "turncard5":
{
final int cond = st.getCond();
int i1 = st.getInt("ex");
int i5 = i1 % 100;
int i9 = i1 / 100;
i1 = cond % 100;
int i2 = (cond % 10000) / 100;
int i3 = (cond % 1000000) / 10000;
int i4 = (cond % 100000000) / 1000000;
switch (event)
{
case "turncard1":
{
if ((i9 % 2) < 1)
{
i9 = i9 + 1;
}
if ((i9 % 32) < 31)
{
st.set("ex", (i9 * 100) + i5);
}
break;
}
case "turncard2":
{
if ((i9 % 4) < 2)
{
i9 = i9 + 2;
}
if ((i9 % 32) < 31)
{
st.set("ex", (i9 * 100) + i5);
}
break;
}
case "turncard3":
{
if ((i9 % 8) < 4)
{
i9 = i9 + 4;
}
if ((i9 % 32) < 31)
{
st.set("ex", (i9 * 100) + i5);
}
break;
}
case "turncard4":
{
if ((i9 % 16) < 8)
{
i9 = i9 + 8;
}
if ((i9 % 32) < 31)
{
st.set("ex", (i9 * 100) + i5);
}
break;
}
case "turncard5":
{
if ((i9 % 32) < 16)
{
i9 = i9 + 16;
}
if ((i9 % 32) < 31)
{
st.set("ex", (i9 * 100) + i5);
}
break;
}
}
if ((i9 % 32) < 31)
{
htmltext = getHtm(player.getHtmlPrefix(), "30845-12.html");
}
else if ((i9 % 32) == 31)
{
int i6 = 0;
int i8 = 0;
if ((i1 >= 1) && (i1 <= 14) && (i2 >= 1) && (i2 <= 14) && (i3 >= 1) && (i3 <= 14) && (i4 >= 1) && (i4 <= 14) && (i5 >= 1) && (i5 <= 14))
{
if (i1 == i2)
{
i6 = i6 + 10;
i8 = i8 + 8;
}
if (i1 == i3)
{
i6 = i6 + 10;
i8 = i8 + 4;
}
if (i1 == i4)
{
i6 = i6 + 10;
i8 = i8 + 2;
}
if (i1 == i5)
{
i6 = i6 + 10;
i8 = i8 + 1;
}
if ((i6 % 100) < 10)
{
if ((i8 % 16) < 8)
{
if ((i8 % 8) < 4)
{
if (i2 == i3)
{
i6 = i6 + 10;
i8 = i8 + 4;
}
}
if ((i8 % 4) < 2)
{
if (i2 == i4)
{
i6 = i6 + 10;
i8 = i8 + 2;
}
}
if ((i8 % 2) < 1)
{
if (i2 == i5)
{
i6 = i6 + 10;
i8 = i8 + 1;
}
}
}
}
else if ((i6 % 10) == 0)
{
if ((i8 % 16) < 8)
{
if ((i8 % 8) < 4)
{
if (i2 == i3)
{
i6 = i6 + 1;
i8 = i8 + 4;
}
}
if ((i8 % 4) < 2)
{
if (i2 == i4)
{
i6 = i6 + 1;
i8 = i8 + 2;
}
}
if ((i8 % 2) < 1)
{
if (i2 == i5)
{
i6 = i6 + 1;
i8 = i8 + 1;
}
}
}
}
if ((i6 % 100) < 10)
{
if ((i8 % 8) < 4)
{
if ((i8 % 4) < 2)
{
if (i3 == i4)
{
i6 = i6 + 10;
i8 = i8 + 2;
}
}
if ((i8 % 2) < 1)
{
if (i3 == i5)
{
i6 = i6 + 10;
i8 = i8 + 1;
}
}
}
}
else if ((i6 % 10) == 0)
{
if ((i8 % 8) < 4)
{
if ((i8 % 4) < 2)
{
if (i3 == i4)
{
i6 = i6 + 1;
i8 = i8 + 2;
}
}
if ((i8 % 2) < 1)
{
if (i3 == i5)
{
i6 = i6 + 1;
i8 = i8 + 1;
}
}
}
}
if ((i6 % 100) < 10)
{
if ((i8 % 4) < 2)
{
if ((i8 % 2) < 1)
{
if (i4 == i5)
{
i6 = i6 + 10;
i8 = i8 + 1;
}
}
}
}
else if ((i6 % 10) == 0)
{
if ((i8 % 4) < 2)
{
if ((i8 % 2) < 1)
{
if (i4 == i5)
{
i6 = i6 + 1;
i8 = i8 + 1;
}
}
}
}
}
if (i6 == 40)
{
st.giveItems(ZIGGOS_GEMSTONE, 43);
st.giveItems(959, 3);
st.giveItems(729, 1);
st.set("ex", 0);
st.setCond(0);
htmltext = getHtm(player.getHtmlPrefix(), "30845-13.html");
}
else if (i6 == 30)
{
st.giveItems(959, 2);
st.giveItems(951, 2);
st.set("ex", 0);
st.setCond(0);
htmltext = getHtm(player.getHtmlPrefix(), "30845-14.html");
}
else if ((i6 == 21) || (i6 == 12))
{
st.giveItems(729, 1);
st.giveItems(947, 2);
st.giveItems(955, 1);
st.set("ex", 0);
st.setCond(0);
htmltext = getHtm(player.getHtmlPrefix(), "30845-15.html");
}
else if (i6 == 20)
{
st.giveItems(951, 2);
st.set("ex", 0);
st.setCond(0);
htmltext = getHtm(player.getHtmlPrefix(), "30845-16.html");
}
else if (i6 == 11)
{
st.giveItems(951, 1);
st.set("ex", 0);
st.setCond(0);
htmltext = getHtm(player.getHtmlPrefix(), "30845-17.html");
}
else if (i6 == 10)
{
st.giveItems(956, 2);
st.set("ex", 0);
st.setCond(0);
htmltext = getHtm(player.getHtmlPrefix(), "30845-18.html");
}
else if (i6 == 0)
{
st.set("ex", 0);
st.setCond(0);
htmltext = getHtm(player.getHtmlPrefix(), "30845-19.html");
}
}
if (htmltext != null)
{
if ((i9 % 2) < 1)
{
htmltext = htmltext.replaceAll("FontColor1", "FFFF00");
htmltext = htmltext.replaceAll("Cell1", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor1", "FF6F6F");
htmltext = setHtml(htmltext, i1, "Cell1");
}
if ((i9 % 4) < 2)
{
htmltext = htmltext.replaceAll("FontColor2", "FFFF00");
htmltext = htmltext.replaceAll("Cell2", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor2", "FF6F6F");
htmltext = setHtml(htmltext, i2, "Cell2");
}
if ((i9 % 8) < 4)
{
htmltext = htmltext.replaceAll("FontColor3", "FFFF00");
htmltext = htmltext.replaceAll("Cell3", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor3", "FF6F6F");
htmltext = setHtml(htmltext, i3, "Cell3");
}
if ((i9 % 16) < 8)
{
htmltext = htmltext.replaceAll("FontColor4", "FFFF00");
htmltext = htmltext.replaceAll("Cell4", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor4", "FF6F6F");
htmltext = setHtml(htmltext, i4, "Cell4");
}
if ((i9 % 32) < 16)
{
htmltext = htmltext.replaceAll("FontColor5", "FFFF00");
htmltext = htmltext.replaceAll("Cell5", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor5", "FF6F6F");
htmltext = setHtml(htmltext, i5, "Cell5");
}
}
break;
}
case "playagain":
{
htmltext = st.getQuestItemsCount(RED_GEM) < REQUIRED_CHIP_COUNT ? "30845-21.html" : "30845-20.html";
break;
}
}
return htmltext;
}
@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
final QuestState st = getQuestState(player, true);
String htmltext = getNoQuestMsg(player);
if (st == null)
{
return htmltext;
}
switch (st.getState())
{
case State.CREATED:
{
htmltext = player.getLevel() < MIN_LEVEL ? "30845-02.html" : "30845-01.htm";
break;
}
case State.STARTED:
{
if (st.isCond(0))
{
htmltext = "30845-04.html";
}
else if (st.getInt("ex") != 0)
{
int i0 = st.getCond();
int i1 = st.getInt("ex");
int i5 = i1 % 100;
int i9 = i1 / 100;
i1 = i0 % 100;
int i2 = (i0 % 10000) / 100;
int i3 = (i0 % 1000000) / 10000;
int i4 = (i0 % 100000000) / 1000000;
htmltext = getHtm(player.getHtmlPrefix(), "30845-11a.html");
if ((i9 % 2) < 1)
{
htmltext = htmltext.replaceAll("FontColor1", "FFFF00");
htmltext = htmltext.replaceAll("Cell1", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor1", "FF6F6F");
htmltext = setHtml(htmltext, i1, "Cell1");
}
if ((i9 % 4) < 2)
{
htmltext = htmltext.replaceAll("FontColor2", "FFFF00");
htmltext = htmltext.replaceAll("Cell2", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor2", "FF6F6F");
htmltext = setHtml(htmltext, i2, "Cell2");
}
if ((i9 % 8) < 4)
{
htmltext = htmltext.replaceAll("FontColor3", "FFFF00");
htmltext = htmltext.replaceAll("Cell3", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor3", "FF6F6F");
htmltext = setHtml(htmltext, i3, "Cell3");
}
if ((i9 % 16) < 8)
{
htmltext = htmltext.replaceAll("FontColor4", "FFFF00");
htmltext = htmltext.replaceAll("Cell4", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor4", "FF6F6F");
htmltext = setHtml(htmltext, i4, "Cell4");
}
if ((i9 % 32) < 16)
{
htmltext = htmltext.replaceAll("FontColor5", "FFFF00");
htmltext = htmltext.replaceAll("Cell5", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor5", "FF6F6F");
htmltext = setHtml(htmltext, i5, "Cell5");
}
}
break;
}
case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(player);
break;
}
}
return htmltext;
}
@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
final List<L2PcInstance> players = new ArrayList<>();
players.add(killer);
players.add(killer);
if (killer.isInParty())
{
for (L2PcInstance member : killer.getParty().getMembers())
{
if (getQuestState(member, false) != null)
{
players.add(member);
}
}
}
final L2PcInstance player = players.get(Rnd.get(players.size()));
if ((player != null) && Util.checkIfInRange(1500, npc, player, false))
{
if (MONSTERS.get(npc.getId()) < getRandom(1000))
{
final QuestState st = getQuestState(player, false);
if (st != null)
{
st.giveItems(RED_GEM, 1);
playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
}
}
}
return super.onKill(npc, killer, isSummon);
}
private static String setHtml(String htmltext, int var, String regex)
{
String replacement = null;
switch (var)
{
case 1:
{
replacement = "!";
break;
}
case 2:
{
replacement = "=";
break;
}
case 3:
{
replacement = "T";
break;
}
case 4:
{
replacement = "V";
break;
}
case 5:
{
replacement = "O";
break;
}
case 6:
{
replacement = "P";
break;
}
case 7:
{
replacement = "S";
break;
}
case 8:
{
replacement = "E";
break;
}
case 9:
{
replacement = "H";
break;
}
case 10:
{
replacement = "A";
break;
}
case 11:
{
replacement = "R";
break;
}
case 12:
{
replacement = "D";
break;
}
case 13:
{
replacement = "I";
break;
}
case 14:
{
replacement = "N";
break;
}
default:
{
replacement = "ERROR";
break;
}
}
return htmltext.replaceAll(regex, replacement);
}
}