- Хроники
- The 2nd Throne: Gracia
- Исходники
- Присутствуют
- Сборка
- j2dev-Epilogue
Добрый день!
Прошу помочь с квестом 144_PailakaInjuredDragon, после убийства последнего босса, появляется орк, открывается диалог, сдаем копье (оно исчезает из инвентаря), а награда за квест не выдается и он не засчитывается выполненным, в чем может быть проблема?
код:
Прошу помочь с квестом 144_PailakaInjuredDragon, после убийства последнего босса, появляется орк, открывается диалог, сдаем копье (оно исчезает из инвентаря), а награда за квест не выдается и он не засчитывается выполненным, в чем может быть проблема?
код:
Код:
package quests;
import l2p.commons.lang.ArrayUtils;
import l2p.commons.util.Rnd;
import l2p.gameserver.Config;
import l2p.gameserver.ai.CtrlEvent;
import l2p.gameserver.model.entity.Reflection;
import l2p.gameserver.model.instances.NpcInstance;
import l2p.gameserver.model.quest.Quest;
import l2p.gameserver.model.quest.QuestState;
import l2p.gameserver.network.outgoing.MagicSkillUse;
import l2p.gameserver.object.Creature;
import l2p.gameserver.object.Player;
import l2p.gameserver.tables.SkillTable;
import l2p.gameserver.utils.ReflectionUtils;
import l2p.gameserver.utils.Location;
import l2p.gameserver.utils.PositionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class _144_PailakaInjuredDragon extends Quest {
// npc
private static final Map<Integer, Integer> behindWall = new HashMap<>();
private static final Map<Integer, NpcInstance> spawnedWall = new HashMap<>();
private static final int KETRAOSHAMAN = 32499;
private static final int KOSUPPORTER = 32502;
private static final int KOIO = 32509;
private static final int KOSUPPORTER2 = 32512;
// wall mobs
private static final int VARKA_SILENOS_RECRUIT = 18635;
private static final int VARKA_SILENOS_FOOTMAN = 18636;
private static final int VARKA_SILENOS_WARRIOR = 18642;
private static final int VARKA_SILENOS_OFFICER = 18646;
private static final int VARKAS_COMMANDER = 18654;
private static final int VARKA_ELITE_GUARD = 18653;
private static final int VARKA_SILENOS_GREAT_MAGUS = 18649;
private static final int VARKA_SILENOS_GENERAL = 18650;
private static final int VARKA_SILENOS_HEAD_GUARD = 18655;
private static final int PROPHET_GUARD = 18657;
private static final int VARKAS_PROPHET = 18659;
private static final int VARKA_SILENOS_SCOUT = 18638;
private static final int VARKA_SILENOS_HUNTER = 18639;
// extra wall silenos
private static final int VARKA_SILENOS_MEDIUM = 18644;
private static final int VARKA_SILENOS_PRIEST = 18641;
private static final int VARKA_SILENOS_SHAMAN = 18640;
private static final int VARKA_SILENOS_SEER = 18648;
private static final int VARKA_SILENOS_MAGNUS = 18645;
private static final int DISCIPLE_OF_PROPHET = 18658;
private static final int VARKA_HEAD_MAGUS = 18656;
private static final int VARKA_SILENOS_GREAT_SEER = 18652;
// normal mobs
private static final int ANTYLOPE_1 = 18637;
private static final int ANTYLOPE_2 = 18643;
private static final int ANTYLOPE_3 = 18651;
private static final int FLAVA = 18647;
private static final int[] Pailaka3rd = new int[]{
VARKA_SILENOS_RECRUIT,
VARKA_SILENOS_FOOTMAN,
VARKA_SILENOS_SCOUT,
VARKA_SILENOS_HUNTER,
VARKA_SILENOS_SHAMAN,
VARKA_SILENOS_PRIEST,
VARKA_SILENOS_WARRIOR,
VARKA_SILENOS_MEDIUM,
VARKA_SILENOS_MAGNUS,
VARKA_SILENOS_OFFICER,
VARKA_SILENOS_SEER,
VARKA_SILENOS_GREAT_MAGUS,
VARKA_SILENOS_GENERAL,
VARKA_SILENOS_GREAT_SEER,
VARKA_ELITE_GUARD,
VARKAS_COMMANDER,
VARKA_SILENOS_HEAD_GUARD,
VARKA_HEAD_MAGUS,
PROPHET_GUARD,
DISCIPLE_OF_PROPHET,
VARKAS_PROPHET
};
private static final int[] OtherMobs = new int[]{ANTYLOPE_1, ANTYLOPE_2, FLAVA, ANTYLOPE_3};
// BOSS
private static final int LATANA = 18660;
// ITEMS
private static final int ScrollOfEscape = 736;
private static final int SPEAR = 13052;
private static final int ENCHSPEAR = 13053;
private static final int LASTSPEAR = 13054;
private static final int STAGE1 = 13056;
private static final int STAGE2 = 13057;
private static final int[] PAILAKA3DROP = {8600, 8601, 8603, 8604};
private static final int[] ANTELOPDROP = {13032, 13033};
// REWARDS
private static final int PSHIRT = 13296;
private static final int[][] BUFFS = {
{4357, 2}, // Haste Lv2
{4342, 2}, // Wind Walk Lv2
{4356, 3}, // Empower Lv3
{4355, 3}, // Acumen Lv3
{4351, 6}, // Concentration Lv6
{4345, 3}, // Might Lv3
{4358, 3}, // Guidance Lv3
{4359, 3}, // Focus Lv3
{4360, 3}, // Death Wisper Lv3
{4352, 2}, // Berserker Spirit Lv2
{4354, 4}, // Vampiric Rage Lv4
{4347, 6} // Blessed Body Lv6
};
private static final int izId = 45;
public _144_PailakaInjuredDragon() {
super(false);
behindWall.put(VARKA_SILENOS_FOOTMAN, VARKA_SILENOS_MEDIUM);
behindWall.put(VARKA_SILENOS_RECRUIT, VARKA_SILENOS_MEDIUM);
behindWall.put(VARKA_SILENOS_WARRIOR, VARKA_SILENOS_PRIEST);
behindWall.put(VARKA_ELITE_GUARD, VARKA_SILENOS_SHAMAN);
behindWall.put(VARKA_SILENOS_OFFICER, VARKA_SILENOS_SEER);
behindWall.put(VARKAS_COMMANDER, VARKA_SILENOS_SEER);
behindWall.put(VARKA_SILENOS_GREAT_MAGUS, VARKA_SILENOS_MAGNUS);
behindWall.put(VARKA_SILENOS_GENERAL, VARKA_SILENOS_MAGNUS);
behindWall.put(VARKAS_PROPHET, DISCIPLE_OF_PROPHET);
behindWall.put(VARKA_SILENOS_HEAD_GUARD, VARKA_HEAD_MAGUS);
behindWall.put(PROPHET_GUARD, VARKA_SILENOS_GREAT_SEER);
addStartNpc(KETRAOSHAMAN);
addTalkId(KOSUPPORTER, KOIO, KOSUPPORTER2);
addAttackId(LATANA, VARKA_SILENOS_FOOTMAN, VARKA_SILENOS_WARRIOR, VARKA_SILENOS_OFFICER, VARKAS_COMMANDER, VARKA_SILENOS_GREAT_MAGUS, VARKA_SILENOS_GENERAL, VARKA_SILENOS_HEAD_GUARD, PROPHET_GUARD);
addKillId(LATANA);
addKillId(Pailaka3rd);
addKillId(OtherMobs);
addQuestItem(STAGE1, STAGE2, SPEAR, ENCHSPEAR, LASTSPEAR, 13033, 13032);
}
private void makeBuff(final NpcInstance npc, final Player player, final int skillId, final int level) {
final List<Creature> target = new ArrayList<>();
target.add(player);
npc.broadcastPacket(new MagicSkillUse(npc, player, skillId, level, 0, 0));
npc.callSkill(SkillTable.getInstance().getSkillEntry(skillId, level), target, true);
}
@Override
public String onEvent(final String event, final QuestState st, final NpcInstance npc) {
final Player player = st.getPlayer();
String htmltext = event;
if (event.equalsIgnoreCase("Enter")) {
enterInstance(player);
return null;
} else if (event.startsWith("buff")) {
final int[] skill = BUFFS[Integer.parseInt(event.split("buff")[1])];
if (st.getInt("spells") < 4) {
makeBuff(npc, player, skill[0], skill[1]);
st.set("spells", String.valueOf(st.getInt("spells") + 1));
htmltext = "32509-06.htm";
return htmltext;
}
if (st.getInt("spells") == 4) {
makeBuff(npc, player, skill[0], skill[1]);
st.set("spells", "5");
htmltext = "32509-05.htm";
return htmltext;
}
} else if (event.equalsIgnoreCase("Support")) {
if (st.getInt("spells") < 5) {
htmltext = "32509-06.htm";
} else {
htmltext = "32509-04.htm";
}
return htmltext;
} else if (event.equalsIgnoreCase("32499-02.htm")) {
st.set("spells", "0");
st.set("stage", "1");
st.setCond(1);
st.setState(STARTED);
st.playSound(SOUND_ACCEPT);
} else if (event.equalsIgnoreCase("32499-05.htm")) {
st.setCond(2);
st.playSound(SOUND_ACCEPT);
} else if (event.equalsIgnoreCase("32502-05.htm")) {
st.setCond(3);
st.playSound(SOUND_MIDDLE);
st.giveItems(SPEAR, 1);
} else if (event.equalsIgnoreCase("32512-02.htm")) {
st.takeItems(SPEAR, 1);
st.takeItems(ENCHSPEAR, 1);
st.takeItems(LASTSPEAR, 1);
}
return htmltext;
}
@Override
public String onTalk(final NpcInstance npc, final QuestState st) {
String htmltext = "noquest";
final int npcId = npc.getNpcId();
final int cond = st.getCond();
final int id = st.getState();
final Player player = st.getPlayer();
switch (npcId) {
case KETRAOSHAMAN:
if (cond == 0) {
if (player.getLevel() < 73 || player.getLevel() > 77) {
htmltext = "32499-no.htm";
st.exitCurrentQuest(true);
} else {
return "32499-01.htm";
}
} else if (id == COMPLETED) {
htmltext = "32499-no.htm";
} else if (cond == 1 || cond == 2 || cond == 3) {
htmltext = "32499-06.htm";
} else {
htmltext = "32499-07.htm";
}
break;
case KOSUPPORTER:
if (cond == 1 || cond == 2) {
htmltext = "32502-01.htm";
} else {
htmltext = "32502-05.htm";
}
break;
case KOIO:
if (st.getQuestItemsCount(SPEAR) > 0 && st.getQuestItemsCount(STAGE1) == 0) {
htmltext = "32509-01.htm";
}
if (st.getQuestItemsCount(ENCHSPEAR) > 0 && st.getQuestItemsCount(STAGE2) == 0) {
htmltext = "32509-01.htm";
}
if (st.getQuestItemsCount(SPEAR) == 0 && st.getQuestItemsCount(STAGE1) > 0) {
htmltext = "32509-07.htm";
}
if (st.getQuestItemsCount(ENCHSPEAR) == 0 && st.getQuestItemsCount(STAGE2) > 0) {
htmltext = "32509-07.htm";
}
if (st.getQuestItemsCount(SPEAR) == 0 && st.getQuestItemsCount(ENCHSPEAR) == 0) {
htmltext = "32509-07.htm";
}
if (st.getQuestItemsCount(STAGE1) == 0 && st.getQuestItemsCount(STAGE2) == 0) {
htmltext = "32509-01.htm";
}
if (st.getQuestItemsCount(SPEAR) > 0 && st.getQuestItemsCount(STAGE1) > 0) {
st.takeItems(SPEAR, 1);
st.takeItems(STAGE1, 1);
st.giveItems(ENCHSPEAR, 1);
htmltext = "32509-02.htm";
}
if (st.getQuestItemsCount(ENCHSPEAR) > 0 && st.getQuestItemsCount(STAGE2) > 0) {
st.takeItems(ENCHSPEAR, 1);
st.takeItems(STAGE2, 1);
st.giveItems(LASTSPEAR, 1);
htmltext = "32509-03.htm";
}
if (st.getQuestItemsCount(LASTSPEAR) > 0) {
htmltext = "32509-03.htm";
}
break;
case KOSUPPORTER2:
if (cond == 4) {
st.giveItems(ScrollOfEscape, 1);
st.giveItems(PSHIRT, 1);
st.addExpAndSp(28000000, 2850000);
st.setCond(5);
st.setState(COMPLETED);
st.playSound(SOUND_FINISH);
st.exitCurrentQuest(false);
player.setVitality(Config.VITALITY_LEVELS[4]);
player.getReflection().startCollapseTimer(60000);
spawnedWall.clear();
htmltext = "32512-01.htm";
} else if (id == COMPLETED) {
htmltext = "32512-03.htm";
}
break;
}
return htmltext;
}
@Override
public String onKill(final NpcInstance npc, final QuestState st) {
final Player player = st.getPlayer();
final int npcId = npc.getNpcId();
final int refId = player.getReflectionId();
switch (npcId) {
case VARKA_SILENOS_FOOTMAN:
case VARKA_SILENOS_WARRIOR:
if (st.getInt("stage") == 1) {
st.set("stage", "2");
}
break;
case VARKA_SILENOS_OFFICER:
case VARKAS_COMMANDER:
if (st.getInt("stage") == 2) {
st.set("stage", "3");
}
if (st.getQuestItemsCount(SPEAR) > 0 && st.getQuestItemsCount(STAGE1) == 0) {
st.giveItems(STAGE1, 1);
}
break;
case VARKA_SILENOS_GREAT_MAGUS:
case VARKA_SILENOS_GENERAL:
if (st.getInt("stage") == 3) {
st.set("stage", "4");
}
if (st.getQuestItemsCount(ENCHSPEAR) > 0 && st.getQuestItemsCount(STAGE2) == 0) {
st.giveItems(STAGE2, 1);
}
break;
case VARKA_SILENOS_HEAD_GUARD:
case PROPHET_GUARD:
if (st.getInt("stage") == 4) {
st.set("stage", "5");
}
break;
case LATANA:
st.setCond(4);
st.playSound(SOUND_MIDDLE);
addSpawnToInstance(KOSUPPORTER2, npc.getLoc(), 0, refId);
break;
default:
break;
}
if (spawnedWall.containsKey(npc.getObjectId())) {
final NpcInstance npc1 = spawnedWall.get(npc.getObjectId());
npc1.decayOrDelete();
}
if (ArrayUtils.contains(Pailaka3rd, npcId)) {
if (Rnd.get(100) < 30) {
st.dropItem(npc, PAILAKA3DROP[Rnd.get(PAILAKA3DROP.length)], 1);
}
}
if (ArrayUtils.contains(OtherMobs, npcId)) {
st.dropItem(npc, ANTELOPDROP[Rnd.get(ANTELOPDROP.length)], Rnd.get(1, 10));
}
return null;
}
@Override
public String onAttack(final NpcInstance npc, final QuestState st) {
final Player player = st.getPlayer();
if (!spawnedWall.containsKey(npc.getObjectId()) && behindWall.containsKey(npc.getNpcId())) {
spawnMageBehind(npc, behindWall.get(npc.getNpcId()));
}
final int npcId = npc.getNpcId();
switch (npcId) {
case VARKA_SILENOS_OFFICER:
case VARKAS_COMMANDER:
if (st.getInt("stage") < 2) {
player.teleToLocation(122789, -45692, -3036);
return null;
}
break;
case VARKA_SILENOS_GREAT_MAGUS:
case VARKA_SILENOS_GENERAL:
if (st.getInt("stage") == 1) {
player.teleToLocation(122789, -45692, -3036);
return null;
} else if (st.getInt("stage") == 2) {
player.teleToLocation(116948, -46445, -2673);
return null;
}
break;
case VARKA_SILENOS_HEAD_GUARD:
case PROPHET_GUARD:
switch (st.getInt("stage")) {
case 1:
player.teleToLocation(122789, -45692, -3036);
return null;
case 2:
player.teleToLocation(116948, -46445, -2673);
return null;
case 3:
player.teleToLocation(112445, -44118, -2700);
return null;
}
break;
case LATANA:
switch (st.getInt("stage")) {
case 1:
player.teleToLocation(122789, -45692, -3036);
return null;
case 2:
player.teleToLocation(116948, -46445, -2673);
return null;
case 3:
player.teleToLocation(112445, -44118, -2700);
return null;
case 4:
player.teleToLocation(109947, -41433, -2311);
return null;
}
break;
default:
break;
}
return null;
}
private void enterInstance(final Player player) {
final Reflection r = player.getActiveReflection();
if (r != null) {
if (player.canReenterInstance(izId)) {
player.teleToLocation(r.getTeleportLoc(), r);
}
} else if (player.canEnterInstance(izId)) {
ReflectionUtils.enterInstantZone(player, izId);
}
}
private NpcInstance spawnMageBehind(final NpcInstance npc, final int mageId) {
final Reflection ref = npc.getReflection();
final Location spawnedLoc = npc.getSpawnedLoc();
final double rads = Math.toRadians(PositionUtils.convertHeadingToDegree(spawnedLoc.h) + 180);
final Location magLoc = new Location((int) (spawnedLoc.x + 75 * Math.cos(rads)), (int) (spawnedLoc.y + 75 * Math.sin(rads)), spawnedLoc.z, spawnedLoc.h);
final NpcInstance spawnedNpc = ref.addSpawnWithoutRespawn(mageId, magLoc, 0);
spawnedNpc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, npc.getTarget(), 1);
spawnedWall.put(npc.getObjectId(), spawnedNpc);
return spawnedNpc;
}
}