/*
* 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 custom.HellboundIsland;
import net.sf.l2j.gameserver.instancemanager.HellboundManager;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.model.quest.State;
import net.sf.l2j.gameserver.model.quest.QuestState;
public class HellboundIsland extends Quest
{
private static final String THATS_BLOODY_HOT = "133_ThatsBloodyHot";
private static final String PATH_TO_HELLBOUND = "130_PathToHellbound";
private final static int[] npcIds =
{
32314, 32315, 32316, 32317, 32318, 32319
};
public HellboundIsland(int questId, String name, String descr)
{
super(questId, name, descr);
for (int id : npcIds)
{
addStartNpc(id);
addFirstTalkId(id);
addTalkId(id);
}
}
private static final boolean canEnter(L2PcInstance player)
{
if (player.isFlying())
return false;
QuestState st;
if (!HellboundManager.getInstance().isLocked())
{
st = player.getQuestState(PATH_TO_HELLBOUND);
if (st != null && st.getState() == State.COMPLETED)
return true;
}
st = player.getQuestState(THATS_BLOODY_HOT);
if (st != null && st.getState() == State.COMPLETED)
return true;
return false;
}
public final String onFirstTalk(L2Npc npc, L2PcInstance player)
{
if (!canEnter(player))
{
if (HellboundManager.getInstance().isLocked())
return "warpgate-locked.htm";
}
return npc.getNpcId() + ".htm";
}
public final String onTalk(L2Npc npc, L2PcInstance player)
{
if (!canEnter(player))
return "warpgate-no.htm";
player.teleToLocation(-11272, 236464, -3248, true);
HellboundManager.getInstance().unlock();
return null;
}
public static void main(String[] args)
{
new HellboundIsland(-1, "HellboundIsland", "custom");
}
}