Warehouse Keeper's Pastime
- ID
- 384
- Название
- Warehouse Keeper's Pastime
- start_npcs_json
- [30182]
- npc_ids_json
- [20241,20242,20243,20281,20282,20286,20556,20559,20605,20635,20668,20677,20758,20759,20760,20773,20774,20942,20943,20944,20945,20946,20947,20948,20949,20950,30182,30685]
- constants_json
- {"CLIFF":30182,"WAREHOUSE_CHIEF_BAXT":30685,"DUST_WIND":20242,"INNERSEN":20950,"CONGERER":20774,"CARINKAIN":20635,"CONNABI":20947,"HUNTER_GARGOYLE":20241,"NIGHTMARE_GUIDE":20942,"DRAGON_BEARER_WARRIOR":20759,"DRAGON_BEARER_CHIEF":20758,"DUST_WIND_HOLD":20281,"WEIRD_DRAKE":20605,"THUNDER_WYRM_HOLD":20282,"CADEINE":20945,"CONGERER_LORD":20773,"DRAGON_BEARER_ARCHER":20760,"NIGHTMARE_LORD":20944,"SANHIDRO":20946,"GIANT_MONSTEREYE":20556,"BARTAL":20948,"HUNTER_GARGOYLE_HOLD":20286,"ROT_GOLEM":20559,"GRAVE_GUARD":20668,"TULBEN":20677,"NIGHTMARE_KEEPER":20943,"LUMINUN":20949,"THUNDER_WYRM":20243,"Q_IRONGATE_MEDAL":5964,"MOONSTONE_EARING":852,"DRAKE_LEATHER_BOOTS":2437,"DRAKE_LEATHER_MAIL":401,"MOLD_HARDENER":4041,"NECKLACE_OF_MERMAID":917,"SCRL_OF_ENCH_AM_C":952,"BLACKSMITH_S_FRAME":1892,"SCRL_OF_ENCH_WP_C":951,"ORIHARUKON":1893,"SAMURAI_LONGSWORD":135,"AQUASTONE_RING":883,"SYNTHESIS_COKES":1888,"MITHIRL_ALLOY":1890,"GREAT_HELMET":500,"VARNISH_OF_PURITY":1887,"BLESSED_GLOVES":2463,"CRAFTED_LEATHER":1894}
- Статус разбора
- metadata_only; dynamic Java conditions/rewards retained in source; unresolved starts: []
- Источник
- game/data/scripts/quests/Q00384_WarehouseKeepersPastime/Q00384_WarehouseKeepersPastime.java
NPC квеста
| ID | Название | Старт квеста | Уровень |
|---|---|---|---|
| 20241 | Hunter Gargoyle | Нет | 52 |
| 20242 | Dustwind Gargoyle | Нет | 53 |
| 20243 | Thunder Wyrm | Нет | 54 |
| 20281 | Dustwind Gargoyle | Нет | 53 |
| 20282 | Thunder Wyrm | Нет | 54 |
| 20286 | Hunter Gargoyle | Нет | 52 |
| 20556 | Giant Monstereye | Нет | 41 |
| 20559 | Rotting Golem | Нет | 44 |
| 20605 | Weird Drake | Нет | 45 |
| 20635 | Carinkain | Нет | 45 |
| 20668 | Grave Guard | Нет | 54 |
| 20677 | Tulben | Нет | 66 |
| 20758 | Dragon Bearer Chief | Нет | 49 |
| 20759 | Dragon Bearer Warrior | Нет | 48 |
| 20760 | Dragon Bearer Archer | Нет | 47 |
| 20773 | Conjurer Bat Lord | Нет | 72 |
| 20774 | Conjurer Bat | Нет | 70 |
| 20942 | Nightmare Guide | Нет | 43 |
| 20943 | Nightmare Keeper | Нет | 45 |
| 20944 | Nightmare Lord | Нет | 47 |
| 20945 | Cadeine | Нет | 50 |
| 20946 | Sanhidro | Нет | 52 |
| 20947 | Connabi | Нет | 54 |
| 20948 | Bartal | Нет | 56 |
| 20949 | Luminun | Нет | 58 |
| 20950 | Innersen | Нет | 60 |
| 30182 | Cliff | Да | 70 |
| 30685 | Baxt | Нет | 70 |
Условия уровней: выражения из Java
if (player.getLevel() >= 40)
Выдача предметов, адены и опыта: выражения из Java
giveItems(player, SYNTHESIS_COKES, 1); giveItems(player, VARNISH_OF_PURITY, 1); giveItems(player, CRAFTED_LEATHER, 1); giveItems(player, SCRL_OF_ENCH_AM_C, 1); giveItems(player, MITHIRL_ALLOY, 1); giveItems(player, ORIHARUKON, 1); giveItems(player, SCRL_OF_ENCH_WP_C, 1); giveItems(player, AQUASTONE_RING, 1); giveItems(player, SCRL_OF_ENCH_WP_C, 1); giveItems(player, MOONSTONE_EARING, 1); giveItems(player, DRAKE_LEATHER_MAIL, 1); giveItems(player, MOLD_HARDENER, 1); giveItems(player, SCRL_OF_ENCH_AM_C, 1); giveItems(player, BLACKSMITH_S_FRAME, 1); giveItems(player, NECKLACE_OF_MERMAID, 1); giveItems(player, SCRL_OF_ENCH_WP_C, 1); giveItems(player, GREAT_HELMET, 1); giveItems(player, DRAKE_LEATHER_BOOTS, 1); giveItems(player, BLESSED_GLOVES, 1); giveItems(player, SAMURAI_LONGSWORD, 1);
Квесты содержат динамические условия Java. Выражения выдачи включают промежуточные предметы, варианты и случайные награды; это не гарантированная награда. Константы приведены выше. Полные условия — в исходнике.
Тексты квеста
[30182-01.htm] Warehouse Keeper Cliff: Don't tell my boss, but this job can get kinda slow. That's why we warehouse keepers created our own fun. I often play bingo with the other warehouse keepers. Sometime I even go over to another town's warehouse to play bingo on my days off. But to be honest, regular bingo has gotten a little boring for me. "So?"
[30182-02.htm] Warehouse Keeper Cliff: We've made the bingo games a little more interesting by adding some gambling. One of the perks of being a warehouse keeper is that there are all sorts of items left by owners who never come back to pick them up. That gives us a good stake for our games. Actually, though, I mainly bet Medals of the Warehouse Keeper in our bingo games. In case you don't know, Medals of the Warehouse Keeper are awarded by the Iron Gate Guild to the warehouse keepers with the most sales. We really shouldn't be risking them, but...well, you know how it is. Actually, though, we have bigger problems concerning those medals... Ask what happened.
[30182-03.htm] Warehouse Keeper Cliff: Recently, a cargo wagon from Hunter's Village was attacked by monsters, and all its freight was stolen. Most of the items weren't very valuable, but a large quantity of Medals of the Warehouse Keeper was also being transported. Every one was taken! Why were all those medals on that cargo wagon, you ask? Well, the thing is...I went to the warehouse in Hunter's Village on my recent day off, and I won big. In fact, I won too many medals to carry back. So I arranged to send them with next cargo wagon... Will you help get them back for me? Say that you will help.
[30182-04.html] Warehouse Keeper Cliff: Don't tell my boss, but this job can get kinda slow. That's why we warehouse keepers created our own fun. I often play bingo with the other warehouse keepers. Sometime I even go over to another town's warehouse to play bingo on my days off. Unfortunately, something recently happened because of my bingo playing and I need some help... Oh, you don't look like someone experienced enough to help. Maybe you know someone? (Only characters who are level 40 and above may undertake this quest.)
[30182-05.htm] Warehouse Keeper Cliff: Good! Bring back my Medals of the Warehouse Keeper and I'll give you a chance to play bingo with the big boys. If you do well, you can get an abandoned item from my warehouse as a reward. Who knows? You might get a nice weapon or a new set of armor. Ha ha! According to rules of the game, you can bet either 10 or 100 medals. So to begin, you'll need to recover at least 10 medals. Of course, betting 100 gives you a better chance of winning. Oh! Just so you know, Warehouse Keeper Baxt in Hunter's Village plays with me, and he offered to help recover the stolen medals. Now, from what the eyewitnesses told us, the monsters who attacked the wagon were Sunken Golems, Giant Eyes, Conjurers, Lord Conjurers, Tulbens, Hunter Gargoyles, Dust Winds, Thunder Wyrms, Karincains, Weird Drakes, Grave Guards, Conductors of Nightmare, Watchers of Nightmare and Rulers of Nightmare. Good luck!
[30182-06.html] Warehouse Freightman Cliff: As I mentioned before, defeat Rotting Golem, Giant Monstereye, Conjurer Bat, Conjurer Bat Lord, Tulben, Hunter Gargoyle, Dustwind Gargoyle, Thunder Wyrm, Karicain, Weird Drake, Grave Guard, Nightmare Guide, Nightmare Keeper, Nightmare Lord, etc. and collect the Warehouse Keeper's Medals that they stole. Do that, and you may have the privilege of PLAYING BINGO! If you then somehow prove your bingo worth, I'll give you an abandoned item in my warehouse. What could be more exciting than that? I've had years to collect things. Ha ha ha~ Now, we play by the bingo rules firmly established three hundred and twelve years, sixty three days ago. That means, the number of medals to bet are either 10 or 100. So you need a minimum of 10 medals. I'm sure you'll get at least.. twice that. Maybe more. And the more you bet, the more chances you have to win better items. And THAT'S NOT ALL!! You can also visit Warehouse Keeper Baxt in Hunter's Village to play Bingo. He is somewhat responsible for the cargo wagon assault and has agreed to cooperate. Listen to the Rules of Bingo Say that you quit.
[30182-07.html] Warehouse Keeper Cliff: Did you recover my medals? Then let's play bingo! According to rules of the game, you can bet either 10 or 100 medals. Of course, betting 100 gives you a better chance of winning. Before we start, make sure you have enough space in your inventory -- if you win, you want to be able to collect your winnings, right? Bet 10 Medals of the Warehouse Keeper. Bet 100 Medals of the Warehouse Keeper. Ask about the bingo rules.
[30182-08.html] Warehouse Keeper Cliff: Well, not all the medals have been recovered, but I understand. I'm sure you have other obligations... Come back whenever you want to play bingo again.
[30182-09.html] Warehouse Keeper Cliff: I'll place numbers 1-9 on a 3x3 numberpad. Then you pick 6 numbers out of 1-9. When you finished your choices, we count how many lines can be made from your numbers: horizontally, vertically or diagonally. Got it? Maybe the easiest way to learn is to play it once. I'll give you a reward if your choice of numbers can make 3 lines. Back to the game.
[30182-09a.htm] Warehouse Keeper Cliff: I'll place numbers 1-9 on a 3x3 numberpad. Then you pick 6 numbers out of 1-9. When you finished your choices, we count how many lines can be made from your numbers: horizontally, vertically or diagonally. Got it? Maybe the easiest way to learn is to play it once. I'll give you a reward if your choice of numbers can make 3 lines.
[30182-10.html] Warehouse Keeper Cliff: I placed hidden numbers from 1-9 on a numberpad. Now I take your 10 medals as a deposit -- that way no one is tempted to welch on a bet! If you stop before we're finished, your medals will be forfeit. Now it's time to pick 6 numbers from 1-9. Choose your first number. 1 2 3 4 5 6 7 8 9
[30182-11.html] Warehouse Keeper Cliff: Hey! You don't have enough medals to play. What happened? Come back after gathering more medals.
[30182-12.html] Warehouse Keeper Cliff: I placed hidden numbers from 1-9 on a numberpad. Now I take your 100 medals as a deposit -- that way no one is tempted to welch on a bet! If you stop before we're finished, your medals will be forfeit. Now it's time to pick 6 numbers from 1-9. Choose your first number. 1 2 3 4 5 6 7 8 9
[30182-13.html] Warehouse Keeper Cliff: Now, pick your second number. 1 2 3 4 5 6 7 8 9 Current status
[30182-14.html] Warehouse Keeper Cliff: Now, pick the third number. 1 2 3 4 5 6 7 8 9 Current status
[30182-15.html] Warehouse Keeper Cliff: That number has already been picked. Pick the second number again. 1 2 3 4 5 6 7 8 9 Current status
[30182-16.html] Warehouse Keeper Cliff: Time to pick the fourth number! 1 2 3 4 5 6 7 8 9 Current status
[30182-17.html] Warehouse Keeper Cliff: That number has already been picked. Pick the third number again. 1 2 3 4 5 6 7 8 9 Current status
[30182-18.html] Warehouse Keeper Cliff: You're almost finished. Choose your fifth number carefully. 1 2 3 4 5 6 7 8 9 Current status
[30182-19.html] Warehouse Keeper Cliff: That number has already been chosen. Pick the fourth number again. 1 2 3 4 5 6 7 8 9 Current status
[30182-20.html] Warehouse Keeper Cliff: OK, now it's time for the sixth number. It's your last choice, so choose well. 1 2 3 4 5 6 7 8 9 Current status
[30182-21.html] Warehouse Keeper Cliff: Getting confused? You chose a number that was already chosen. Pick the fifth number again. 1 2 3 4 5 6 7 8 9 Current status
[30182-22.html] Warehouse Keeper Cliff: Ah! On the bingo pad below, you can see the numbers you chose in red. You've completed 3 lines! Congratulations! As I promised, I'll give you one of the abandoned items from my warehouse. Wait here... . . . Phew! So dusty! Here it is. See anything you like? "> "> "> "> "> "> "> "> ">
[30182-23.html] Warehouse Keeper Cliff: Hmm. You can see your picks in red on the numberpad below/ Unfortunately, your numbers didn't create at least 3 lines. Better luck next time! "> "> "> "> "> "> "> "> ">
[30182-24.html] Warehouse Keeper Cliff: You are a seriously unlucky person! You can see your picks in red on the bingo pad below. As you can see, you didn't even get 1 line! You know, that's harder to do than to get 3! I feel for you, friend. Let me give you something as a bit of encouragement. Wait here for a minute. . . . Here, take this. I hope it helps! "> "> "> "> "> "> "> "> ">
[30182-25.html] Warehouse Keeper Cliff: That number has already been chosen. Pick the sixth number again. 1 2 3 4 5 6 7 8 9 Current status
[30685-06.html] Warehouse keeper Baxt: As Cliff mentioned before, defeat the Rotting Golem, Giant Monstereye, Conjurer Bat, Conjurer Bat Lord, Tulben, Hunter Gargoyle, Dragon Bearer Chief, Dragon Bearer Warrior, Dragon Bearer Archer, Dustwind Gargoyle, Thunder Wyrm, Karicain, Weird Drake, Grave Guard, Nightmare Guide, Nightmare Keeper, and Nightmare Lord, and collect the Warehouse Keeper's Medals that were stolen by them. Then I will give you a chance to play Bingo! The cargo wagon security was not great, obviously, so I'm taking responsibility and will help retrieve it. If you do well at bingo, I'll give you an abandoned item in my warehouse for a reward. You might get a nice weapon or a decent piece armor if you're lucky. Ha ha ha.... According to the commonly used bingo rules between warehouse keepers, the number of medals to bet are either 10 or 100. You will need to gather at least 10 medals. Of course, betting 100 will give you higher chance of winning the better item.... Listen to the rules of the game. Tell him that you're done
[30685-07.html] Warehouse Chief Baxt: Did you bring the medals? Alright, then, let's play Bingo! Our Bingo rules state that you can bet only 10 or 100 medals. Of course, when you bet 100 medals you stand a better chance of winning a high-quality item. By the way, before you start playing Bingo, make sure you have enough room in your inventory! It would be a shame if you didn't have room for all your winnings, don't you think? Bet 10 Warehouse Keeper's Medals and play Bingo. Bet 100 Warehouse Keeper's Medals and play Bingo. "What are the rules of Bingo?"
[30685-08.html] Warehouse Chief Baxt: I'm sorry to hear that. There are still more medals that need to be recovered. I understand that you must have your own reasons for quitting... If you ever want to play bingo again, come back and see me.
[30685-09.html] Warehouse Chief Baxt: I will randomly arrange the numbers 1-9 on the panel. Then you select 6 numbers between 1 and 9. If your choices form 3 lines, either horizontal, vertical or diagonal, you win! Does that make sense? You'll understand better once we start playing. Return to the game.
[30685-09a.html] Warehouse Chief Baxt: I'll arrange the numbers 1-9 on the panel. Then you select 6 numbers between 1 and 9. If your choices form 3 lines, either horizontal, vertical or diagonal, you win! Does that make sense? You'll understand better once we start playing.
[30685-10.html] Warehouse Chief Baxt: I've arranged 9 numbers on the panel. Don't peek! Ha ha ha! Now give me your 10 medals. Some players run away when they realize that they don't stand a good chance of winning. Therefore, I prefer to hold the medals before the game starts. If you quit during game play, you'll forfeit your bet. Is that satisfactory? Now, select your first number. 1 2 3 4 5 6 7 8 9
[30685-11.html] Warehouse Chief Baxt: You don't have enough medals. Did you drop them somewhere? Please bring the appropriate number of medals when you return.
[30685-12.html] Warehouse Chief Baxt: I've arranged 9 numbers on the panel. Don't peek! Ha ha ha! Please give me your 100 medals. Some players run away when they realize that they don't stand a good chance of winning. Therefore, I prefer to hold the medals before the game starts. If you quit during game play, you'll forfeit your bet. Is that satisfactory? Now, select your first number. 1 2 3 4 5 6 7 8 9
[30685-13.html] Warehouse Chief Baxt: Now, choose your second number. 1 2 3 4 5 6 7 8 9 For your information, below is your current selection.
[30685-14.html] Warehouse Chief Baxt: Now, choose your third number. 1 2 3 4 5 6 7 8 9 For your information, below is your current selection.
[30685-15.html] Warehouse Chief Baxt: You have already selected that number. Choose your second number again. 1 2 3 4 5 6 7 8 9 For your information, below is your current selection.
[30685-16.html] Warehouse Chief Baxt: Now choose your fourth number! 1 2 3 4 5 6 7 8 9 For your information, below is your current selection.
[30685-17.html] Warehouse Chief Baxt: You have already selected that number. Choose your third number again. 1 2 3 4 5 6 7 8 9 For your information, below is your current selection.
[30685-18.html] Warehouse Chief Baxt: Now, choose your fifth number. 1 2 3 4 5 6 7 8 9 For your information, below is your current selection.
[30685-19.html] Warehouse Chief Baxt: You have already selected that number. Choose your fourth number again. 1 2 3 4 5 6 7 8 9 For your information, below is your current selection.
[30685-20.html] Warehouse Chief Baxt: Now choose your final number. 1 2 3 4 5 6 7 8 9 For your information, below is your current selection.
[30685-21.html] Warehouse Chief Baxt: You have already selected that number. Choose your fifth number again. 1 2 3 4 5 6 7 8 9 For your information, below is your current selection.
[30685-22.html] Warehouse Chief Baxt: You've created 3 lines! The red colored numbers on the bingo panel below are the numbers you chose. Congratulations! As I promised, I'll give you an unclaimed item from my warehouse. Wait here. . . . Puff puff... it's very dusty. Here it is. Do you like it? "> "> "> "> "> "> "> "> ">
[30685-23.html] Warehouse Chief Baxt: Hmm... You didn't make 3 lines. Why don't you try again? The red-colored numbers on the panel are the ones you chose. "> "> "> "> "> "> "> "> ">
[30685-24.html] Warehouse Chief Baxt: You are spectacularly unlucky! The red-colored numbers on the panel below are the ones you chose. As you can see, they didn't create even a single line. Did you know that it is harder not to create a single line than creating all 3 lines? Usually, I don't give a reward when you don't create a single line, but since I'm feeling sorry for you, I'll be generous this time. Wait here. . . . Here, take this. I hope it will bring you better luck in the future. "> "> "> "> "> "> "> "> ">
[30685-25.html] Warehouse Chief Baxt: You've already chosen that number. Please choose your sixth number again. 1 2 3 4 5 6 7 8 9 For your information, below is your current selection.
Исходник условий и наград (Java)
/*
* 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 <http://www.gnu.org/licenses/>.
*/
package quests.Q00384_WarehouseKeepersPastime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.l2jmobius.commons.util.StringUtil;
import org.l2jmobius.gameserver.config.PlayerConfig;
import org.l2jmobius.gameserver.entity.actor.Npc;
import org.l2jmobius.gameserver.entity.actor.Player;
import org.l2jmobius.gameserver.mechanics.script.Quest;
import org.l2jmobius.gameserver.mechanics.script.QuestSound;
import org.l2jmobius.gameserver.mechanics.script.QuestState;
import org.l2jmobius.gameserver.util.LocationUtil;
/**
* Warehouse Keeper's Pastime (384)
* @author Zealar
* @since 2.6.0.0
*/
public class Q00384_WarehouseKeepersPastime extends Quest
{
// NPCs
private static final int CLIFF = 30182;
private static final int WAREHOUSE_CHIEF_BAXT = 30685;
// Monsters
private static final int DUST_WIND = 20242;
private static final int INNERSEN = 20950;
private static final int CONGERER = 20774;
private static final int CARINKAIN = 20635;
private static final int CONNABI = 20947;
private static final int HUNTER_GARGOYLE = 20241;
private static final int NIGHTMARE_GUIDE = 20942;
private static final int DRAGON_BEARER_WARRIOR = 20759;
private static final int DRAGON_BEARER_CHIEF = 20758;
private static final int DUST_WIND_HOLD = 20281;
private static final int WEIRD_DRAKE = 20605;
private static final int THUNDER_WYRM_HOLD = 20282;
private static final int CADEINE = 20945;
private static final int CONGERER_LORD = 20773;
private static final int DRAGON_BEARER_ARCHER = 20760;
private static final int NIGHTMARE_LORD = 20944;
private static final int SANHIDRO = 20946;
private static final int GIANT_MONSTEREYE = 20556;
private static final int BARTAL = 20948;
private static final int HUNTER_GARGOYLE_HOLD = 20286;
private static final int ROT_GOLEM = 20559;
private static final int GRAVE_GUARD = 20668;
private static final int TULBEN = 20677;
private static final int NIGHTMARE_KEEPER = 20943;
private static final int LUMINUN = 20949;
private static final int THUNDER_WYRM = 20243;
// Items
private static final int Q_IRONGATE_MEDAL = 5964;
// Reward
private static final int MOONSTONE_EARING = 852;
private static final int DRAKE_LEATHER_BOOTS = 2437;
private static final int DRAKE_LEATHER_MAIL = 401;
private static final int MOLD_HARDENER = 4041;
private static final int NECKLACE_OF_MERMAID = 917;
private static final int SCRL_OF_ENCH_AM_C = 952;
private static final int BLACKSMITH_S_FRAME = 1892;
private static final int SCRL_OF_ENCH_WP_C = 951;
private static final int ORIHARUKON = 1893;
private static final int SAMURAI_LONGSWORD = 135;
private static final int AQUASTONE_RING = 883;
private static final int SYNTHESIS_COKES = 1888;
private static final int MITHIRL_ALLOY = 1890;
private static final int GREAT_HELMET = 500;
private static final int VARNISH_OF_PURITY = 1887;
private static final int BLESSED_GLOVES = 2463;
private static final int CRAFTED_LEATHER = 1894;
public Q00384_WarehouseKeepersPastime()
{
super(384, "Warehouse Keeper's Pastime");
addStartNpc(CLIFF);
addTalkId(CLIFF, WAREHOUSE_CHIEF_BAXT);
addKillId(WAREHOUSE_CHIEF_BAXT, DUST_WIND, INNERSEN, CLIFF, CONGERER, CARINKAIN, CONNABI, HUNTER_GARGOYLE, NIGHTMARE_GUIDE, DRAGON_BEARER_WARRIOR, DRAGON_BEARER_CHIEF, DUST_WIND_HOLD, WEIRD_DRAKE, THUNDER_WYRM_HOLD, CADEINE, CONGERER_LORD, DRAGON_BEARER_ARCHER, NIGHTMARE_LORD, SANHIDRO, GIANT_MONSTEREYE, BARTAL, HUNTER_GARGOYLE_HOLD, ROT_GOLEM, GRAVE_GUARD, TULBEN, NIGHTMARE_KEEPER, LUMINUN, THUNDER_WYRM);
registerQuestItems(Q_IRONGATE_MEDAL);
}
@Override
public String onTalk(Npc npc, Player player)
{
final QuestState qs = getQuestState(player, true);
final String htmltext = getNoQuestMsg(player);
switch (npc.getId())
{
case CLIFF:
{
if (qs.isCreated())
{
if (player.getLevel() >= 40)
{
return "30182-01.htm";
}
return "30182-04.html";
}
if (getQuestItemsCount(player, Q_IRONGATE_MEDAL) < 10)
{
return "30182-06.html";
}
return "30182-07.html";
}
case WAREHOUSE_CHIEF_BAXT:
{
if (qs.getMemoState() > 0)
{
if (getQuestItemsCount(player, Q_IRONGATE_MEDAL) < 10)
{
return "30685-06.html";
}
return "30685-07.html";
}
break;
}
}
return htmltext;
}
@Override
public String onEvent(String event, Npc npc, Player player)
{
final QuestState qs = getQuestState(player, false);
if (qs != null)
{
if (event.contains(".htm"))
{
return event;
}
switch (npc.getId())
{
case CLIFF:
{
if (event.equals("QUEST_ACCEPTED"))
{
playSound(player, QuestSound.ITEMSOUND_QUEST_ACCEPT);
qs.setMemoState(384);
qs.startQuest();
qs.showQuestionMark(384);
playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
return "30182-05.htm";
}
final int ask = Integer.parseInt(event);
switch (ask)
{
case 3:
{
return "30182-09a.htm";
}
case 4:
{
return "30182-02.htm";
}
case 5:
{
if (npc.getId() != CLIFF)
{
return getNoQuestMsg(player);
}
return "30182-03.htm";
}
case 6:
{
qs.exitQuest(true);
return "30182-08.html";
}
case 9:
{
return "30182-09.html";
}
case 7:
{
if (getQuestItemsCount(player, Q_IRONGATE_MEDAL) >= 10)
{
takeItems(player, Q_IRONGATE_MEDAL, 10);
qs.setMemoState(10);
createBingoBoard(qs);
return "30182-10.html";
}
return "30182-11.html";
}
case 8:
{
if (getQuestItemsCount(player, Q_IRONGATE_MEDAL) >= 100)
{
takeItems(player, Q_IRONGATE_MEDAL, 100);
qs.setMemoState(20);
createBingoBoard(qs);
return "30182-12.html";
}
return "30182-11.html";
}
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
{
selectBingoNumber(qs, (ask - 10) + 1);
return fillBoard(qs, getHtm(player, "30182-13.html"));
}
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
case 26:
case 27:
{
return takeHtml(player, qs, (ask - 18), CLIFF);
}
case 55:
case 56:
case 57:
case 58:
case 59:
case 60:
case 61:
case 62:
case 63:
{
return beforeReward(player, qs, (ask - 54), CLIFF);
}
}
break;
}
case WAREHOUSE_CHIEF_BAXT:
{
final int ask = Integer.parseInt(event);
switch (ask)
{
case 3:
{
return "30685-09a.html";
}
case 6:
{
qs.exitQuest(true);
return "30685-08.html";
}
case 9:
{
return "30685-09.html";
}
case 7:
{
if (getQuestItemsCount(player, Q_IRONGATE_MEDAL) >= 10)
{
takeItems(player, Q_IRONGATE_MEDAL, 10);
qs.setMemoState(10);
createBingoBoard(qs);
return "30685-10.html";
}
return "30685-11.html";
}
case 8:
{
if (getQuestItemsCount(player, Q_IRONGATE_MEDAL) >= 100)
{
takeItems(player, Q_IRONGATE_MEDAL, 100);
qs.setMemoState(20);
createBingoBoard(qs);
return "30685-12.html";
}
return "30685-11.html";
}
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
{
selectBingoNumber(qs, (ask - 9));
return fillBoard(qs, getHtm(player, "30685-13.html"));
}
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
case 26:
case 27:
{
return takeHtml(player, qs, (ask - 18), WAREHOUSE_CHIEF_BAXT);
}
case 55:
case 56:
case 57:
case 58:
case 59:
case 60:
case 61:
case 62:
case 63:
{
return beforeReward(player, qs, (ask - 54), WAREHOUSE_CHIEF_BAXT);
}
}
break;
}
}
}
return super.onEvent(event, npc, player);
}
private String takeHtml(Player player, QuestState qs, int num, int npcId)
{
String html = null;
int i3;
if (!isSelectedBingoNumber(qs, num))
{
selectBingoNumber(qs, num);
i3 = getBingoSelectCount(qs);
if (i3 == 2)
{
html = getHtm(player, npcId + "-14.html");
}
else if (i3 == 3)
{
html = getHtm(player, npcId + "-16.html");
}
else if (i3 == 4)
{
html = getHtm(player, npcId + "-18.html");
}
else if (i3 == 5)
{
html = getHtm(player, npcId + "-20.html");
}
return fillBoard(qs, html);
}
i3 = getBingoSelectCount(qs);
if (i3 == 1)
{
html = getHtm(player, npcId + "-15.html");
}
else if (i3 == 2)
{
html = getHtm(player, npcId + "-17.html");
}
else if (i3 == 3)
{
html = getHtm(player, npcId + "-19.html");
}
else if (i3 == 4)
{
html = getHtm(player, npcId + "-21.html");
}
return fillBoard(qs, html);
}
private String fillBoard(QuestState qs, String html)
{
String result = html;
for (int i0 = 0; i0 < 9; i0 += 1)
{
final int i1 = getNumberFromBingoBoard(qs, i0);
if (isSelectedBingoNumber(qs, i1))
{
result = result.replace("<?Cell" + (i0 + 1) + "?>", Integer.toString(i1));
}
else
{
result = result.replace("<?Cell" + (i0 + 1) + "?>", "?");
}
}
return result;
}
private String colorBoard(QuestState qs, String html)
{
String result = html;
for (int i0 = 0; i0 < 9; i0 += 1)
{
final int i1 = getNumberFromBingoBoard(qs, i0);
result = result.replace("<?FontColor" + (i0 + 1) + "?>", (isSelectedBingoNumber(qs, i1)) ? "ff0000" : "ffffff");
result = result.replace("<?Cell" + (i0 + 1) + "?>", Integer.toString(i1));
}
return result;
}
private String beforeReward(Player player, QuestState qs, int num, int npcId)
{
if (!isSelectedBingoNumber(qs, num))
{
selectBingoNumber(qs, num);
final int i3 = getMatchedBingoLineCount(qs);
String html;
if ((i3 == 3) && ((getBingoSelectCount(qs)) == 6))
{
reward(player, qs, i3);
html = getHtm(player, npcId + "-22.html");
}
else if ((i3 == 0) && (getBingoSelectCount(qs) == 6))
{
reward(player, qs, i3);
html = getHtm(player, npcId + "-24.html");
}
else
{
html = getHtm(player, npcId + "-23.html");
}
return colorBoard(qs, html);
}
return fillBoard(qs, getHtm(player, npcId + "-25.html"));
}
private void reward(Player player, QuestState qs, int i3)
{
if (i3 == 3)
{
if (qs.getMemoState() == 10)
{
final int random = getRandom(100);
if (random < 16)
{
giveItems(player, SYNTHESIS_COKES, 1);
}
else if (random < 32)
{
giveItems(player, VARNISH_OF_PURITY, 1);
}
else if (random < 50)
{
giveItems(player, CRAFTED_LEATHER, 1);
}
else if (random < 80)
{
giveItems(player, SCRL_OF_ENCH_AM_C, 1);
}
else if (random < 89)
{
giveItems(player, MITHIRL_ALLOY, 1);
}
else if (random < 98)
{
giveItems(player, ORIHARUKON, 1);
}
else
{
giveItems(player, SCRL_OF_ENCH_WP_C, 1);
}
}
else if (qs.getMemoState() == 20)
{
final int random = getRandom(100);
if (random < 50)
{
giveItems(player, AQUASTONE_RING, 1);
}
else if (random < 80)
{
giveItems(player, SCRL_OF_ENCH_WP_C, 1);
}
else if (random < 98)
{
giveItems(player, MOONSTONE_EARING, 1);
}
else
{
giveItems(player, DRAKE_LEATHER_MAIL, 1);
}
}
}
else if (i3 == 0)
{
if (qs.getMemoState() == 10)
{
final int random = getRandom(100);
if (random < 50)
{
giveItems(player, MOLD_HARDENER, 1);
}
else if (random < 80)
{
giveItems(player, SCRL_OF_ENCH_AM_C, 1);
}
else if (random < 98)
{
giveItems(player, BLACKSMITH_S_FRAME, 1);
}
else
{
giveItems(player, NECKLACE_OF_MERMAID, 1);
}
}
else if (qs.getMemoState() == 20)
{
final int random = getRandom(100);
if (random < 50)
{
giveItems(player, SCRL_OF_ENCH_WP_C, 1);
}
else if (random < 80)
{
giveItems(player, GREAT_HELMET, 1);
}
else if (random < 98)
{
giveItems(player, DRAKE_LEATHER_BOOTS, 1);
giveItems(player, BLESSED_GLOVES, 1);
}
else
{
giveItems(player, SAMURAI_LONGSWORD, 1);
}
}
}
}
/**
* @param qs
*/
private void createBingoBoard(QuestState qs)
{
// @formatter:off
final Integer[] arr = {1,2,3,4,5,6,7,8,9};
// @formatter:on
Collections.shuffle(Arrays.asList(arr));
qs.set("numbers", Arrays.asList(arr).toString().replaceAll("[^\\d ]", ""));
qs.set("selected", "? ? ? ? ? ? ? ? ?");
}
/**
* @param qs
* @return
*/
private int getMatchedBingoLineCount(QuestState qs)
{
final String[] q = qs.get("selected").split(" ");
int found = 0;
// Horizontal
if (StringUtil.isNumeric(q[0] + q[1] + q[2]))
{
found++;
}
if (StringUtil.isNumeric(q[3] + q[4] + q[5]))
{
found++;
}
if (StringUtil.isNumeric(q[6] + q[7] + q[8]))
{
found++;
}
// Vertical
if (StringUtil.isNumeric(q[0] + q[3] + q[6]))
{
found++;
}
if (StringUtil.isNumeric(q[1] + q[4] + q[7]))
{
found++;
}
if (StringUtil.isNumeric(q[2] + q[5] + q[8]))
{
found++;
}
// Diagonal
if (StringUtil.isNumeric(q[0] + q[4] + q[8]))
{
found++;
}
if (StringUtil.isNumeric(q[2] + q[4] + q[6]))
{
found++;
}
return found;
}
/**
* @param qs
* @param num
*/
private void selectBingoNumber(QuestState qs, int num)
{
final String[] numbers = qs.get("numbers").split(" ");
int pos = 0;
for (int i = 0; i < numbers.length; i++)
{
if (Integer.parseInt(numbers[i]) == num)
{
pos = i;
break;
}
}
final String[] selected = qs.get("selected").split(" ");
for (int i = 0; i < selected.length; i++)
{
if (i == pos)
{
selected[i] = Integer.toString(num);
}
}
String result = selected[0];
for (int i = 1; i < selected.length; i++)
{
result += " " + selected[i];
}
qs.set("selected", result);
}
/**
* @param qs
* @param num
* @return
*/
private boolean isSelectedBingoNumber(QuestState qs, int num)
{
return qs.get("selected").contains(Integer.toString(num));
}
/**
* @param qs
* @param num
* @return
*/
private int getNumberFromBingoBoard(QuestState qs, int num)
{
return Integer.parseInt(qs.get("numbers").split(" ")[num]);
}
/**
* @param qs
* @return
*/
private int getBingoSelectCount(QuestState qs)
{
final String current = qs.get("selected");
return current.replaceAll("\\D", "").length();
}
@Override
public void onKill(Npc npc, Player killer, boolean isSummon)
{
final QuestState qs = getRandomPlayerFromParty(killer, npc);
if (qs != null)
{
switch (npc.getId())
{
case HUNTER_GARGOYLE:
{
if (getRandom(1000) < 328)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case DUST_WIND:
{
if (getRandom(100) < 35)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case THUNDER_WYRM:
{
if (getRandom(1000) < 312)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case DUST_WIND_HOLD:
{
if (getRandom(100) < 35)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case THUNDER_WYRM_HOLD:
{
if (getRandom(1000) < 312)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case HUNTER_GARGOYLE_HOLD:
{
if (getRandom(1000) < 328)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case GIANT_MONSTEREYE:
{
if (getRandom(1000) < 176)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case ROT_GOLEM:
{
if (getRandom(1000) < 226)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case WEIRD_DRAKE:
{
if (getRandom(1000) < 218)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case CARINKAIN:
{
if (getRandom(1000) < 216)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case GRAVE_GUARD:
{
if (getRandom(1000) < 312)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case TULBEN:
{
if (getRandom(1000) < 522)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case DRAGON_BEARER_CHIEF:
{
if (getRandom(100) < 38)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case DRAGON_BEARER_WARRIOR:
{
if (getRandom(100) < 39)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case DRAGON_BEARER_ARCHER:
{
if (getRandom(1000) < 372)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case CONGERER_LORD:
{
if (getRandom(1000) < 802)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case CONGERER:
{
if (getRandom(1000) < 844)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case NIGHTMARE_GUIDE:
{
if (getRandom(1000) < 118)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case NIGHTMARE_KEEPER:
{
if (getRandom(100) < 17)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case NIGHTMARE_LORD:
{
if (getRandom(1000) < 144)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case CADEINE:
{
if (getRandom(1000) < 162)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case SANHIDRO:
{
if (getRandom(100) < 25)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case CONNABI:
{
if (getRandom(1000) < 272)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case BARTAL:
{
if (getRandom(100) < 27)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case LUMINUN:
{
if (getRandom(100) < 32)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
case INNERSEN:
{
if (getRandom(1000) < 346)
{
giveItemRandomly(qs.getPlayer(), npc, Q_IRONGATE_MEDAL, 1, 0, 1, true);
}
break;
}
}
}
}
private QuestState getRandomPlayerFromParty(Player player, Npc npc)
{
final QuestState qs = getQuestState(player, false);
final List<QuestState> candidates = new ArrayList<>();
if ((qs != null) && qs.isStarted())
{
candidates.add(qs);
candidates.add(qs);
}
if (player.isInParty())
{
player.getParty().getMembers().forEach(pm ->
{
final QuestState qss = getQuestState(pm, false);
if ((qss != null) && qss.isStarted() && LocationUtil.checkIfInRange(PlayerConfig.ALT_PARTY_RANGE, npc, pm, true))
{
candidates.add(qss);
}
});
}
return candidates.isEmpty() ? null : candidates.get(getRandom(candidates.size()));
}
}