- Хроники
- Chaotic Throne: High Five
- Исходники
- Присутствуют
- Сборка
- L2jSunrise
Hello, i have custom quest that spawn the monsters. But after a while ( x time ) mobs don't appear anymore! Can someone take a look of this code and tell me what's wrong ?
Thank you in advance!
Thank you in advance!
JavaScript:
package quests.Q10506_RebirthBall;
import l2r.Config;
import l2r.gameserver.model.Location;
import l2r.gameserver.model.actor.L2Npc;
import l2r.gameserver.model.actor.instance.L2PcInstance;
import l2r.gameserver.model.quest.Quest;
import l2r.gameserver.model.quest.QuestState;
import l2r.gameserver.util.Util;
public final class Q10506_RebirthBall extends Quest
{
// NPC
private static final int GHOST_OF_ADVENTURER = Config.NPC_ID;
// Items Required
private static final int BROKEN_RELIC_PART = Config.ITEM_ID_FOR_REBIRTH_BALL;
// Item Count Required
private static final int REQUIRED_RELIC_COUNT = Config.TOTAL_ITEM_ID_FOR_REBIRTH_BALL;
// Misc
private static final int MIN_LEVEL = Config.REQUIRED_LEVEL_TO_ENTER;
// Teleport Location
private static final Location TELEPORT_PLAYER = new Location(155299, 19786, -3720, 0);
// Reward
private static final int[] REBIRTH_BALL =
{
14880
};
// @formatter:off
// Mobs
private static final int[] MUTANT_OVERLORD =
{
22736
};
// @formatter:on
public Q10506_RebirthBall()
{
super(10506, Q10506_RebirthBall.class.getSimpleName(), "Rebirth Ball");
addStartNpc(GHOST_OF_ADVENTURER);
addTalkId(GHOST_OF_ADVENTURER);
addKillId(MUTANT_OVERLORD);
registerQuestItems(BROKEN_RELIC_PART);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
final QuestState st = player.getQuestState(getName());
if (st == null)
{
return null;
}
String htmltext = null;
switch (event)
{
case "31538-02.html":
{
player.teleToLocation(TELEPORT_PLAYER, 0);
st.startQuest();
htmltext = event;
break;
}
case "31538-05.html":
{
htmltext = event;
break;
}
case "14880": // Rebirth Ball
{
if (getQuestItemsCount(player, BROKEN_RELIC_PART) >= REQUIRED_RELIC_COUNT)
{
rewardItems(player, REBIRTH_BALL[getRandom(REBIRTH_BALL.length)], (player.isPremium() && player.isTempPremium()) ? 2 : 1);
takeItems(player, BROKEN_RELIC_PART, REQUIRED_RELIC_COUNT);
//player.getStat().addLevel((byte) 5);
htmltext = event;
return "";
}
break;
}
case "31538-08.html":
{
st.exitQuest(true, true);
htmltext = event;
break;
}
}
return htmltext;
}
@Override
public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
{
final QuestState st = getRandomPartyMemberState(player, -1, 3, npc);
if (st != null)
{
int npcId = npc.getId();
if (Util.contains(MUTANT_OVERLORD, npcId))
{
final int itemCount = ((getRandom(100) < 79) ? 2 : 1);
giveItemRandomly(player, npc, BROKEN_RELIC_PART, itemCount, 0, 1.00, true);
}
}
return super.onKill(npc, player, isSummon);
}
@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
QuestState st = getQuestState(player, true);
String htmltext = getNoQuestMsg(player);
if (st == null)
{
return htmltext;
}
if (st.isCreated())
{
htmltext = ((player.getLevel() >= MIN_LEVEL) ? "31538-01.html" : "31538-03.html");
}
else if (st.isStarted())
{
htmltext = ((getQuestItemsCount(player, BROKEN_RELIC_PART) >= REQUIRED_RELIC_COUNT) ? "31538-04.html" : "31538-07.html");
}
return htmltext;
}
}