Basic Fortuna AI.

Thanks Stayway.
This commit is contained in:
MobiusDev
2017-10-30 17:48:12 +00:00
parent a7eac59811
commit 68b1c4aa9e
39 changed files with 2793 additions and 186 deletions

View File

@@ -0,0 +1,6 @@
<html><body>Josephina's Companion Izael:<br>
Ah, an ill-omened place, indeed. Many ages ago, a group of heroes quarreled with their god,<br>
and they were cursed to wander forever in the form of vicious monsters who shun the light.<br>
Fortuna was the heroes' fortress, but it's become a place of darkness. Nobody who enters it can leave.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Fortuna 32894-2.htm">"I don't fear Fortuna."</Button>
</body></html>

View File

@@ -0,0 +1,5 @@
<html><body>Josephina's Companion Izael:<br>
You do understand that this is a place cursed by the gods, do you not?<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Fortuna request_enter_fortuna">"I can handle it." (7 level 90+ characters must be here to undertake this.)</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Fortuna request_re_enter_fortuna">"I exited by mistake, and need to return to the Instance Zone."</Button>
</body></html>

View File

@@ -0,0 +1,4 @@
<html><body>Josephina's Companion Izael:<br>
You don't look like you're powerful enough to face a god's curse yet.<br>
(You must be level 90 or above to start this quest.)
</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Josephina's Companion Izael:<br>
The party leader must ask me while you are in a party.
</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Josephina's Companion Izael:<br>
You mentioned a map, but there is no map.
</body></html>

View File

@@ -0,0 +1,5 @@
<html><body>Josephina's Companion Izael:<br>
You have traveled a long way. What brings you here to me?<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Fortuna 32894-1.htm">"Have you heard of Fortuna?"</Button>
<Button ALIGN=LEFT ICON="QUEST" action="bypass -h npc_%objectId%_Quest">Quest</Button>
</body></html>

View File

@@ -0,0 +1,5 @@
<html><body>Josephina's Companion Izael:<br>
When the power of darkness becomes stronger, the cursed ones will drive out all of the forgotten heroes who rest in this place.<br>
The forgotten heroes will only find true rest when the root of darkness has been pulled out. I beg of you. Can you help find eternal rest?<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Fortuna 33153-2.htm">"Yes."</Button>
</body></html>

View File

@@ -0,0 +1,3 @@
<html><body>Josephina's Companion Izael:<br>
I hope for many things. For your health, for my own eternal peace...
</body></html>

View File

@@ -0,0 +1,5 @@
<html><body>Josephina's Companion Izael:<br>
There's a very dark force emanating from inside, a sensation of Decaying Darkness...?<br>
The forces that have been waking up must have made this worse.<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest Fortuna 33153-1.htm">"What should I do?"</Button>
</body></html>

View File

@@ -0,0 +1,497 @@
/*
* 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 instances.Fortuna;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.network.NpcStringId;
import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
import instances.AbstractInstance;
/**
* @author Mobius, Stayway
* @URL https://l2wiki.com/Fortuna
* @VIDEO https://www.youtube.com/watch?v=OeDVPu-STY4
*/
public class Fortuna extends AbstractInstance
{
// NPCs
private static final int ARCAN_IZAEL = 32894;
private static final int INSTANCE_IZAEL = 33153;
private static final int RON = 25825;
// Location
private static final Location RE_ENTRY_LOCATION = new Location(42104, -172712, -7980);
// Misc
private static final int TEMPLATE_ID = 179;
public Fortuna()
{
super(TEMPLATE_ID);
addStartNpc(ARCAN_IZAEL, INSTANCE_IZAEL);
addFirstTalkId(ARCAN_IZAEL, INSTANCE_IZAEL);
addTalkId(ARCAN_IZAEL, INSTANCE_IZAEL);
addKillId(RON);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
switch (event)
{
case "32894-1.htm":
case "32894-2.htm":
case "33153-1.htm":
case "33153-2.htm":
{
return event;
}
case "request_enter_fortuna":
{
enterInstance(player, npc, TEMPLATE_ID);
if (player.getInstanceWorld() != null)
{
startQuestTimer("start_fortuna", 60000, player.getInstanceWorld().getNpc(INSTANCE_IZAEL), null);
}
return null;
}
case "request_re_enter_fortuna":
{
if (player.getParty() != null)
{
for (L2PcInstance member : player.getParty().getMembers())
{
if ((member.getInstanceWorld() != null) && (member.getInstanceWorld().getTemplateId() == TEMPLATE_ID))
{
player.teleToLocation(RE_ENTRY_LOCATION.getX(), RE_ENTRY_LOCATION.getY(), RE_ENTRY_LOCATION.getZ(), member.getInstanceWorld());
break;
}
}
}
return null;
}
case "start_fortuna":
{
startQuestTimer("check_fortuna_status", 1000, npc, null);
return null;
}
case "boss_1_pause":
{
final Instance world = npc.getInstanceWorld();
if (world == null)
{
return null;
}
world.setStatus(11);
world.spawnGroup("fortuna_11");
showOnScreenMsg(world, NpcStringId.BLOODSUCKING_CREATURES_ABSORB_THE_LIGHT_AND_FILL_IT_INTO_DARKNESS, ExShowScreenMessage.TOP_CENTER, 10000, true);
startQuestTimer("check_fortuna_status", 5000, npc, null);
return null;
}
case "boss_2_pause":
{
final Instance world = npc.getInstanceWorld();
if (world == null)
{
return null;
}
world.setStatus(16);
world.spawnGroup("fortuna_16");
showOnScreenMsg(world, NpcStringId.WE_NEED_A_LITTLE_MORE, ExShowScreenMessage.TOP_CENTER, 10000, true);
startQuestTimer("check_fortuna_status", 5000, npc, null);
return null;
}
case "boss_3_pause":
{
final Instance world = npc.getInstanceWorld();
if (world == null)
{
return null;
}
world.setStatus(19);
world.spawnGroup("fortuna_19");
showOnScreenMsg(world, NpcStringId.BLOODSUCKING_CREATURES_WAKE_THE_SOLDIERS_NOW, ExShowScreenMessage.TOP_CENTER, 10000, true);
startQuestTimer("check_fortuna_status", 5000, npc, null);
return null;
}
case "boss_4_pause":
{
final Instance world = npc.getInstanceWorld();
if (world == null)
{
return null;
}
world.setStatus(23);
world.spawnGroup("fortuna_23");
showOnScreenMsg(world, NpcStringId.DARKNESS_SWALLOW_EVERYTHING_AWAY, ExShowScreenMessage.TOP_CENTER, 10000, true);
startQuestTimer("check_fortuna_status", 5000, npc, null);
return null;
}
case "boss_5_pause":
{
final Instance world = npc.getInstanceWorld();
if (world == null)
{
return null;
}
world.setStatus(26);
world.spawnGroup("fortuna_26");
showOnScreenMsg(world, NpcStringId.I_NOW_HAVE_TO_GO_AND_HANDLE_IT, ExShowScreenMessage.TOP_CENTER, 10000, true);
startQuestTimer("check_fortuna_status", 5000, npc, null);
return null;
}
case "boss_6_pause":
{
final Instance world = npc.getInstanceWorld();
if (world == null)
{
return null;
}
world.setStatus(27);
world.spawnGroup("fortuna_last_boss");
showOnScreenMsg(world, NpcStringId.RON_APPEARS, ExShowScreenMessage.BOTTOM_RIGHT, 6000, true);
return null;
}
case "check_fortuna_status":
{
final Instance world = npc.getInstanceWorld();
if (world == null)
{
return null;
}
switch (world.getStatus())
{
case 0:
{
world.setStatus(1);
world.spawnGroup("fortuna_1");
showOnScreenMsg(world, NpcStringId.WHO_DARE_TO_INTERRUPT_OUR_REST, ExShowScreenMessage.TOP_CENTER, 10000, true);
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 1:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(2);
world.spawnGroup("fortuna_2");
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 2:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(3);
world.spawnGroup("fortuna_3");
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 3:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(4);
world.spawnGroup("fortuna_4");
showOnScreenMsg(world, NpcStringId.THOSE_WHO_CAME_HERE_LOOKING_FOR_CURSED_ONES_WELCOME, ExShowScreenMessage.TOP_CENTER, 10000, true);
}
startQuestTimer("check_fortuna_status", 15000, npc, null);
break;
}
case 4:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(5);
world.spawnGroup("fortuna_5");
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 5:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(6);
world.spawnGroup("fortuna_6");
showOnScreenMsg(world, NpcStringId.LET_S_SEE_HOW_MUCH_YOU_CAN_ENDURE, ExShowScreenMessage.TOP_CENTER, 10000, true);
}
startQuestTimer("check_fortuna_status", 15000, npc, null);
break;
}
case 6:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(7);
world.spawnGroup("fortuna_7");
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 7:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(8);
world.spawnGroup("fortuna_8");
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 8:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(9);
world.spawnGroup("fortuna_9");
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 9:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(10);
world.spawnGroup("fortuna_10");
showOnScreenMsg(world, NpcStringId.WEEPING_YUI_APPEARS, ExShowScreenMessage.BOTTOM_RIGHT, 6000, true);
}
startQuestTimer("check_fortuna_status", 35000, npc, null);
break;
}
case 10:
{
if (world.getAliveNpcs().size() == 1)
{
startQuestTimer("boss_1_pause", 30000, npc, null);
}
else
{
startQuestTimer("check_fortuna_status", 5000, npc, null);
}
break;
}
case 11:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(12);
world.spawnGroup("fortuna_12");
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 12:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(13);
world.spawnGroup("fortuna_13");
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 13:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(14);
world.spawnGroup("fortuna_14");
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 14:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(15);
world.spawnGroup("fortuna_15");
showOnScreenMsg(world, NpcStringId.ENRAGED_MASTER_KINEN_APPEARS, ExShowScreenMessage.BOTTOM_RIGHT, 6000, true);
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 15:
{
if (world.getAliveNpcs().size() == 1)
{
startQuestTimer("boss_2_pause", 30000, npc, null);
}
else
{
startQuestTimer("check_fortuna_status", 5000, npc, null);
}
break;
}
case 16:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(17);
world.spawnGroup("fortuna_17");
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 17:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(18);
world.spawnGroup("fortuna_18");
showOnScreenMsg(world, NpcStringId.MAGICAL_WARRIOR_KONYAR_APPEARS, ExShowScreenMessage.BOTTOM_RIGHT, 6000, true);
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 18:
{
if (world.getAliveNpcs().size() == 1)
{
startQuestTimer("boss_3_pause", 30000, npc, null);
}
else
{
startQuestTimer("check_fortuna_status", 5000, npc, null);
}
break;
}
case 19:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(20);
world.spawnGroup("fortuna_20");
showOnScreenMsg(world, NpcStringId.THIS_IS_ONLY_THE_START, ExShowScreenMessage.TOP_CENTER, 10000, true);
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 20:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(21);
world.spawnGroup("fortuna_21");
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 21:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(22);
world.spawnGroup("fortuna_22");
showOnScreenMsg(world, NpcStringId.SIR_LESYINDA_OF_THE_BLACK_SHADOW_APPEARS, ExShowScreenMessage.BOTTOM_RIGHT, 6000, true);
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 22:
{
if (world.getAliveNpcs().size() == 1)
{
startQuestTimer("boss_4_pause", 30000, npc, null);
}
else
{
startQuestTimer("check_fortuna_status", 5000, npc, null);
}
break;
}
case 23:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(24);
world.spawnGroup("fortuna_24");
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 24:
{
if (world.getAliveNpcs().size() == 1)
{
world.setStatus(25);
world.spawnGroup("fortuna_25");
showOnScreenMsg(world, NpcStringId.MUKSHU_THE_COWARD_AND_BLIND_HORNAFI_APPEARS, ExShowScreenMessage.BOTTOM_RIGHT, 6000, true);
}
startQuestTimer("check_fortuna_status", 5000, npc, null);
break;
}
case 25:
{
if (world.getAliveNpcs().size() == 1)
{
startQuestTimer("boss_5_pause", 30000, npc, null);
showOnScreenMsg(world, NpcStringId.DARKNESS_SWALLOW_EVERYTHING_AWAY, ExShowScreenMessage.TOP_CENTER, 10000, true);
}
else
{
startQuestTimer("check_fortuna_status", 5000, npc, null);
}
break;
}
case 26:
{
if (world.getAliveNpcs().size() == 1)
{
startQuestTimer("boss_6_pause", 30000, npc, null);
showOnScreenMsg(world, NpcStringId.I_NOW_HAVE_TO_GO_AND_HANDLE_IT, ExShowScreenMessage.TOP_CENTER, 10000, true);
}
else
{
startQuestTimer("check_fortuna_status", 5000, npc, null);
}
break;
}
}
return null;
}
}
return super.onAdvEvent(event, npc, player);
}
@Override
public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
{
if (npc.getInstanceWorld() != null)
{
npc.getInstanceWorld().finishInstance();
}
return super.onKill(npc, player, isSummon);
}
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
return npc.getId() + ".htm";
}
public static void main(String[] args)
{
new Fortuna();
}
}

View File

@@ -180,62 +180,64 @@ public class Q10304_ForForgottenHeroes extends Quest
@Override
public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
{
final QuestState qs = getQuestState(player, false);
int cond = qs.getCond();
int npcId = npc.getId();
if (player.isInsideRadius(npc, Config.ALT_PARTY_RANGE, true, true))
if (qs != null)
{
if ((npcId == YUI) && (cond == 2))
int cond = qs.getCond();
int npcId = npc.getId();
if (player.isInsideRadius(npc, Config.ALT_PARTY_RANGE, true, true))
{
qs.setCond(3, true);
}
else if ((npcId == KINEN) && (cond == 3))
{
qs.setCond(4, true);
}
else if ((npcId == KONYAR) && (cond == 4))
{
qs.setCond(5, true);
}
else if ((npcId == LESYINDA) && (cond == 5))
{
qs.setCond(6, true);
}
else if ((npcId == MAKSHU) && (cond == 6))
{
int kills = qs.getInt(Integer.toString(MAKSHU));
if (kills < 1)
if ((npcId == YUI) && (cond == 2))
{
kills++;
qs.set(Integer.toString(MAKSHU), kills);
qs.setCond(3, true);
}
else if ((npcId == KINEN) && (cond == 3))
{
qs.setCond(4, true);
}
else if ((npcId == KONYAR) && (cond == 4))
{
qs.setCond(5, true);
}
else if ((npcId == LESYINDA) && (cond == 5))
{
qs.setCond(6, true);
}
else if ((npcId == MAKSHU) && (cond == 6))
{
int kills = qs.getInt(Integer.toString(MAKSHU));
if (kills < 1)
{
kills++;
qs.set(Integer.toString(MAKSHU), kills);
}
}
else if ((npcId == HORNAFI) && (cond == 6))
{
int kills = qs.getInt(Integer.toString(HORNAFI));
if (kills < 1)
{
kills++;
qs.set(Integer.toString(HORNAFI), kills);
}
}
else if ((npcId == YONTYMAK) && (cond == 7))
{
qs.setCond(8);
}
else if ((npcId == RON) && (cond == 8))
{
qs.setCond(8);
}
}
else if ((npcId == HORNAFI) && (cond == 6))
final ExQuestNpcLogList log = new ExQuestNpcLogList(getId());
log.addNpc(MAKSHU, qs.getInt(Integer.toString(MAKSHU)));
log.addNpc(HORNAFI, qs.getInt(Integer.toString(HORNAFI)));
qs.getPlayer().sendPacket(log);
if ((qs.getInt(Integer.toString(MAKSHU)) >= 1) && (qs.getInt(Integer.toString(HORNAFI)) >= 1))
{
int kills = qs.getInt(Integer.toString(HORNAFI));
if (kills < 1)
{
kills++;
qs.set(Integer.toString(HORNAFI), kills);
}
qs.setCond(7, true);
}
else if ((npcId == YONTYMAK) && (cond == 7))
{
qs.setCond(8);
}
else if ((npcId == RON) && (cond == 8))
{
qs.setCond(8);
}
}
final ExQuestNpcLogList log = new ExQuestNpcLogList(getId());
log.addNpc(MAKSHU, qs.getInt(Integer.toString(MAKSHU)));
log.addNpc(HORNAFI, qs.getInt(Integer.toString(HORNAFI)));
qs.getPlayer().sendPacket(log);
if ((qs.getInt(Integer.toString(MAKSHU)) >= 1) && (qs.getInt(Integer.toString(HORNAFI)) >= 1))
{
qs.setCond(7, true);
}
}