Always use static modifier when adding values to static lists and maps.
This commit is contained in:
@@ -62,7 +62,8 @@ public final class Antharas extends AbstractNpcAI
|
||||
private static final int BOMBER = 29070; // Dragon Bomber
|
||||
private static final int HEART = 13001; // Heart of Warding
|
||||
private static final int CUBE = 31859; // Teleportation Cubic
|
||||
private static final Map<Integer, Location> INVISIBLE_NPC = new HashMap<>();
|
||||
private static final Map<Integer, Location> INVISIBLE_NPC = new HashMap<>();
|
||||
static
|
||||
{
|
||||
INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735));
|
||||
INVISIBLE_NPC.put(29078, new Location(176707, 113585, -7735));
|
||||
|
||||
@@ -49,7 +49,8 @@ public final class Core extends AbstractNpcAI
|
||||
private static final int DOOM_WRAITH = 29008;
|
||||
private static final int SUSCEPTOR = 29011;
|
||||
// Spawns
|
||||
private static final Map<Integer, Location> MINNION_SPAWNS = new HashMap<>();
|
||||
private static final Map<Integer, Location> MINNION_SPAWNS = new HashMap<>();
|
||||
static
|
||||
{
|
||||
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17191, 109298, -6488));
|
||||
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17564, 109548, -6488));
|
||||
|
||||
@@ -66,7 +66,8 @@ import ai.AbstractNpcAI;
|
||||
public final class ClassMaster extends AbstractNpcAI implements IXmlReader
|
||||
{
|
||||
// NPCs
|
||||
private static final List<Integer> CLASS_MASTERS = new ArrayList<>();
|
||||
private static final List<Integer> CLASS_MASTERS = new ArrayList<>();
|
||||
static
|
||||
{
|
||||
CLASS_MASTERS.add(31756); // Mr. Cat
|
||||
CLASS_MASTERS.add(31757); // Queen of Hearts
|
||||
|
||||
@@ -33,7 +33,8 @@ import ai.AbstractNpcAI;
|
||||
*/
|
||||
public class NpcLocationInfo extends AbstractNpcAI
|
||||
{
|
||||
private static final List<Integer> NPC = new ArrayList<>();
|
||||
private static final List<Integer> NPC = new ArrayList<>();
|
||||
static
|
||||
{
|
||||
NPC.add(30598);
|
||||
NPC.add(30599);
|
||||
@@ -41,7 +42,8 @@ public class NpcLocationInfo extends AbstractNpcAI
|
||||
NPC.add(30601);
|
||||
NPC.add(30602);
|
||||
}
|
||||
private static final List<Integer> NPCRADAR = new ArrayList<>();
|
||||
private static final List<Integer> NPCRADAR = new ArrayList<>();
|
||||
static
|
||||
{
|
||||
// Talking Island
|
||||
NPCRADAR.add(30006); // Gatekeeper Roxxy
|
||||
|
||||
@@ -1,87 +1,88 @@
|
||||
/*
|
||||
* 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 handlers.itemhandlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.ItemGrade;
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.handler.IItemHandler;
|
||||
import com.l2jmobius.gameserver.model.ItemInfo;
|
||||
import com.l2jmobius.gameserver.model.actor.Playable;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ChangeAttributeCrystal implements IItemHandler
|
||||
{
|
||||
/*
|
||||
* 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 handlers.itemhandlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.ItemGrade;
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.handler.IItemHandler;
|
||||
import com.l2jmobius.gameserver.model.ItemInfo;
|
||||
import com.l2jmobius.gameserver.model.actor.Playable;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ChangeAttributeCrystal implements IItemHandler
|
||||
{
|
||||
private static final Map<Integer, ItemGrade> ITEM_GRADES = new HashMap<>();
|
||||
{
|
||||
ITEM_GRADES.put(33502, ItemGrade.S);
|
||||
ITEM_GRADES.put(35749, ItemGrade.R);
|
||||
ITEM_GRADES.put(45817, ItemGrade.R);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useItem(Playable playable, ItemInstance item, boolean forceUse)
|
||||
{
|
||||
if (!playable.isPlayer())
|
||||
{
|
||||
playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM);
|
||||
return false;
|
||||
}
|
||||
|
||||
final PlayerInstance player = playable.getActingPlayer();
|
||||
if (player.getPrivateStoreType() != PrivateStoreType.NONE)
|
||||
{
|
||||
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ITEM_GRADES.get(item.getId()) == null)
|
||||
{
|
||||
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED));
|
||||
return false;
|
||||
}
|
||||
|
||||
final List<ItemInfo> itemList = new ArrayList<>();
|
||||
for (ItemInstance i : player.getInventory().getItems())
|
||||
{
|
||||
if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId())))
|
||||
{
|
||||
itemList.add(new ItemInfo(i));
|
||||
}
|
||||
}
|
||||
|
||||
if (itemList.isEmpty())
|
||||
{
|
||||
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST));
|
||||
return false;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()])));
|
||||
return true;
|
||||
}
|
||||
static
|
||||
{
|
||||
ITEM_GRADES.put(33502, ItemGrade.S);
|
||||
ITEM_GRADES.put(35749, ItemGrade.R);
|
||||
ITEM_GRADES.put(45817, ItemGrade.R);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useItem(Playable playable, ItemInstance item, boolean forceUse)
|
||||
{
|
||||
if (!playable.isPlayer())
|
||||
{
|
||||
playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM);
|
||||
return false;
|
||||
}
|
||||
|
||||
final PlayerInstance player = playable.getActingPlayer();
|
||||
if (player.getPrivateStoreType() != PrivateStoreType.NONE)
|
||||
{
|
||||
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ITEM_GRADES.get(item.getId()) == null)
|
||||
{
|
||||
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED));
|
||||
return false;
|
||||
}
|
||||
|
||||
final List<ItemInfo> itemList = new ArrayList<>();
|
||||
for (ItemInstance i : player.getInventory().getItems())
|
||||
{
|
||||
if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId())))
|
||||
{
|
||||
itemList.add(new ItemInfo(i));
|
||||
}
|
||||
}
|
||||
|
||||
if (itemList.isEmpty())
|
||||
{
|
||||
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST));
|
||||
return false;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()])));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,452 +1,436 @@
|
||||
/*
|
||||
* 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.Q00255_Tutorial;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import com.l2jmobius.gameserver.enums.Race;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.World;
|
||||
import com.l2jmobius.gameserver.model.actor.Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import com.l2jmobius.gameserver.model.events.EventType;
|
||||
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
||||
import com.l2jmobius.gameserver.model.events.annotations.Id;
|
||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||
import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerBypass;
|
||||
import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemPickup;
|
||||
import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin;
|
||||
import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerPressTutorialMark;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import com.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.quest.Quest;
|
||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import com.l2jmobius.gameserver.network.NpcStringId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.PlaySound;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TutorialCloseHtml;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TutorialShowHtml;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TutorialShowQuestionMark;
|
||||
|
||||
/**
|
||||
* Tutorial Quest
|
||||
* @author Mobius
|
||||
*/
|
||||
public class Q00255_Tutorial extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final List<Integer> NEWBIE_HELPERS = new ArrayList<>();
|
||||
{
|
||||
NEWBIE_HELPERS.add(30009); // human fighter
|
||||
NEWBIE_HELPERS.add(30019); // human mystic
|
||||
NEWBIE_HELPERS.add(30400); // elf
|
||||
NEWBIE_HELPERS.add(30131); // dark elf
|
||||
NEWBIE_HELPERS.add(30575); // orc
|
||||
NEWBIE_HELPERS.add(30530); // dwarf
|
||||
}
|
||||
private static final List<Integer> SUPERVISORS = new ArrayList<>();
|
||||
{
|
||||
SUPERVISORS.add(30008); // human fighter
|
||||
SUPERVISORS.add(30017); // human mystic
|
||||
SUPERVISORS.add(30370); // elf
|
||||
SUPERVISORS.add(30129); // dark elf
|
||||
SUPERVISORS.add(30573); // orc
|
||||
SUPERVISORS.add(30528); // dwarf
|
||||
}
|
||||
// Monsters
|
||||
private static final int[] GREMLINS =
|
||||
{
|
||||
18342, // this is used for now
|
||||
20001
|
||||
};
|
||||
// Items
|
||||
private static final int BLUE_GEM = 6353;
|
||||
private static final ItemHolder SOULSHOT_REWARD = new ItemHolder(5789, 200);
|
||||
private static final ItemHolder SPIRITSHOT_REWARD = new ItemHolder(5790, 100);
|
||||
// Others
|
||||
private static final Map<Integer, QuestSoundHtmlHolder> STARTING_VOICE_HTML = new HashMap<>();
|
||||
{
|
||||
STARTING_VOICE_HTML.put(0, new QuestSoundHtmlHolder("tutorial_voice_001a", "tutorial_human_fighter001.html"));
|
||||
STARTING_VOICE_HTML.put(10, new QuestSoundHtmlHolder("tutorial_voice_001b", "tutorial_human_mage001.html"));
|
||||
STARTING_VOICE_HTML.put(18, new QuestSoundHtmlHolder("tutorial_voice_001c", "tutorial_elven_fighter001.html"));
|
||||
STARTING_VOICE_HTML.put(25, new QuestSoundHtmlHolder("tutorial_voice_001d", "tutorial_elven_mage001.html"));
|
||||
STARTING_VOICE_HTML.put(31, new QuestSoundHtmlHolder("tutorial_voice_001e", "tutorial_delf_fighter001.html"));
|
||||
STARTING_VOICE_HTML.put(38, new QuestSoundHtmlHolder("tutorial_voice_001f", "tutorial_delf_mage001.html"));
|
||||
STARTING_VOICE_HTML.put(44, new QuestSoundHtmlHolder("tutorial_voice_001g", "tutorial_orc_fighter001.html"));
|
||||
STARTING_VOICE_HTML.put(49, new QuestSoundHtmlHolder("tutorial_voice_001h", "tutorial_orc_mage001.html"));
|
||||
STARTING_VOICE_HTML.put(53, new QuestSoundHtmlHolder("tutorial_voice_001i", "tutorial_dwarven_fighter001.html"));
|
||||
}
|
||||
private static final Map<Integer, Location> HELPER_LOCATION = new HashMap<>();
|
||||
{
|
||||
HELPER_LOCATION.put(0, new Location(-71424, 258336, -3109));
|
||||
HELPER_LOCATION.put(10, new Location(-91036, 248044, -3568));
|
||||
HELPER_LOCATION.put(18, new Location(46112, 41200, -3504));
|
||||
HELPER_LOCATION.put(25, new Location(46112, 41200, -3504));
|
||||
HELPER_LOCATION.put(31, new Location(28384, 11056, -4233));
|
||||
HELPER_LOCATION.put(38, new Location(28384, 11056, -4233));
|
||||
HELPER_LOCATION.put(44, new Location(-56736, -113680, -672));
|
||||
HELPER_LOCATION.put(49, new Location(-56736, -113680, -672));
|
||||
HELPER_LOCATION.put(53, new Location(108567, -173994, -406));
|
||||
}
|
||||
private static final Map<Integer, Location> COMPLETE_LOCATION = new HashMap<>();
|
||||
{
|
||||
COMPLETE_LOCATION.put(0, new Location(-84081, 243227, -3723));
|
||||
COMPLETE_LOCATION.put(10, new Location(-84081, 243227, -3723));
|
||||
COMPLETE_LOCATION.put(18, new Location(45475, 48359, -3060));
|
||||
COMPLETE_LOCATION.put(25, new Location(45475, 48359, -3060));
|
||||
COMPLETE_LOCATION.put(31, new Location(12111, 16686, -4582));
|
||||
COMPLETE_LOCATION.put(38, new Location(12111, 16686, -4582));
|
||||
COMPLETE_LOCATION.put(44, new Location(-45032, -113598, -192));
|
||||
COMPLETE_LOCATION.put(49, new Location(-45032, -113598, -192));
|
||||
COMPLETE_LOCATION.put(53, new Location(115632, -177996, -905));
|
||||
}
|
||||
private static final String TUTORIAL_BUYPASS = "Quest Q00255_Tutorial ";
|
||||
private static final int QUESTION_MARK_ID_1 = 1;
|
||||
private static final int QUESTION_MARK_ID_2 = 5;
|
||||
private static final int QUESTION_MARK_ID_3 = 28;
|
||||
|
||||
public Q00255_Tutorial()
|
||||
{
|
||||
super(255);
|
||||
addTalkId(NEWBIE_HELPERS);
|
||||
addTalkId(SUPERVISORS);
|
||||
addFirstTalkId(NEWBIE_HELPERS);
|
||||
addFirstTalkId(SUPERVISORS);
|
||||
addKillId(GREMLINS);
|
||||
registerQuestItems(BLUE_GEM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
|
||||
{
|
||||
final QuestState qs = getQuestState(player, false);
|
||||
if (qs == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String htmltext = null;
|
||||
switch (event)
|
||||
{
|
||||
case "start_newbie_tutorial":
|
||||
{
|
||||
if (qs.getMemoState() < 4)
|
||||
{
|
||||
qs.startQuest();
|
||||
qs.setMemoState(1);
|
||||
playTutorialVoice(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getSound());
|
||||
showTutorialHtml(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getHtml());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "tutorial_02.html":
|
||||
case "tutorial_03.html":
|
||||
{
|
||||
if (qs.isMemoState(1))
|
||||
{
|
||||
showTutorialHtml(player, event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "question_mark_1":
|
||||
{
|
||||
if (qs.isMemoState(1))
|
||||
{
|
||||
player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_1, 0));
|
||||
player.sendPacket(TutorialCloseHtml.STATIC_PACKET);
|
||||
player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "reward_2":
|
||||
{
|
||||
if (qs.isMemoState(4))
|
||||
{
|
||||
qs.setMemoState(5);
|
||||
if (player.isMageClass() && (player.getRace() != Race.ORC))
|
||||
{
|
||||
giveItems(player, SPIRITSHOT_REWARD);
|
||||
playTutorialVoice(player, "tutorial_voice_027");
|
||||
}
|
||||
else
|
||||
{
|
||||
giveItems(player, SOULSHOT_REWARD);
|
||||
playTutorialVoice(player, "tutorial_voice_026");
|
||||
}
|
||||
htmltext = (npc != null ? npc.getId() : player.getTarget().getId()) + "-3.html";
|
||||
player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_3, 0));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "close_tutorial":
|
||||
{
|
||||
player.sendPacket(TutorialCloseHtml.STATIC_PACKET);
|
||||
player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(Npc npc, PlayerInstance player)
|
||||
{
|
||||
final QuestState qs = getQuestState(player, false);
|
||||
if (qs != null)
|
||||
{
|
||||
// start newbie helpers
|
||||
if (NEWBIE_HELPERS.contains(npc.getId()))
|
||||
{
|
||||
if (hasQuestItems(player, BLUE_GEM))
|
||||
{
|
||||
qs.setMemoState(3);
|
||||
}
|
||||
switch (qs.getMemoState())
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
{
|
||||
player.sendPacket(TutorialCloseHtml.STATIC_PACKET);
|
||||
player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML);
|
||||
qs.setMemoState(2);
|
||||
if (!player.isMageClass())
|
||||
{
|
||||
return "tutorial_05_fighter.html";
|
||||
}
|
||||
else if (player.getRace() == Race.ORC)
|
||||
{
|
||||
return "tutorial_05_mystic_orc.html";
|
||||
}
|
||||
return "tutorial_05_mystic.html";
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if (!player.isMageClass())
|
||||
{
|
||||
return "tutorial_05_fighter_back.html";
|
||||
}
|
||||
else if (player.getRace() == Race.ORC)
|
||||
{
|
||||
return "tutorial_05_mystic_orc_back.html";
|
||||
}
|
||||
return "tutorial_05_mystic_back.html";
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
player.sendPacket(TutorialCloseHtml.STATIC_PACKET);
|
||||
player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML);
|
||||
qs.setMemoState(4);
|
||||
takeItems(player, BLUE_GEM, -1);
|
||||
if (player.isMageClass() && (player.getRace() != Race.ORC))
|
||||
{
|
||||
giveItems(player, SPIRITSHOT_REWARD);
|
||||
playTutorialVoice(player, "tutorial_voice_027");
|
||||
return npc.getId() + "-3.html";
|
||||
}
|
||||
giveItems(player, SOULSHOT_REWARD);
|
||||
playTutorialVoice(player, "tutorial_voice_026");
|
||||
return npc.getId() + "-2.html";
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
return npc.getId() + "-4.html";
|
||||
}
|
||||
case 5:
|
||||
case 6:
|
||||
{
|
||||
return npc.getId() + "-5.html";
|
||||
}
|
||||
}
|
||||
}
|
||||
// else supervisors
|
||||
switch (qs.getMemoState())
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
{
|
||||
return npc.getId() + "-1.html";
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
return npc.getId() + "-2.html";
|
||||
}
|
||||
case 5:
|
||||
case 6:
|
||||
{
|
||||
return npc.getId() + "-4.html";
|
||||
}
|
||||
}
|
||||
}
|
||||
return npc.getId() + "-1.html";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
|
||||
{
|
||||
final QuestState qs = getQuestState(killer, false);
|
||||
if ((qs != null) && qs.isMemoState(2) && !hasQuestItems(killer, BLUE_GEM) && (getRandom(100) < 30))
|
||||
{
|
||||
// check for too many gems on ground
|
||||
int counter = 0;
|
||||
for (ItemInstance item : World.getInstance().getVisibleObjectsInRange(killer, ItemInstance.class, 1500))
|
||||
{
|
||||
if (item.getId() == BLUE_GEM)
|
||||
{
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
if (counter < 10) // do not drop if more than 10
|
||||
{
|
||||
npc.dropItem(killer, BLUE_GEM, 1);
|
||||
}
|
||||
}
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
|
||||
@RegisterEvent(EventType.ON_PLAYER_ITEM_PICKUP)
|
||||
@RegisterType(ListenerRegisterType.ITEM)
|
||||
@Id(BLUE_GEM)
|
||||
public void OnPlayerItemPickup(OnPlayerItemPickup event)
|
||||
{
|
||||
final PlayerInstance player = event.getPlayer();
|
||||
final QuestState qs = getQuestState(player, false);
|
||||
if ((qs != null) && (qs.getMemoState() < 3))
|
||||
{
|
||||
qs.setMemoState(3);
|
||||
playSound(player, "ItemSound.quest_tutorial");
|
||||
playTutorialVoice(player, "tutorial_voice_013");
|
||||
player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_2, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@RegisterEvent(EventType.ON_PLAYER_PRESS_TUTORIAL_MARK)
|
||||
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
|
||||
public void onPlayerPressTutorialMark(OnPlayerPressTutorialMark event)
|
||||
{
|
||||
final QuestState qs = getQuestState(event.getPlayer(), false);
|
||||
if (qs != null)
|
||||
{
|
||||
switch (event.getMarkId())
|
||||
{
|
||||
case QUESTION_MARK_ID_1:
|
||||
{
|
||||
if (qs.isMemoState(1))
|
||||
{
|
||||
showOnScreenMsg(event.getPlayer(), NpcStringId.SPEAK_WITH_THE_NEWBIE_HELPER, ExShowScreenMessage.TOP_CENTER, 5000);
|
||||
final int classId = event.getPlayer().getClassId().getId();
|
||||
addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ());
|
||||
showTutorialHtml(event.getPlayer(), "tutorial_04.html");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QUESTION_MARK_ID_2:
|
||||
{
|
||||
if (qs.isMemoState(3))
|
||||
{
|
||||
final int classId = event.getPlayer().getClassId().getId();
|
||||
addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ());
|
||||
showTutorialHtml(event.getPlayer(), "tutorial_06.html");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QUESTION_MARK_ID_3:
|
||||
{
|
||||
if (qs.isMemoState(5))
|
||||
{
|
||||
final int classId = event.getPlayer().getClassId().getId();
|
||||
addRadar(event.getPlayer(), COMPLETE_LOCATION.get(classId).getX(), COMPLETE_LOCATION.get(classId).getY(), COMPLETE_LOCATION.get(classId).getZ());
|
||||
playSound(event.getPlayer(), "ItemSound.quest_tutorial");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RegisterEvent(EventType.ON_PLAYER_BYPASS)
|
||||
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
|
||||
public void OnPlayerBypass(OnPlayerBypass event)
|
||||
{
|
||||
final PlayerInstance player = event.getPlayer();
|
||||
if (event.getCommand().startsWith(TUTORIAL_BUYPASS))
|
||||
{
|
||||
notifyEvent(event.getCommand().replace(TUTORIAL_BUYPASS, ""), null, player);
|
||||
}
|
||||
}
|
||||
|
||||
@RegisterEvent(EventType.ON_PLAYER_LOGIN)
|
||||
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
|
||||
public void OnPlayerLogin(OnPlayerLogin event)
|
||||
{
|
||||
if (Config.DISABLE_TUTORIAL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final PlayerInstance player = event.getPlayer();
|
||||
if (player.getLevel() > 6)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QuestState qs = getQuestState(player, true);
|
||||
if ((qs != null) && (qs.getMemoState() < 4) && STARTING_VOICE_HTML.containsKey(player.getClassId().getId()))
|
||||
{
|
||||
startQuestTimer("start_newbie_tutorial", 5000, null, player);
|
||||
}
|
||||
}
|
||||
|
||||
private void showTutorialHtml(PlayerInstance player, String html)
|
||||
{
|
||||
player.sendPacket(new TutorialShowHtml(getHtm(player, html)));
|
||||
}
|
||||
|
||||
public void playTutorialVoice(PlayerInstance player, String voice)
|
||||
{
|
||||
player.sendPacket(new PlaySound(2, voice, 0, 0, player.getX(), player.getY(), player.getZ()));
|
||||
}
|
||||
|
||||
private class QuestSoundHtmlHolder
|
||||
{
|
||||
private final String _sound;
|
||||
private final String _html;
|
||||
|
||||
QuestSoundHtmlHolder(String sound, String html)
|
||||
{
|
||||
_sound = sound;
|
||||
_html = html;
|
||||
}
|
||||
|
||||
String getSound()
|
||||
{
|
||||
return _sound;
|
||||
}
|
||||
|
||||
String getHtml()
|
||||
{
|
||||
return _html;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.Q00255_Tutorial;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import com.l2jmobius.gameserver.enums.Race;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.World;
|
||||
import com.l2jmobius.gameserver.model.actor.Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import com.l2jmobius.gameserver.model.events.EventType;
|
||||
import com.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
||||
import com.l2jmobius.gameserver.model.events.annotations.Id;
|
||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||
import com.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||
import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerBypass;
|
||||
import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemPickup;
|
||||
import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin;
|
||||
import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerPressTutorialMark;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import com.l2jmobius.gameserver.model.holders.QuestSoundHtmlHolder;
|
||||
import com.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.quest.Quest;
|
||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import com.l2jmobius.gameserver.network.NpcStringId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.PlaySound;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TutorialCloseHtml;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TutorialShowHtml;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.TutorialShowQuestionMark;
|
||||
|
||||
/**
|
||||
* Tutorial Quest
|
||||
* @author Mobius
|
||||
*/
|
||||
public class Q00255_Tutorial extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final List<Integer> NEWBIE_HELPERS = new ArrayList<>();
|
||||
static
|
||||
{
|
||||
NEWBIE_HELPERS.add(30009); // human fighter
|
||||
NEWBIE_HELPERS.add(30019); // human mystic
|
||||
NEWBIE_HELPERS.add(30400); // elf
|
||||
NEWBIE_HELPERS.add(30131); // dark elf
|
||||
NEWBIE_HELPERS.add(30575); // orc
|
||||
NEWBIE_HELPERS.add(30530); // dwarf
|
||||
}
|
||||
private static final List<Integer> SUPERVISORS = new ArrayList<>();
|
||||
static
|
||||
{
|
||||
SUPERVISORS.add(30008); // human fighter
|
||||
SUPERVISORS.add(30017); // human mystic
|
||||
SUPERVISORS.add(30370); // elf
|
||||
SUPERVISORS.add(30129); // dark elf
|
||||
SUPERVISORS.add(30573); // orc
|
||||
SUPERVISORS.add(30528); // dwarf
|
||||
}
|
||||
// Monsters
|
||||
private static final int[] GREMLINS =
|
||||
{
|
||||
18342, // this is used for now
|
||||
20001
|
||||
};
|
||||
// Items
|
||||
private static final int BLUE_GEM = 6353;
|
||||
private static final ItemHolder SOULSHOT_REWARD = new ItemHolder(5789, 200);
|
||||
private static final ItemHolder SPIRITSHOT_REWARD = new ItemHolder(5790, 100);
|
||||
// Others
|
||||
private static final Map<Integer, QuestSoundHtmlHolder> STARTING_VOICE_HTML = new HashMap<>();
|
||||
static
|
||||
{
|
||||
STARTING_VOICE_HTML.put(0, new QuestSoundHtmlHolder("tutorial_voice_001a", "tutorial_human_fighter001.html"));
|
||||
STARTING_VOICE_HTML.put(10, new QuestSoundHtmlHolder("tutorial_voice_001b", "tutorial_human_mage001.html"));
|
||||
STARTING_VOICE_HTML.put(18, new QuestSoundHtmlHolder("tutorial_voice_001c", "tutorial_elven_fighter001.html"));
|
||||
STARTING_VOICE_HTML.put(25, new QuestSoundHtmlHolder("tutorial_voice_001d", "tutorial_elven_mage001.html"));
|
||||
STARTING_VOICE_HTML.put(31, new QuestSoundHtmlHolder("tutorial_voice_001e", "tutorial_delf_fighter001.html"));
|
||||
STARTING_VOICE_HTML.put(38, new QuestSoundHtmlHolder("tutorial_voice_001f", "tutorial_delf_mage001.html"));
|
||||
STARTING_VOICE_HTML.put(44, new QuestSoundHtmlHolder("tutorial_voice_001g", "tutorial_orc_fighter001.html"));
|
||||
STARTING_VOICE_HTML.put(49, new QuestSoundHtmlHolder("tutorial_voice_001h", "tutorial_orc_mage001.html"));
|
||||
STARTING_VOICE_HTML.put(53, new QuestSoundHtmlHolder("tutorial_voice_001i", "tutorial_dwarven_fighter001.html"));
|
||||
}
|
||||
private static final Map<Integer, Location> HELPER_LOCATION = new HashMap<>();
|
||||
static
|
||||
{
|
||||
HELPER_LOCATION.put(0, new Location(-71424, 258336, -3109));
|
||||
HELPER_LOCATION.put(10, new Location(-91036, 248044, -3568));
|
||||
HELPER_LOCATION.put(18, new Location(46112, 41200, -3504));
|
||||
HELPER_LOCATION.put(25, new Location(46112, 41200, -3504));
|
||||
HELPER_LOCATION.put(31, new Location(28384, 11056, -4233));
|
||||
HELPER_LOCATION.put(38, new Location(28384, 11056, -4233));
|
||||
HELPER_LOCATION.put(44, new Location(-56736, -113680, -672));
|
||||
HELPER_LOCATION.put(49, new Location(-56736, -113680, -672));
|
||||
HELPER_LOCATION.put(53, new Location(108567, -173994, -406));
|
||||
}
|
||||
private static final Map<Integer, Location> COMPLETE_LOCATION = new HashMap<>();
|
||||
static
|
||||
{
|
||||
COMPLETE_LOCATION.put(0, new Location(-84081, 243227, -3723));
|
||||
COMPLETE_LOCATION.put(10, new Location(-84081, 243227, -3723));
|
||||
COMPLETE_LOCATION.put(18, new Location(45475, 48359, -3060));
|
||||
COMPLETE_LOCATION.put(25, new Location(45475, 48359, -3060));
|
||||
COMPLETE_LOCATION.put(31, new Location(12111, 16686, -4582));
|
||||
COMPLETE_LOCATION.put(38, new Location(12111, 16686, -4582));
|
||||
COMPLETE_LOCATION.put(44, new Location(-45032, -113598, -192));
|
||||
COMPLETE_LOCATION.put(49, new Location(-45032, -113598, -192));
|
||||
COMPLETE_LOCATION.put(53, new Location(115632, -177996, -905));
|
||||
}
|
||||
private static final String TUTORIAL_BUYPASS = "Quest Q00255_Tutorial ";
|
||||
private static final int QUESTION_MARK_ID_1 = 1;
|
||||
private static final int QUESTION_MARK_ID_2 = 5;
|
||||
private static final int QUESTION_MARK_ID_3 = 28;
|
||||
|
||||
public Q00255_Tutorial()
|
||||
{
|
||||
super(255);
|
||||
addTalkId(NEWBIE_HELPERS);
|
||||
addTalkId(SUPERVISORS);
|
||||
addFirstTalkId(NEWBIE_HELPERS);
|
||||
addFirstTalkId(SUPERVISORS);
|
||||
addKillId(GREMLINS);
|
||||
registerQuestItems(BLUE_GEM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
|
||||
{
|
||||
final QuestState qs = getQuestState(player, false);
|
||||
if (qs == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String htmltext = null;
|
||||
switch (event)
|
||||
{
|
||||
case "start_newbie_tutorial":
|
||||
{
|
||||
if (qs.getMemoState() < 4)
|
||||
{
|
||||
qs.startQuest();
|
||||
qs.setMemoState(1);
|
||||
playTutorialVoice(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getSound());
|
||||
showTutorialHtml(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getHtml());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "tutorial_02.html":
|
||||
case "tutorial_03.html":
|
||||
{
|
||||
if (qs.isMemoState(1))
|
||||
{
|
||||
showTutorialHtml(player, event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "question_mark_1":
|
||||
{
|
||||
if (qs.isMemoState(1))
|
||||
{
|
||||
player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_1, 0));
|
||||
player.sendPacket(TutorialCloseHtml.STATIC_PACKET);
|
||||
player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "reward_2":
|
||||
{
|
||||
if (qs.isMemoState(4))
|
||||
{
|
||||
qs.setMemoState(5);
|
||||
if (player.isMageClass() && (player.getRace() != Race.ORC))
|
||||
{
|
||||
giveItems(player, SPIRITSHOT_REWARD);
|
||||
playTutorialVoice(player, "tutorial_voice_027");
|
||||
}
|
||||
else
|
||||
{
|
||||
giveItems(player, SOULSHOT_REWARD);
|
||||
playTutorialVoice(player, "tutorial_voice_026");
|
||||
}
|
||||
htmltext = (npc != null ? npc.getId() : player.getTarget().getId()) + "-3.html";
|
||||
player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_3, 0));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "close_tutorial":
|
||||
{
|
||||
player.sendPacket(TutorialCloseHtml.STATIC_PACKET);
|
||||
player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(Npc npc, PlayerInstance player)
|
||||
{
|
||||
final QuestState qs = getQuestState(player, false);
|
||||
if (qs != null)
|
||||
{
|
||||
// start newbie helpers
|
||||
if (NEWBIE_HELPERS.contains(npc.getId()))
|
||||
{
|
||||
if (hasQuestItems(player, BLUE_GEM))
|
||||
{
|
||||
qs.setMemoState(3);
|
||||
}
|
||||
switch (qs.getMemoState())
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
{
|
||||
player.sendPacket(TutorialCloseHtml.STATIC_PACKET);
|
||||
player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML);
|
||||
qs.setMemoState(2);
|
||||
if (!player.isMageClass())
|
||||
{
|
||||
return "tutorial_05_fighter.html";
|
||||
}
|
||||
else if (player.getRace() == Race.ORC)
|
||||
{
|
||||
return "tutorial_05_mystic_orc.html";
|
||||
}
|
||||
return "tutorial_05_mystic.html";
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if (!player.isMageClass())
|
||||
{
|
||||
return "tutorial_05_fighter_back.html";
|
||||
}
|
||||
else if (player.getRace() == Race.ORC)
|
||||
{
|
||||
return "tutorial_05_mystic_orc_back.html";
|
||||
}
|
||||
return "tutorial_05_mystic_back.html";
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
player.sendPacket(TutorialCloseHtml.STATIC_PACKET);
|
||||
player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML);
|
||||
qs.setMemoState(4);
|
||||
takeItems(player, BLUE_GEM, -1);
|
||||
if (player.isMageClass() && (player.getRace() != Race.ORC))
|
||||
{
|
||||
giveItems(player, SPIRITSHOT_REWARD);
|
||||
playTutorialVoice(player, "tutorial_voice_027");
|
||||
return npc.getId() + "-3.html";
|
||||
}
|
||||
giveItems(player, SOULSHOT_REWARD);
|
||||
playTutorialVoice(player, "tutorial_voice_026");
|
||||
return npc.getId() + "-2.html";
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
return npc.getId() + "-4.html";
|
||||
}
|
||||
case 5:
|
||||
case 6:
|
||||
{
|
||||
return npc.getId() + "-5.html";
|
||||
}
|
||||
}
|
||||
}
|
||||
// else supervisors
|
||||
switch (qs.getMemoState())
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
{
|
||||
return npc.getId() + "-1.html";
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
return npc.getId() + "-2.html";
|
||||
}
|
||||
case 5:
|
||||
case 6:
|
||||
{
|
||||
return npc.getId() + "-4.html";
|
||||
}
|
||||
}
|
||||
}
|
||||
return npc.getId() + "-1.html";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
|
||||
{
|
||||
final QuestState qs = getQuestState(killer, false);
|
||||
if ((qs != null) && qs.isMemoState(2) && !hasQuestItems(killer, BLUE_GEM) && (getRandom(100) < 30))
|
||||
{
|
||||
// check for too many gems on ground
|
||||
int counter = 0;
|
||||
for (ItemInstance item : World.getInstance().getVisibleObjectsInRange(killer, ItemInstance.class, 1500))
|
||||
{
|
||||
if (item.getId() == BLUE_GEM)
|
||||
{
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
if (counter < 10) // do not drop if more than 10
|
||||
{
|
||||
npc.dropItem(killer, BLUE_GEM, 1);
|
||||
}
|
||||
}
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
|
||||
@RegisterEvent(EventType.ON_PLAYER_ITEM_PICKUP)
|
||||
@RegisterType(ListenerRegisterType.ITEM)
|
||||
@Id(BLUE_GEM)
|
||||
public void OnPlayerItemPickup(OnPlayerItemPickup event)
|
||||
{
|
||||
final PlayerInstance player = event.getPlayer();
|
||||
final QuestState qs = getQuestState(player, false);
|
||||
if ((qs != null) && (qs.getMemoState() < 3))
|
||||
{
|
||||
qs.setMemoState(3);
|
||||
playSound(player, "ItemSound.quest_tutorial");
|
||||
playTutorialVoice(player, "tutorial_voice_013");
|
||||
player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_2, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@RegisterEvent(EventType.ON_PLAYER_PRESS_TUTORIAL_MARK)
|
||||
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
|
||||
public void onPlayerPressTutorialMark(OnPlayerPressTutorialMark event)
|
||||
{
|
||||
final QuestState qs = getQuestState(event.getPlayer(), false);
|
||||
if (qs != null)
|
||||
{
|
||||
switch (event.getMarkId())
|
||||
{
|
||||
case QUESTION_MARK_ID_1:
|
||||
{
|
||||
if (qs.isMemoState(1))
|
||||
{
|
||||
showOnScreenMsg(event.getPlayer(), NpcStringId.SPEAK_WITH_THE_NEWBIE_HELPER, ExShowScreenMessage.TOP_CENTER, 5000);
|
||||
final int classId = event.getPlayer().getClassId().getId();
|
||||
addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ());
|
||||
showTutorialHtml(event.getPlayer(), "tutorial_04.html");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QUESTION_MARK_ID_2:
|
||||
{
|
||||
if (qs.isMemoState(3))
|
||||
{
|
||||
final int classId = event.getPlayer().getClassId().getId();
|
||||
addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ());
|
||||
showTutorialHtml(event.getPlayer(), "tutorial_06.html");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QUESTION_MARK_ID_3:
|
||||
{
|
||||
if (qs.isMemoState(5))
|
||||
{
|
||||
final int classId = event.getPlayer().getClassId().getId();
|
||||
addRadar(event.getPlayer(), COMPLETE_LOCATION.get(classId).getX(), COMPLETE_LOCATION.get(classId).getY(), COMPLETE_LOCATION.get(classId).getZ());
|
||||
playSound(event.getPlayer(), "ItemSound.quest_tutorial");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RegisterEvent(EventType.ON_PLAYER_BYPASS)
|
||||
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
|
||||
public void OnPlayerBypass(OnPlayerBypass event)
|
||||
{
|
||||
final PlayerInstance player = event.getPlayer();
|
||||
if (event.getCommand().startsWith(TUTORIAL_BUYPASS))
|
||||
{
|
||||
notifyEvent(event.getCommand().replace(TUTORIAL_BUYPASS, ""), null, player);
|
||||
}
|
||||
}
|
||||
|
||||
@RegisterEvent(EventType.ON_PLAYER_LOGIN)
|
||||
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
|
||||
public void OnPlayerLogin(OnPlayerLogin event)
|
||||
{
|
||||
if (Config.DISABLE_TUTORIAL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final PlayerInstance player = event.getPlayer();
|
||||
if (player.getLevel() > 6)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QuestState qs = getQuestState(player, true);
|
||||
if ((qs != null) && (qs.getMemoState() < 4) && STARTING_VOICE_HTML.containsKey(player.getClassId().getId()))
|
||||
{
|
||||
startQuestTimer("start_newbie_tutorial", 5000, null, player);
|
||||
}
|
||||
}
|
||||
|
||||
private void showTutorialHtml(PlayerInstance player, String html)
|
||||
{
|
||||
player.sendPacket(new TutorialShowHtml(getHtm(player, html)));
|
||||
}
|
||||
|
||||
public void playTutorialVoice(PlayerInstance player, String voice)
|
||||
{
|
||||
player.sendPacket(new PlaySound(2, voice, 0, 0, player.getX(), player.getY(), player.getZ()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,6 @@ public final class Q00257_TheGuardIsBusy extends Quest
|
||||
private static final int ORC_AMULET = 752;
|
||||
private static final int ORC_NECKLACE = 1085;
|
||||
private static final int WEREWOLF_FANG = 1086;
|
||||
|
||||
static
|
||||
{
|
||||
MONSTERS.put(20006, Arrays.asList(new MobDrop(10, 2, ORC_AMULET, 2), new MobDrop(10, 10, ORC_AMULET, 1))); // Orc Archer
|
||||
|
||||
@@ -54,7 +54,6 @@ public final class Q00276_TotemOfTheHestui extends Quest
|
||||
// Misc
|
||||
private static final List<ItemHolder> SPAWN_CHANCES = new ArrayList<>();
|
||||
private static final int MIN_LVL = 15;
|
||||
|
||||
static
|
||||
{
|
||||
SPAWN_CHANCES.add(new ItemHolder(79, 100));
|
||||
|
||||
@@ -78,7 +78,6 @@ public final class Q00327_RecoverTheFarmland extends Quest
|
||||
new ItemHolder(ANCIENT_BRONZE_MIRROR, 3227),
|
||||
new ItemHolder(ANCIENT_JADE_NECKLACE, 3919)
|
||||
};
|
||||
|
||||
static
|
||||
{
|
||||
FRAGMENTS_REWARD_DATA.put("30034-03.html", new ItemHolder(CLAY_URN_FRAGMENT, 307));
|
||||
|
||||
@@ -1,378 +1,379 @@
|
||||
/*
|
||||
* 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.Q00344_1000YearsTheEndOfLamentation;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import com.l2jmobius.gameserver.model.quest.Quest;
|
||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||
|
||||
/**
|
||||
* 1000 years, the End of Lamentation (344)
|
||||
* @author Pandragon
|
||||
*/
|
||||
public final class Q00344_1000YearsTheEndOfLamentation extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int KAIEN = 30623;
|
||||
private static final int GARVARENTZ = 30704;
|
||||
private static final int GILMORE = 30754;
|
||||
private static final int RODEMAI = 30756;
|
||||
private static final int ORVEN = 30857;
|
||||
// Items
|
||||
private static final int ARTICLES = 4269;
|
||||
private static final ItemHolder OLD_KEY = new ItemHolder(4270, 1);
|
||||
private static final ItemHolder OLD_HILT = new ItemHolder(4271, 1);
|
||||
private static final ItemHolder TOTEM_NECKLACE = new ItemHolder(4272, 1);
|
||||
private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1);
|
||||
// Monsters
|
||||
/*
|
||||
* 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.Q00344_1000YearsTheEndOfLamentation;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.gameserver.model.actor.Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import com.l2jmobius.gameserver.model.quest.Quest;
|
||||
import com.l2jmobius.gameserver.model.quest.QuestState;
|
||||
|
||||
/**
|
||||
* 1000 years, the End of Lamentation (344)
|
||||
* @author Pandragon
|
||||
*/
|
||||
public final class Q00344_1000YearsTheEndOfLamentation extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int KAIEN = 30623;
|
||||
private static final int GARVARENTZ = 30704;
|
||||
private static final int GILMORE = 30754;
|
||||
private static final int RODEMAI = 30756;
|
||||
private static final int ORVEN = 30857;
|
||||
// Items
|
||||
private static final int ARTICLES = 4269;
|
||||
private static final ItemHolder OLD_KEY = new ItemHolder(4270, 1);
|
||||
private static final ItemHolder OLD_HILT = new ItemHolder(4271, 1);
|
||||
private static final ItemHolder TOTEM_NECKLACE = new ItemHolder(4272, 1);
|
||||
private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1);
|
||||
// Monsters
|
||||
private static final Map<Integer, Double> MONSTER_CHANCES = new HashMap<>();
|
||||
{
|
||||
MONSTER_CHANCES.put(20236, 0.58); // Cave Servant
|
||||
MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior
|
||||
MONSTER_CHANCES.put(20237, 0.78); // Cave Servant Archer
|
||||
MONSTER_CHANCES.put(20239, 0.79); // Cave Servant Captain
|
||||
MONSTER_CHANCES.put(20240, 0.85); // Royal Cave Servant
|
||||
MONSTER_CHANCES.put(20272, 0.58); // Cave Servant
|
||||
MONSTER_CHANCES.put(20273, 0.78); // Cave Servant Archer
|
||||
MONSTER_CHANCES.put(20274, 0.75); // Cave Servant Warrior
|
||||
MONSTER_CHANCES.put(20275, 0.79); // Cave Servant Captain
|
||||
MONSTER_CHANCES.put(20276, 0.85); // Royal Cave Servant
|
||||
}
|
||||
// Rewards
|
||||
private static final ItemHolder ORIHARUKON_ORE = new ItemHolder(1874, 25);
|
||||
private static final ItemHolder VARNISH_OF_PURITY = new ItemHolder(1887, 10);
|
||||
private static final ItemHolder SCROLL_EWC = new ItemHolder(951, 1);
|
||||
private static final ItemHolder RAID_SWORD = new ItemHolder(133, 1);
|
||||
private static final ItemHolder COKES = new ItemHolder(1879, 55);
|
||||
private static final ItemHolder RING_OF_AGES = new ItemHolder(885, 1);
|
||||
private static final ItemHolder LEATHER = new ItemHolder(1882, 70);
|
||||
private static final ItemHolder COARSE_BONE_POWDER = new ItemHolder(1881, 50);
|
||||
private static final ItemHolder HEAVY_DOOM_HAMMER = new ItemHolder(191, 1);
|
||||
private static final ItemHolder STONE_OF_PURITY = new ItemHolder(1875, 19);
|
||||
private static final ItemHolder SCROLL_EAC = new ItemHolder(952, 5);
|
||||
private static final ItemHolder DRAKE_LEATHER_BOOTS = new ItemHolder(2437, 1);
|
||||
// Misc
|
||||
private static final int MIN_LVL = 48;
|
||||
|
||||
public Q00344_1000YearsTheEndOfLamentation()
|
||||
{
|
||||
super(344);
|
||||
addStartNpc(GILMORE);
|
||||
addTalkId(KAIEN, GARVARENTZ, GILMORE, RODEMAI, ORVEN);
|
||||
addKillId(MONSTER_CHANCES.keySet());
|
||||
registerQuestItems(ARTICLES, OLD_KEY.getId(), OLD_HILT.getId(), TOTEM_NECKLACE.getId(), CRUCIFIX.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
|
||||
{
|
||||
final QuestState qs = getQuestState(player, false);
|
||||
String htmltext = null;
|
||||
if (qs == null)
|
||||
{
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case "30754-03.htm":
|
||||
case "30754-16.html":
|
||||
{
|
||||
htmltext = event;
|
||||
break;
|
||||
}
|
||||
case "30754-04.htm":
|
||||
{
|
||||
if (qs.isCreated())
|
||||
{
|
||||
qs.startQuest();
|
||||
htmltext = event;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "30754-08.html":
|
||||
{
|
||||
if (qs.isCond(1))
|
||||
{
|
||||
final long count = getQuestItemsCount(player, ARTICLES);
|
||||
if (count < 1)
|
||||
{
|
||||
htmltext = "30754-07.html";
|
||||
}
|
||||
else
|
||||
{
|
||||
takeItems(player, ARTICLES, -1);
|
||||
if (getRandom(1000) >= count)
|
||||
{
|
||||
giveAdena(player, count * 60, true);
|
||||
htmltext = event;
|
||||
}
|
||||
else
|
||||
{
|
||||
qs.setCond(2, true);
|
||||
switch (getRandom(4))
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
qs.setMemoState(1);
|
||||
giveItems(player, OLD_HILT);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
qs.setMemoState(2);
|
||||
giveItems(player, OLD_KEY);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
qs.setMemoState(3);
|
||||
giveItems(player, TOTEM_NECKLACE);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
qs.setMemoState(4);
|
||||
giveItems(player, CRUCIFIX);
|
||||
break;
|
||||
}
|
||||
}
|
||||
htmltext = "30754-09.html";
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "30754-17.html":
|
||||
{
|
||||
if (qs.isCond(1))
|
||||
{
|
||||
htmltext = event;
|
||||
qs.exitQuest(true, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "relic_info":
|
||||
{
|
||||
switch (qs.getMemoState())
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
htmltext = "30754-10.html";
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
htmltext = "30754-11.html";
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
htmltext = "30754-12.html";
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
htmltext = "30754-13.html";
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onTalk(Npc npc, PlayerInstance talker)
|
||||
{
|
||||
final QuestState qs = getQuestState(talker, true);
|
||||
String htmltext = getNoQuestMsg(talker);
|
||||
switch (npc.getId())
|
||||
{
|
||||
case GILMORE:
|
||||
{
|
||||
if (qs.isCreated())
|
||||
{
|
||||
htmltext = (talker.getLevel() >= MIN_LVL) ? "30754-02.htm" : "30754-01.htm";
|
||||
}
|
||||
else if (qs.isStarted())
|
||||
{
|
||||
if (qs.isCond(1))
|
||||
{
|
||||
htmltext = (hasQuestItems(talker, ARTICLES)) ? "30754-06.html" : "30754-05.html";
|
||||
}
|
||||
else if (hasItem(talker, OLD_KEY) || hasItem(talker, OLD_HILT) || hasItem(talker, TOTEM_NECKLACE) || hasItem(talker, CRUCIFIX))
|
||||
{
|
||||
htmltext = "30754-14.html";
|
||||
}
|
||||
else
|
||||
{
|
||||
qs.setCond(1);
|
||||
htmltext = "30754-15.html";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
htmltext = getAlreadyCompletedMsg(talker);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KAIEN:
|
||||
{
|
||||
if (qs.getMemoState() == 1)
|
||||
{
|
||||
if (hasItem(talker, OLD_HILT))
|
||||
{
|
||||
takeItems(talker, OLD_HILT.getId(), -1);
|
||||
final int rand = getRandom(100);
|
||||
if (rand <= 52)
|
||||
{
|
||||
rewardItems(talker, ORIHARUKON_ORE);
|
||||
}
|
||||
else if (rand <= 76)
|
||||
{
|
||||
rewardItems(talker, VARNISH_OF_PURITY);
|
||||
}
|
||||
else if (rand <= 98)
|
||||
{
|
||||
rewardItems(talker, SCROLL_EWC);
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardItems(talker, RAID_SWORD);
|
||||
}
|
||||
qs.setCond(1);
|
||||
htmltext = "30623-01.html";
|
||||
}
|
||||
else
|
||||
{
|
||||
htmltext = "30623-02.html";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RODEMAI:
|
||||
{
|
||||
if (qs.getMemoState() == 2)
|
||||
{
|
||||
if (hasItem(talker, OLD_KEY))
|
||||
{
|
||||
takeItems(talker, OLD_KEY.getId(), -1);
|
||||
final int rand = getRandom(100);
|
||||
if (rand <= 39)
|
||||
{
|
||||
rewardItems(talker, COKES);
|
||||
}
|
||||
else if (rand <= 89)
|
||||
{
|
||||
rewardItems(talker, SCROLL_EWC);
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardItems(talker, RING_OF_AGES);
|
||||
}
|
||||
qs.setCond(1);
|
||||
htmltext = "30756-01.html";
|
||||
}
|
||||
else
|
||||
{
|
||||
htmltext = "30756-02.html";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GARVARENTZ:
|
||||
{
|
||||
if (qs.getMemoState() == 3)
|
||||
{
|
||||
if (hasItem(talker, TOTEM_NECKLACE))
|
||||
{
|
||||
takeItems(talker, TOTEM_NECKLACE.getId(), -1);
|
||||
final int rand = getRandom(100);
|
||||
if (rand <= 47)
|
||||
{
|
||||
rewardItems(talker, LEATHER);
|
||||
}
|
||||
else if (rand <= 97)
|
||||
{
|
||||
rewardItems(talker, COARSE_BONE_POWDER);
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardItems(talker, HEAVY_DOOM_HAMMER);
|
||||
}
|
||||
qs.setCond(1);
|
||||
htmltext = "30704-01.html";
|
||||
}
|
||||
else
|
||||
{
|
||||
htmltext = "30704-02.html";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ORVEN:
|
||||
{
|
||||
if (qs.getMemoState() == 4)
|
||||
{
|
||||
if (hasItem(talker, CRUCIFIX))
|
||||
{
|
||||
takeItems(talker, CRUCIFIX.getId(), -1);
|
||||
final int rand = getRandom(100);
|
||||
if (rand <= 49)
|
||||
{
|
||||
rewardItems(talker, STONE_OF_PURITY);
|
||||
}
|
||||
else if (rand <= 69)
|
||||
{
|
||||
rewardItems(talker, SCROLL_EAC);
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardItems(talker, DRAKE_LEATHER_BOOTS);
|
||||
}
|
||||
qs.setCond(1);
|
||||
htmltext = "30857-01.html";
|
||||
}
|
||||
else
|
||||
{
|
||||
htmltext = "30857-02.html";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
|
||||
{
|
||||
final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc);
|
||||
if (qs != null)
|
||||
{
|
||||
giveItemRandomly(qs.getPlayer(), npc, ARTICLES, 1, 0, MONSTER_CHANCES.get(npc.getId()), true);
|
||||
}
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
}
|
||||
static
|
||||
{
|
||||
MONSTER_CHANCES.put(20236, 0.58); // Cave Servant
|
||||
MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior
|
||||
MONSTER_CHANCES.put(20237, 0.78); // Cave Servant Archer
|
||||
MONSTER_CHANCES.put(20239, 0.79); // Cave Servant Captain
|
||||
MONSTER_CHANCES.put(20240, 0.85); // Royal Cave Servant
|
||||
MONSTER_CHANCES.put(20272, 0.58); // Cave Servant
|
||||
MONSTER_CHANCES.put(20273, 0.78); // Cave Servant Archer
|
||||
MONSTER_CHANCES.put(20274, 0.75); // Cave Servant Warrior
|
||||
MONSTER_CHANCES.put(20275, 0.79); // Cave Servant Captain
|
||||
MONSTER_CHANCES.put(20276, 0.85); // Royal Cave Servant
|
||||
}
|
||||
// Rewards
|
||||
private static final ItemHolder ORIHARUKON_ORE = new ItemHolder(1874, 25);
|
||||
private static final ItemHolder VARNISH_OF_PURITY = new ItemHolder(1887, 10);
|
||||
private static final ItemHolder SCROLL_EWC = new ItemHolder(951, 1);
|
||||
private static final ItemHolder RAID_SWORD = new ItemHolder(133, 1);
|
||||
private static final ItemHolder COKES = new ItemHolder(1879, 55);
|
||||
private static final ItemHolder RING_OF_AGES = new ItemHolder(885, 1);
|
||||
private static final ItemHolder LEATHER = new ItemHolder(1882, 70);
|
||||
private static final ItemHolder COARSE_BONE_POWDER = new ItemHolder(1881, 50);
|
||||
private static final ItemHolder HEAVY_DOOM_HAMMER = new ItemHolder(191, 1);
|
||||
private static final ItemHolder STONE_OF_PURITY = new ItemHolder(1875, 19);
|
||||
private static final ItemHolder SCROLL_EAC = new ItemHolder(952, 5);
|
||||
private static final ItemHolder DRAKE_LEATHER_BOOTS = new ItemHolder(2437, 1);
|
||||
// Misc
|
||||
private static final int MIN_LVL = 48;
|
||||
|
||||
public Q00344_1000YearsTheEndOfLamentation()
|
||||
{
|
||||
super(344);
|
||||
addStartNpc(GILMORE);
|
||||
addTalkId(KAIEN, GARVARENTZ, GILMORE, RODEMAI, ORVEN);
|
||||
addKillId(MONSTER_CHANCES.keySet());
|
||||
registerQuestItems(ARTICLES, OLD_KEY.getId(), OLD_HILT.getId(), TOTEM_NECKLACE.getId(), CRUCIFIX.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
|
||||
{
|
||||
final QuestState qs = getQuestState(player, false);
|
||||
String htmltext = null;
|
||||
if (qs == null)
|
||||
{
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case "30754-03.htm":
|
||||
case "30754-16.html":
|
||||
{
|
||||
htmltext = event;
|
||||
break;
|
||||
}
|
||||
case "30754-04.htm":
|
||||
{
|
||||
if (qs.isCreated())
|
||||
{
|
||||
qs.startQuest();
|
||||
htmltext = event;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "30754-08.html":
|
||||
{
|
||||
if (qs.isCond(1))
|
||||
{
|
||||
final long count = getQuestItemsCount(player, ARTICLES);
|
||||
if (count < 1)
|
||||
{
|
||||
htmltext = "30754-07.html";
|
||||
}
|
||||
else
|
||||
{
|
||||
takeItems(player, ARTICLES, -1);
|
||||
if (getRandom(1000) >= count)
|
||||
{
|
||||
giveAdena(player, count * 60, true);
|
||||
htmltext = event;
|
||||
}
|
||||
else
|
||||
{
|
||||
qs.setCond(2, true);
|
||||
switch (getRandom(4))
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
qs.setMemoState(1);
|
||||
giveItems(player, OLD_HILT);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
qs.setMemoState(2);
|
||||
giveItems(player, OLD_KEY);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
qs.setMemoState(3);
|
||||
giveItems(player, TOTEM_NECKLACE);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
qs.setMemoState(4);
|
||||
giveItems(player, CRUCIFIX);
|
||||
break;
|
||||
}
|
||||
}
|
||||
htmltext = "30754-09.html";
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "30754-17.html":
|
||||
{
|
||||
if (qs.isCond(1))
|
||||
{
|
||||
htmltext = event;
|
||||
qs.exitQuest(true, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "relic_info":
|
||||
{
|
||||
switch (qs.getMemoState())
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
htmltext = "30754-10.html";
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
htmltext = "30754-11.html";
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
htmltext = "30754-12.html";
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
htmltext = "30754-13.html";
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onTalk(Npc npc, PlayerInstance talker)
|
||||
{
|
||||
final QuestState qs = getQuestState(talker, true);
|
||||
String htmltext = getNoQuestMsg(talker);
|
||||
switch (npc.getId())
|
||||
{
|
||||
case GILMORE:
|
||||
{
|
||||
if (qs.isCreated())
|
||||
{
|
||||
htmltext = (talker.getLevel() >= MIN_LVL) ? "30754-02.htm" : "30754-01.htm";
|
||||
}
|
||||
else if (qs.isStarted())
|
||||
{
|
||||
if (qs.isCond(1))
|
||||
{
|
||||
htmltext = (hasQuestItems(talker, ARTICLES)) ? "30754-06.html" : "30754-05.html";
|
||||
}
|
||||
else if (hasItem(talker, OLD_KEY) || hasItem(talker, OLD_HILT) || hasItem(talker, TOTEM_NECKLACE) || hasItem(talker, CRUCIFIX))
|
||||
{
|
||||
htmltext = "30754-14.html";
|
||||
}
|
||||
else
|
||||
{
|
||||
qs.setCond(1);
|
||||
htmltext = "30754-15.html";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
htmltext = getAlreadyCompletedMsg(talker);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case KAIEN:
|
||||
{
|
||||
if (qs.getMemoState() == 1)
|
||||
{
|
||||
if (hasItem(talker, OLD_HILT))
|
||||
{
|
||||
takeItems(talker, OLD_HILT.getId(), -1);
|
||||
final int rand = getRandom(100);
|
||||
if (rand <= 52)
|
||||
{
|
||||
rewardItems(talker, ORIHARUKON_ORE);
|
||||
}
|
||||
else if (rand <= 76)
|
||||
{
|
||||
rewardItems(talker, VARNISH_OF_PURITY);
|
||||
}
|
||||
else if (rand <= 98)
|
||||
{
|
||||
rewardItems(talker, SCROLL_EWC);
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardItems(talker, RAID_SWORD);
|
||||
}
|
||||
qs.setCond(1);
|
||||
htmltext = "30623-01.html";
|
||||
}
|
||||
else
|
||||
{
|
||||
htmltext = "30623-02.html";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RODEMAI:
|
||||
{
|
||||
if (qs.getMemoState() == 2)
|
||||
{
|
||||
if (hasItem(talker, OLD_KEY))
|
||||
{
|
||||
takeItems(talker, OLD_KEY.getId(), -1);
|
||||
final int rand = getRandom(100);
|
||||
if (rand <= 39)
|
||||
{
|
||||
rewardItems(talker, COKES);
|
||||
}
|
||||
else if (rand <= 89)
|
||||
{
|
||||
rewardItems(talker, SCROLL_EWC);
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardItems(talker, RING_OF_AGES);
|
||||
}
|
||||
qs.setCond(1);
|
||||
htmltext = "30756-01.html";
|
||||
}
|
||||
else
|
||||
{
|
||||
htmltext = "30756-02.html";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GARVARENTZ:
|
||||
{
|
||||
if (qs.getMemoState() == 3)
|
||||
{
|
||||
if (hasItem(talker, TOTEM_NECKLACE))
|
||||
{
|
||||
takeItems(talker, TOTEM_NECKLACE.getId(), -1);
|
||||
final int rand = getRandom(100);
|
||||
if (rand <= 47)
|
||||
{
|
||||
rewardItems(talker, LEATHER);
|
||||
}
|
||||
else if (rand <= 97)
|
||||
{
|
||||
rewardItems(talker, COARSE_BONE_POWDER);
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardItems(talker, HEAVY_DOOM_HAMMER);
|
||||
}
|
||||
qs.setCond(1);
|
||||
htmltext = "30704-01.html";
|
||||
}
|
||||
else
|
||||
{
|
||||
htmltext = "30704-02.html";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ORVEN:
|
||||
{
|
||||
if (qs.getMemoState() == 4)
|
||||
{
|
||||
if (hasItem(talker, CRUCIFIX))
|
||||
{
|
||||
takeItems(talker, CRUCIFIX.getId(), -1);
|
||||
final int rand = getRandom(100);
|
||||
if (rand <= 49)
|
||||
{
|
||||
rewardItems(talker, STONE_OF_PURITY);
|
||||
}
|
||||
else if (rand <= 69)
|
||||
{
|
||||
rewardItems(talker, SCROLL_EAC);
|
||||
}
|
||||
else
|
||||
{
|
||||
rewardItems(talker, DRAKE_LEATHER_BOOTS);
|
||||
}
|
||||
qs.setCond(1);
|
||||
htmltext = "30857-01.html";
|
||||
}
|
||||
else
|
||||
{
|
||||
htmltext = "30857-02.html";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
|
||||
{
|
||||
final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc);
|
||||
if (qs != null)
|
||||
{
|
||||
giveItemRandomly(qs.getPlayer(), npc, ARTICLES, 1, 0, MONSTER_CHANCES.get(npc.getId()), true);
|
||||
}
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ public final class Q00360_PlunderTheirSupplies extends Quest
|
||||
private static final Map<Integer, Integer> MONSTER_DROP_CHANCES = new HashMap<>();
|
||||
// Item
|
||||
private static final int SUPPLY_ITEMS = 5872;
|
||||
|
||||
static
|
||||
{
|
||||
MONSTER_DROP_CHANCES.put(20666, 50); // Taik Orc Seeker
|
||||
|
||||
@@ -68,7 +68,6 @@ public final class Q00416_PathOfTheOrcShaman extends Quest
|
||||
private static final int MIN_LEVEL = 19;
|
||||
// Mobs
|
||||
private static final Map<Integer, ItemChanceHolder> MOBS = new HashMap<>();
|
||||
|
||||
static
|
||||
{
|
||||
MOBS.put(20415, new ItemChanceHolder(FIRST_FIERY_EGG, 1.0, 1)); // scarlet_salamander
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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 com.l2jmobius.gameserver.model.holders;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class QuestSoundHtmlHolder
|
||||
{
|
||||
private final String _sound;
|
||||
private final String _html;
|
||||
|
||||
public QuestSoundHtmlHolder(String sound, String html)
|
||||
{
|
||||
_sound = sound;
|
||||
_html = html;
|
||||
}
|
||||
|
||||
public String getSound()
|
||||
{
|
||||
return _sound;
|
||||
}
|
||||
|
||||
public String getHtml()
|
||||
{
|
||||
return _html;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,38 @@
|
||||
/*
|
||||
* 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 com.l2jmobius.gameserver.model.skills;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class MountEnabledSkillList
|
||||
{
|
||||
/*
|
||||
* 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 com.l2jmobius.gameserver.model.skills;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class MountEnabledSkillList
|
||||
{
|
||||
private final static List<Integer> ENABLED_SKILLS = new ArrayList<>(2);
|
||||
{
|
||||
ENABLED_SKILLS.add(4289); // Wyvern Breath
|
||||
ENABLED_SKILLS.add(325); // Strider Siege Assault
|
||||
}
|
||||
|
||||
public static boolean contains(int skillId)
|
||||
{
|
||||
return ENABLED_SKILLS.contains(skillId);
|
||||
}
|
||||
}
|
||||
static
|
||||
{
|
||||
ENABLED_SKILLS.add(4289); // Wyvern Breath
|
||||
ENABLED_SKILLS.add(325); // Strider Siege Assault
|
||||
}
|
||||
|
||||
public static boolean contains(int skillId)
|
||||
{
|
||||
return ENABLED_SKILLS.contains(skillId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +1,70 @@
|
||||
/*
|
||||
* 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 com.l2jmobius.gameserver.network.serverpackets.attributechange;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketWriter;
|
||||
import com.l2jmobius.gameserver.enums.AttributeType;
|
||||
import com.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ExChangeAttributeInfo implements IClientOutgoingPacket
|
||||
{
|
||||
/*
|
||||
* 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 com.l2jmobius.gameserver.network.serverpackets.attributechange;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketWriter;
|
||||
import com.l2jmobius.gameserver.enums.AttributeType;
|
||||
import com.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ExChangeAttributeInfo implements IClientOutgoingPacket
|
||||
{
|
||||
private static final Map<AttributeType, Byte> ATTRIBUTE_MASKS = new HashMap<>();
|
||||
{
|
||||
ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1);
|
||||
ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2);
|
||||
ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4);
|
||||
ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8);
|
||||
ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16);
|
||||
ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32);
|
||||
}
|
||||
|
||||
private final int _crystalItemId;
|
||||
private int _attributes;
|
||||
private int _itemObjId;
|
||||
|
||||
public ExChangeAttributeInfo(int crystalItemId, ItemInstance item)
|
||||
{
|
||||
_crystalItemId = crystalItemId;
|
||||
_attributes = 0;
|
||||
for (AttributeType e : AttributeType.ATTRIBUTE_TYPES)
|
||||
{
|
||||
if (e != item.getAttackAttributeType())
|
||||
{
|
||||
_attributes |= ATTRIBUTE_MASKS.get(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet);
|
||||
packet.writeD(_crystalItemId);
|
||||
packet.writeD(_attributes);
|
||||
packet.writeD(_itemObjId);
|
||||
return true;
|
||||
}
|
||||
static
|
||||
{
|
||||
ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1);
|
||||
ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2);
|
||||
ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4);
|
||||
ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8);
|
||||
ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16);
|
||||
ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32);
|
||||
}
|
||||
|
||||
private final int _crystalItemId;
|
||||
private int _attributes;
|
||||
private int _itemObjId;
|
||||
|
||||
public ExChangeAttributeInfo(int crystalItemId, ItemInstance item)
|
||||
{
|
||||
_crystalItemId = crystalItemId;
|
||||
_attributes = 0;
|
||||
for (AttributeType e : AttributeType.ATTRIBUTE_TYPES)
|
||||
{
|
||||
if (e != item.getAttackAttributeType())
|
||||
{
|
||||
_attributes |= ATTRIBUTE_MASKS.get(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet);
|
||||
packet.writeD(_crystalItemId);
|
||||
packet.writeD(_attributes);
|
||||
packet.writeD(_itemObjId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user