diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/Routes.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/Routes.xml
index daa7547e36..a4bbf24088 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/Routes.xml
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/Routes.xml
@@ -1043,38 +1043,98 @@
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml
index 79319c9ba7..81d3df75c8 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml
@@ -12,8 +12,12 @@
-
-
+
+
+
+
+
+
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml
index 8e5d962638..afc416a820 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml
@@ -12,45 +12,48 @@
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
@@ -95,6 +98,11 @@
+
+
+
+
+
@@ -115,7 +123,6 @@
-
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml
index 10fdc99062..cc2bdd0cd9 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml
@@ -12,8 +12,12 @@
-
-
+
+
+
+
+
+
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml
index c469b93c64..fbb2cac4e8 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml
@@ -16,22 +16,37 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -41,16 +56,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -95,6 +100,11 @@
+
+
+
+
+
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml
index d04fc781ee..26f843c0b8 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml
@@ -12,8 +12,12 @@
-
-
+
+
+
+
+
+
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml
index a8235c88d7..4a4b8d99a4 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml
@@ -17,21 +17,36 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -41,16 +56,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -94,6 +99,11 @@
+
+
+
+
+
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/33647-9.htm b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/33647-9.htm
new file mode 100644
index 0000000000..f72bd6b6d6
--- /dev/null
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/33647-9.htm
@@ -0,0 +1,5 @@
+Kartia Researcher:
+Don't waste my time! I'm a researcher sent directly by the Kingdom of Aden after all.
+You must have the quest started in order to enter the labyrinth.
+
+
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java
index 0f7156ae8b..5ef95e7b46 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java
@@ -28,7 +28,7 @@ import ai.AbstractNpcAI;
/**
* Kartia Boss AI.
- * @author St3eT
+ * @author flanagak
*/
public final class KartiaBoss extends AbstractNpcAI
{
@@ -139,8 +139,8 @@ public final class KartiaBoss extends AbstractNpcAI
{
for (int i = 0; i < 3; i++)
{
- addSpawn(fighter, npc, false, 0, false, npc.getInstanceId());
- addSpawn(mage, npc, false, 0, false, npc.getInstanceId());
+ addSpawn(fighter, npc, true, 0, false, npc.getInstanceId());
+ addSpawn(mage, npc, true, 0, false, npc.getInstanceId());
}
}
}
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java
index fe268f6cd0..63766759cc 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java
@@ -33,16 +33,14 @@ import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.instancezone.Instance;
-import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.skills.SkillCaster;
import com.l2jmobius.gameserver.network.NpcStringId;
-import com.l2jmobius.gameserver.util.Util;
import ai.AbstractNpcAI;
/**
* Kartia Helper Adolph AI.
- * @author St3eT
+ * @author flanagak
*/
public final class KartiaHelperAdolph extends AbstractNpcAI
{
@@ -59,6 +57,27 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
33799, // Life Plunderer (90)
33800, // Life Plunderer (95)
};
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -82,114 +101,161 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
final Instance instance = npc.getInstanceWorld();
if ((instance != null) && event.equals("CHECK_ACTION"))
{
- final StatsSet instParams = instance.getTemplateParameters();
- boolean actionFound = false;
-
- if (!npc.isInCombat() || !npc.isAttackingNow() || (npc.getTarget() == null))
+ final StatsSet npcVars = npc.getVariables();
+ player = npcVars.getObject("PLAYER_OBJECT", L2PcInstance.class);
+ if (player != null)
{
- final List monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 500);
- if (!monsterList.isEmpty())
+ final double distance = npc.calculateDistance(player, false, false);
+ if (distance > 300)
{
- final L2MonsterInstance monster = monsterList.get(getRandom(monsterList.size()));
-
- if (monster.isTargetable() && GeoEngine.getInstance().canSeeTarget(npc, monster) && !CommonUtil.contains(MIRRORS, monster.getId()))
+ final Location loc = new Location(player.getX(), player.getY(), player.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
{
- actionFound = true;
- addAttackDesire(npc, monster);
+ npc.teleToLocation(loc);
}
- }
- }
-
- if (!actionFound)
- {
- final SkillHolder hateSkill = instParams.getSkillHolder("adolphHate");
- if (npc.isInCombat() && (hateSkill != null) && SkillCaster.checkUseConditions(npc, hateSkill.getSkill()))
- {
- addSkillCastDesire(npc, npc.getTarget(), hateSkill, 23);
- }
- else
- {
- final L2PcInstance instancePlayer = npc.getVariables().getObject("PLAYER_OBJECT", L2PcInstance.class);
- if (instancePlayer != null)
+ else
{
- final double radian = Math.toRadians(Util.convertHeadingToDegree(instancePlayer.getHeading()));
- final int X = (int) (instancePlayer.getX() + (Math.cos(radian) * 150));
- final int Y = (int) (instancePlayer.getY() + (Math.sin(radian) * 150));
- final Location loc = GeoEngine.getInstance().canMoveToTargetLoc(instancePlayer.getX(), instancePlayer.getY(), instancePlayer.getZ(), X, Y, instancePlayer.getZ(), instance);
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final List monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 500);
+ if (!monsterList.isEmpty())
+ {
+ final L2MonsterInstance monster = monsterList.get(getRandom(monsterList.size()));
- if (!npc.isInsideRadius(loc, 50, true, true))
+ if (monster.isTargetable() && GeoEngine.getInstance().canSeeTarget(npc, monster) && !CommonUtil.contains(MIRRORS, monster.getId()) && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
{
- npc.setRunning();
- addMoveToDesire(npc, loc, 23);
+ addAttackDesire(npc, monster);
}
}
}
}
}
- }
-
- @Override
- public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill)
- {
- final Instance instance = npc.getInstanceWorld();
- if (instance != null)
+ else if ((instance != null) && event.equals("USE_SKILL"))
{
- final StatsSet instParams = instance.getTemplateParameters();
- final SkillHolder hateSkill = instParams.getSkillHolder("adolphHate");
- final SkillHolder shieldSkill = instParams.getSkillHolder("adolphShield");
- final SkillHolder punishSkill = instParams.getSkillHolder("adolphPunish");
-
- if ((hateSkill != null) && (skill.getId() == hateSkill.getSkillId()))
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
{
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_FILTHY_MONSTERS_I_WILL_TAKE_YOU_ON);
- }
- else if ((shieldSkill != null) && (skill.getId() == shieldSkill.getSkillId()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.STOP_RIGHT_THERE_I_WILL_BE_YOUR_OPPONENT);
- }
- else if ((punishSkill != null) && (skill.getId() == punishSkill.getSkillId()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
+ }
+
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("adolphHate");
+ final SkillHolder skill_02 = instParams.getSkillHolder("adolphPunish");
+ final SkillHolder skill_03 = instParams.getSkillHolder("adolphShield");
+ final SkillHolder skill_04 = instParams.getSkillHolder("adolphAggression");
+ final SkillHolder skill_05 = instParams.getSkillHolder("adolphChainHydra");
+ final SkillHolder lowHpSkill = instParams.getSkillHolder("adolphUltimate");
+ final int numberOfActiveSkills = 5;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ if ((lowHpSkill != null) && (npc.getCurrentHpPercent() < 50))
+ {
+ // NPC has low HP Skill and HP is < 50% HP
+ if (!npc.isAffectedBySkill(lowHpSkill.getSkillId()) && (SkillCaster.checkUseConditions(npc, lowHpSkill.getSkill())))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IT_S_NOT_OVER);
+ npc.doCast(lowHpSkill.getSkill());
+ }
+ }
+ else
+ {
+ switch (randomSkill)
+ {
+ case 0:
+ case 1:
+ {
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ final List monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 300);
+ if (!monsterList.isEmpty())
+ {
+ for (L2MonsterInstance monster : monsterList)
+ {
+ if (monster.isTargetable() && GeoEngine.getInstance().canSeeTarget(npc, monster) && !CommonUtil.contains(MIRRORS, monster.getId()) && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ monster.addDamageHate(npc, 100, 10000);
+ }
+ }
+ }
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 3:
+ {
+ if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
+ npc.doCast(skill_03.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 4:
+ {
+ if ((skill_04 != null) && SkillCaster.checkUseConditions(npc, skill_04.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_BE_DESTROYED);
+ npc.doCast(skill_04.getSkill());
+ }
+ break;
+ }
+ case 5:
+ {
+ if ((skill_05 != null) && SkillCaster.checkUseConditions(npc, skill_05.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_DIE);
+ npc.doCast(skill_05.getSkill(), null, true, false);
+ }
+ break;
+ }
+ }
}
}
- return super.onSpellFinished(npc, player, skill);
}
public void onCreatureAttacked(OnCreatureAttacked event)
{
final L2Npc npc = (L2Npc) event.getTarget();
- final Instance instance = npc.getInstanceWorld();
- if ((instance != null) && !event.getAttacker().isPlayable())
+ if (npc != null)
{
- final StatsSet instParams = instance.getTemplateParameters();
- final int random = getRandom(1000);
-
- if (random < 333)
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
{
- final SkillHolder shieldSkill = instParams.getSkillHolder("adolphShield");
- if ((shieldSkill != null) && SkillCaster.checkUseConditions(npc, shieldSkill.getSkill()))
+ if (!npc.isInCombat())
{
- addSkillCastDesire(npc, npc.getTarget(), shieldSkill, 23);
- }
- }
- else if (random < 666)
- {
- final SkillHolder punishSkill = instParams.getSkillHolder("adolphPunish");
- if ((punishSkill != null) && SkillCaster.checkUseConditions(npc, punishSkill.getSkill()))
- {
- addSkillCastDesire(npc, npc.getTarget(), punishSkill, 23);
- }
- }
-
- if ((npc.getCurrentHpPercent() < 30) && npc.isScriptValue(0))
- {
- final SkillHolder ultimateSkill = instParams.getSkillHolder("adolphUltimate");
- if ((ultimateSkill != null) && !npc.isAffectedBySkill(ultimateSkill.getSkillId()) && SkillCaster.checkUseConditions(npc, ultimateSkill.getSkill()))
- {
- npc.setScriptValue(1);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IT_S_NOT_OVER);
- addSkillCastDesire(npc, npc.getTarget(), ultimateSkill, 23);
- getTimers().addTimer("RESTORE_SCRIPTVAL", 10000, n -> npc.setScriptValue(0));
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder hateSkill = instParams.getSkillHolder("adolphHate");
+ if ((hateSkill != null) && SkillCaster.checkUseConditions(npc, hateSkill.getSkill()))
+ {
+ npc.doCast(hateSkill.getSkill(), null, true, false);
+ }
}
}
}
@@ -210,23 +276,10 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
- {
- instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, adolph, null));
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("adolphTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> adolph.teleToLocation(loc));
- }
- break;
- }
+ instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, adolph, null));
+ instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> getTimers().addRepeatingTimer("USE_SKILL", 6000, adolph, null));
}
}
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java
index 374348ece8..9ad2b19e13 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java
@@ -35,8 +35,8 @@ import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Barton AI.
- * @author St3eT
+ * Kartia Helper Barton AI. Tyrr Warrior
+ * @author flanagak
*/
public final class KartiaHelperBarton extends AbstractNpcAI
{
@@ -53,6 +53,27 @@ public final class KartiaHelperBarton extends AbstractNpcAI
33620, // Adolph (Kartia 90)
33631, // Adolph (Kartia 95)
};
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -79,52 +100,50 @@ public final class KartiaHelperBarton extends AbstractNpcAI
if (adolph != null)
{
final double distance = npc.calculateDistance(adolph, false, false);
- if (distance > 200)
+ if (distance > 300)
{
- final Location loc = new Location(adolph.getX() + getRandom(-100, 100), adolph.getY() + getRandom(-100, 100), adolph.getZ() + 50);
- if (distance > 500)
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
{
npc.teleToLocation(loc);
}
else
{
npc.setRunning();
- addMoveToDesire(npc, loc, 23);
}
+ addMoveToDesire(npc, randLoc, 23);
}
- else if (!npc.isInCombat() || !npc.isAttackingNow() || (npc.getTarget() == null))
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
{
final L2Character monster = (L2Character) adolph.getTarget();
- if ((monster != null) && adolph.isInCombat())
+ if ((monster != null) && adolph.isInCombat() && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
{
addAttackDesire(npc, monster);
}
}
}
}
+ else if ((instance != null) && event.equals("USE_SKILL"))
+ {
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
+ {
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
}
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
- {
- instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, barton, null));
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("bartonTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> barton.teleToLocation(loc));
- }
- break;
- }
+ instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, barton, null));
+ instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> getTimers().addRepeatingTimer("USE_SKILL", 6000, barton, null));
}
}
@@ -142,33 +161,83 @@ public final class KartiaHelperBarton extends AbstractNpcAI
return super.onSeeCreature(npc, creature, isSummon);
}
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("bartonInfinity");
+ final SkillHolder skill_02 = instParams.getSkillHolder("bartonBerserker");
+ final SkillHolder skill_03 = instParams.getSkillHolder("bartonHurricane");
+ final SkillHolder skill_04 = instParams.getSkillHolder("bartonPowerBomber");
+ final SkillHolder skill_05 = instParams.getSkillHolder("bartonSonicStar");
+ final int numberOfActiveSkills = 5;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ switch (randomSkill)
+ {
+ case 0:
+ case 1:
+ {
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 3:
+ {
+ if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
+ npc.doCast(skill_03.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 4:
+ {
+ if ((skill_04 != null) && SkillCaster.checkUseConditions(npc, skill_04.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_BE_DESTROYED);
+ npc.doCast(skill_04.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 5:
+ {
+ if ((skill_05 != null) && SkillCaster.checkUseConditions(npc, skill_05.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_DIE);
+ npc.doCast(skill_05.getSkill(), null, true, false);
+ }
+ break;
+ }
+ }
+ }
+ }
+
public void onCreatureAttacked(OnCreatureAttacked event)
{
final L2Npc npc = (L2Npc) event.getTarget();
- final Instance instance = npc.getInstanceWorld();
- if ((instance != null) && !event.getAttacker().isPlayable())
+ if (npc != null)
{
- final StatsSet instParams = instance.getTemplateParameters();
- final int random = getRandom(1000);
-
- if (random < 333)
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !npc.isInCombat() && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
{
- final SkillHolder infinitySkill = instParams.getSkillHolder("bartonInfinity");
- if ((infinitySkill != null) && SkillCaster.checkUseConditions(npc, infinitySkill.getSkill()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
- addSkillCastDesire(npc, npc.getTarget(), infinitySkill, 23);
- }
- }
- else if ((npc.getCurrentHpPercent() < 50) && npc.isScriptValue(0))
- {
- final SkillHolder berserkerSkill = instParams.getSkillHolder("bartonBerserker");
- if ((berserkerSkill != null) && !npc.isAffectedBySkill(berserkerSkill.getSkillId()) && SkillCaster.checkUseConditions(npc, berserkerSkill.getSkill()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAAAAAAAAHHHHHH);
- addSkillCastDesire(npc, npc.getTarget(), berserkerSkill, 23);
- getTimers().addTimer("RESTORE_SCRIPTVAL", 10000, n -> npc.setScriptValue(0));
- }
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
}
}
}
@@ -180,6 +249,7 @@ public final class KartiaHelperBarton extends AbstractNpcAI
if (world != null)
{
getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
}
}
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java
index a667ca8510..f1d14df41b 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java
@@ -16,8 +16,15 @@
*/
package instances.KartiasLabyrinth;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.enums.InstanceType;
+import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
@@ -34,8 +41,8 @@ import com.l2jmobius.gameserver.util.Util;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Elise AI.
- * @author St3eT
+ * Kartia Helper Elise AI. Healer
+ * @author flanagak
*/
public final class KartiaHelperElise extends AbstractNpcAI
{
@@ -70,9 +77,27 @@ public final class KartiaHelperElise extends AbstractNpcAI
33624, // Hayuk (Kartia 90)
33635, // Hayuk (Kartia 95)
};
- private static final int HEALING_TREE = 19256;
- // Skill
- private static final SkillHolder TREE_HEAL_SKILL = new SkillHolder(15003, 1); // Summon Tree of Life - NPC
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -95,167 +120,124 @@ public final class KartiaHelperElise extends AbstractNpcAI
if ((instance != null) && event.equals("CHECK_ACTION"))
{
final StatsSet npcVars = npc.getVariables();
- final StatsSet instParams = instance.getTemplateParameters();
-
- player = npcVars.getObject("PLAYER_OBJECT", L2PcInstance.class);
final FriendlyNpcInstance adolph = npcVars.getObject("ADOLPH_OBJECT", FriendlyNpcInstance.class);
- final FriendlyNpcInstance barton = npcVars.getObject("BARTON_OBJECT", FriendlyNpcInstance.class);
- final FriendlyNpcInstance eliyah = npcVars.getObject("ELIYAH_OBJECT", FriendlyNpcInstance.class);
- final FriendlyNpcInstance hayuk = npcVars.getObject("HAYUK_OBJECT", FriendlyNpcInstance.class);
-
- if ((player != null) && !player.isDead() && ((player.getCurrentHpPercent() < 75) || (player.getCurrentMpPercent() < 30)))
+ if (!npc.isCastingNow())
{
- final int hpPer = player.getCurrentHpPercent();
- if ((hpPer < 40) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, player);
- }
- else if (hpPer < 60)
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, player, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- else if (hpPer < 75)
- {
- final SkillHolder healSkill = instParams.getSkillHolder("eliseHeal");
- if (healSkill != null)
- {
- addSkillCastDesire(npc, player, healSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- else if (player.getCurrentMpPercent() < 30)
- {
- final SkillHolder rechargeSkill = instParams.getSkillHolder("eliseRecharge");
- if (rechargeSkill != null)
- {
- addSkillCastDesire(npc, player, rechargeSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.MEN_FOCUS_CHARGING_COMPLETE);
- }
- }
+ healFriends(npc, player);
}
- else if ((adolph != null) && !adolph.isDead() && (adolph.getCurrentHpPercent() < 75))
- {
- final int hpPer = adolph.getCurrentHpPercent();
- if ((hpPer < 40) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, adolph);
- }
- else if (hpPer < 60)
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, adolph, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- else
- {
- final SkillHolder healSkill = instParams.getSkillHolder("eliseHeal");
- if (healSkill != null)
- {
- addSkillCastDesire(npc, adolph, healSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if ((barton != null) && !barton.isDead() && (barton.getCurrentHpPercent() < 60))
- {
- final int hpPer = barton.getCurrentHpPercent();
- if ((hpPer < 30) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, barton);
- }
- else
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, barton, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if ((eliyah != null) && !eliyah.isDead() && (eliyah.getCurrentHpPercent() < 60))
- {
- final int hpPer = eliyah.getCurrentHpPercent();
- if ((hpPer < 30) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, eliyah);
- }
- else
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, eliyah, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if ((hayuk != null) && !hayuk.isDead() && (hayuk.getCurrentHpPercent() < 60))
- {
- final int hpPer = hayuk.getCurrentHpPercent();
- if ((hpPer < 30) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, hayuk);
- }
- else
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, hayuk, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if (adolph != null)
+ if (adolph != null)
{
final double distance = npc.calculateDistance(adolph, false, false);
- if (distance > 200)
+ if (distance > 300)
{
- final Location loc = new Location(adolph.getX() + getRandom(-100, 100), adolph.getY() + getRandom(-100, 100), adolph.getZ() + 50);
- if (distance > 500)
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
{
npc.teleToLocation(loc);
}
else
{
npc.setRunning();
- addMoveToDesire(npc, loc, 23);
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ }
+ npc.setTarget(npc);
+ }
+ }
+
+ private void healFriends(L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if (instance != null)
+ {
+ final StatsSet npcVars = npc.getVariables();
+ final StatsSet instParams = instance.getTemplateParameters();
+ if (!npc.isCastingNow())
+ {
+ player = npcVars.getObject("PLAYER_OBJECT", L2PcInstance.class);
+ final SkillHolder progressiveHeal = instParams.getSkillHolder("eliseProgressiveHeal"); // AOE heal
+ final SkillHolder radiantHeal = instParams.getSkillHolder("eliseRadiantHeal"); // Single target heal
+ final SkillHolder recharge = instParams.getSkillHolder("eliseRecharge");
+
+ // Get HP percentage for all friends
+ final Map hpMap = new HashMap<>();
+ instance.getAliveNpcs(KARTIA_FRIENDS).forEach(friend -> hpMap.put(friend, friend != null ? friend.getCurrentHpPercent() : 100));
+ hpMap.put(player, player != null ? player.getCurrentHpPercent() : 100);
+ Map sortedHpMap = new HashMap<>();
+ sortedHpMap = Util.sortByValue(hpMap, false);
+
+ // See if any friends are below 80% HP and add to list of people to heal.
+ final List peopleToHeal = new ArrayList<>();
+ for (L2Object friend : sortedHpMap.keySet())
+ {
+ if ((friend != null) && (sortedHpMap.get(friend) < 80) && (sortedHpMap.get(friend) > 1))
+ {
+ peopleToHeal.add(friend);
+ }
+ }
+
+ if (peopleToHeal.size() > 0)
+ {
+ // At least one friend was below 80% HP.
+ if (peopleToHeal.size() > 1)
+ {
+ // Helper NPC AOE skills affecting monsters so skill power has set to 0.
+ // Using skill is just for animation. Need to heal each NPC/Player manually.
+ npc.setTarget(npc);
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
+ npc.doCast(progressiveHeal.getSkill(), null, true, false);
+ npc.setTarget(npc);
+ for (L2Object personToHeal : peopleToHeal)
+ {
+ if (personToHeal.getInstanceType() == InstanceType.L2PcInstance)
+ {
+ L2PcInstance thePlayer = (L2PcInstance) personToHeal;
+ thePlayer.setCurrentHp((thePlayer.getMaxHp() * .20) + thePlayer.getCurrentHp());
+ }
+ else
+ {
+ L2Npc npcToHeal = (L2Npc) personToHeal;
+ npcToHeal.setCurrentHp((npcToHeal.getMaxHp() * .20) + npcToHeal.getCurrentHp());
+ }
+ }
+ }
+ else
+ {
+ // Only one person needs cure. Cast single target heal
+ for (L2Object personToHeal : peopleToHeal)
+ {
+ npc.setTarget(personToHeal);
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
+ npc.doCast(radiantHeal.getSkill(), null, true, false);
+ npc.setTarget(npc);
+ }
+ }
+ }
+ else
+ {
+ // No one needs healing. Check if player character needs recharge.
+ if ((player != null) && !player.isDead() && (player.getCurrentMpPercent() < 50))
+ {
+ npc.setTarget(player);
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ELECTRIFYING_RECHARGE);
+ npc.doCast(recharge.getSkill(), null, true, false);
+ npc.setTarget(npc);
}
}
}
}
+
}
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
- {
- instance.getAliveNpcs(KARTIA_ELISE).forEach(elise -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, elise, null));
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("eliseTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_ELISE).forEach(elise -> elise.teleToLocation(loc));
- }
- break;
- }
+ instance.getAliveNpcs(KARTIA_ELISE).forEach(elise -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, elise, null));
}
}
@@ -297,18 +279,10 @@ public final class KartiaHelperElise extends AbstractNpcAI
if (world != null)
{
getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
}
}
- private void summonHealingTree(L2Npc npc, L2Character target)
- {
- npc.getVariables().set("CAN_USE_TREE", false);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.COME_FORTH_TREE_OF_LIFE);
- final L2Npc tree = addSpawn(HEALING_TREE, Util.getRandomPosition(target, 20, 50), false, 0, false, npc.getInstanceId());
- getTimers().addTimer("TREE_REUSE", 10000, evnt -> npc.getVariables().set("CAN_USE_TREE", true));
- getTimers().addTimer("TREE_HEAL", 3000, evnt -> addSkillCastDesire(tree, target, TREE_HEAL_SKILL, 23));
- }
-
public static void main(String[] args)
{
new KartiaHelperElise();
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java
index 80d3710a94..0b64d51602 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java
@@ -16,15 +16,23 @@
*/
package instances.KartiasLabyrinth;
+import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.model.Location;
+import com.l2jmobius.gameserver.model.StatsSet;
+import com.l2jmobius.gameserver.model.actor.L2Character;
+import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.FriendlyNpcInstance;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureAttacked;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Eliyah AI.
- * @author St3eT
+ * Kartia Helper Eliyah AI. Summoner
+ * @author flanagak
*/
public final class KartiaHelperEliyah extends AbstractNpcAI
{
@@ -35,6 +43,33 @@ public final class KartiaHelperEliyah extends AbstractNpcAI
33626, // Eliyah (Kartia 90)
33637, // Eliyah (Kartia 95)
};
+ private static final int[] KARTIA_ADOLPH =
+ {
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ };
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -45,33 +80,101 @@ public final class KartiaHelperEliyah extends AbstractNpcAI
private KartiaHelperEliyah()
{
+ setCreatureKillId(this::onCreatureKill, KARTIA_ELIYAH);
+ setCreatureAttackedId(this::onCreatureAttacked, KARTIA_ELIYAH);
+ addSeeCreatureId(KARTIA_ELIYAH);
setInstanceStatusChangeId(this::onInstanceStatusChange, KARTIA_SOLO_INSTANCES);
}
+ @Override
+ public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && event.equals("CHECK_ACTION"))
+ {
+ final FriendlyNpcInstance adolph = npc.getVariables().getObject("ADOLPH_OBJECT", FriendlyNpcInstance.class);
+ if (adolph != null)
+ {
+ final double distance = npc.calculateDistance(adolph, false, false);
+ if (distance > 300)
+ {
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
+ {
+ npc.teleToLocation(loc);
+ }
+ else
+ {
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final L2Character monster = (L2Character) adolph.getTarget();
+ if ((monster != null) && adolph.isInCombat() && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ npc.setTarget(monster);
+ }
+ }
+ }
+ }
+ }
+
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
+ instance.getAliveNpcs(KARTIA_ELIYAH).forEach(eliyah -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, eliyah, null));
+ if ((instance.getAliveNpcs(KARTIA_ELIYAH) != null) && (instance.getAliveNpcs(KARTIA_ELIYAH).size() > 0))
{
- // Nothing for now
- break;
+ instance.spawnGroup("GUARDIANS");
}
- case 2:
- case 3:
+ }
+ }
+
+ @Override
+ public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
+ {
+ if (creature.isPlayer())
+ {
+ npc.getVariables().set("PLAYER_OBJECT", creature.getActingPlayer());
+ }
+ else if (CommonUtil.contains(KARTIA_ADOLPH, creature.getId()))
+ {
+ npc.getVariables().set("ADOLPH_OBJECT", creature);
+ }
+ return super.onSeeCreature(npc, creature, isSummon);
+ }
+
+ public void onCreatureAttacked(OnCreatureAttacked event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ if (npc != null)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
{
- final Location loc = instance.getTemplateParameters().getLocation("eliyahTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_ELIYAH).forEach(eliyah -> eliyah.teleToLocation(loc));
- }
- break;
+ npc.setTarget(event.getAttacker());
}
}
}
+ public void onCreatureKill(OnCreatureDeath event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ final Instance world = npc.getInstanceWorld();
+ if (world != null)
+ {
+ getTimers().cancelTimersOf(npc);
+ world.despawnGroup("GUARDIANS");
+ npc.doDie(event.getAttacker());
+ }
+ }
+
public static void main(String[] args)
{
new KartiaHelperEliyah();
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperGuardian.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperGuardian.java
new file mode 100644
index 0000000000..0cc90ab787
--- /dev/null
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperGuardian.java
@@ -0,0 +1,237 @@
+/*
+ * 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 .
+ */
+package instances.KartiasLabyrinth;
+
+import com.l2jmobius.commons.util.CommonUtil;
+import com.l2jmobius.gameserver.model.Location;
+import com.l2jmobius.gameserver.model.StatsSet;
+import com.l2jmobius.gameserver.model.actor.L2Character;
+import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.FriendlyNpcInstance;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureAttacked;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
+import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
+import com.l2jmobius.gameserver.model.holders.SkillHolder;
+import com.l2jmobius.gameserver.model.instancezone.Instance;
+import com.l2jmobius.gameserver.model.skills.SkillCaster;
+
+import ai.AbstractNpcAI;
+
+/**
+ * Kartia Helper Eliyah's Guardian Spirit
+ * @author flanagak *
+ */
+public final class KartiaHelperGuardian extends AbstractNpcAI
+{
+ // NPCs
+ private static final int[] KARTIA_ELIYAH =
+ {
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ };
+ private static final int[] KARTIA_ADOLPH =
+ {
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ };
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
+ private static final int[] KARTIA_GUARDIANS =
+ {
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
+ // Misc
+ private static final int[] KARTIA_SOLO_INSTANCES =
+ {
+ 205, // Solo 85
+ 206, // Solo 90
+ 207, // Solo 95
+ };
+
+ private KartiaHelperGuardian()
+ {
+ setCreatureKillId(this::onCreatureKill, KARTIA_GUARDIANS);
+ setCreatureAttackedId(this::onCreatureAttacked, KARTIA_GUARDIANS);
+ addSeeCreatureId(KARTIA_GUARDIANS);
+ setInstanceStatusChangeId(this::onInstanceStatusChange, KARTIA_SOLO_INSTANCES);
+ }
+
+ @Override
+ public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && event.equals("CHECK_ACTION"))
+ {
+ final FriendlyNpcInstance eliyah = npc.getVariables().getObject("ELIYAH_OBJECT", FriendlyNpcInstance.class);
+ if (eliyah != null)
+ {
+ final double distance = npc.calculateDistance(eliyah, false, false);
+ if (distance > 300)
+ {
+ final Location loc = new Location(eliyah.getX(), eliyah.getY(), eliyah.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-50, 50), loc.getY() + getRandom(-50, 50), loc.getZ());
+ if (distance > 600)
+ {
+ npc.teleToLocation(loc);
+ }
+ else
+ {
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final L2Character monster = (L2Character) eliyah.getTarget();
+ if ((monster != null) && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ addAttackDesire(npc, monster);
+ }
+ }
+ }
+ }
+ else if ((instance != null) && event.equals("USE_SKILL"))
+ {
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
+ {
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
+ }
+
+ public void onInstanceStatusChange(OnInstanceStatusChange event)
+ {
+ final Instance instance = event.getWorld();
+ final int status = event.getStatus();
+ if (status == 1)
+ {
+ instance.getAliveNpcs(KARTIA_GUARDIANS).forEach(guardian -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, guardian, null));
+ instance.getAliveNpcs(KARTIA_GUARDIANS).forEach(guardian -> getTimers().addRepeatingTimer("USE_SKILL", 6000, guardian, null));
+ }
+ }
+
+ @Override
+ public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
+ {
+ if (creature.isPlayer())
+ {
+ npc.getVariables().set("PLAYER_OBJECT", creature.getActingPlayer());
+ }
+ else if (CommonUtil.contains(KARTIA_ADOLPH, creature.getId()))
+ {
+ npc.getVariables().set("ADOLPH_OBJECT", creature);
+ }
+ else if (CommonUtil.contains(KARTIA_ELIYAH, creature.getId()))
+ {
+ npc.getVariables().set("ELIYAH_OBJECT", creature);
+ }
+ return super.onSeeCreature(npc, creature, isSummon);
+ }
+
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("guardianSpiritsBlow");
+ final SkillHolder skill_02 = instParams.getSkillHolder("guardianSpiritsWrath");
+ final int numberOfActiveSkills = 2;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ switch (randomSkill)
+ {
+ case 0:
+ case 1:
+ {
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ public void onCreatureAttacked(OnCreatureAttacked event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ if (npc != null)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !npc.isInCombat() && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
+ {
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
+ }
+ }
+ }
+
+ public void onCreatureKill(OnCreatureDeath event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ final Instance world = npc.getInstanceWorld();
+ if (world != null)
+ {
+ getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ new KartiaHelperGuardian();
+ }
+
+}
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java
index be412bb83b..12d10d91c1 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java
@@ -16,25 +16,65 @@
*/
package instances.KartiasLabyrinth;
+import com.l2jmobius.commons.util.CommonUtil;
+import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.Location;
+import com.l2jmobius.gameserver.model.StatsSet;
+import com.l2jmobius.gameserver.model.actor.L2Character;
+import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.FriendlyNpcInstance;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureAttacked;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
+import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.instancezone.Instance;
+import com.l2jmobius.gameserver.model.skills.SkillCaster;
+import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Hayuk AI.
- * @author St3eT
+ * Kartia Helper Hayuk AI. Archer
+ * @author flanagak
*/
public final class KartiaHelperHayuk extends AbstractNpcAI
{
// NPCs
+ private static final int[] KARTIA_ADOLPH =
+ {
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ };
private static final int[] KARTIA_HAYUK =
{
33613, // Hayuk (Kartia 85)
33624, // Hayuk (Kartia 90)
33635, // Hayuk (Kartia 95)
};
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
+
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -45,33 +85,155 @@ public final class KartiaHelperHayuk extends AbstractNpcAI
private KartiaHelperHayuk()
{
+ setCreatureKillId(this::onCreatureKill, KARTIA_HAYUK);
+ setCreatureAttackedId(this::onCreatureAttacked, KARTIA_HAYUK);
+ addSeeCreatureId(KARTIA_HAYUK);
setInstanceStatusChangeId(this::onInstanceStatusChange, KARTIA_SOLO_INSTANCES);
}
+ @Override
+ public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && event.equals("CHECK_ACTION"))
+ {
+ final FriendlyNpcInstance adolph = npc.getVariables().getObject("ADOLPH_OBJECT", FriendlyNpcInstance.class);
+ if (adolph != null)
+ {
+ final double distance = npc.calculateDistance(adolph, false, false);
+ if (distance > 300)
+ {
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
+ {
+ npc.teleToLocation(loc);
+ }
+ else
+ {
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final L2Character monster = (L2Character) adolph.getTarget();
+ if ((monster != null) && adolph.isInCombat() && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ addAttackDesire(npc, monster);
+ }
+ }
+ }
+ }
+ else if ((instance != null) && event.equals("USE_SKILL"))
+ {
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
+ {
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
+ }
+
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
+ instance.getAliveNpcs(KARTIA_HAYUK).forEach(hayuk -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, hayuk, null));
+ instance.getAliveNpcs(KARTIA_HAYUK).forEach(hayuk -> getTimers().addRepeatingTimer("USE_SKILL", 6000, hayuk, null));
+ }
+ }
+
+ @Override
+ public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
+ {
+ if (creature.isPlayer())
+ {
+ npc.getVariables().set("PLAYER_OBJECT", creature.getActingPlayer());
+ }
+ else if (CommonUtil.contains(KARTIA_ADOLPH, creature.getId()))
+ {
+ npc.getVariables().set("ADOLPH_OBJECT", creature);
+ }
+ return super.onSeeCreature(npc, creature, isSummon);
+ }
+
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("hayukPinpointShot");
+ final SkillHolder skill_02 = instParams.getSkillHolder("hayukRecoilShot");
+ final SkillHolder skill_03 = instParams.getSkillHolder("hayukMultipleArrow");
+ final int numberOfActiveSkills = 3;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ switch (randomSkill)
{
- // Nothing for now
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("hayukTeleportStatus" + status);
- if (loc != null)
+ case 0:
+ case 1:
{
- instance.getAliveNpcs(KARTIA_HAYUK).forEach(hayuk -> hayuk.teleToLocation(loc));
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 3:
+ {
+ if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
+ npc.doCast(skill_03.getSkill(), null, true, false);
+ }
+ break;
}
- break;
}
}
}
+ public void onCreatureAttacked(OnCreatureAttacked event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ if (npc != null)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !npc.isInCombat() && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
+ {
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
+ }
+ }
+ }
+
+ public void onCreatureKill(OnCreatureDeath event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ final Instance world = npc.getInstanceWorld();
+ if (world != null)
+ {
+ getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
+ }
+ }
+
public static void main(String[] args)
{
new KartiaHelperHayuk();
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java
index b633afc228..fbb7d13161 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java
@@ -19,13 +19,16 @@ package instances.KartiasLabyrinth;
import java.util.List;
import com.l2jmobius.commons.util.CommonUtil;
+import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.instancemanager.WalkingManager;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureSee;
@@ -47,7 +50,7 @@ import quests.Q00499_IncarnationOfGluttonyKaliosSolo.Q00499_IncarnationOfGlutton
/**
* Kartia Labyrinth instance zone.
- * @author St3eT
+ * @author flanagak
*/
public final class KartiasLabyrinth extends AbstractInstance
{
@@ -84,17 +87,27 @@ public final class KartiasLabyrinth extends AbstractInstance
33623,
33634,
};
- // @formatter:off
private static final int[] MONSTERS =
{
- 19220, 19221, 19222, // Solo 85
- 19223, 19224, 19225, // Solo 90
- 19226, 19227, 19228, // Solo 95
- 19229, 19230, 19231, // Group 85
- 19232, 19233, 19234, // Group 90
- 19235, 19236, 19237, // Group 95
+ 19220,
+ 19221,
+ 19222, // Solo 85
+ 19223,
+ 19224,
+ 19225, // Solo 90
+ 19226,
+ 19227,
+ 19228, // Solo 95
+ 19229,
+ 19230,
+ 19231, // Group 85
+ 19232,
+ 19233,
+ 19234, // Group 90
+ 19235,
+ 19236,
+ 19237, // Group 95
};
- // @formatter:on
private static final int[] BOSSES =
{
19253, // Zellaka (Solo 85)
@@ -134,19 +147,10 @@ public final class KartiasLabyrinth extends AbstractInstance
// Zones
private static final int KARTIA_85_DETECT_1 = 12020;
private static final int KARTIA_85_DETECT_2 = 12021;
- // private static final int KARTIA_85_TELEPORT_1 = 12022;
- // private static final int KARTIA_85_TELEPORT_2 = 12023;
- // private static final int KARTIA_85_TELEPORT_3 = 12024;
private static final int KARTIA_90_DETECT_1 = 12025;
private static final int KARTIA_90_DETECT_2 = 12026;
- // private static final int KARTIA_90_TELEPORT_1 = 12027;
- // private static final int KARTIA_90_TELEPORT_2 = 12028;
- // private static final int KARTIA_90_TELEPORT_3 = 12029;
private static final int KARTIA_95_DETECT_1 = 12030;
private static final int KARTIA_95_DETECT_2 = 12031;
- // private static final int KARTIA_95_TELEPORT_1 = 12032;
- // private static final int KARTIA_95_TELEPORT_2 = 12033;
- // private static final int KARTIA_95_TELEPORT_3 = 12034;
// Misc
private static final int TEMPLATE_ID_SOLO_85 = 205;
private static final int TEMPLATE_ID_SOLO_90 = 206;
@@ -154,6 +158,22 @@ public final class KartiasLabyrinth extends AbstractInstance
private static final int TEMPLATE_ID_GROUP_85 = 208;
private static final int TEMPLATE_ID_GROUP_90 = 209;
private static final int TEMPLATE_ID_GROUP_95 = 210;
+ private static final long WAVE_DEALY = 30000;
+ private static final long WAVE_MONITOR_DELAY = 3000;
+ // Solo instance XP reward values
+ private static final int SOLO_BASE_EXP_85 = 480000000;
+ private static final int SOLO_RAND_EXP_85 = 8055934;
+ private static final int SOLO_BASE_EXP_90 = 670000000;
+ private static final int SOLO_RAND_EXP_90 = 6173918;
+ private static final int SOLO_BASE_EXP_95 = 970000000;
+ private static final int SOLO_RAND_EXP_95 = 6305195;
+ // Solo instance SP reward values
+ private static final int SOLO_BASE_SP_85 = 3800000;
+ private static final int SOLO_RAND_SP_85 = 73460;
+ private static final int SOLO_BASE_SP_90 = 5600000;
+ private static final int SOLO_RAND_SP_90 = 82134;
+ private static final int SOLO_BASE_SP_95 = 8500000;
+ private static final int SOLO_RAND_SP_95 = 39112;
public KartiasLabyrinth()
{
@@ -177,9 +197,9 @@ public final class KartiasLabyrinth extends AbstractInstance
setCreatureKillId(this::onCreatureKill, MONSTERS);
setCreatureKillId(this::onBossKill, BOSSES);
setCreatureSeeId(this::onCreatureSee, MONSTERS);
- addEnterZoneId(KARTIA_85_DETECT_1, KARTIA_85_DETECT_2 /* , KARTIA_85_TELEPORT_1, KARTIA_85_TELEPORT_2, KARTIA_85_TELEPORT_3 */);
- addEnterZoneId(KARTIA_90_DETECT_1, KARTIA_90_DETECT_2 /* , KARTIA_90_TELEPORT_1, KARTIA_90_TELEPORT_2, KARTIA_90_TELEPORT_3 */);
- addEnterZoneId(KARTIA_95_DETECT_1, KARTIA_95_DETECT_2 /* , KARTIA_95_TELEPORT_1, KARTIA_95_TELEPORT_2, KARTIA_95_TELEPORT_3 */);
+ addEnterZoneId(KARTIA_85_DETECT_1, KARTIA_85_DETECT_2);
+ addEnterZoneId(KARTIA_90_DETECT_1, KARTIA_90_DETECT_2);
+ addEnterZoneId(KARTIA_95_DETECT_1, KARTIA_95_DETECT_2);
addInstanceCreatedId(TEMPLATE_ID_SOLO_85, TEMPLATE_ID_SOLO_90, TEMPLATE_ID_SOLO_95, TEMPLATE_ID_GROUP_85, TEMPLATE_ID_GROUP_90, TEMPLATE_ID_GROUP_95);
}
@@ -197,33 +217,63 @@ public final class KartiasLabyrinth extends AbstractInstance
}
case "request_zellaka_solo":
{
- enterInstance(player, npc, TEMPLATE_ID_SOLO_85);
- return null;
+ final QuestState qs = player.getQuestState(Q00497_IncarnationOfGreedZellakaSolo.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_SOLO_85);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_pelline_solo":
{
- enterInstance(player, npc, TEMPLATE_ID_SOLO_90);
- return null;
+ final QuestState qs = player.getQuestState(Q00498_IncarnationOfJealousyPellineSolo.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_SOLO_90);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_kalios_solo":
{
- enterInstance(player, npc, TEMPLATE_ID_SOLO_95);
- return null;
+ final QuestState qs = player.getQuestState(Q00499_IncarnationOfGluttonyKaliosSolo.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_SOLO_95);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_zellaka_party":
{
- enterInstance(player, npc, TEMPLATE_ID_GROUP_85);
- return null;
+ final QuestState qs = player.getQuestState(Q00494_IncarnationOfGreedZellakaGroup.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_GROUP_85);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_pelline_party":
{
- enterInstance(player, npc, TEMPLATE_ID_GROUP_90);
- return null;
+ final QuestState qs = player.getQuestState(Q00495_IncarnationOfJealousyPellineGroup.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_GROUP_90);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_kalios_party":
{
- enterInstance(player, npc, TEMPLATE_ID_GROUP_95);
- return null;
+ final QuestState qs = player.getQuestState(Q00496_IncarnationOfGluttonyKaliosGroup.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_GROUP_95);
+ return null;
+ }
+ return "33647-9.htm";
}
default:
{
@@ -280,16 +330,18 @@ public final class KartiasLabyrinth extends AbstractInstance
{
if (npc != null)
{
- if (npc.getInstanceWorld().getParameters().getInt("ROOM", 1) <= 2)
+ if (npc.getInstanceWorld().getParameters().getInt("ROOM", 1) < 2)
{
+ // Move mobs in Room 1 to the middle at top of the steps. Add timer to start moving towards prisoners.
final Location loc = instance.getTemplateParameters().getLocation("middlePointRoom1");
final Location moveTo = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
npc.setRunning();
addMoveToDesire(npc, moveTo, 6);
- getTimers().addTimer("START_MOVE", 15000, npc, null);
+ getTimers().addTimer("START_MOVE", 12000, npc, null);
}
else if (npc.getInstanceWorld().getParameters().getInt("ROOM", 1) == 3)
{
+ // Move mobs in Room 3 towards center of room.
final Location loc = instance.getTemplateParameters().getLocation("middlePointRoom3");
final Location moveTo = new Location(loc.getX() + getRandom(-200, 200), loc.getY() + getRandom(-200, 200), loc.getZ());
npc.setRunning();
@@ -302,18 +354,8 @@ public final class KartiasLabyrinth extends AbstractInstance
{
if (npc != null)
{
- WalkingManager.getInstance().startMoving(npc, instance.getTemplateParameters().getString(getRandomBoolean() ? "route1" : "route2"));
- getTimers().addTimer("CHANGE_TARGETABLE_STATUS", 5000, npc, null);
- }
- break;
- }
- case "CHANGE_TARGETABLE_STATUS":
- {
- if (npc != null)
- {
- npc.setTargetable(true);
- final L2PcInstance randomPlayer = instance.getPlayers().stream().findAny().get();
- npc.moveToLocation(randomPlayer.getX(), randomPlayer.getY(), randomPlayer.getZ(), 10);
+ final String selectedRoute = (getRandomBoolean() ? "route1_" : "route2_") + Integer.toString(getRandom(1, 3));
+ WalkingManager.getInstance().startMoving(npc, instance.getTemplateParameters().getString(selectedRoute));
}
break;
}
@@ -346,7 +388,6 @@ public final class KartiasLabyrinth extends AbstractInstance
});
- instance.getParameters().set("TELEPORT_1_ENABLED", true);
if (!isSoloKartia(instance))
{
getTimers().addTimer("CALL_PROGRESS", 2500, n -> manageProgressInInstance(instance));
@@ -375,6 +416,20 @@ public final class KartiasLabyrinth extends AbstractInstance
}
}
+ private void manageWaves(Instance instance)
+ {
+ if ((instance != null) && instance.getAliveNpcs(MONSTERS).isEmpty())
+ {
+ getTimers().cancelTimers("NEXT_WAVE_DELAY");
+ getTimers().cancelTimers("MONITOR_WAVE");
+ getTimers().addTimer("CALL_PROGRESS", 5000, n -> manageProgressInInstance(instance));
+ }
+ else
+ {
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
+ }
+ }
+
public void onBossKill(OnCreatureDeath event)
{
final L2Npc npc = (L2Npc) event.getTarget();
@@ -384,80 +439,29 @@ public final class KartiasLabyrinth extends AbstractInstance
{
if (isSoloKartia(instance))
{
- final StatsSet tempParam = instance.getTemplateParameters();
- final int xp = tempParam.getInt("soloEXP");
- final int xp_rnd = tempParam.getInt("SoloEXP_Rand");
- final int sp = tempParam.getInt("SoloSP");
- final int sp_rnd = tempParam.getInt("SoloSP_Rand");
-
- instance.getPlayers().forEach(player ->
+ final L2PcInstance player = instance.getFirstPlayer();
+ if (player != null)
{
- addExpAndSp(player, (xp + getRandom(xp_rnd)), (sp + getRandom(sp_rnd)));
- });
- }
-
- // Check Instance Quests.
- instance.getPlayers().forEach(player ->
- {
- switch (instance.getTemplateId())
- {
- case TEMPLATE_ID_SOLO_85:
+ switch (instance.getTemplateId())
{
- final QuestState qs = player.getQuestState(Q00497_IncarnationOfGreedZellakaSolo.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ case TEMPLATE_ID_SOLO_85:
{
- qs.setCond(2, true);
+ player.addExpAndSp(SOLO_BASE_EXP_85 + getRandom(SOLO_RAND_EXP_85), SOLO_BASE_SP_85 + getRandom(SOLO_RAND_SP_85));
+ break;
}
- break;
- }
- case TEMPLATE_ID_SOLO_90:
- {
- final QuestState qs = player.getQuestState(Q00498_IncarnationOfJealousyPellineSolo.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ case TEMPLATE_ID_SOLO_90:
{
- qs.setCond(2, true);
+ player.addExpAndSp(SOLO_BASE_EXP_90 + getRandom(SOLO_RAND_EXP_90), SOLO_BASE_SP_90 + getRandom(SOLO_RAND_SP_90));
+ break;
}
- break;
- }
- case TEMPLATE_ID_SOLO_95:
- {
- final QuestState qs = player.getQuestState(Q00499_IncarnationOfGluttonyKaliosSolo.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ case TEMPLATE_ID_SOLO_95:
{
- qs.setCond(2, true);
+ player.addExpAndSp(SOLO_BASE_EXP_95 + getRandom(SOLO_RAND_EXP_95), SOLO_BASE_SP_95 + getRandom(SOLO_RAND_SP_95));
+ break;
}
- break;
- }
- case TEMPLATE_ID_GROUP_85:
- {
- final QuestState qs = player.getQuestState(Q00494_IncarnationOfGreedZellakaGroup.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
- {
- qs.setCond(2, true);
- }
- break;
- }
- case TEMPLATE_ID_GROUP_90:
- {
- final QuestState qs = player.getQuestState(Q00495_IncarnationOfJealousyPellineGroup.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
- {
- qs.setCond(2, true);
- }
- break;
- }
- case TEMPLATE_ID_GROUP_95:
- {
- final QuestState qs = player.getQuestState(Q00496_IncarnationOfGluttonyKaliosGroup.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
- {
- qs.setCond(2, true);
- }
- break;
}
}
- });
-
+ }
instance.finishInstance();
}
}
@@ -475,8 +479,6 @@ public final class KartiasLabyrinth extends AbstractInstance
instance.setParameter("BOSS_CAN_ESCAPE", false);
npc.setScriptValue(1);
npc.broadcastSay(ChatType.NPC_SHOUT, NpcStringId.NOT_BAD_FOR_A_BUNCH_OF_HUMANS_I_M_LEAVING);
- npc.disableCoreAI(true);
- addMoveToDesire(npc, instance.getTemplateParameters().getLocation("bossEscapeLoc1"), 23);
}
}
else
@@ -503,7 +505,6 @@ public final class KartiasLabyrinth extends AbstractInstance
final Instance instance = character.getInstanceWorld();
if ((instance != null) && character.isPlayer())
{
- // final L2PcInstance player = character.getActingPlayer();
switch (zone.getId())
{
case KARTIA_85_DETECT_1:
@@ -532,11 +533,6 @@ public final class KartiasLabyrinth extends AbstractInstance
}
break;
}
- /*
- * case KARTIA_85_TELEPORT_1: case KARTIA_90_TELEPORT_1: case KARTIA_95_TELEPORT_1: { if (instance.getParameters().getBoolean("TELEPORT_1_ENABLED", false)) { player.teleToLocation(instance.getTemplateParameters().getLocation("teleportZone1_loc")); } break; } case
- * KARTIA_85_TELEPORT_2: case KARTIA_90_TELEPORT_2: case KARTIA_95_TELEPORT_2: { if (instance.getParameters().getBoolean("TELEPORT_2_ENABLED", false)) { player.teleToLocation(instance.getTemplateParameters().getLocation("teleportZone2_loc")); } break; } case KARTIA_85_TELEPORT_3:
- * case KARTIA_90_TELEPORT_3: case KARTIA_95_TELEPORT_3: { if (instance.getParameters().getBoolean("TELEPORT_3_ENABLED", false)) { player.teleToLocation(instance.getTemplateParameters().getLocation("teleportZone3_loc")); } break; }
- */
}
}
return super.onEnterZone(character, zone);
@@ -546,31 +542,15 @@ public final class KartiasLabyrinth extends AbstractInstance
public void onMoveFinished(L2Npc npc)
{
final Instance instance = npc.getInstanceWorld();
- if (instance != null)
+ if ((instance != null) && CommonUtil.contains(PRISONERS, npc.getId()))
{
- if (CommonUtil.contains(PRISONERS, npc.getId()))
+ if (npc.isScriptValue(0))
{
- if (npc.isScriptValue(0))
- {
- npc.setScriptValue(1);
- final Location moveTo = new Location(npc.getX() + getRandom(-500, 500), npc.getY() + getRandom(-500, 500), npc.getZ());
- addMoveToDesire(npc, moveTo, 23);
- }
- else
- {
- npc.deleteMe();
- }
+ final Location moveTo = new Location(npc.getX() + getRandom(-200, 200), npc.getY() + getRandom(-200, 200), npc.getZ());
+ addMoveToDesire(npc, moveTo, 23);
}
- else if (npc.isScriptValue(1))
+ else
{
- npc.setScriptValue(2);
- addMoveToDesire(npc, instance.getTemplateParameters().getLocation("bossEscapeLoc2"), 23);
- }
- else if (npc.isScriptValue(2))
- {
- instance.setParameter("MINIBOSS_SURVIVED", true);
- instance.openCloseDoor(instance.getTemplateParameters().getInt("thirdDoorId"), true);
- instance.setStatus(3); // Used for notify helper's AI
npc.deleteMe();
}
}
@@ -585,7 +565,7 @@ public final class KartiasLabyrinth extends AbstractInstance
{
final Location moveTo = new Location(npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ());
npc.setRandomWalking(true);
- addMoveToDesire(npc, moveTo, 0);
+ addMoveToDesire(npc, moveTo, 6);
}
}
@@ -608,6 +588,11 @@ public final class KartiasLabyrinth extends AbstractInstance
npc.setTargetable(false);
npc.setIsInvul(true);
}
+ else if (CommonUtil.contains(MONSTERS, npc.getId()) || CommonUtil.contains(MINI_BOSSES, npc.getId()))
+ {
+ npc.setTargetable(false);
+ npc.setIsInvul(true);
+ }
}
return super.onSpawn(npc);
}
@@ -632,14 +617,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE1_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE1_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -662,14 +649,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE2_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE2_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -692,14 +681,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE3_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE3_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -744,7 +735,7 @@ public final class KartiasLabyrinth extends AbstractInstance
}
break;
}
- case 4:
+ case 4: // Only used in group version of instance.
{
switch (wave)
{
@@ -753,14 +744,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE4_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE4_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -774,7 +767,7 @@ public final class KartiasLabyrinth extends AbstractInstance
}
break;
}
- case 5:
+ case 5: // Only used in group version of instance.
{
switch (wave)
{
@@ -783,7 +776,8 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE5_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
@@ -815,8 +809,7 @@ public final class KartiasLabyrinth extends AbstractInstance
}
else if (room == 2)
{
- instance.getParameters().set("TELEPORT_1_ENABLED", false);
- instance.setParameter("BOSS_CAN_ESCAPE", true);
+ instance.setParameter("BOSS_CAN_ESCAPE", false);
instance.setParameter("BOSS_KILL_OPEN_DOOR", true);
instance.spawnGroup("ROOM2_STAGE1_WAVE1");
instance.openCloseDoor(instance.getTemplateParameters().getInt("secondDoorId"), true);
@@ -909,24 +902,23 @@ public final class KartiasLabyrinth extends AbstractInstance
private void moveMonsters(List monsterList)
{
int delay = 500;
- for (L2Npc npc : monsterList)
+ for (L2Npc monster : monsterList)
{
- final Instance world = npc.getInstanceWorld();
- if (npc.isAttackable() && (world != null))
+ final Instance world = monster.getInstanceWorld();
+ if (monster.isAttackable() && (world != null))
{
if (world.getParameters().getInt("ROOM", 1) <= 2)
{
- npc.setRandomWalking(false);
- npc.setTargetable(false);
- getTimers().addTimer("MOVE_TO_MIDDLE", delay, npc, null);
+ monster.setRandomWalking(false);
+ getTimers().addTimer("MOVE_TO_MIDDLE", delay, monster, null);
delay += 250;
}
else if (world.getParameters().getInt("ROOM", 1) == 3)
{
- onTimerEvent("MOVE_TO_MIDDLE", null, npc, null);
+ onTimerEvent("MOVE_TO_MIDDLE", null, monster, null);
}
- ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
- npc.initSeenCreatures();
+ ((L2Attackable) monster).setCanReturnToSpawnPoint(false);
+ monster.initSeenCreatures();
}
}
}
@@ -937,10 +929,19 @@ public final class KartiasLabyrinth extends AbstractInstance
final L2Npc npc = (L2Npc) event.getSeer();
final Instance world = npc.getInstanceWorld();
- if ((world != null) && creature.isPlayer() && npc.isScriptValue(0))
+ if ((world != null) && (creature.isPlayer() || creature.getInstanceType().isType(InstanceType.FriendlyNpcInstance)) && npc.isScriptValue(0))
{
- npc.setScriptValue(1);
- addAttackDesire(npc, creature);
+ final double distance = npc.calculateDistance(creature, false, false);
+ if ((distance < 450) && !CommonUtil.contains(PRISONERS, creature.getId()))
+ {
+ npc.setTargetable(true);
+ npc.setIsInvul(false);
+ npc.setScriptValue(1);
+ WalkingManager.getInstance().cancelMoving(npc);
+ ((L2MonsterInstance) npc).addDamageHate(creature, 0, 1000);
+ npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
+ addAttackDesire(npc, creature);
+ }
}
}
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java
index 58760f2b2f..8b41bab529 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java
@@ -33,6 +33,8 @@ public class Q00494_IncarnationOfGreedZellakaGroup extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_KEEPER_BLUE_BOX = 34927;
+ // Boss
+ private static final int BOSS = 25882; // Zellaka (Group 85)
// Misc
private static final int MIN_LEVEL = 85;
private static final int MAX_LEVEL = 89;
@@ -42,6 +44,7 @@ public class Q00494_IncarnationOfGreedZellakaGroup extends Quest
super(494);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,21 @@ public class Q00494_IncarnationOfGreedZellakaGroup extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ executeForEachPlayer(player, npc, isSummon, true, false);
+ return super.onKill(npc, player, isSummon);
+ }
+
+ @Override
+ public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java
index e8ab074857..3ea2f7da89 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java
@@ -33,6 +33,8 @@ public class Q00495_IncarnationOfJealousyPellineGroup extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_KEEPER_RED_BOX = 34928;
+ // Boss
+ private static final int BOSS = 25883; // Pelline (Group 90)
// Misc
private static final int MIN_LEVEL = 90;
private static final int MAX_LEVEL = 94;
@@ -42,6 +44,7 @@ public class Q00495_IncarnationOfJealousyPellineGroup extends Quest
super(495);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,21 @@ public class Q00495_IncarnationOfJealousyPellineGroup extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ executeForEachPlayer(player, npc, isSummon, true, false);
+ return super.onKill(npc, player, isSummon);
+ }
+
+ @Override
+ public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java
index 89a9d09a7a..e7a6258abf 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java
@@ -33,6 +33,8 @@ public class Q00496_IncarnationOfGluttonyKaliosGroup extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_KEEPER_GOLDEN_BOX = 34929;
+ // Boss
+ private static final int BOSS = 25884; // Kalios (Group 95)
// Misc
private static final int MIN_LEVEL = 95;
private static final int MAX_LEVEL = 99;
@@ -42,6 +44,7 @@ public class Q00496_IncarnationOfGluttonyKaliosGroup extends Quest
super(496);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,21 @@ public class Q00496_IncarnationOfGluttonyKaliosGroup extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ executeForEachPlayer(player, npc, isSummon, true, false);
+ return super.onKill(npc, player, isSummon);
+ }
+
+ @Override
+ public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java
index 9905030179..6e089781b2 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java
@@ -33,6 +33,8 @@ public class Q00497_IncarnationOfGreedZellakaSolo extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_TRAVELERS_BLUE_BOX = 34930;
+ // Boss
+ private static final int BOSS = 19253; // Zellaka (Solo 85)
// Misc
private static final int MIN_LEVEL = 85;
private static final int MAX_LEVEL = 89;
@@ -42,6 +44,7 @@ public class Q00497_IncarnationOfGreedZellakaSolo extends Quest
super(497);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,15 @@ public class Q00497_IncarnationOfGreedZellakaSolo extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ return super.onKill(npc, player, isSummon);
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java
index cab1faa0cd..ce0d861ab5 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java
@@ -33,6 +33,8 @@ public class Q00498_IncarnationOfJealousyPellineSolo extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_TRAVELERS_RED_BOX = 34931;
+ // Boss
+ private static final int BOSS = 19254; // Pelline (Solo 90)
// Misc
private static final int MIN_LEVEL = 90;
private static final int MAX_LEVEL = 94;
@@ -42,6 +44,7 @@ public class Q00498_IncarnationOfJealousyPellineSolo extends Quest
super(498);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,15 @@ public class Q00498_IncarnationOfJealousyPellineSolo extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ return super.onKill(npc, player, isSummon);
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java
index d0f4108998..9ab232f31a 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java
@@ -33,6 +33,8 @@ public class Q00499_IncarnationOfGluttonyKaliosSolo extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_TRAVELERS_GOLDEN_BOX = 34932;
+ // Boss
+ private static final int BOSS = 19255; // Kalios (Solo 95)
// Misc
private static final int MIN_LEVEL = 95;
private static final int MAX_LEVEL = 99;
@@ -42,6 +44,7 @@ public class Q00499_IncarnationOfGluttonyKaliosSolo extends Quest
super(499);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,15 @@ public class Q00499_IncarnationOfGluttonyKaliosSolo extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ return super.onKill(npc, player, isSummon);
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/19200-19299.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/19200-19299.xml
index 0b3b016e06..b6944db973 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/19200-19299.xml
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/19200-19299.xml
@@ -625,7 +625,7 @@
-
+
UNDEAD
@@ -1999,7 +1999,7 @@
DEMONIC
MALE
-
+
@@ -2044,7 +2044,7 @@
DEMONIC
MALE
-
+
@@ -2091,7 +2091,7 @@
DEMONIC
MALE
-
+
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/25800-25899.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/25800-25899.xml
index ebbda2edd5..2bd90ec5ab 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/25800-25899.xml
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/25800-25899.xml
@@ -10,7 +10,7 @@
-
+
@@ -3556,7 +3556,7 @@
-
+
@@ -3605,10 +3605,10 @@
DEMONIC
MALE
-
+
-
+
@@ -3715,10 +3715,10 @@
DEMONIC
MALE
-
+
-
+
@@ -3827,10 +3827,10 @@
DEMONIC
MALE
-
+
-
+
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/14800-14899.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/14800-14899.xml
index edfa9194a0..e90acdeff7 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/14800-14899.xml
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/14800-14899.xml
@@ -1090,7 +1090,7 @@
icon.skill10016
- A2
+ A1
600
500
1000
@@ -1112,8 +1112,7 @@
10-10
true
ENEMY
- RANGE
- NOT_FRIEND
+ SINGLE
600
@@ -1128,7 +1127,7 @@
icon.skill10016
- A2
+ A1
600
500
1000
@@ -1150,8 +1149,7 @@
10-10
true
ENEMY
- RANGE
- NOT_FRIEND
+ SINGLE
600
@@ -1166,7 +1164,7 @@
icon.skill10016
- A2
+ A1
600
500
1000
@@ -1188,8 +1186,7 @@
10-10
true
ENEMY
- RANGE
- NOT_FRIEND
+ SINGLE
600
@@ -1351,7 +1348,7 @@
0;0;150;180
STUN
true
- SELF
+ ENEMY
SINGLE
@@ -1387,7 +1384,7 @@
0;0;150;180
STUN
true
- SELF
+ ENEMY
SINGLE
@@ -1423,7 +1420,7 @@
0;0;150;180
STUN
true
- SELF
+ ENEMY
SINGLE
@@ -2709,7 +2706,6 @@
true
TARGET
SINGLE
- NOT_FRIEND
@@ -2738,7 +2734,6 @@
true
TARGET
SINGLE
- NOT_FRIEND
@@ -2767,7 +2762,6 @@
true
TARGET
SINGLE
- NOT_FRIEND
@@ -2925,11 +2919,6 @@
TARGET
RANGE
FRIEND
-
-
- 40
-
-
@@ -2950,8 +2939,8 @@
TARGET
SINGLE
-
- 1488
+
+ 20
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/Util.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/Util.java
index 850ae469e6..0508148f16 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/Util.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/Util.java
@@ -29,11 +29,13 @@ import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Date;
+import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
-import java.util.TreeMap;
import java.util.logging.Logger;
+import java.util.stream.Collectors;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.Rnd;
@@ -791,14 +793,24 @@ public final class Util
}
/**
- * Short an map by its integer values.
- * @param unsortedMap
- * @return
+ * This will sort a Map according to the values. Default sort direction is ascending.
+ * @param keyType
+ * @param valueType
+ * @param map Map to be sorted.
+ * @param descending If you want to sort descending.
+ * @return A new Map sorted by the values.
*/
- public static Map sortByValue(Map unsortedMap)
+ public static > Map sortByValue(Map map, boolean descending)
{
- Map sortedMap = new TreeMap<>(new ValueComparator(unsortedMap));
- sortedMap.putAll(unsortedMap);
- return sortedMap;
+ if (descending)
+ {
+ return map.entrySet().stream().sorted(Map.Entry.comparingByValue(Collections.reverseOrder())).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
+ }
+ return map.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
+ }
+
+ public static > Map sortByValue(Map map)
+ {
+ return map.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
}
}
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/ValueComparator.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/ValueComparator.java
deleted file mode 100644
index 32c494218d..0000000000
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/ValueComparator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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 .
- */
-package com.l2jmobius.gameserver.util;
-
-import java.util.Comparator;
-import java.util.Map;
-
-/**
- * @author Mobius
- */
-public class ValueComparator implements Comparator
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml b/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml
index 79319c9ba7..81d3df75c8 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml
@@ -12,8 +12,12 @@
-
-
+
+
+
+
+
+
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml b/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml
index 8e5d962638..afc416a820 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml
@@ -12,45 +12,48 @@
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
@@ -95,6 +98,11 @@
+
+
+
+
+
@@ -115,7 +123,6 @@
-
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml b/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml
index 10fdc99062..cc2bdd0cd9 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml
@@ -12,8 +12,12 @@
-
-
+
+
+
+
+
+
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml b/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml
index c469b93c64..fbb2cac4e8 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml
@@ -16,22 +16,37 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -41,16 +56,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -95,6 +100,11 @@
+
+
+
+
+
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml b/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml
index d04fc781ee..26f843c0b8 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml
@@ -12,8 +12,12 @@
-
-
+
+
+
+
+
+
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml b/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml
index a8235c88d7..4a4b8d99a4 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml
@@ -17,21 +17,36 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -41,16 +56,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -94,6 +99,11 @@
+
+
+
+
+
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/33647-9.htm b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/33647-9.htm
new file mode 100644
index 0000000000..f72bd6b6d6
--- /dev/null
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/33647-9.htm
@@ -0,0 +1,5 @@
+Kartia Researcher:
+Don't waste my time! I'm a researcher sent directly by the Kingdom of Aden after all.
+You must have the quest started in order to enter the labyrinth.
+
+
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java
index 0f7156ae8b..5ef95e7b46 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java
@@ -28,7 +28,7 @@ import ai.AbstractNpcAI;
/**
* Kartia Boss AI.
- * @author St3eT
+ * @author flanagak
*/
public final class KartiaBoss extends AbstractNpcAI
{
@@ -139,8 +139,8 @@ public final class KartiaBoss extends AbstractNpcAI
{
for (int i = 0; i < 3; i++)
{
- addSpawn(fighter, npc, false, 0, false, npc.getInstanceId());
- addSpawn(mage, npc, false, 0, false, npc.getInstanceId());
+ addSpawn(fighter, npc, true, 0, false, npc.getInstanceId());
+ addSpawn(mage, npc, true, 0, false, npc.getInstanceId());
}
}
}
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java
index fe268f6cd0..63766759cc 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java
@@ -33,16 +33,14 @@ import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.instancezone.Instance;
-import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.skills.SkillCaster;
import com.l2jmobius.gameserver.network.NpcStringId;
-import com.l2jmobius.gameserver.util.Util;
import ai.AbstractNpcAI;
/**
* Kartia Helper Adolph AI.
- * @author St3eT
+ * @author flanagak
*/
public final class KartiaHelperAdolph extends AbstractNpcAI
{
@@ -59,6 +57,27 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
33799, // Life Plunderer (90)
33800, // Life Plunderer (95)
};
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -82,114 +101,161 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
final Instance instance = npc.getInstanceWorld();
if ((instance != null) && event.equals("CHECK_ACTION"))
{
- final StatsSet instParams = instance.getTemplateParameters();
- boolean actionFound = false;
-
- if (!npc.isInCombat() || !npc.isAttackingNow() || (npc.getTarget() == null))
+ final StatsSet npcVars = npc.getVariables();
+ player = npcVars.getObject("PLAYER_OBJECT", L2PcInstance.class);
+ if (player != null)
{
- final List monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 500);
- if (!monsterList.isEmpty())
+ final double distance = npc.calculateDistance(player, false, false);
+ if (distance > 300)
{
- final L2MonsterInstance monster = monsterList.get(getRandom(monsterList.size()));
-
- if (monster.isTargetable() && GeoEngine.getInstance().canSeeTarget(npc, monster) && !CommonUtil.contains(MIRRORS, monster.getId()))
+ final Location loc = new Location(player.getX(), player.getY(), player.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
{
- actionFound = true;
- addAttackDesire(npc, monster);
+ npc.teleToLocation(loc);
}
- }
- }
-
- if (!actionFound)
- {
- final SkillHolder hateSkill = instParams.getSkillHolder("adolphHate");
- if (npc.isInCombat() && (hateSkill != null) && SkillCaster.checkUseConditions(npc, hateSkill.getSkill()))
- {
- addSkillCastDesire(npc, npc.getTarget(), hateSkill, 23);
- }
- else
- {
- final L2PcInstance instancePlayer = npc.getVariables().getObject("PLAYER_OBJECT", L2PcInstance.class);
- if (instancePlayer != null)
+ else
{
- final double radian = Math.toRadians(Util.convertHeadingToDegree(instancePlayer.getHeading()));
- final int X = (int) (instancePlayer.getX() + (Math.cos(radian) * 150));
- final int Y = (int) (instancePlayer.getY() + (Math.sin(radian) * 150));
- final Location loc = GeoEngine.getInstance().canMoveToTargetLoc(instancePlayer.getX(), instancePlayer.getY(), instancePlayer.getZ(), X, Y, instancePlayer.getZ(), instance);
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final List monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 500);
+ if (!monsterList.isEmpty())
+ {
+ final L2MonsterInstance monster = monsterList.get(getRandom(monsterList.size()));
- if (!npc.isInsideRadius(loc, 50, true, true))
+ if (monster.isTargetable() && GeoEngine.getInstance().canSeeTarget(npc, monster) && !CommonUtil.contains(MIRRORS, monster.getId()) && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
{
- npc.setRunning();
- addMoveToDesire(npc, loc, 23);
+ addAttackDesire(npc, monster);
}
}
}
}
}
- }
-
- @Override
- public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill)
- {
- final Instance instance = npc.getInstanceWorld();
- if (instance != null)
+ else if ((instance != null) && event.equals("USE_SKILL"))
{
- final StatsSet instParams = instance.getTemplateParameters();
- final SkillHolder hateSkill = instParams.getSkillHolder("adolphHate");
- final SkillHolder shieldSkill = instParams.getSkillHolder("adolphShield");
- final SkillHolder punishSkill = instParams.getSkillHolder("adolphPunish");
-
- if ((hateSkill != null) && (skill.getId() == hateSkill.getSkillId()))
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
{
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_FILTHY_MONSTERS_I_WILL_TAKE_YOU_ON);
- }
- else if ((shieldSkill != null) && (skill.getId() == shieldSkill.getSkillId()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.STOP_RIGHT_THERE_I_WILL_BE_YOUR_OPPONENT);
- }
- else if ((punishSkill != null) && (skill.getId() == punishSkill.getSkillId()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
+ }
+
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("adolphHate");
+ final SkillHolder skill_02 = instParams.getSkillHolder("adolphPunish");
+ final SkillHolder skill_03 = instParams.getSkillHolder("adolphShield");
+ final SkillHolder skill_04 = instParams.getSkillHolder("adolphAggression");
+ final SkillHolder skill_05 = instParams.getSkillHolder("adolphChainHydra");
+ final SkillHolder lowHpSkill = instParams.getSkillHolder("adolphUltimate");
+ final int numberOfActiveSkills = 5;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ if ((lowHpSkill != null) && (npc.getCurrentHpPercent() < 50))
+ {
+ // NPC has low HP Skill and HP is < 50% HP
+ if (!npc.isAffectedBySkill(lowHpSkill.getSkillId()) && (SkillCaster.checkUseConditions(npc, lowHpSkill.getSkill())))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IT_S_NOT_OVER);
+ npc.doCast(lowHpSkill.getSkill());
+ }
+ }
+ else
+ {
+ switch (randomSkill)
+ {
+ case 0:
+ case 1:
+ {
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ final List monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 300);
+ if (!monsterList.isEmpty())
+ {
+ for (L2MonsterInstance monster : monsterList)
+ {
+ if (monster.isTargetable() && GeoEngine.getInstance().canSeeTarget(npc, monster) && !CommonUtil.contains(MIRRORS, monster.getId()) && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ monster.addDamageHate(npc, 100, 10000);
+ }
+ }
+ }
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 3:
+ {
+ if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
+ npc.doCast(skill_03.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 4:
+ {
+ if ((skill_04 != null) && SkillCaster.checkUseConditions(npc, skill_04.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_BE_DESTROYED);
+ npc.doCast(skill_04.getSkill());
+ }
+ break;
+ }
+ case 5:
+ {
+ if ((skill_05 != null) && SkillCaster.checkUseConditions(npc, skill_05.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_DIE);
+ npc.doCast(skill_05.getSkill(), null, true, false);
+ }
+ break;
+ }
+ }
}
}
- return super.onSpellFinished(npc, player, skill);
}
public void onCreatureAttacked(OnCreatureAttacked event)
{
final L2Npc npc = (L2Npc) event.getTarget();
- final Instance instance = npc.getInstanceWorld();
- if ((instance != null) && !event.getAttacker().isPlayable())
+ if (npc != null)
{
- final StatsSet instParams = instance.getTemplateParameters();
- final int random = getRandom(1000);
-
- if (random < 333)
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
{
- final SkillHolder shieldSkill = instParams.getSkillHolder("adolphShield");
- if ((shieldSkill != null) && SkillCaster.checkUseConditions(npc, shieldSkill.getSkill()))
+ if (!npc.isInCombat())
{
- addSkillCastDesire(npc, npc.getTarget(), shieldSkill, 23);
- }
- }
- else if (random < 666)
- {
- final SkillHolder punishSkill = instParams.getSkillHolder("adolphPunish");
- if ((punishSkill != null) && SkillCaster.checkUseConditions(npc, punishSkill.getSkill()))
- {
- addSkillCastDesire(npc, npc.getTarget(), punishSkill, 23);
- }
- }
-
- if ((npc.getCurrentHpPercent() < 30) && npc.isScriptValue(0))
- {
- final SkillHolder ultimateSkill = instParams.getSkillHolder("adolphUltimate");
- if ((ultimateSkill != null) && !npc.isAffectedBySkill(ultimateSkill.getSkillId()) && SkillCaster.checkUseConditions(npc, ultimateSkill.getSkill()))
- {
- npc.setScriptValue(1);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IT_S_NOT_OVER);
- addSkillCastDesire(npc, npc.getTarget(), ultimateSkill, 23);
- getTimers().addTimer("RESTORE_SCRIPTVAL", 10000, n -> npc.setScriptValue(0));
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder hateSkill = instParams.getSkillHolder("adolphHate");
+ if ((hateSkill != null) && SkillCaster.checkUseConditions(npc, hateSkill.getSkill()))
+ {
+ npc.doCast(hateSkill.getSkill(), null, true, false);
+ }
}
}
}
@@ -210,23 +276,10 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
- {
- instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, adolph, null));
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("adolphTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> adolph.teleToLocation(loc));
- }
- break;
- }
+ instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, adolph, null));
+ instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> getTimers().addRepeatingTimer("USE_SKILL", 6000, adolph, null));
}
}
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java
index 374348ece8..9ad2b19e13 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java
@@ -35,8 +35,8 @@ import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Barton AI.
- * @author St3eT
+ * Kartia Helper Barton AI. Tyrr Warrior
+ * @author flanagak
*/
public final class KartiaHelperBarton extends AbstractNpcAI
{
@@ -53,6 +53,27 @@ public final class KartiaHelperBarton extends AbstractNpcAI
33620, // Adolph (Kartia 90)
33631, // Adolph (Kartia 95)
};
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -79,52 +100,50 @@ public final class KartiaHelperBarton extends AbstractNpcAI
if (adolph != null)
{
final double distance = npc.calculateDistance(adolph, false, false);
- if (distance > 200)
+ if (distance > 300)
{
- final Location loc = new Location(adolph.getX() + getRandom(-100, 100), adolph.getY() + getRandom(-100, 100), adolph.getZ() + 50);
- if (distance > 500)
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
{
npc.teleToLocation(loc);
}
else
{
npc.setRunning();
- addMoveToDesire(npc, loc, 23);
}
+ addMoveToDesire(npc, randLoc, 23);
}
- else if (!npc.isInCombat() || !npc.isAttackingNow() || (npc.getTarget() == null))
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
{
final L2Character monster = (L2Character) adolph.getTarget();
- if ((monster != null) && adolph.isInCombat())
+ if ((monster != null) && adolph.isInCombat() && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
{
addAttackDesire(npc, monster);
}
}
}
}
+ else if ((instance != null) && event.equals("USE_SKILL"))
+ {
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
+ {
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
}
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
- {
- instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, barton, null));
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("bartonTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> barton.teleToLocation(loc));
- }
- break;
- }
+ instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, barton, null));
+ instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> getTimers().addRepeatingTimer("USE_SKILL", 6000, barton, null));
}
}
@@ -142,33 +161,83 @@ public final class KartiaHelperBarton extends AbstractNpcAI
return super.onSeeCreature(npc, creature, isSummon);
}
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("bartonInfinity");
+ final SkillHolder skill_02 = instParams.getSkillHolder("bartonBerserker");
+ final SkillHolder skill_03 = instParams.getSkillHolder("bartonHurricane");
+ final SkillHolder skill_04 = instParams.getSkillHolder("bartonPowerBomber");
+ final SkillHolder skill_05 = instParams.getSkillHolder("bartonSonicStar");
+ final int numberOfActiveSkills = 5;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ switch (randomSkill)
+ {
+ case 0:
+ case 1:
+ {
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 3:
+ {
+ if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
+ npc.doCast(skill_03.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 4:
+ {
+ if ((skill_04 != null) && SkillCaster.checkUseConditions(npc, skill_04.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_BE_DESTROYED);
+ npc.doCast(skill_04.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 5:
+ {
+ if ((skill_05 != null) && SkillCaster.checkUseConditions(npc, skill_05.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_DIE);
+ npc.doCast(skill_05.getSkill(), null, true, false);
+ }
+ break;
+ }
+ }
+ }
+ }
+
public void onCreatureAttacked(OnCreatureAttacked event)
{
final L2Npc npc = (L2Npc) event.getTarget();
- final Instance instance = npc.getInstanceWorld();
- if ((instance != null) && !event.getAttacker().isPlayable())
+ if (npc != null)
{
- final StatsSet instParams = instance.getTemplateParameters();
- final int random = getRandom(1000);
-
- if (random < 333)
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !npc.isInCombat() && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
{
- final SkillHolder infinitySkill = instParams.getSkillHolder("bartonInfinity");
- if ((infinitySkill != null) && SkillCaster.checkUseConditions(npc, infinitySkill.getSkill()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
- addSkillCastDesire(npc, npc.getTarget(), infinitySkill, 23);
- }
- }
- else if ((npc.getCurrentHpPercent() < 50) && npc.isScriptValue(0))
- {
- final SkillHolder berserkerSkill = instParams.getSkillHolder("bartonBerserker");
- if ((berserkerSkill != null) && !npc.isAffectedBySkill(berserkerSkill.getSkillId()) && SkillCaster.checkUseConditions(npc, berserkerSkill.getSkill()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAAAAAAAAHHHHHH);
- addSkillCastDesire(npc, npc.getTarget(), berserkerSkill, 23);
- getTimers().addTimer("RESTORE_SCRIPTVAL", 10000, n -> npc.setScriptValue(0));
- }
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
}
}
}
@@ -180,6 +249,7 @@ public final class KartiaHelperBarton extends AbstractNpcAI
if (world != null)
{
getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
}
}
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java
index a667ca8510..f1d14df41b 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java
@@ -16,8 +16,15 @@
*/
package instances.KartiasLabyrinth;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.enums.InstanceType;
+import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
@@ -34,8 +41,8 @@ import com.l2jmobius.gameserver.util.Util;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Elise AI.
- * @author St3eT
+ * Kartia Helper Elise AI. Healer
+ * @author flanagak
*/
public final class KartiaHelperElise extends AbstractNpcAI
{
@@ -70,9 +77,27 @@ public final class KartiaHelperElise extends AbstractNpcAI
33624, // Hayuk (Kartia 90)
33635, // Hayuk (Kartia 95)
};
- private static final int HEALING_TREE = 19256;
- // Skill
- private static final SkillHolder TREE_HEAL_SKILL = new SkillHolder(15003, 1); // Summon Tree of Life - NPC
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -95,167 +120,124 @@ public final class KartiaHelperElise extends AbstractNpcAI
if ((instance != null) && event.equals("CHECK_ACTION"))
{
final StatsSet npcVars = npc.getVariables();
- final StatsSet instParams = instance.getTemplateParameters();
-
- player = npcVars.getObject("PLAYER_OBJECT", L2PcInstance.class);
final FriendlyNpcInstance adolph = npcVars.getObject("ADOLPH_OBJECT", FriendlyNpcInstance.class);
- final FriendlyNpcInstance barton = npcVars.getObject("BARTON_OBJECT", FriendlyNpcInstance.class);
- final FriendlyNpcInstance eliyah = npcVars.getObject("ELIYAH_OBJECT", FriendlyNpcInstance.class);
- final FriendlyNpcInstance hayuk = npcVars.getObject("HAYUK_OBJECT", FriendlyNpcInstance.class);
-
- if ((player != null) && !player.isDead() && ((player.getCurrentHpPercent() < 75) || (player.getCurrentMpPercent() < 30)))
+ if (!npc.isCastingNow())
{
- final int hpPer = player.getCurrentHpPercent();
- if ((hpPer < 40) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, player);
- }
- else if (hpPer < 60)
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, player, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- else if (hpPer < 75)
- {
- final SkillHolder healSkill = instParams.getSkillHolder("eliseHeal");
- if (healSkill != null)
- {
- addSkillCastDesire(npc, player, healSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- else if (player.getCurrentMpPercent() < 30)
- {
- final SkillHolder rechargeSkill = instParams.getSkillHolder("eliseRecharge");
- if (rechargeSkill != null)
- {
- addSkillCastDesire(npc, player, rechargeSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.MEN_FOCUS_CHARGING_COMPLETE);
- }
- }
+ healFriends(npc, player);
}
- else if ((adolph != null) && !adolph.isDead() && (adolph.getCurrentHpPercent() < 75))
- {
- final int hpPer = adolph.getCurrentHpPercent();
- if ((hpPer < 40) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, adolph);
- }
- else if (hpPer < 60)
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, adolph, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- else
- {
- final SkillHolder healSkill = instParams.getSkillHolder("eliseHeal");
- if (healSkill != null)
- {
- addSkillCastDesire(npc, adolph, healSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if ((barton != null) && !barton.isDead() && (barton.getCurrentHpPercent() < 60))
- {
- final int hpPer = barton.getCurrentHpPercent();
- if ((hpPer < 30) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, barton);
- }
- else
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, barton, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if ((eliyah != null) && !eliyah.isDead() && (eliyah.getCurrentHpPercent() < 60))
- {
- final int hpPer = eliyah.getCurrentHpPercent();
- if ((hpPer < 30) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, eliyah);
- }
- else
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, eliyah, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if ((hayuk != null) && !hayuk.isDead() && (hayuk.getCurrentHpPercent() < 60))
- {
- final int hpPer = hayuk.getCurrentHpPercent();
- if ((hpPer < 30) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, hayuk);
- }
- else
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, hayuk, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if (adolph != null)
+ if (adolph != null)
{
final double distance = npc.calculateDistance(adolph, false, false);
- if (distance > 200)
+ if (distance > 300)
{
- final Location loc = new Location(adolph.getX() + getRandom(-100, 100), adolph.getY() + getRandom(-100, 100), adolph.getZ() + 50);
- if (distance > 500)
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
{
npc.teleToLocation(loc);
}
else
{
npc.setRunning();
- addMoveToDesire(npc, loc, 23);
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ }
+ npc.setTarget(npc);
+ }
+ }
+
+ private void healFriends(L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if (instance != null)
+ {
+ final StatsSet npcVars = npc.getVariables();
+ final StatsSet instParams = instance.getTemplateParameters();
+ if (!npc.isCastingNow())
+ {
+ player = npcVars.getObject("PLAYER_OBJECT", L2PcInstance.class);
+ final SkillHolder progressiveHeal = instParams.getSkillHolder("eliseProgressiveHeal"); // AOE heal
+ final SkillHolder radiantHeal = instParams.getSkillHolder("eliseRadiantHeal"); // Single target heal
+ final SkillHolder recharge = instParams.getSkillHolder("eliseRecharge");
+
+ // Get HP percentage for all friends
+ final Map hpMap = new HashMap<>();
+ instance.getAliveNpcs(KARTIA_FRIENDS).forEach(friend -> hpMap.put(friend, friend != null ? friend.getCurrentHpPercent() : 100));
+ hpMap.put(player, player != null ? player.getCurrentHpPercent() : 100);
+ Map sortedHpMap = new HashMap<>();
+ sortedHpMap = Util.sortByValue(hpMap, false);
+
+ // See if any friends are below 80% HP and add to list of people to heal.
+ final List peopleToHeal = new ArrayList<>();
+ for (L2Object friend : sortedHpMap.keySet())
+ {
+ if ((friend != null) && (sortedHpMap.get(friend) < 80) && (sortedHpMap.get(friend) > 1))
+ {
+ peopleToHeal.add(friend);
+ }
+ }
+
+ if (peopleToHeal.size() > 0)
+ {
+ // At least one friend was below 80% HP.
+ if (peopleToHeal.size() > 1)
+ {
+ // Helper NPC AOE skills affecting monsters so skill power has set to 0.
+ // Using skill is just for animation. Need to heal each NPC/Player manually.
+ npc.setTarget(npc);
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
+ npc.doCast(progressiveHeal.getSkill(), null, true, false);
+ npc.setTarget(npc);
+ for (L2Object personToHeal : peopleToHeal)
+ {
+ if (personToHeal.getInstanceType() == InstanceType.L2PcInstance)
+ {
+ L2PcInstance thePlayer = (L2PcInstance) personToHeal;
+ thePlayer.setCurrentHp((thePlayer.getMaxHp() * .20) + thePlayer.getCurrentHp());
+ }
+ else
+ {
+ L2Npc npcToHeal = (L2Npc) personToHeal;
+ npcToHeal.setCurrentHp((npcToHeal.getMaxHp() * .20) + npcToHeal.getCurrentHp());
+ }
+ }
+ }
+ else
+ {
+ // Only one person needs cure. Cast single target heal
+ for (L2Object personToHeal : peopleToHeal)
+ {
+ npc.setTarget(personToHeal);
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
+ npc.doCast(radiantHeal.getSkill(), null, true, false);
+ npc.setTarget(npc);
+ }
+ }
+ }
+ else
+ {
+ // No one needs healing. Check if player character needs recharge.
+ if ((player != null) && !player.isDead() && (player.getCurrentMpPercent() < 50))
+ {
+ npc.setTarget(player);
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ELECTRIFYING_RECHARGE);
+ npc.doCast(recharge.getSkill(), null, true, false);
+ npc.setTarget(npc);
}
}
}
}
+
}
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
- {
- instance.getAliveNpcs(KARTIA_ELISE).forEach(elise -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, elise, null));
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("eliseTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_ELISE).forEach(elise -> elise.teleToLocation(loc));
- }
- break;
- }
+ instance.getAliveNpcs(KARTIA_ELISE).forEach(elise -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, elise, null));
}
}
@@ -297,18 +279,10 @@ public final class KartiaHelperElise extends AbstractNpcAI
if (world != null)
{
getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
}
}
- private void summonHealingTree(L2Npc npc, L2Character target)
- {
- npc.getVariables().set("CAN_USE_TREE", false);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.COME_FORTH_TREE_OF_LIFE);
- final L2Npc tree = addSpawn(HEALING_TREE, Util.getRandomPosition(target, 20, 50), false, 0, false, npc.getInstanceId());
- getTimers().addTimer("TREE_REUSE", 10000, evnt -> npc.getVariables().set("CAN_USE_TREE", true));
- getTimers().addTimer("TREE_HEAL", 3000, evnt -> addSkillCastDesire(tree, target, TREE_HEAL_SKILL, 23));
- }
-
public static void main(String[] args)
{
new KartiaHelperElise();
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java
index 80d3710a94..0b64d51602 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java
@@ -16,15 +16,23 @@
*/
package instances.KartiasLabyrinth;
+import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.model.Location;
+import com.l2jmobius.gameserver.model.StatsSet;
+import com.l2jmobius.gameserver.model.actor.L2Character;
+import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.FriendlyNpcInstance;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureAttacked;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Eliyah AI.
- * @author St3eT
+ * Kartia Helper Eliyah AI. Summoner
+ * @author flanagak
*/
public final class KartiaHelperEliyah extends AbstractNpcAI
{
@@ -35,6 +43,33 @@ public final class KartiaHelperEliyah extends AbstractNpcAI
33626, // Eliyah (Kartia 90)
33637, // Eliyah (Kartia 95)
};
+ private static final int[] KARTIA_ADOLPH =
+ {
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ };
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -45,33 +80,101 @@ public final class KartiaHelperEliyah extends AbstractNpcAI
private KartiaHelperEliyah()
{
+ setCreatureKillId(this::onCreatureKill, KARTIA_ELIYAH);
+ setCreatureAttackedId(this::onCreatureAttacked, KARTIA_ELIYAH);
+ addSeeCreatureId(KARTIA_ELIYAH);
setInstanceStatusChangeId(this::onInstanceStatusChange, KARTIA_SOLO_INSTANCES);
}
+ @Override
+ public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && event.equals("CHECK_ACTION"))
+ {
+ final FriendlyNpcInstance adolph = npc.getVariables().getObject("ADOLPH_OBJECT", FriendlyNpcInstance.class);
+ if (adolph != null)
+ {
+ final double distance = npc.calculateDistance(adolph, false, false);
+ if (distance > 300)
+ {
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
+ {
+ npc.teleToLocation(loc);
+ }
+ else
+ {
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final L2Character monster = (L2Character) adolph.getTarget();
+ if ((monster != null) && adolph.isInCombat() && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ npc.setTarget(monster);
+ }
+ }
+ }
+ }
+ }
+
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
+ instance.getAliveNpcs(KARTIA_ELIYAH).forEach(eliyah -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, eliyah, null));
+ if ((instance.getAliveNpcs(KARTIA_ELIYAH) != null) && (instance.getAliveNpcs(KARTIA_ELIYAH).size() > 0))
{
- // Nothing for now
- break;
+ instance.spawnGroup("GUARDIANS");
}
- case 2:
- case 3:
+ }
+ }
+
+ @Override
+ public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
+ {
+ if (creature.isPlayer())
+ {
+ npc.getVariables().set("PLAYER_OBJECT", creature.getActingPlayer());
+ }
+ else if (CommonUtil.contains(KARTIA_ADOLPH, creature.getId()))
+ {
+ npc.getVariables().set("ADOLPH_OBJECT", creature);
+ }
+ return super.onSeeCreature(npc, creature, isSummon);
+ }
+
+ public void onCreatureAttacked(OnCreatureAttacked event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ if (npc != null)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
{
- final Location loc = instance.getTemplateParameters().getLocation("eliyahTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_ELIYAH).forEach(eliyah -> eliyah.teleToLocation(loc));
- }
- break;
+ npc.setTarget(event.getAttacker());
}
}
}
+ public void onCreatureKill(OnCreatureDeath event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ final Instance world = npc.getInstanceWorld();
+ if (world != null)
+ {
+ getTimers().cancelTimersOf(npc);
+ world.despawnGroup("GUARDIANS");
+ npc.doDie(event.getAttacker());
+ }
+ }
+
public static void main(String[] args)
{
new KartiaHelperEliyah();
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperGuardian.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperGuardian.java
new file mode 100644
index 0000000000..0cc90ab787
--- /dev/null
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperGuardian.java
@@ -0,0 +1,237 @@
+/*
+ * 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 .
+ */
+package instances.KartiasLabyrinth;
+
+import com.l2jmobius.commons.util.CommonUtil;
+import com.l2jmobius.gameserver.model.Location;
+import com.l2jmobius.gameserver.model.StatsSet;
+import com.l2jmobius.gameserver.model.actor.L2Character;
+import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.FriendlyNpcInstance;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureAttacked;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
+import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
+import com.l2jmobius.gameserver.model.holders.SkillHolder;
+import com.l2jmobius.gameserver.model.instancezone.Instance;
+import com.l2jmobius.gameserver.model.skills.SkillCaster;
+
+import ai.AbstractNpcAI;
+
+/**
+ * Kartia Helper Eliyah's Guardian Spirit
+ * @author flanagak *
+ */
+public final class KartiaHelperGuardian extends AbstractNpcAI
+{
+ // NPCs
+ private static final int[] KARTIA_ELIYAH =
+ {
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ };
+ private static final int[] KARTIA_ADOLPH =
+ {
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ };
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
+ private static final int[] KARTIA_GUARDIANS =
+ {
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
+ // Misc
+ private static final int[] KARTIA_SOLO_INSTANCES =
+ {
+ 205, // Solo 85
+ 206, // Solo 90
+ 207, // Solo 95
+ };
+
+ private KartiaHelperGuardian()
+ {
+ setCreatureKillId(this::onCreatureKill, KARTIA_GUARDIANS);
+ setCreatureAttackedId(this::onCreatureAttacked, KARTIA_GUARDIANS);
+ addSeeCreatureId(KARTIA_GUARDIANS);
+ setInstanceStatusChangeId(this::onInstanceStatusChange, KARTIA_SOLO_INSTANCES);
+ }
+
+ @Override
+ public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && event.equals("CHECK_ACTION"))
+ {
+ final FriendlyNpcInstance eliyah = npc.getVariables().getObject("ELIYAH_OBJECT", FriendlyNpcInstance.class);
+ if (eliyah != null)
+ {
+ final double distance = npc.calculateDistance(eliyah, false, false);
+ if (distance > 300)
+ {
+ final Location loc = new Location(eliyah.getX(), eliyah.getY(), eliyah.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-50, 50), loc.getY() + getRandom(-50, 50), loc.getZ());
+ if (distance > 600)
+ {
+ npc.teleToLocation(loc);
+ }
+ else
+ {
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final L2Character monster = (L2Character) eliyah.getTarget();
+ if ((monster != null) && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ addAttackDesire(npc, monster);
+ }
+ }
+ }
+ }
+ else if ((instance != null) && event.equals("USE_SKILL"))
+ {
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
+ {
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
+ }
+
+ public void onInstanceStatusChange(OnInstanceStatusChange event)
+ {
+ final Instance instance = event.getWorld();
+ final int status = event.getStatus();
+ if (status == 1)
+ {
+ instance.getAliveNpcs(KARTIA_GUARDIANS).forEach(guardian -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, guardian, null));
+ instance.getAliveNpcs(KARTIA_GUARDIANS).forEach(guardian -> getTimers().addRepeatingTimer("USE_SKILL", 6000, guardian, null));
+ }
+ }
+
+ @Override
+ public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
+ {
+ if (creature.isPlayer())
+ {
+ npc.getVariables().set("PLAYER_OBJECT", creature.getActingPlayer());
+ }
+ else if (CommonUtil.contains(KARTIA_ADOLPH, creature.getId()))
+ {
+ npc.getVariables().set("ADOLPH_OBJECT", creature);
+ }
+ else if (CommonUtil.contains(KARTIA_ELIYAH, creature.getId()))
+ {
+ npc.getVariables().set("ELIYAH_OBJECT", creature);
+ }
+ return super.onSeeCreature(npc, creature, isSummon);
+ }
+
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("guardianSpiritsBlow");
+ final SkillHolder skill_02 = instParams.getSkillHolder("guardianSpiritsWrath");
+ final int numberOfActiveSkills = 2;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ switch (randomSkill)
+ {
+ case 0:
+ case 1:
+ {
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ public void onCreatureAttacked(OnCreatureAttacked event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ if (npc != null)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !npc.isInCombat() && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
+ {
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
+ }
+ }
+ }
+
+ public void onCreatureKill(OnCreatureDeath event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ final Instance world = npc.getInstanceWorld();
+ if (world != null)
+ {
+ getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ new KartiaHelperGuardian();
+ }
+
+}
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java
index be412bb83b..12d10d91c1 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java
@@ -16,25 +16,65 @@
*/
package instances.KartiasLabyrinth;
+import com.l2jmobius.commons.util.CommonUtil;
+import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.Location;
+import com.l2jmobius.gameserver.model.StatsSet;
+import com.l2jmobius.gameserver.model.actor.L2Character;
+import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.FriendlyNpcInstance;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureAttacked;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
+import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.instancezone.Instance;
+import com.l2jmobius.gameserver.model.skills.SkillCaster;
+import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Hayuk AI.
- * @author St3eT
+ * Kartia Helper Hayuk AI. Archer
+ * @author flanagak
*/
public final class KartiaHelperHayuk extends AbstractNpcAI
{
// NPCs
+ private static final int[] KARTIA_ADOLPH =
+ {
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ };
private static final int[] KARTIA_HAYUK =
{
33613, // Hayuk (Kartia 85)
33624, // Hayuk (Kartia 90)
33635, // Hayuk (Kartia 95)
};
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
+
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -45,33 +85,155 @@ public final class KartiaHelperHayuk extends AbstractNpcAI
private KartiaHelperHayuk()
{
+ setCreatureKillId(this::onCreatureKill, KARTIA_HAYUK);
+ setCreatureAttackedId(this::onCreatureAttacked, KARTIA_HAYUK);
+ addSeeCreatureId(KARTIA_HAYUK);
setInstanceStatusChangeId(this::onInstanceStatusChange, KARTIA_SOLO_INSTANCES);
}
+ @Override
+ public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && event.equals("CHECK_ACTION"))
+ {
+ final FriendlyNpcInstance adolph = npc.getVariables().getObject("ADOLPH_OBJECT", FriendlyNpcInstance.class);
+ if (adolph != null)
+ {
+ final double distance = npc.calculateDistance(adolph, false, false);
+ if (distance > 300)
+ {
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
+ {
+ npc.teleToLocation(loc);
+ }
+ else
+ {
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final L2Character monster = (L2Character) adolph.getTarget();
+ if ((monster != null) && adolph.isInCombat() && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ addAttackDesire(npc, monster);
+ }
+ }
+ }
+ }
+ else if ((instance != null) && event.equals("USE_SKILL"))
+ {
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
+ {
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
+ }
+
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
+ instance.getAliveNpcs(KARTIA_HAYUK).forEach(hayuk -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, hayuk, null));
+ instance.getAliveNpcs(KARTIA_HAYUK).forEach(hayuk -> getTimers().addRepeatingTimer("USE_SKILL", 6000, hayuk, null));
+ }
+ }
+
+ @Override
+ public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
+ {
+ if (creature.isPlayer())
+ {
+ npc.getVariables().set("PLAYER_OBJECT", creature.getActingPlayer());
+ }
+ else if (CommonUtil.contains(KARTIA_ADOLPH, creature.getId()))
+ {
+ npc.getVariables().set("ADOLPH_OBJECT", creature);
+ }
+ return super.onSeeCreature(npc, creature, isSummon);
+ }
+
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("hayukPinpointShot");
+ final SkillHolder skill_02 = instParams.getSkillHolder("hayukRecoilShot");
+ final SkillHolder skill_03 = instParams.getSkillHolder("hayukMultipleArrow");
+ final int numberOfActiveSkills = 3;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ switch (randomSkill)
{
- // Nothing for now
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("hayukTeleportStatus" + status);
- if (loc != null)
+ case 0:
+ case 1:
{
- instance.getAliveNpcs(KARTIA_HAYUK).forEach(hayuk -> hayuk.teleToLocation(loc));
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 3:
+ {
+ if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
+ npc.doCast(skill_03.getSkill(), null, true, false);
+ }
+ break;
}
- break;
}
}
}
+ public void onCreatureAttacked(OnCreatureAttacked event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ if (npc != null)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !npc.isInCombat() && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
+ {
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
+ }
+ }
+ }
+
+ public void onCreatureKill(OnCreatureDeath event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ final Instance world = npc.getInstanceWorld();
+ if (world != null)
+ {
+ getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
+ }
+ }
+
public static void main(String[] args)
{
new KartiaHelperHayuk();
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java
index b633afc228..fbb7d13161 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java
@@ -19,13 +19,16 @@ package instances.KartiasLabyrinth;
import java.util.List;
import com.l2jmobius.commons.util.CommonUtil;
+import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.instancemanager.WalkingManager;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureSee;
@@ -47,7 +50,7 @@ import quests.Q00499_IncarnationOfGluttonyKaliosSolo.Q00499_IncarnationOfGlutton
/**
* Kartia Labyrinth instance zone.
- * @author St3eT
+ * @author flanagak
*/
public final class KartiasLabyrinth extends AbstractInstance
{
@@ -84,17 +87,27 @@ public final class KartiasLabyrinth extends AbstractInstance
33623,
33634,
};
- // @formatter:off
private static final int[] MONSTERS =
{
- 19220, 19221, 19222, // Solo 85
- 19223, 19224, 19225, // Solo 90
- 19226, 19227, 19228, // Solo 95
- 19229, 19230, 19231, // Group 85
- 19232, 19233, 19234, // Group 90
- 19235, 19236, 19237, // Group 95
+ 19220,
+ 19221,
+ 19222, // Solo 85
+ 19223,
+ 19224,
+ 19225, // Solo 90
+ 19226,
+ 19227,
+ 19228, // Solo 95
+ 19229,
+ 19230,
+ 19231, // Group 85
+ 19232,
+ 19233,
+ 19234, // Group 90
+ 19235,
+ 19236,
+ 19237, // Group 95
};
- // @formatter:on
private static final int[] BOSSES =
{
19253, // Zellaka (Solo 85)
@@ -134,19 +147,10 @@ public final class KartiasLabyrinth extends AbstractInstance
// Zones
private static final int KARTIA_85_DETECT_1 = 12020;
private static final int KARTIA_85_DETECT_2 = 12021;
- // private static final int KARTIA_85_TELEPORT_1 = 12022;
- // private static final int KARTIA_85_TELEPORT_2 = 12023;
- // private static final int KARTIA_85_TELEPORT_3 = 12024;
private static final int KARTIA_90_DETECT_1 = 12025;
private static final int KARTIA_90_DETECT_2 = 12026;
- // private static final int KARTIA_90_TELEPORT_1 = 12027;
- // private static final int KARTIA_90_TELEPORT_2 = 12028;
- // private static final int KARTIA_90_TELEPORT_3 = 12029;
private static final int KARTIA_95_DETECT_1 = 12030;
private static final int KARTIA_95_DETECT_2 = 12031;
- // private static final int KARTIA_95_TELEPORT_1 = 12032;
- // private static final int KARTIA_95_TELEPORT_2 = 12033;
- // private static final int KARTIA_95_TELEPORT_3 = 12034;
// Misc
private static final int TEMPLATE_ID_SOLO_85 = 205;
private static final int TEMPLATE_ID_SOLO_90 = 206;
@@ -154,6 +158,22 @@ public final class KartiasLabyrinth extends AbstractInstance
private static final int TEMPLATE_ID_GROUP_85 = 208;
private static final int TEMPLATE_ID_GROUP_90 = 209;
private static final int TEMPLATE_ID_GROUP_95 = 210;
+ private static final long WAVE_DEALY = 30000;
+ private static final long WAVE_MONITOR_DELAY = 3000;
+ // Solo instance XP reward values
+ private static final int SOLO_BASE_EXP_85 = 480000000;
+ private static final int SOLO_RAND_EXP_85 = 8055934;
+ private static final int SOLO_BASE_EXP_90 = 670000000;
+ private static final int SOLO_RAND_EXP_90 = 6173918;
+ private static final int SOLO_BASE_EXP_95 = 970000000;
+ private static final int SOLO_RAND_EXP_95 = 6305195;
+ // Solo instance SP reward values
+ private static final int SOLO_BASE_SP_85 = 3800000;
+ private static final int SOLO_RAND_SP_85 = 73460;
+ private static final int SOLO_BASE_SP_90 = 5600000;
+ private static final int SOLO_RAND_SP_90 = 82134;
+ private static final int SOLO_BASE_SP_95 = 8500000;
+ private static final int SOLO_RAND_SP_95 = 39112;
public KartiasLabyrinth()
{
@@ -177,9 +197,9 @@ public final class KartiasLabyrinth extends AbstractInstance
setCreatureKillId(this::onCreatureKill, MONSTERS);
setCreatureKillId(this::onBossKill, BOSSES);
setCreatureSeeId(this::onCreatureSee, MONSTERS);
- addEnterZoneId(KARTIA_85_DETECT_1, KARTIA_85_DETECT_2 /* , KARTIA_85_TELEPORT_1, KARTIA_85_TELEPORT_2, KARTIA_85_TELEPORT_3 */);
- addEnterZoneId(KARTIA_90_DETECT_1, KARTIA_90_DETECT_2 /* , KARTIA_90_TELEPORT_1, KARTIA_90_TELEPORT_2, KARTIA_90_TELEPORT_3 */);
- addEnterZoneId(KARTIA_95_DETECT_1, KARTIA_95_DETECT_2 /* , KARTIA_95_TELEPORT_1, KARTIA_95_TELEPORT_2, KARTIA_95_TELEPORT_3 */);
+ addEnterZoneId(KARTIA_85_DETECT_1, KARTIA_85_DETECT_2);
+ addEnterZoneId(KARTIA_90_DETECT_1, KARTIA_90_DETECT_2);
+ addEnterZoneId(KARTIA_95_DETECT_1, KARTIA_95_DETECT_2);
addInstanceCreatedId(TEMPLATE_ID_SOLO_85, TEMPLATE_ID_SOLO_90, TEMPLATE_ID_SOLO_95, TEMPLATE_ID_GROUP_85, TEMPLATE_ID_GROUP_90, TEMPLATE_ID_GROUP_95);
}
@@ -197,33 +217,63 @@ public final class KartiasLabyrinth extends AbstractInstance
}
case "request_zellaka_solo":
{
- enterInstance(player, npc, TEMPLATE_ID_SOLO_85);
- return null;
+ final QuestState qs = player.getQuestState(Q00497_IncarnationOfGreedZellakaSolo.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_SOLO_85);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_pelline_solo":
{
- enterInstance(player, npc, TEMPLATE_ID_SOLO_90);
- return null;
+ final QuestState qs = player.getQuestState(Q00498_IncarnationOfJealousyPellineSolo.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_SOLO_90);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_kalios_solo":
{
- enterInstance(player, npc, TEMPLATE_ID_SOLO_95);
- return null;
+ final QuestState qs = player.getQuestState(Q00499_IncarnationOfGluttonyKaliosSolo.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_SOLO_95);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_zellaka_party":
{
- enterInstance(player, npc, TEMPLATE_ID_GROUP_85);
- return null;
+ final QuestState qs = player.getQuestState(Q00494_IncarnationOfGreedZellakaGroup.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_GROUP_85);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_pelline_party":
{
- enterInstance(player, npc, TEMPLATE_ID_GROUP_90);
- return null;
+ final QuestState qs = player.getQuestState(Q00495_IncarnationOfJealousyPellineGroup.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_GROUP_90);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_kalios_party":
{
- enterInstance(player, npc, TEMPLATE_ID_GROUP_95);
- return null;
+ final QuestState qs = player.getQuestState(Q00496_IncarnationOfGluttonyKaliosGroup.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_GROUP_95);
+ return null;
+ }
+ return "33647-9.htm";
}
default:
{
@@ -280,16 +330,18 @@ public final class KartiasLabyrinth extends AbstractInstance
{
if (npc != null)
{
- if (npc.getInstanceWorld().getParameters().getInt("ROOM", 1) <= 2)
+ if (npc.getInstanceWorld().getParameters().getInt("ROOM", 1) < 2)
{
+ // Move mobs in Room 1 to the middle at top of the steps. Add timer to start moving towards prisoners.
final Location loc = instance.getTemplateParameters().getLocation("middlePointRoom1");
final Location moveTo = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
npc.setRunning();
addMoveToDesire(npc, moveTo, 6);
- getTimers().addTimer("START_MOVE", 15000, npc, null);
+ getTimers().addTimer("START_MOVE", 12000, npc, null);
}
else if (npc.getInstanceWorld().getParameters().getInt("ROOM", 1) == 3)
{
+ // Move mobs in Room 3 towards center of room.
final Location loc = instance.getTemplateParameters().getLocation("middlePointRoom3");
final Location moveTo = new Location(loc.getX() + getRandom(-200, 200), loc.getY() + getRandom(-200, 200), loc.getZ());
npc.setRunning();
@@ -302,18 +354,8 @@ public final class KartiasLabyrinth extends AbstractInstance
{
if (npc != null)
{
- WalkingManager.getInstance().startMoving(npc, instance.getTemplateParameters().getString(getRandomBoolean() ? "route1" : "route2"));
- getTimers().addTimer("CHANGE_TARGETABLE_STATUS", 5000, npc, null);
- }
- break;
- }
- case "CHANGE_TARGETABLE_STATUS":
- {
- if (npc != null)
- {
- npc.setTargetable(true);
- final L2PcInstance randomPlayer = instance.getPlayers().stream().findAny().get();
- npc.moveToLocation(randomPlayer.getX(), randomPlayer.getY(), randomPlayer.getZ(), 10);
+ final String selectedRoute = (getRandomBoolean() ? "route1_" : "route2_") + Integer.toString(getRandom(1, 3));
+ WalkingManager.getInstance().startMoving(npc, instance.getTemplateParameters().getString(selectedRoute));
}
break;
}
@@ -346,7 +388,6 @@ public final class KartiasLabyrinth extends AbstractInstance
});
- instance.getParameters().set("TELEPORT_1_ENABLED", true);
if (!isSoloKartia(instance))
{
getTimers().addTimer("CALL_PROGRESS", 2500, n -> manageProgressInInstance(instance));
@@ -375,6 +416,20 @@ public final class KartiasLabyrinth extends AbstractInstance
}
}
+ private void manageWaves(Instance instance)
+ {
+ if ((instance != null) && instance.getAliveNpcs(MONSTERS).isEmpty())
+ {
+ getTimers().cancelTimers("NEXT_WAVE_DELAY");
+ getTimers().cancelTimers("MONITOR_WAVE");
+ getTimers().addTimer("CALL_PROGRESS", 5000, n -> manageProgressInInstance(instance));
+ }
+ else
+ {
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
+ }
+ }
+
public void onBossKill(OnCreatureDeath event)
{
final L2Npc npc = (L2Npc) event.getTarget();
@@ -384,80 +439,29 @@ public final class KartiasLabyrinth extends AbstractInstance
{
if (isSoloKartia(instance))
{
- final StatsSet tempParam = instance.getTemplateParameters();
- final int xp = tempParam.getInt("soloEXP");
- final int xp_rnd = tempParam.getInt("SoloEXP_Rand");
- final int sp = tempParam.getInt("SoloSP");
- final int sp_rnd = tempParam.getInt("SoloSP_Rand");
-
- instance.getPlayers().forEach(player ->
+ final L2PcInstance player = instance.getFirstPlayer();
+ if (player != null)
{
- addExpAndSp(player, (xp + getRandom(xp_rnd)), (sp + getRandom(sp_rnd)));
- });
- }
-
- // Check Instance Quests.
- instance.getPlayers().forEach(player ->
- {
- switch (instance.getTemplateId())
- {
- case TEMPLATE_ID_SOLO_85:
+ switch (instance.getTemplateId())
{
- final QuestState qs = player.getQuestState(Q00497_IncarnationOfGreedZellakaSolo.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ case TEMPLATE_ID_SOLO_85:
{
- qs.setCond(2, true);
+ player.addExpAndSp(SOLO_BASE_EXP_85 + getRandom(SOLO_RAND_EXP_85), SOLO_BASE_SP_85 + getRandom(SOLO_RAND_SP_85));
+ break;
}
- break;
- }
- case TEMPLATE_ID_SOLO_90:
- {
- final QuestState qs = player.getQuestState(Q00498_IncarnationOfJealousyPellineSolo.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ case TEMPLATE_ID_SOLO_90:
{
- qs.setCond(2, true);
+ player.addExpAndSp(SOLO_BASE_EXP_90 + getRandom(SOLO_RAND_EXP_90), SOLO_BASE_SP_90 + getRandom(SOLO_RAND_SP_90));
+ break;
}
- break;
- }
- case TEMPLATE_ID_SOLO_95:
- {
- final QuestState qs = player.getQuestState(Q00499_IncarnationOfGluttonyKaliosSolo.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ case TEMPLATE_ID_SOLO_95:
{
- qs.setCond(2, true);
+ player.addExpAndSp(SOLO_BASE_EXP_95 + getRandom(SOLO_RAND_EXP_95), SOLO_BASE_SP_95 + getRandom(SOLO_RAND_SP_95));
+ break;
}
- break;
- }
- case TEMPLATE_ID_GROUP_85:
- {
- final QuestState qs = player.getQuestState(Q00494_IncarnationOfGreedZellakaGroup.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
- {
- qs.setCond(2, true);
- }
- break;
- }
- case TEMPLATE_ID_GROUP_90:
- {
- final QuestState qs = player.getQuestState(Q00495_IncarnationOfJealousyPellineGroup.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
- {
- qs.setCond(2, true);
- }
- break;
- }
- case TEMPLATE_ID_GROUP_95:
- {
- final QuestState qs = player.getQuestState(Q00496_IncarnationOfGluttonyKaliosGroup.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
- {
- qs.setCond(2, true);
- }
- break;
}
}
- });
-
+ }
instance.finishInstance();
}
}
@@ -475,8 +479,6 @@ public final class KartiasLabyrinth extends AbstractInstance
instance.setParameter("BOSS_CAN_ESCAPE", false);
npc.setScriptValue(1);
npc.broadcastSay(ChatType.NPC_SHOUT, NpcStringId.NOT_BAD_FOR_A_BUNCH_OF_HUMANS_I_M_LEAVING);
- npc.disableCoreAI(true);
- addMoveToDesire(npc, instance.getTemplateParameters().getLocation("bossEscapeLoc1"), 23);
}
}
else
@@ -503,7 +505,6 @@ public final class KartiasLabyrinth extends AbstractInstance
final Instance instance = character.getInstanceWorld();
if ((instance != null) && character.isPlayer())
{
- // final L2PcInstance player = character.getActingPlayer();
switch (zone.getId())
{
case KARTIA_85_DETECT_1:
@@ -532,11 +533,6 @@ public final class KartiasLabyrinth extends AbstractInstance
}
break;
}
- /*
- * case KARTIA_85_TELEPORT_1: case KARTIA_90_TELEPORT_1: case KARTIA_95_TELEPORT_1: { if (instance.getParameters().getBoolean("TELEPORT_1_ENABLED", false)) { player.teleToLocation(instance.getTemplateParameters().getLocation("teleportZone1_loc")); } break; } case
- * KARTIA_85_TELEPORT_2: case KARTIA_90_TELEPORT_2: case KARTIA_95_TELEPORT_2: { if (instance.getParameters().getBoolean("TELEPORT_2_ENABLED", false)) { player.teleToLocation(instance.getTemplateParameters().getLocation("teleportZone2_loc")); } break; } case KARTIA_85_TELEPORT_3:
- * case KARTIA_90_TELEPORT_3: case KARTIA_95_TELEPORT_3: { if (instance.getParameters().getBoolean("TELEPORT_3_ENABLED", false)) { player.teleToLocation(instance.getTemplateParameters().getLocation("teleportZone3_loc")); } break; }
- */
}
}
return super.onEnterZone(character, zone);
@@ -546,31 +542,15 @@ public final class KartiasLabyrinth extends AbstractInstance
public void onMoveFinished(L2Npc npc)
{
final Instance instance = npc.getInstanceWorld();
- if (instance != null)
+ if ((instance != null) && CommonUtil.contains(PRISONERS, npc.getId()))
{
- if (CommonUtil.contains(PRISONERS, npc.getId()))
+ if (npc.isScriptValue(0))
{
- if (npc.isScriptValue(0))
- {
- npc.setScriptValue(1);
- final Location moveTo = new Location(npc.getX() + getRandom(-500, 500), npc.getY() + getRandom(-500, 500), npc.getZ());
- addMoveToDesire(npc, moveTo, 23);
- }
- else
- {
- npc.deleteMe();
- }
+ final Location moveTo = new Location(npc.getX() + getRandom(-200, 200), npc.getY() + getRandom(-200, 200), npc.getZ());
+ addMoveToDesire(npc, moveTo, 23);
}
- else if (npc.isScriptValue(1))
+ else
{
- npc.setScriptValue(2);
- addMoveToDesire(npc, instance.getTemplateParameters().getLocation("bossEscapeLoc2"), 23);
- }
- else if (npc.isScriptValue(2))
- {
- instance.setParameter("MINIBOSS_SURVIVED", true);
- instance.openCloseDoor(instance.getTemplateParameters().getInt("thirdDoorId"), true);
- instance.setStatus(3); // Used for notify helper's AI
npc.deleteMe();
}
}
@@ -585,7 +565,7 @@ public final class KartiasLabyrinth extends AbstractInstance
{
final Location moveTo = new Location(npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ());
npc.setRandomWalking(true);
- addMoveToDesire(npc, moveTo, 0);
+ addMoveToDesire(npc, moveTo, 6);
}
}
@@ -608,6 +588,11 @@ public final class KartiasLabyrinth extends AbstractInstance
npc.setTargetable(false);
npc.setIsInvul(true);
}
+ else if (CommonUtil.contains(MONSTERS, npc.getId()) || CommonUtil.contains(MINI_BOSSES, npc.getId()))
+ {
+ npc.setTargetable(false);
+ npc.setIsInvul(true);
+ }
}
return super.onSpawn(npc);
}
@@ -632,14 +617,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE1_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE1_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -662,14 +649,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE2_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE2_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -692,14 +681,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE3_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE3_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -744,7 +735,7 @@ public final class KartiasLabyrinth extends AbstractInstance
}
break;
}
- case 4:
+ case 4: // Only used in group version of instance.
{
switch (wave)
{
@@ -753,14 +744,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE4_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE4_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -774,7 +767,7 @@ public final class KartiasLabyrinth extends AbstractInstance
}
break;
}
- case 5:
+ case 5: // Only used in group version of instance.
{
switch (wave)
{
@@ -783,7 +776,8 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE5_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
@@ -815,8 +809,7 @@ public final class KartiasLabyrinth extends AbstractInstance
}
else if (room == 2)
{
- instance.getParameters().set("TELEPORT_1_ENABLED", false);
- instance.setParameter("BOSS_CAN_ESCAPE", true);
+ instance.setParameter("BOSS_CAN_ESCAPE", false);
instance.setParameter("BOSS_KILL_OPEN_DOOR", true);
instance.spawnGroup("ROOM2_STAGE1_WAVE1");
instance.openCloseDoor(instance.getTemplateParameters().getInt("secondDoorId"), true);
@@ -909,24 +902,23 @@ public final class KartiasLabyrinth extends AbstractInstance
private void moveMonsters(List monsterList)
{
int delay = 500;
- for (L2Npc npc : monsterList)
+ for (L2Npc monster : monsterList)
{
- final Instance world = npc.getInstanceWorld();
- if (npc.isAttackable() && (world != null))
+ final Instance world = monster.getInstanceWorld();
+ if (monster.isAttackable() && (world != null))
{
if (world.getParameters().getInt("ROOM", 1) <= 2)
{
- npc.setRandomWalking(false);
- npc.setTargetable(false);
- getTimers().addTimer("MOVE_TO_MIDDLE", delay, npc, null);
+ monster.setRandomWalking(false);
+ getTimers().addTimer("MOVE_TO_MIDDLE", delay, monster, null);
delay += 250;
}
else if (world.getParameters().getInt("ROOM", 1) == 3)
{
- onTimerEvent("MOVE_TO_MIDDLE", null, npc, null);
+ onTimerEvent("MOVE_TO_MIDDLE", null, monster, null);
}
- ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
- npc.initSeenCreatures();
+ ((L2Attackable) monster).setCanReturnToSpawnPoint(false);
+ monster.initSeenCreatures();
}
}
}
@@ -937,10 +929,19 @@ public final class KartiasLabyrinth extends AbstractInstance
final L2Npc npc = (L2Npc) event.getSeer();
final Instance world = npc.getInstanceWorld();
- if ((world != null) && creature.isPlayer() && npc.isScriptValue(0))
+ if ((world != null) && (creature.isPlayer() || creature.getInstanceType().isType(InstanceType.FriendlyNpcInstance)) && npc.isScriptValue(0))
{
- npc.setScriptValue(1);
- addAttackDesire(npc, creature);
+ final double distance = npc.calculateDistance(creature, false, false);
+ if ((distance < 450) && !CommonUtil.contains(PRISONERS, creature.getId()))
+ {
+ npc.setTargetable(true);
+ npc.setIsInvul(false);
+ npc.setScriptValue(1);
+ WalkingManager.getInstance().cancelMoving(npc);
+ ((L2MonsterInstance) npc).addDamageHate(creature, 0, 1000);
+ npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
+ addAttackDesire(npc, creature);
+ }
}
}
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java
index 58760f2b2f..8b41bab529 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java
@@ -33,6 +33,8 @@ public class Q00494_IncarnationOfGreedZellakaGroup extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_KEEPER_BLUE_BOX = 34927;
+ // Boss
+ private static final int BOSS = 25882; // Zellaka (Group 85)
// Misc
private static final int MIN_LEVEL = 85;
private static final int MAX_LEVEL = 89;
@@ -42,6 +44,7 @@ public class Q00494_IncarnationOfGreedZellakaGroup extends Quest
super(494);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,21 @@ public class Q00494_IncarnationOfGreedZellakaGroup extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ executeForEachPlayer(player, npc, isSummon, true, false);
+ return super.onKill(npc, player, isSummon);
+ }
+
+ @Override
+ public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java
index e8ab074857..3ea2f7da89 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java
@@ -33,6 +33,8 @@ public class Q00495_IncarnationOfJealousyPellineGroup extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_KEEPER_RED_BOX = 34928;
+ // Boss
+ private static final int BOSS = 25883; // Pelline (Group 90)
// Misc
private static final int MIN_LEVEL = 90;
private static final int MAX_LEVEL = 94;
@@ -42,6 +44,7 @@ public class Q00495_IncarnationOfJealousyPellineGroup extends Quest
super(495);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,21 @@ public class Q00495_IncarnationOfJealousyPellineGroup extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ executeForEachPlayer(player, npc, isSummon, true, false);
+ return super.onKill(npc, player, isSummon);
+ }
+
+ @Override
+ public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java
index 89a9d09a7a..e7a6258abf 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java
@@ -33,6 +33,8 @@ public class Q00496_IncarnationOfGluttonyKaliosGroup extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_KEEPER_GOLDEN_BOX = 34929;
+ // Boss
+ private static final int BOSS = 25884; // Kalios (Group 95)
// Misc
private static final int MIN_LEVEL = 95;
private static final int MAX_LEVEL = 99;
@@ -42,6 +44,7 @@ public class Q00496_IncarnationOfGluttonyKaliosGroup extends Quest
super(496);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,21 @@ public class Q00496_IncarnationOfGluttonyKaliosGroup extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ executeForEachPlayer(player, npc, isSummon, true, false);
+ return super.onKill(npc, player, isSummon);
+ }
+
+ @Override
+ public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java
index 9905030179..6e089781b2 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java
@@ -33,6 +33,8 @@ public class Q00497_IncarnationOfGreedZellakaSolo extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_TRAVELERS_BLUE_BOX = 34930;
+ // Boss
+ private static final int BOSS = 19253; // Zellaka (Solo 85)
// Misc
private static final int MIN_LEVEL = 85;
private static final int MAX_LEVEL = 89;
@@ -42,6 +44,7 @@ public class Q00497_IncarnationOfGreedZellakaSolo extends Quest
super(497);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,15 @@ public class Q00497_IncarnationOfGreedZellakaSolo extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ return super.onKill(npc, player, isSummon);
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java
index cab1faa0cd..ce0d861ab5 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java
@@ -33,6 +33,8 @@ public class Q00498_IncarnationOfJealousyPellineSolo extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_TRAVELERS_RED_BOX = 34931;
+ // Boss
+ private static final int BOSS = 19254; // Pelline (Solo 90)
// Misc
private static final int MIN_LEVEL = 90;
private static final int MAX_LEVEL = 94;
@@ -42,6 +44,7 @@ public class Q00498_IncarnationOfJealousyPellineSolo extends Quest
super(498);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,15 @@ public class Q00498_IncarnationOfJealousyPellineSolo extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ return super.onKill(npc, player, isSummon);
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java
index d0f4108998..9ab232f31a 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java
@@ -33,6 +33,8 @@ public class Q00499_IncarnationOfGluttonyKaliosSolo extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_TRAVELERS_GOLDEN_BOX = 34932;
+ // Boss
+ private static final int BOSS = 19255; // Kalios (Solo 95)
// Misc
private static final int MIN_LEVEL = 95;
private static final int MAX_LEVEL = 99;
@@ -42,6 +44,7 @@ public class Q00499_IncarnationOfGluttonyKaliosSolo extends Quest
super(499);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,15 @@ public class Q00499_IncarnationOfGluttonyKaliosSolo extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ return super.onKill(npc, player, isSummon);
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/19200-19299.xml b/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/19200-19299.xml
index fd4ca0f496..8925b01ea2 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/19200-19299.xml
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/19200-19299.xml
@@ -625,7 +625,7 @@
-
+
UNDEAD
@@ -2000,7 +2000,7 @@
DEMONIC
MALE
-
+
@@ -2046,7 +2046,7 @@
DEMONIC
MALE
-
+
@@ -2093,7 +2093,7 @@
DEMONIC
MALE
-
+
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/25800-25899.xml b/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/25800-25899.xml
index 62c4c0d57a..d583c85905 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/25800-25899.xml
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/25800-25899.xml
@@ -3682,10 +3682,10 @@
DEMONIC
MALE
-
+
-
+
@@ -3708,66 +3708,86 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3793,10 +3813,10 @@
DEMONIC
MALE
-
+
-
+
@@ -3825,66 +3845,86 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3905,10 +3945,10 @@
DEMONIC
MALE
-
+
-
+
@@ -3937,67 +3977,92 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/14800-14899.xml b/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/14800-14899.xml
index c043df30c4..723beaff50 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/14800-14899.xml
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/14800-14899.xml
@@ -1090,7 +1090,7 @@
icon.skill10016
- A2
+ A1
600
500
1000
@@ -1112,8 +1112,7 @@
10-10
true
ENEMY
- RANGE
- NOT_FRIEND
+ SINGLE
600
@@ -1128,7 +1127,7 @@
icon.skill10016
- A2
+ A1
600
500
1000
@@ -1150,8 +1149,7 @@
10-10
true
ENEMY
- RANGE
- NOT_FRIEND
+ SINGLE
600
@@ -1166,7 +1164,7 @@
icon.skill10016
- A2
+ A1
600
500
1000
@@ -1188,8 +1186,7 @@
10-10
true
ENEMY
- RANGE
- NOT_FRIEND
+ SINGLE
600
@@ -1351,7 +1348,7 @@
0;0;150;180
STUN
true
- SELF
+ ENEMY
SINGLE
@@ -1387,7 +1384,7 @@
0;0;150;180
STUN
true
- SELF
+ ENEMY
SINGLE
@@ -1423,7 +1420,7 @@
0;0;150;180
STUN
true
- SELF
+ ENEMY
SINGLE
@@ -2709,7 +2706,6 @@
true
TARGET
SINGLE
- NOT_FRIEND
@@ -2738,7 +2734,6 @@
true
TARGET
SINGLE
- NOT_FRIEND
@@ -2767,7 +2762,6 @@
true
TARGET
SINGLE
- NOT_FRIEND
@@ -2925,11 +2919,6 @@
TARGET
RANGE
FRIEND
-
-
- 40
-
-
@@ -2950,8 +2939,8 @@
TARGET
SINGLE
-
- 1488
+
+ 20
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/Util.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/Util.java
index 850ae469e6..0508148f16 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/Util.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/Util.java
@@ -29,11 +29,13 @@ import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Date;
+import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
-import java.util.TreeMap;
import java.util.logging.Logger;
+import java.util.stream.Collectors;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.Rnd;
@@ -791,14 +793,24 @@ public final class Util
}
/**
- * Short an map by its integer values.
- * @param unsortedMap
- * @return
+ * This will sort a Map according to the values. Default sort direction is ascending.
+ * @param keyType
+ * @param valueType
+ * @param map Map to be sorted.
+ * @param descending If you want to sort descending.
+ * @return A new Map sorted by the values.
*/
- public static Map sortByValue(Map unsortedMap)
+ public static > Map sortByValue(Map map, boolean descending)
{
- Map sortedMap = new TreeMap<>(new ValueComparator(unsortedMap));
- sortedMap.putAll(unsortedMap);
- return sortedMap;
+ if (descending)
+ {
+ return map.entrySet().stream().sorted(Map.Entry.comparingByValue(Collections.reverseOrder())).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
+ }
+ return map.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
+ }
+
+ public static > Map sortByValue(Map map)
+ {
+ return map.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
}
}
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/ValueComparator.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/ValueComparator.java
deleted file mode 100644
index 32c494218d..0000000000
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/ValueComparator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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 .
- */
-package com.l2jmobius.gameserver.util;
-
-import java.util.Comparator;
-import java.util.Map;
-
-/**
- * @author Mobius
- */
-public class ValueComparator implements Comparator
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml b/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml
index 79319c9ba7..81d3df75c8 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml
@@ -12,8 +12,12 @@
-
-
+
+
+
+
+
+
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml b/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml
index 8e5d962638..afc416a820 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml
@@ -12,45 +12,48 @@
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
@@ -95,6 +98,11 @@
+
+
+
+
+
@@ -115,7 +123,6 @@
-
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml b/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml
index 10fdc99062..cc2bdd0cd9 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml
@@ -12,8 +12,12 @@
-
-
+
+
+
+
+
+
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml b/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml
index c469b93c64..fbb2cac4e8 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml
@@ -16,22 +16,37 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -41,16 +56,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -95,6 +100,11 @@
+
+
+
+
+
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml b/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml
index d04fc781ee..26f843c0b8 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml
@@ -12,8 +12,12 @@
-
-
+
+
+
+
+
+
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml b/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml
index a8235c88d7..4a4b8d99a4 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml
@@ -17,21 +17,36 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -41,16 +56,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -94,6 +99,11 @@
+
+
+
+
+
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/33647-9.htm b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/33647-9.htm
new file mode 100644
index 0000000000..f72bd6b6d6
--- /dev/null
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/33647-9.htm
@@ -0,0 +1,5 @@
+Kartia Researcher:
+Don't waste my time! I'm a researcher sent directly by the Kingdom of Aden after all.
+You must have the quest started in order to enter the labyrinth.
+
+
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java
index 0f7156ae8b..5ef95e7b46 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java
@@ -28,7 +28,7 @@ import ai.AbstractNpcAI;
/**
* Kartia Boss AI.
- * @author St3eT
+ * @author flanagak
*/
public final class KartiaBoss extends AbstractNpcAI
{
@@ -139,8 +139,8 @@ public final class KartiaBoss extends AbstractNpcAI
{
for (int i = 0; i < 3; i++)
{
- addSpawn(fighter, npc, false, 0, false, npc.getInstanceId());
- addSpawn(mage, npc, false, 0, false, npc.getInstanceId());
+ addSpawn(fighter, npc, true, 0, false, npc.getInstanceId());
+ addSpawn(mage, npc, true, 0, false, npc.getInstanceId());
}
}
}
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java
index fe268f6cd0..63766759cc 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java
@@ -33,16 +33,14 @@ import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.instancezone.Instance;
-import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.skills.SkillCaster;
import com.l2jmobius.gameserver.network.NpcStringId;
-import com.l2jmobius.gameserver.util.Util;
import ai.AbstractNpcAI;
/**
* Kartia Helper Adolph AI.
- * @author St3eT
+ * @author flanagak
*/
public final class KartiaHelperAdolph extends AbstractNpcAI
{
@@ -59,6 +57,27 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
33799, // Life Plunderer (90)
33800, // Life Plunderer (95)
};
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -82,114 +101,161 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
final Instance instance = npc.getInstanceWorld();
if ((instance != null) && event.equals("CHECK_ACTION"))
{
- final StatsSet instParams = instance.getTemplateParameters();
- boolean actionFound = false;
-
- if (!npc.isInCombat() || !npc.isAttackingNow() || (npc.getTarget() == null))
+ final StatsSet npcVars = npc.getVariables();
+ player = npcVars.getObject("PLAYER_OBJECT", L2PcInstance.class);
+ if (player != null)
{
- final List monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 500);
- if (!monsterList.isEmpty())
+ final double distance = npc.calculateDistance(player, false, false);
+ if (distance > 300)
{
- final L2MonsterInstance monster = monsterList.get(getRandom(monsterList.size()));
-
- if (monster.isTargetable() && GeoEngine.getInstance().canSeeTarget(npc, monster) && !CommonUtil.contains(MIRRORS, monster.getId()))
+ final Location loc = new Location(player.getX(), player.getY(), player.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
{
- actionFound = true;
- addAttackDesire(npc, monster);
+ npc.teleToLocation(loc);
}
- }
- }
-
- if (!actionFound)
- {
- final SkillHolder hateSkill = instParams.getSkillHolder("adolphHate");
- if (npc.isInCombat() && (hateSkill != null) && SkillCaster.checkUseConditions(npc, hateSkill.getSkill()))
- {
- addSkillCastDesire(npc, npc.getTarget(), hateSkill, 23);
- }
- else
- {
- final L2PcInstance instancePlayer = npc.getVariables().getObject("PLAYER_OBJECT", L2PcInstance.class);
- if (instancePlayer != null)
+ else
{
- final double radian = Math.toRadians(Util.convertHeadingToDegree(instancePlayer.getHeading()));
- final int X = (int) (instancePlayer.getX() + (Math.cos(radian) * 150));
- final int Y = (int) (instancePlayer.getY() + (Math.sin(radian) * 150));
- final Location loc = GeoEngine.getInstance().canMoveToTargetLoc(instancePlayer.getX(), instancePlayer.getY(), instancePlayer.getZ(), X, Y, instancePlayer.getZ(), instance);
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final List monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 500);
+ if (!monsterList.isEmpty())
+ {
+ final L2MonsterInstance monster = monsterList.get(getRandom(monsterList.size()));
- if (!npc.isInsideRadius(loc, 50, true, true))
+ if (monster.isTargetable() && GeoEngine.getInstance().canSeeTarget(npc, monster) && !CommonUtil.contains(MIRRORS, monster.getId()) && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
{
- npc.setRunning();
- addMoveToDesire(npc, loc, 23);
+ addAttackDesire(npc, monster);
}
}
}
}
}
- }
-
- @Override
- public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill)
- {
- final Instance instance = npc.getInstanceWorld();
- if (instance != null)
+ else if ((instance != null) && event.equals("USE_SKILL"))
{
- final StatsSet instParams = instance.getTemplateParameters();
- final SkillHolder hateSkill = instParams.getSkillHolder("adolphHate");
- final SkillHolder shieldSkill = instParams.getSkillHolder("adolphShield");
- final SkillHolder punishSkill = instParams.getSkillHolder("adolphPunish");
-
- if ((hateSkill != null) && (skill.getId() == hateSkill.getSkillId()))
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
{
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_FILTHY_MONSTERS_I_WILL_TAKE_YOU_ON);
- }
- else if ((shieldSkill != null) && (skill.getId() == shieldSkill.getSkillId()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.STOP_RIGHT_THERE_I_WILL_BE_YOUR_OPPONENT);
- }
- else if ((punishSkill != null) && (skill.getId() == punishSkill.getSkillId()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
+ }
+
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("adolphHate");
+ final SkillHolder skill_02 = instParams.getSkillHolder("adolphPunish");
+ final SkillHolder skill_03 = instParams.getSkillHolder("adolphShield");
+ final SkillHolder skill_04 = instParams.getSkillHolder("adolphAggression");
+ final SkillHolder skill_05 = instParams.getSkillHolder("adolphChainHydra");
+ final SkillHolder lowHpSkill = instParams.getSkillHolder("adolphUltimate");
+ final int numberOfActiveSkills = 5;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ if ((lowHpSkill != null) && (npc.getCurrentHpPercent() < 50))
+ {
+ // NPC has low HP Skill and HP is < 50% HP
+ if (!npc.isAffectedBySkill(lowHpSkill.getSkillId()) && (SkillCaster.checkUseConditions(npc, lowHpSkill.getSkill())))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IT_S_NOT_OVER);
+ npc.doCast(lowHpSkill.getSkill());
+ }
+ }
+ else
+ {
+ switch (randomSkill)
+ {
+ case 0:
+ case 1:
+ {
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ final List monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 300);
+ if (!monsterList.isEmpty())
+ {
+ for (L2MonsterInstance monster : monsterList)
+ {
+ if (monster.isTargetable() && GeoEngine.getInstance().canSeeTarget(npc, monster) && !CommonUtil.contains(MIRRORS, monster.getId()) && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ monster.addDamageHate(npc, 100, 10000);
+ }
+ }
+ }
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 3:
+ {
+ if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
+ npc.doCast(skill_03.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 4:
+ {
+ if ((skill_04 != null) && SkillCaster.checkUseConditions(npc, skill_04.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_BE_DESTROYED);
+ npc.doCast(skill_04.getSkill());
+ }
+ break;
+ }
+ case 5:
+ {
+ if ((skill_05 != null) && SkillCaster.checkUseConditions(npc, skill_05.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_DIE);
+ npc.doCast(skill_05.getSkill(), null, true, false);
+ }
+ break;
+ }
+ }
}
}
- return super.onSpellFinished(npc, player, skill);
}
public void onCreatureAttacked(OnCreatureAttacked event)
{
final L2Npc npc = (L2Npc) event.getTarget();
- final Instance instance = npc.getInstanceWorld();
- if ((instance != null) && !event.getAttacker().isPlayable())
+ if (npc != null)
{
- final StatsSet instParams = instance.getTemplateParameters();
- final int random = getRandom(1000);
-
- if (random < 333)
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
{
- final SkillHolder shieldSkill = instParams.getSkillHolder("adolphShield");
- if ((shieldSkill != null) && SkillCaster.checkUseConditions(npc, shieldSkill.getSkill()))
+ if (!npc.isInCombat())
{
- addSkillCastDesire(npc, npc.getTarget(), shieldSkill, 23);
- }
- }
- else if (random < 666)
- {
- final SkillHolder punishSkill = instParams.getSkillHolder("adolphPunish");
- if ((punishSkill != null) && SkillCaster.checkUseConditions(npc, punishSkill.getSkill()))
- {
- addSkillCastDesire(npc, npc.getTarget(), punishSkill, 23);
- }
- }
-
- if ((npc.getCurrentHpPercent() < 30) && npc.isScriptValue(0))
- {
- final SkillHolder ultimateSkill = instParams.getSkillHolder("adolphUltimate");
- if ((ultimateSkill != null) && !npc.isAffectedBySkill(ultimateSkill.getSkillId()) && SkillCaster.checkUseConditions(npc, ultimateSkill.getSkill()))
- {
- npc.setScriptValue(1);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IT_S_NOT_OVER);
- addSkillCastDesire(npc, npc.getTarget(), ultimateSkill, 23);
- getTimers().addTimer("RESTORE_SCRIPTVAL", 10000, n -> npc.setScriptValue(0));
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder hateSkill = instParams.getSkillHolder("adolphHate");
+ if ((hateSkill != null) && SkillCaster.checkUseConditions(npc, hateSkill.getSkill()))
+ {
+ npc.doCast(hateSkill.getSkill(), null, true, false);
+ }
}
}
}
@@ -210,23 +276,10 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
- {
- instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, adolph, null));
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("adolphTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> adolph.teleToLocation(loc));
- }
- break;
- }
+ instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, adolph, null));
+ instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> getTimers().addRepeatingTimer("USE_SKILL", 6000, adolph, null));
}
}
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java
index 374348ece8..9ad2b19e13 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java
@@ -35,8 +35,8 @@ import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Barton AI.
- * @author St3eT
+ * Kartia Helper Barton AI. Tyrr Warrior
+ * @author flanagak
*/
public final class KartiaHelperBarton extends AbstractNpcAI
{
@@ -53,6 +53,27 @@ public final class KartiaHelperBarton extends AbstractNpcAI
33620, // Adolph (Kartia 90)
33631, // Adolph (Kartia 95)
};
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -79,52 +100,50 @@ public final class KartiaHelperBarton extends AbstractNpcAI
if (adolph != null)
{
final double distance = npc.calculateDistance(adolph, false, false);
- if (distance > 200)
+ if (distance > 300)
{
- final Location loc = new Location(adolph.getX() + getRandom(-100, 100), adolph.getY() + getRandom(-100, 100), adolph.getZ() + 50);
- if (distance > 500)
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
{
npc.teleToLocation(loc);
}
else
{
npc.setRunning();
- addMoveToDesire(npc, loc, 23);
}
+ addMoveToDesire(npc, randLoc, 23);
}
- else if (!npc.isInCombat() || !npc.isAttackingNow() || (npc.getTarget() == null))
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
{
final L2Character monster = (L2Character) adolph.getTarget();
- if ((monster != null) && adolph.isInCombat())
+ if ((monster != null) && adolph.isInCombat() && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
{
addAttackDesire(npc, monster);
}
}
}
}
+ else if ((instance != null) && event.equals("USE_SKILL"))
+ {
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
+ {
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
}
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
- {
- instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, barton, null));
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("bartonTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> barton.teleToLocation(loc));
- }
- break;
- }
+ instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, barton, null));
+ instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> getTimers().addRepeatingTimer("USE_SKILL", 6000, barton, null));
}
}
@@ -142,33 +161,83 @@ public final class KartiaHelperBarton extends AbstractNpcAI
return super.onSeeCreature(npc, creature, isSummon);
}
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("bartonInfinity");
+ final SkillHolder skill_02 = instParams.getSkillHolder("bartonBerserker");
+ final SkillHolder skill_03 = instParams.getSkillHolder("bartonHurricane");
+ final SkillHolder skill_04 = instParams.getSkillHolder("bartonPowerBomber");
+ final SkillHolder skill_05 = instParams.getSkillHolder("bartonSonicStar");
+ final int numberOfActiveSkills = 5;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ switch (randomSkill)
+ {
+ case 0:
+ case 1:
+ {
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 3:
+ {
+ if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
+ npc.doCast(skill_03.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 4:
+ {
+ if ((skill_04 != null) && SkillCaster.checkUseConditions(npc, skill_04.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_BE_DESTROYED);
+ npc.doCast(skill_04.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 5:
+ {
+ if ((skill_05 != null) && SkillCaster.checkUseConditions(npc, skill_05.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_DIE);
+ npc.doCast(skill_05.getSkill(), null, true, false);
+ }
+ break;
+ }
+ }
+ }
+ }
+
public void onCreatureAttacked(OnCreatureAttacked event)
{
final L2Npc npc = (L2Npc) event.getTarget();
- final Instance instance = npc.getInstanceWorld();
- if ((instance != null) && !event.getAttacker().isPlayable())
+ if (npc != null)
{
- final StatsSet instParams = instance.getTemplateParameters();
- final int random = getRandom(1000);
-
- if (random < 333)
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !npc.isInCombat() && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
{
- final SkillHolder infinitySkill = instParams.getSkillHolder("bartonInfinity");
- if ((infinitySkill != null) && SkillCaster.checkUseConditions(npc, infinitySkill.getSkill()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
- addSkillCastDesire(npc, npc.getTarget(), infinitySkill, 23);
- }
- }
- else if ((npc.getCurrentHpPercent() < 50) && npc.isScriptValue(0))
- {
- final SkillHolder berserkerSkill = instParams.getSkillHolder("bartonBerserker");
- if ((berserkerSkill != null) && !npc.isAffectedBySkill(berserkerSkill.getSkillId()) && SkillCaster.checkUseConditions(npc, berserkerSkill.getSkill()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAAAAAAAAHHHHHH);
- addSkillCastDesire(npc, npc.getTarget(), berserkerSkill, 23);
- getTimers().addTimer("RESTORE_SCRIPTVAL", 10000, n -> npc.setScriptValue(0));
- }
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
}
}
}
@@ -180,6 +249,7 @@ public final class KartiaHelperBarton extends AbstractNpcAI
if (world != null)
{
getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
}
}
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java
index a667ca8510..f1d14df41b 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java
@@ -16,8 +16,15 @@
*/
package instances.KartiasLabyrinth;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.enums.InstanceType;
+import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
@@ -34,8 +41,8 @@ import com.l2jmobius.gameserver.util.Util;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Elise AI.
- * @author St3eT
+ * Kartia Helper Elise AI. Healer
+ * @author flanagak
*/
public final class KartiaHelperElise extends AbstractNpcAI
{
@@ -70,9 +77,27 @@ public final class KartiaHelperElise extends AbstractNpcAI
33624, // Hayuk (Kartia 90)
33635, // Hayuk (Kartia 95)
};
- private static final int HEALING_TREE = 19256;
- // Skill
- private static final SkillHolder TREE_HEAL_SKILL = new SkillHolder(15003, 1); // Summon Tree of Life - NPC
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -95,167 +120,124 @@ public final class KartiaHelperElise extends AbstractNpcAI
if ((instance != null) && event.equals("CHECK_ACTION"))
{
final StatsSet npcVars = npc.getVariables();
- final StatsSet instParams = instance.getTemplateParameters();
-
- player = npcVars.getObject("PLAYER_OBJECT", L2PcInstance.class);
final FriendlyNpcInstance adolph = npcVars.getObject("ADOLPH_OBJECT", FriendlyNpcInstance.class);
- final FriendlyNpcInstance barton = npcVars.getObject("BARTON_OBJECT", FriendlyNpcInstance.class);
- final FriendlyNpcInstance eliyah = npcVars.getObject("ELIYAH_OBJECT", FriendlyNpcInstance.class);
- final FriendlyNpcInstance hayuk = npcVars.getObject("HAYUK_OBJECT", FriendlyNpcInstance.class);
-
- if ((player != null) && !player.isDead() && ((player.getCurrentHpPercent() < 75) || (player.getCurrentMpPercent() < 30)))
+ if (!npc.isCastingNow())
{
- final int hpPer = player.getCurrentHpPercent();
- if ((hpPer < 40) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, player);
- }
- else if (hpPer < 60)
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, player, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- else if (hpPer < 75)
- {
- final SkillHolder healSkill = instParams.getSkillHolder("eliseHeal");
- if (healSkill != null)
- {
- addSkillCastDesire(npc, player, healSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- else if (player.getCurrentMpPercent() < 30)
- {
- final SkillHolder rechargeSkill = instParams.getSkillHolder("eliseRecharge");
- if (rechargeSkill != null)
- {
- addSkillCastDesire(npc, player, rechargeSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.MEN_FOCUS_CHARGING_COMPLETE);
- }
- }
+ healFriends(npc, player);
}
- else if ((adolph != null) && !adolph.isDead() && (adolph.getCurrentHpPercent() < 75))
- {
- final int hpPer = adolph.getCurrentHpPercent();
- if ((hpPer < 40) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, adolph);
- }
- else if (hpPer < 60)
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, adolph, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- else
- {
- final SkillHolder healSkill = instParams.getSkillHolder("eliseHeal");
- if (healSkill != null)
- {
- addSkillCastDesire(npc, adolph, healSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if ((barton != null) && !barton.isDead() && (barton.getCurrentHpPercent() < 60))
- {
- final int hpPer = barton.getCurrentHpPercent();
- if ((hpPer < 30) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, barton);
- }
- else
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, barton, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if ((eliyah != null) && !eliyah.isDead() && (eliyah.getCurrentHpPercent() < 60))
- {
- final int hpPer = eliyah.getCurrentHpPercent();
- if ((hpPer < 30) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, eliyah);
- }
- else
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, eliyah, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if ((hayuk != null) && !hayuk.isDead() && (hayuk.getCurrentHpPercent() < 60))
- {
- final int hpPer = hayuk.getCurrentHpPercent();
- if ((hpPer < 30) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, hayuk);
- }
- else
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, hayuk, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if (adolph != null)
+ if (adolph != null)
{
final double distance = npc.calculateDistance(adolph, false, false);
- if (distance > 200)
+ if (distance > 300)
{
- final Location loc = new Location(adolph.getX() + getRandom(-100, 100), adolph.getY() + getRandom(-100, 100), adolph.getZ() + 50);
- if (distance > 500)
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
{
npc.teleToLocation(loc);
}
else
{
npc.setRunning();
- addMoveToDesire(npc, loc, 23);
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ }
+ npc.setTarget(npc);
+ }
+ }
+
+ private void healFriends(L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if (instance != null)
+ {
+ final StatsSet npcVars = npc.getVariables();
+ final StatsSet instParams = instance.getTemplateParameters();
+ if (!npc.isCastingNow())
+ {
+ player = npcVars.getObject("PLAYER_OBJECT", L2PcInstance.class);
+ final SkillHolder progressiveHeal = instParams.getSkillHolder("eliseProgressiveHeal"); // AOE heal
+ final SkillHolder radiantHeal = instParams.getSkillHolder("eliseRadiantHeal"); // Single target heal
+ final SkillHolder recharge = instParams.getSkillHolder("eliseRecharge");
+
+ // Get HP percentage for all friends
+ final Map hpMap = new HashMap<>();
+ instance.getAliveNpcs(KARTIA_FRIENDS).forEach(friend -> hpMap.put(friend, friend != null ? friend.getCurrentHpPercent() : 100));
+ hpMap.put(player, player != null ? player.getCurrentHpPercent() : 100);
+ Map sortedHpMap = new HashMap<>();
+ sortedHpMap = Util.sortByValue(hpMap, false);
+
+ // See if any friends are below 80% HP and add to list of people to heal.
+ final List peopleToHeal = new ArrayList<>();
+ for (L2Object friend : sortedHpMap.keySet())
+ {
+ if ((friend != null) && (sortedHpMap.get(friend) < 80) && (sortedHpMap.get(friend) > 1))
+ {
+ peopleToHeal.add(friend);
+ }
+ }
+
+ if (peopleToHeal.size() > 0)
+ {
+ // At least one friend was below 80% HP.
+ if (peopleToHeal.size() > 1)
+ {
+ // Helper NPC AOE skills affecting monsters so skill power has set to 0.
+ // Using skill is just for animation. Need to heal each NPC/Player manually.
+ npc.setTarget(npc);
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
+ npc.doCast(progressiveHeal.getSkill(), null, true, false);
+ npc.setTarget(npc);
+ for (L2Object personToHeal : peopleToHeal)
+ {
+ if (personToHeal.getInstanceType() == InstanceType.L2PcInstance)
+ {
+ L2PcInstance thePlayer = (L2PcInstance) personToHeal;
+ thePlayer.setCurrentHp((thePlayer.getMaxHp() * .20) + thePlayer.getCurrentHp());
+ }
+ else
+ {
+ L2Npc npcToHeal = (L2Npc) personToHeal;
+ npcToHeal.setCurrentHp((npcToHeal.getMaxHp() * .20) + npcToHeal.getCurrentHp());
+ }
+ }
+ }
+ else
+ {
+ // Only one person needs cure. Cast single target heal
+ for (L2Object personToHeal : peopleToHeal)
+ {
+ npc.setTarget(personToHeal);
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
+ npc.doCast(radiantHeal.getSkill(), null, true, false);
+ npc.setTarget(npc);
+ }
+ }
+ }
+ else
+ {
+ // No one needs healing. Check if player character needs recharge.
+ if ((player != null) && !player.isDead() && (player.getCurrentMpPercent() < 50))
+ {
+ npc.setTarget(player);
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ELECTRIFYING_RECHARGE);
+ npc.doCast(recharge.getSkill(), null, true, false);
+ npc.setTarget(npc);
}
}
}
}
+
}
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
- {
- instance.getAliveNpcs(KARTIA_ELISE).forEach(elise -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, elise, null));
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("eliseTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_ELISE).forEach(elise -> elise.teleToLocation(loc));
- }
- break;
- }
+ instance.getAliveNpcs(KARTIA_ELISE).forEach(elise -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, elise, null));
}
}
@@ -297,18 +279,10 @@ public final class KartiaHelperElise extends AbstractNpcAI
if (world != null)
{
getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
}
}
- private void summonHealingTree(L2Npc npc, L2Character target)
- {
- npc.getVariables().set("CAN_USE_TREE", false);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.COME_FORTH_TREE_OF_LIFE);
- final L2Npc tree = addSpawn(HEALING_TREE, Util.getRandomPosition(target, 20, 50), false, 0, false, npc.getInstanceId());
- getTimers().addTimer("TREE_REUSE", 10000, evnt -> npc.getVariables().set("CAN_USE_TREE", true));
- getTimers().addTimer("TREE_HEAL", 3000, evnt -> addSkillCastDesire(tree, target, TREE_HEAL_SKILL, 23));
- }
-
public static void main(String[] args)
{
new KartiaHelperElise();
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java
index 80d3710a94..0b64d51602 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java
@@ -16,15 +16,23 @@
*/
package instances.KartiasLabyrinth;
+import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.model.Location;
+import com.l2jmobius.gameserver.model.StatsSet;
+import com.l2jmobius.gameserver.model.actor.L2Character;
+import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.FriendlyNpcInstance;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureAttacked;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Eliyah AI.
- * @author St3eT
+ * Kartia Helper Eliyah AI. Summoner
+ * @author flanagak
*/
public final class KartiaHelperEliyah extends AbstractNpcAI
{
@@ -35,6 +43,33 @@ public final class KartiaHelperEliyah extends AbstractNpcAI
33626, // Eliyah (Kartia 90)
33637, // Eliyah (Kartia 95)
};
+ private static final int[] KARTIA_ADOLPH =
+ {
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ };
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -45,33 +80,101 @@ public final class KartiaHelperEliyah extends AbstractNpcAI
private KartiaHelperEliyah()
{
+ setCreatureKillId(this::onCreatureKill, KARTIA_ELIYAH);
+ setCreatureAttackedId(this::onCreatureAttacked, KARTIA_ELIYAH);
+ addSeeCreatureId(KARTIA_ELIYAH);
setInstanceStatusChangeId(this::onInstanceStatusChange, KARTIA_SOLO_INSTANCES);
}
+ @Override
+ public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && event.equals("CHECK_ACTION"))
+ {
+ final FriendlyNpcInstance adolph = npc.getVariables().getObject("ADOLPH_OBJECT", FriendlyNpcInstance.class);
+ if (adolph != null)
+ {
+ final double distance = npc.calculateDistance(adolph, false, false);
+ if (distance > 300)
+ {
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
+ {
+ npc.teleToLocation(loc);
+ }
+ else
+ {
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final L2Character monster = (L2Character) adolph.getTarget();
+ if ((monster != null) && adolph.isInCombat() && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ npc.setTarget(monster);
+ }
+ }
+ }
+ }
+ }
+
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
+ instance.getAliveNpcs(KARTIA_ELIYAH).forEach(eliyah -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, eliyah, null));
+ if ((instance.getAliveNpcs(KARTIA_ELIYAH) != null) && (instance.getAliveNpcs(KARTIA_ELIYAH).size() > 0))
{
- // Nothing for now
- break;
+ instance.spawnGroup("GUARDIANS");
}
- case 2:
- case 3:
+ }
+ }
+
+ @Override
+ public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
+ {
+ if (creature.isPlayer())
+ {
+ npc.getVariables().set("PLAYER_OBJECT", creature.getActingPlayer());
+ }
+ else if (CommonUtil.contains(KARTIA_ADOLPH, creature.getId()))
+ {
+ npc.getVariables().set("ADOLPH_OBJECT", creature);
+ }
+ return super.onSeeCreature(npc, creature, isSummon);
+ }
+
+ public void onCreatureAttacked(OnCreatureAttacked event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ if (npc != null)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
{
- final Location loc = instance.getTemplateParameters().getLocation("eliyahTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_ELIYAH).forEach(eliyah -> eliyah.teleToLocation(loc));
- }
- break;
+ npc.setTarget(event.getAttacker());
}
}
}
+ public void onCreatureKill(OnCreatureDeath event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ final Instance world = npc.getInstanceWorld();
+ if (world != null)
+ {
+ getTimers().cancelTimersOf(npc);
+ world.despawnGroup("GUARDIANS");
+ npc.doDie(event.getAttacker());
+ }
+ }
+
public static void main(String[] args)
{
new KartiaHelperEliyah();
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperGuardian.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperGuardian.java
new file mode 100644
index 0000000000..0cc90ab787
--- /dev/null
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperGuardian.java
@@ -0,0 +1,237 @@
+/*
+ * 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 .
+ */
+package instances.KartiasLabyrinth;
+
+import com.l2jmobius.commons.util.CommonUtil;
+import com.l2jmobius.gameserver.model.Location;
+import com.l2jmobius.gameserver.model.StatsSet;
+import com.l2jmobius.gameserver.model.actor.L2Character;
+import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.FriendlyNpcInstance;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureAttacked;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
+import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
+import com.l2jmobius.gameserver.model.holders.SkillHolder;
+import com.l2jmobius.gameserver.model.instancezone.Instance;
+import com.l2jmobius.gameserver.model.skills.SkillCaster;
+
+import ai.AbstractNpcAI;
+
+/**
+ * Kartia Helper Eliyah's Guardian Spirit
+ * @author flanagak *
+ */
+public final class KartiaHelperGuardian extends AbstractNpcAI
+{
+ // NPCs
+ private static final int[] KARTIA_ELIYAH =
+ {
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ };
+ private static final int[] KARTIA_ADOLPH =
+ {
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ };
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
+ private static final int[] KARTIA_GUARDIANS =
+ {
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
+ // Misc
+ private static final int[] KARTIA_SOLO_INSTANCES =
+ {
+ 205, // Solo 85
+ 206, // Solo 90
+ 207, // Solo 95
+ };
+
+ private KartiaHelperGuardian()
+ {
+ setCreatureKillId(this::onCreatureKill, KARTIA_GUARDIANS);
+ setCreatureAttackedId(this::onCreatureAttacked, KARTIA_GUARDIANS);
+ addSeeCreatureId(KARTIA_GUARDIANS);
+ setInstanceStatusChangeId(this::onInstanceStatusChange, KARTIA_SOLO_INSTANCES);
+ }
+
+ @Override
+ public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && event.equals("CHECK_ACTION"))
+ {
+ final FriendlyNpcInstance eliyah = npc.getVariables().getObject("ELIYAH_OBJECT", FriendlyNpcInstance.class);
+ if (eliyah != null)
+ {
+ final double distance = npc.calculateDistance(eliyah, false, false);
+ if (distance > 300)
+ {
+ final Location loc = new Location(eliyah.getX(), eliyah.getY(), eliyah.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-50, 50), loc.getY() + getRandom(-50, 50), loc.getZ());
+ if (distance > 600)
+ {
+ npc.teleToLocation(loc);
+ }
+ else
+ {
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final L2Character monster = (L2Character) eliyah.getTarget();
+ if ((monster != null) && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ addAttackDesire(npc, monster);
+ }
+ }
+ }
+ }
+ else if ((instance != null) && event.equals("USE_SKILL"))
+ {
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
+ {
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
+ }
+
+ public void onInstanceStatusChange(OnInstanceStatusChange event)
+ {
+ final Instance instance = event.getWorld();
+ final int status = event.getStatus();
+ if (status == 1)
+ {
+ instance.getAliveNpcs(KARTIA_GUARDIANS).forEach(guardian -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, guardian, null));
+ instance.getAliveNpcs(KARTIA_GUARDIANS).forEach(guardian -> getTimers().addRepeatingTimer("USE_SKILL", 6000, guardian, null));
+ }
+ }
+
+ @Override
+ public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
+ {
+ if (creature.isPlayer())
+ {
+ npc.getVariables().set("PLAYER_OBJECT", creature.getActingPlayer());
+ }
+ else if (CommonUtil.contains(KARTIA_ADOLPH, creature.getId()))
+ {
+ npc.getVariables().set("ADOLPH_OBJECT", creature);
+ }
+ else if (CommonUtil.contains(KARTIA_ELIYAH, creature.getId()))
+ {
+ npc.getVariables().set("ELIYAH_OBJECT", creature);
+ }
+ return super.onSeeCreature(npc, creature, isSummon);
+ }
+
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("guardianSpiritsBlow");
+ final SkillHolder skill_02 = instParams.getSkillHolder("guardianSpiritsWrath");
+ final int numberOfActiveSkills = 2;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ switch (randomSkill)
+ {
+ case 0:
+ case 1:
+ {
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ public void onCreatureAttacked(OnCreatureAttacked event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ if (npc != null)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !npc.isInCombat() && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
+ {
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
+ }
+ }
+ }
+
+ public void onCreatureKill(OnCreatureDeath event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ final Instance world = npc.getInstanceWorld();
+ if (world != null)
+ {
+ getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ new KartiaHelperGuardian();
+ }
+
+}
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java
index be412bb83b..12d10d91c1 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java
@@ -16,25 +16,65 @@
*/
package instances.KartiasLabyrinth;
+import com.l2jmobius.commons.util.CommonUtil;
+import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.Location;
+import com.l2jmobius.gameserver.model.StatsSet;
+import com.l2jmobius.gameserver.model.actor.L2Character;
+import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.FriendlyNpcInstance;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureAttacked;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
+import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.instancezone.Instance;
+import com.l2jmobius.gameserver.model.skills.SkillCaster;
+import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Hayuk AI.
- * @author St3eT
+ * Kartia Helper Hayuk AI. Archer
+ * @author flanagak
*/
public final class KartiaHelperHayuk extends AbstractNpcAI
{
// NPCs
+ private static final int[] KARTIA_ADOLPH =
+ {
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ };
private static final int[] KARTIA_HAYUK =
{
33613, // Hayuk (Kartia 85)
33624, // Hayuk (Kartia 90)
33635, // Hayuk (Kartia 95)
};
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
+
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -45,33 +85,155 @@ public final class KartiaHelperHayuk extends AbstractNpcAI
private KartiaHelperHayuk()
{
+ setCreatureKillId(this::onCreatureKill, KARTIA_HAYUK);
+ setCreatureAttackedId(this::onCreatureAttacked, KARTIA_HAYUK);
+ addSeeCreatureId(KARTIA_HAYUK);
setInstanceStatusChangeId(this::onInstanceStatusChange, KARTIA_SOLO_INSTANCES);
}
+ @Override
+ public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && event.equals("CHECK_ACTION"))
+ {
+ final FriendlyNpcInstance adolph = npc.getVariables().getObject("ADOLPH_OBJECT", FriendlyNpcInstance.class);
+ if (adolph != null)
+ {
+ final double distance = npc.calculateDistance(adolph, false, false);
+ if (distance > 300)
+ {
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
+ {
+ npc.teleToLocation(loc);
+ }
+ else
+ {
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final L2Character monster = (L2Character) adolph.getTarget();
+ if ((monster != null) && adolph.isInCombat() && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ addAttackDesire(npc, monster);
+ }
+ }
+ }
+ }
+ else if ((instance != null) && event.equals("USE_SKILL"))
+ {
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
+ {
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
+ }
+
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
+ instance.getAliveNpcs(KARTIA_HAYUK).forEach(hayuk -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, hayuk, null));
+ instance.getAliveNpcs(KARTIA_HAYUK).forEach(hayuk -> getTimers().addRepeatingTimer("USE_SKILL", 6000, hayuk, null));
+ }
+ }
+
+ @Override
+ public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
+ {
+ if (creature.isPlayer())
+ {
+ npc.getVariables().set("PLAYER_OBJECT", creature.getActingPlayer());
+ }
+ else if (CommonUtil.contains(KARTIA_ADOLPH, creature.getId()))
+ {
+ npc.getVariables().set("ADOLPH_OBJECT", creature);
+ }
+ return super.onSeeCreature(npc, creature, isSummon);
+ }
+
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("hayukPinpointShot");
+ final SkillHolder skill_02 = instParams.getSkillHolder("hayukRecoilShot");
+ final SkillHolder skill_03 = instParams.getSkillHolder("hayukMultipleArrow");
+ final int numberOfActiveSkills = 3;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ switch (randomSkill)
{
- // Nothing for now
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("hayukTeleportStatus" + status);
- if (loc != null)
+ case 0:
+ case 1:
{
- instance.getAliveNpcs(KARTIA_HAYUK).forEach(hayuk -> hayuk.teleToLocation(loc));
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 3:
+ {
+ if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
+ npc.doCast(skill_03.getSkill(), null, true, false);
+ }
+ break;
}
- break;
}
}
}
+ public void onCreatureAttacked(OnCreatureAttacked event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ if (npc != null)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !npc.isInCombat() && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
+ {
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
+ }
+ }
+ }
+
+ public void onCreatureKill(OnCreatureDeath event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ final Instance world = npc.getInstanceWorld();
+ if (world != null)
+ {
+ getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
+ }
+ }
+
public static void main(String[] args)
{
new KartiaHelperHayuk();
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java
index b633afc228..fbb7d13161 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java
@@ -19,13 +19,16 @@ package instances.KartiasLabyrinth;
import java.util.List;
import com.l2jmobius.commons.util.CommonUtil;
+import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.instancemanager.WalkingManager;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureSee;
@@ -47,7 +50,7 @@ import quests.Q00499_IncarnationOfGluttonyKaliosSolo.Q00499_IncarnationOfGlutton
/**
* Kartia Labyrinth instance zone.
- * @author St3eT
+ * @author flanagak
*/
public final class KartiasLabyrinth extends AbstractInstance
{
@@ -84,17 +87,27 @@ public final class KartiasLabyrinth extends AbstractInstance
33623,
33634,
};
- // @formatter:off
private static final int[] MONSTERS =
{
- 19220, 19221, 19222, // Solo 85
- 19223, 19224, 19225, // Solo 90
- 19226, 19227, 19228, // Solo 95
- 19229, 19230, 19231, // Group 85
- 19232, 19233, 19234, // Group 90
- 19235, 19236, 19237, // Group 95
+ 19220,
+ 19221,
+ 19222, // Solo 85
+ 19223,
+ 19224,
+ 19225, // Solo 90
+ 19226,
+ 19227,
+ 19228, // Solo 95
+ 19229,
+ 19230,
+ 19231, // Group 85
+ 19232,
+ 19233,
+ 19234, // Group 90
+ 19235,
+ 19236,
+ 19237, // Group 95
};
- // @formatter:on
private static final int[] BOSSES =
{
19253, // Zellaka (Solo 85)
@@ -134,19 +147,10 @@ public final class KartiasLabyrinth extends AbstractInstance
// Zones
private static final int KARTIA_85_DETECT_1 = 12020;
private static final int KARTIA_85_DETECT_2 = 12021;
- // private static final int KARTIA_85_TELEPORT_1 = 12022;
- // private static final int KARTIA_85_TELEPORT_2 = 12023;
- // private static final int KARTIA_85_TELEPORT_3 = 12024;
private static final int KARTIA_90_DETECT_1 = 12025;
private static final int KARTIA_90_DETECT_2 = 12026;
- // private static final int KARTIA_90_TELEPORT_1 = 12027;
- // private static final int KARTIA_90_TELEPORT_2 = 12028;
- // private static final int KARTIA_90_TELEPORT_3 = 12029;
private static final int KARTIA_95_DETECT_1 = 12030;
private static final int KARTIA_95_DETECT_2 = 12031;
- // private static final int KARTIA_95_TELEPORT_1 = 12032;
- // private static final int KARTIA_95_TELEPORT_2 = 12033;
- // private static final int KARTIA_95_TELEPORT_3 = 12034;
// Misc
private static final int TEMPLATE_ID_SOLO_85 = 205;
private static final int TEMPLATE_ID_SOLO_90 = 206;
@@ -154,6 +158,22 @@ public final class KartiasLabyrinth extends AbstractInstance
private static final int TEMPLATE_ID_GROUP_85 = 208;
private static final int TEMPLATE_ID_GROUP_90 = 209;
private static final int TEMPLATE_ID_GROUP_95 = 210;
+ private static final long WAVE_DEALY = 30000;
+ private static final long WAVE_MONITOR_DELAY = 3000;
+ // Solo instance XP reward values
+ private static final int SOLO_BASE_EXP_85 = 480000000;
+ private static final int SOLO_RAND_EXP_85 = 8055934;
+ private static final int SOLO_BASE_EXP_90 = 670000000;
+ private static final int SOLO_RAND_EXP_90 = 6173918;
+ private static final int SOLO_BASE_EXP_95 = 970000000;
+ private static final int SOLO_RAND_EXP_95 = 6305195;
+ // Solo instance SP reward values
+ private static final int SOLO_BASE_SP_85 = 3800000;
+ private static final int SOLO_RAND_SP_85 = 73460;
+ private static final int SOLO_BASE_SP_90 = 5600000;
+ private static final int SOLO_RAND_SP_90 = 82134;
+ private static final int SOLO_BASE_SP_95 = 8500000;
+ private static final int SOLO_RAND_SP_95 = 39112;
public KartiasLabyrinth()
{
@@ -177,9 +197,9 @@ public final class KartiasLabyrinth extends AbstractInstance
setCreatureKillId(this::onCreatureKill, MONSTERS);
setCreatureKillId(this::onBossKill, BOSSES);
setCreatureSeeId(this::onCreatureSee, MONSTERS);
- addEnterZoneId(KARTIA_85_DETECT_1, KARTIA_85_DETECT_2 /* , KARTIA_85_TELEPORT_1, KARTIA_85_TELEPORT_2, KARTIA_85_TELEPORT_3 */);
- addEnterZoneId(KARTIA_90_DETECT_1, KARTIA_90_DETECT_2 /* , KARTIA_90_TELEPORT_1, KARTIA_90_TELEPORT_2, KARTIA_90_TELEPORT_3 */);
- addEnterZoneId(KARTIA_95_DETECT_1, KARTIA_95_DETECT_2 /* , KARTIA_95_TELEPORT_1, KARTIA_95_TELEPORT_2, KARTIA_95_TELEPORT_3 */);
+ addEnterZoneId(KARTIA_85_DETECT_1, KARTIA_85_DETECT_2);
+ addEnterZoneId(KARTIA_90_DETECT_1, KARTIA_90_DETECT_2);
+ addEnterZoneId(KARTIA_95_DETECT_1, KARTIA_95_DETECT_2);
addInstanceCreatedId(TEMPLATE_ID_SOLO_85, TEMPLATE_ID_SOLO_90, TEMPLATE_ID_SOLO_95, TEMPLATE_ID_GROUP_85, TEMPLATE_ID_GROUP_90, TEMPLATE_ID_GROUP_95);
}
@@ -197,33 +217,63 @@ public final class KartiasLabyrinth extends AbstractInstance
}
case "request_zellaka_solo":
{
- enterInstance(player, npc, TEMPLATE_ID_SOLO_85);
- return null;
+ final QuestState qs = player.getQuestState(Q00497_IncarnationOfGreedZellakaSolo.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_SOLO_85);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_pelline_solo":
{
- enterInstance(player, npc, TEMPLATE_ID_SOLO_90);
- return null;
+ final QuestState qs = player.getQuestState(Q00498_IncarnationOfJealousyPellineSolo.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_SOLO_90);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_kalios_solo":
{
- enterInstance(player, npc, TEMPLATE_ID_SOLO_95);
- return null;
+ final QuestState qs = player.getQuestState(Q00499_IncarnationOfGluttonyKaliosSolo.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_SOLO_95);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_zellaka_party":
{
- enterInstance(player, npc, TEMPLATE_ID_GROUP_85);
- return null;
+ final QuestState qs = player.getQuestState(Q00494_IncarnationOfGreedZellakaGroup.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_GROUP_85);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_pelline_party":
{
- enterInstance(player, npc, TEMPLATE_ID_GROUP_90);
- return null;
+ final QuestState qs = player.getQuestState(Q00495_IncarnationOfJealousyPellineGroup.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_GROUP_90);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_kalios_party":
{
- enterInstance(player, npc, TEMPLATE_ID_GROUP_95);
- return null;
+ final QuestState qs = player.getQuestState(Q00496_IncarnationOfGluttonyKaliosGroup.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_GROUP_95);
+ return null;
+ }
+ return "33647-9.htm";
}
default:
{
@@ -280,16 +330,18 @@ public final class KartiasLabyrinth extends AbstractInstance
{
if (npc != null)
{
- if (npc.getInstanceWorld().getParameters().getInt("ROOM", 1) <= 2)
+ if (npc.getInstanceWorld().getParameters().getInt("ROOM", 1) < 2)
{
+ // Move mobs in Room 1 to the middle at top of the steps. Add timer to start moving towards prisoners.
final Location loc = instance.getTemplateParameters().getLocation("middlePointRoom1");
final Location moveTo = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
npc.setRunning();
addMoveToDesire(npc, moveTo, 6);
- getTimers().addTimer("START_MOVE", 15000, npc, null);
+ getTimers().addTimer("START_MOVE", 12000, npc, null);
}
else if (npc.getInstanceWorld().getParameters().getInt("ROOM", 1) == 3)
{
+ // Move mobs in Room 3 towards center of room.
final Location loc = instance.getTemplateParameters().getLocation("middlePointRoom3");
final Location moveTo = new Location(loc.getX() + getRandom(-200, 200), loc.getY() + getRandom(-200, 200), loc.getZ());
npc.setRunning();
@@ -302,18 +354,8 @@ public final class KartiasLabyrinth extends AbstractInstance
{
if (npc != null)
{
- WalkingManager.getInstance().startMoving(npc, instance.getTemplateParameters().getString(getRandomBoolean() ? "route1" : "route2"));
- getTimers().addTimer("CHANGE_TARGETABLE_STATUS", 5000, npc, null);
- }
- break;
- }
- case "CHANGE_TARGETABLE_STATUS":
- {
- if (npc != null)
- {
- npc.setTargetable(true);
- final L2PcInstance randomPlayer = instance.getPlayers().stream().findAny().get();
- npc.moveToLocation(randomPlayer.getX(), randomPlayer.getY(), randomPlayer.getZ(), 10);
+ final String selectedRoute = (getRandomBoolean() ? "route1_" : "route2_") + Integer.toString(getRandom(1, 3));
+ WalkingManager.getInstance().startMoving(npc, instance.getTemplateParameters().getString(selectedRoute));
}
break;
}
@@ -346,7 +388,6 @@ public final class KartiasLabyrinth extends AbstractInstance
});
- instance.getParameters().set("TELEPORT_1_ENABLED", true);
if (!isSoloKartia(instance))
{
getTimers().addTimer("CALL_PROGRESS", 2500, n -> manageProgressInInstance(instance));
@@ -375,6 +416,20 @@ public final class KartiasLabyrinth extends AbstractInstance
}
}
+ private void manageWaves(Instance instance)
+ {
+ if ((instance != null) && instance.getAliveNpcs(MONSTERS).isEmpty())
+ {
+ getTimers().cancelTimers("NEXT_WAVE_DELAY");
+ getTimers().cancelTimers("MONITOR_WAVE");
+ getTimers().addTimer("CALL_PROGRESS", 5000, n -> manageProgressInInstance(instance));
+ }
+ else
+ {
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
+ }
+ }
+
public void onBossKill(OnCreatureDeath event)
{
final L2Npc npc = (L2Npc) event.getTarget();
@@ -384,80 +439,29 @@ public final class KartiasLabyrinth extends AbstractInstance
{
if (isSoloKartia(instance))
{
- final StatsSet tempParam = instance.getTemplateParameters();
- final int xp = tempParam.getInt("soloEXP");
- final int xp_rnd = tempParam.getInt("SoloEXP_Rand");
- final int sp = tempParam.getInt("SoloSP");
- final int sp_rnd = tempParam.getInt("SoloSP_Rand");
-
- instance.getPlayers().forEach(player ->
+ final L2PcInstance player = instance.getFirstPlayer();
+ if (player != null)
{
- addExpAndSp(player, (xp + getRandom(xp_rnd)), (sp + getRandom(sp_rnd)));
- });
- }
-
- // Check Instance Quests.
- instance.getPlayers().forEach(player ->
- {
- switch (instance.getTemplateId())
- {
- case TEMPLATE_ID_SOLO_85:
+ switch (instance.getTemplateId())
{
- final QuestState qs = player.getQuestState(Q00497_IncarnationOfGreedZellakaSolo.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ case TEMPLATE_ID_SOLO_85:
{
- qs.setCond(2, true);
+ player.addExpAndSp(SOLO_BASE_EXP_85 + getRandom(SOLO_RAND_EXP_85), SOLO_BASE_SP_85 + getRandom(SOLO_RAND_SP_85));
+ break;
}
- break;
- }
- case TEMPLATE_ID_SOLO_90:
- {
- final QuestState qs = player.getQuestState(Q00498_IncarnationOfJealousyPellineSolo.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ case TEMPLATE_ID_SOLO_90:
{
- qs.setCond(2, true);
+ player.addExpAndSp(SOLO_BASE_EXP_90 + getRandom(SOLO_RAND_EXP_90), SOLO_BASE_SP_90 + getRandom(SOLO_RAND_SP_90));
+ break;
}
- break;
- }
- case TEMPLATE_ID_SOLO_95:
- {
- final QuestState qs = player.getQuestState(Q00499_IncarnationOfGluttonyKaliosSolo.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ case TEMPLATE_ID_SOLO_95:
{
- qs.setCond(2, true);
+ player.addExpAndSp(SOLO_BASE_EXP_95 + getRandom(SOLO_RAND_EXP_95), SOLO_BASE_SP_95 + getRandom(SOLO_RAND_SP_95));
+ break;
}
- break;
- }
- case TEMPLATE_ID_GROUP_85:
- {
- final QuestState qs = player.getQuestState(Q00494_IncarnationOfGreedZellakaGroup.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
- {
- qs.setCond(2, true);
- }
- break;
- }
- case TEMPLATE_ID_GROUP_90:
- {
- final QuestState qs = player.getQuestState(Q00495_IncarnationOfJealousyPellineGroup.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
- {
- qs.setCond(2, true);
- }
- break;
- }
- case TEMPLATE_ID_GROUP_95:
- {
- final QuestState qs = player.getQuestState(Q00496_IncarnationOfGluttonyKaliosGroup.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
- {
- qs.setCond(2, true);
- }
- break;
}
}
- });
-
+ }
instance.finishInstance();
}
}
@@ -475,8 +479,6 @@ public final class KartiasLabyrinth extends AbstractInstance
instance.setParameter("BOSS_CAN_ESCAPE", false);
npc.setScriptValue(1);
npc.broadcastSay(ChatType.NPC_SHOUT, NpcStringId.NOT_BAD_FOR_A_BUNCH_OF_HUMANS_I_M_LEAVING);
- npc.disableCoreAI(true);
- addMoveToDesire(npc, instance.getTemplateParameters().getLocation("bossEscapeLoc1"), 23);
}
}
else
@@ -503,7 +505,6 @@ public final class KartiasLabyrinth extends AbstractInstance
final Instance instance = character.getInstanceWorld();
if ((instance != null) && character.isPlayer())
{
- // final L2PcInstance player = character.getActingPlayer();
switch (zone.getId())
{
case KARTIA_85_DETECT_1:
@@ -532,11 +533,6 @@ public final class KartiasLabyrinth extends AbstractInstance
}
break;
}
- /*
- * case KARTIA_85_TELEPORT_1: case KARTIA_90_TELEPORT_1: case KARTIA_95_TELEPORT_1: { if (instance.getParameters().getBoolean("TELEPORT_1_ENABLED", false)) { player.teleToLocation(instance.getTemplateParameters().getLocation("teleportZone1_loc")); } break; } case
- * KARTIA_85_TELEPORT_2: case KARTIA_90_TELEPORT_2: case KARTIA_95_TELEPORT_2: { if (instance.getParameters().getBoolean("TELEPORT_2_ENABLED", false)) { player.teleToLocation(instance.getTemplateParameters().getLocation("teleportZone2_loc")); } break; } case KARTIA_85_TELEPORT_3:
- * case KARTIA_90_TELEPORT_3: case KARTIA_95_TELEPORT_3: { if (instance.getParameters().getBoolean("TELEPORT_3_ENABLED", false)) { player.teleToLocation(instance.getTemplateParameters().getLocation("teleportZone3_loc")); } break; }
- */
}
}
return super.onEnterZone(character, zone);
@@ -546,31 +542,15 @@ public final class KartiasLabyrinth extends AbstractInstance
public void onMoveFinished(L2Npc npc)
{
final Instance instance = npc.getInstanceWorld();
- if (instance != null)
+ if ((instance != null) && CommonUtil.contains(PRISONERS, npc.getId()))
{
- if (CommonUtil.contains(PRISONERS, npc.getId()))
+ if (npc.isScriptValue(0))
{
- if (npc.isScriptValue(0))
- {
- npc.setScriptValue(1);
- final Location moveTo = new Location(npc.getX() + getRandom(-500, 500), npc.getY() + getRandom(-500, 500), npc.getZ());
- addMoveToDesire(npc, moveTo, 23);
- }
- else
- {
- npc.deleteMe();
- }
+ final Location moveTo = new Location(npc.getX() + getRandom(-200, 200), npc.getY() + getRandom(-200, 200), npc.getZ());
+ addMoveToDesire(npc, moveTo, 23);
}
- else if (npc.isScriptValue(1))
+ else
{
- npc.setScriptValue(2);
- addMoveToDesire(npc, instance.getTemplateParameters().getLocation("bossEscapeLoc2"), 23);
- }
- else if (npc.isScriptValue(2))
- {
- instance.setParameter("MINIBOSS_SURVIVED", true);
- instance.openCloseDoor(instance.getTemplateParameters().getInt("thirdDoorId"), true);
- instance.setStatus(3); // Used for notify helper's AI
npc.deleteMe();
}
}
@@ -585,7 +565,7 @@ public final class KartiasLabyrinth extends AbstractInstance
{
final Location moveTo = new Location(npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ());
npc.setRandomWalking(true);
- addMoveToDesire(npc, moveTo, 0);
+ addMoveToDesire(npc, moveTo, 6);
}
}
@@ -608,6 +588,11 @@ public final class KartiasLabyrinth extends AbstractInstance
npc.setTargetable(false);
npc.setIsInvul(true);
}
+ else if (CommonUtil.contains(MONSTERS, npc.getId()) || CommonUtil.contains(MINI_BOSSES, npc.getId()))
+ {
+ npc.setTargetable(false);
+ npc.setIsInvul(true);
+ }
}
return super.onSpawn(npc);
}
@@ -632,14 +617,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE1_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE1_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -662,14 +649,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE2_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE2_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -692,14 +681,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE3_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE3_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -744,7 +735,7 @@ public final class KartiasLabyrinth extends AbstractInstance
}
break;
}
- case 4:
+ case 4: // Only used in group version of instance.
{
switch (wave)
{
@@ -753,14 +744,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE4_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE4_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -774,7 +767,7 @@ public final class KartiasLabyrinth extends AbstractInstance
}
break;
}
- case 5:
+ case 5: // Only used in group version of instance.
{
switch (wave)
{
@@ -783,7 +776,8 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE5_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
@@ -815,8 +809,7 @@ public final class KartiasLabyrinth extends AbstractInstance
}
else if (room == 2)
{
- instance.getParameters().set("TELEPORT_1_ENABLED", false);
- instance.setParameter("BOSS_CAN_ESCAPE", true);
+ instance.setParameter("BOSS_CAN_ESCAPE", false);
instance.setParameter("BOSS_KILL_OPEN_DOOR", true);
instance.spawnGroup("ROOM2_STAGE1_WAVE1");
instance.openCloseDoor(instance.getTemplateParameters().getInt("secondDoorId"), true);
@@ -909,24 +902,23 @@ public final class KartiasLabyrinth extends AbstractInstance
private void moveMonsters(List monsterList)
{
int delay = 500;
- for (L2Npc npc : monsterList)
+ for (L2Npc monster : monsterList)
{
- final Instance world = npc.getInstanceWorld();
- if (npc.isAttackable() && (world != null))
+ final Instance world = monster.getInstanceWorld();
+ if (monster.isAttackable() && (world != null))
{
if (world.getParameters().getInt("ROOM", 1) <= 2)
{
- npc.setRandomWalking(false);
- npc.setTargetable(false);
- getTimers().addTimer("MOVE_TO_MIDDLE", delay, npc, null);
+ monster.setRandomWalking(false);
+ getTimers().addTimer("MOVE_TO_MIDDLE", delay, monster, null);
delay += 250;
}
else if (world.getParameters().getInt("ROOM", 1) == 3)
{
- onTimerEvent("MOVE_TO_MIDDLE", null, npc, null);
+ onTimerEvent("MOVE_TO_MIDDLE", null, monster, null);
}
- ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
- npc.initSeenCreatures();
+ ((L2Attackable) monster).setCanReturnToSpawnPoint(false);
+ monster.initSeenCreatures();
}
}
}
@@ -937,10 +929,19 @@ public final class KartiasLabyrinth extends AbstractInstance
final L2Npc npc = (L2Npc) event.getSeer();
final Instance world = npc.getInstanceWorld();
- if ((world != null) && creature.isPlayer() && npc.isScriptValue(0))
+ if ((world != null) && (creature.isPlayer() || creature.getInstanceType().isType(InstanceType.FriendlyNpcInstance)) && npc.isScriptValue(0))
{
- npc.setScriptValue(1);
- addAttackDesire(npc, creature);
+ final double distance = npc.calculateDistance(creature, false, false);
+ if ((distance < 450) && !CommonUtil.contains(PRISONERS, creature.getId()))
+ {
+ npc.setTargetable(true);
+ npc.setIsInvul(false);
+ npc.setScriptValue(1);
+ WalkingManager.getInstance().cancelMoving(npc);
+ ((L2MonsterInstance) npc).addDamageHate(creature, 0, 1000);
+ npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
+ addAttackDesire(npc, creature);
+ }
}
}
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java
index 58760f2b2f..8b41bab529 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java
@@ -33,6 +33,8 @@ public class Q00494_IncarnationOfGreedZellakaGroup extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_KEEPER_BLUE_BOX = 34927;
+ // Boss
+ private static final int BOSS = 25882; // Zellaka (Group 85)
// Misc
private static final int MIN_LEVEL = 85;
private static final int MAX_LEVEL = 89;
@@ -42,6 +44,7 @@ public class Q00494_IncarnationOfGreedZellakaGroup extends Quest
super(494);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,21 @@ public class Q00494_IncarnationOfGreedZellakaGroup extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ executeForEachPlayer(player, npc, isSummon, true, false);
+ return super.onKill(npc, player, isSummon);
+ }
+
+ @Override
+ public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java
index e8ab074857..3ea2f7da89 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java
@@ -33,6 +33,8 @@ public class Q00495_IncarnationOfJealousyPellineGroup extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_KEEPER_RED_BOX = 34928;
+ // Boss
+ private static final int BOSS = 25883; // Pelline (Group 90)
// Misc
private static final int MIN_LEVEL = 90;
private static final int MAX_LEVEL = 94;
@@ -42,6 +44,7 @@ public class Q00495_IncarnationOfJealousyPellineGroup extends Quest
super(495);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,21 @@ public class Q00495_IncarnationOfJealousyPellineGroup extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ executeForEachPlayer(player, npc, isSummon, true, false);
+ return super.onKill(npc, player, isSummon);
+ }
+
+ @Override
+ public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java
index 89a9d09a7a..e7a6258abf 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java
@@ -33,6 +33,8 @@ public class Q00496_IncarnationOfGluttonyKaliosGroup extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_KEEPER_GOLDEN_BOX = 34929;
+ // Boss
+ private static final int BOSS = 25884; // Kalios (Group 95)
// Misc
private static final int MIN_LEVEL = 95;
private static final int MAX_LEVEL = 99;
@@ -42,6 +44,7 @@ public class Q00496_IncarnationOfGluttonyKaliosGroup extends Quest
super(496);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,21 @@ public class Q00496_IncarnationOfGluttonyKaliosGroup extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ executeForEachPlayer(player, npc, isSummon, true, false);
+ return super.onKill(npc, player, isSummon);
+ }
+
+ @Override
+ public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java
index 9905030179..6e089781b2 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java
@@ -33,6 +33,8 @@ public class Q00497_IncarnationOfGreedZellakaSolo extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_TRAVELERS_BLUE_BOX = 34930;
+ // Boss
+ private static final int BOSS = 19253; // Zellaka (Solo 85)
// Misc
private static final int MIN_LEVEL = 85;
private static final int MAX_LEVEL = 89;
@@ -42,6 +44,7 @@ public class Q00497_IncarnationOfGreedZellakaSolo extends Quest
super(497);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,15 @@ public class Q00497_IncarnationOfGreedZellakaSolo extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ return super.onKill(npc, player, isSummon);
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java
index cab1faa0cd..ce0d861ab5 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java
@@ -33,6 +33,8 @@ public class Q00498_IncarnationOfJealousyPellineSolo extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_TRAVELERS_RED_BOX = 34931;
+ // Boss
+ private static final int BOSS = 19254; // Pelline (Solo 90)
// Misc
private static final int MIN_LEVEL = 90;
private static final int MAX_LEVEL = 94;
@@ -42,6 +44,7 @@ public class Q00498_IncarnationOfJealousyPellineSolo extends Quest
super(498);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,15 @@ public class Q00498_IncarnationOfJealousyPellineSolo extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ return super.onKill(npc, player, isSummon);
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java
index d0f4108998..9ab232f31a 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java
@@ -33,6 +33,8 @@ public class Q00499_IncarnationOfGluttonyKaliosSolo extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_TRAVELERS_GOLDEN_BOX = 34932;
+ // Boss
+ private static final int BOSS = 19255; // Kalios (Solo 95)
// Misc
private static final int MIN_LEVEL = 95;
private static final int MAX_LEVEL = 99;
@@ -42,6 +44,7 @@ public class Q00499_IncarnationOfGluttonyKaliosSolo extends Quest
super(499);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,15 @@ public class Q00499_IncarnationOfGluttonyKaliosSolo extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ return super.onKill(npc, player, isSummon);
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/19200-19299.xml b/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/19200-19299.xml
index 390650ecf3..7a7ddabc8c 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/19200-19299.xml
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/19200-19299.xml
@@ -636,7 +636,7 @@
-
+
UNDEAD
@@ -2011,7 +2011,7 @@
DEMONIC
MALE
-
+
@@ -2057,7 +2057,7 @@
DEMONIC
MALE
-
+
@@ -2104,7 +2104,7 @@
DEMONIC
MALE
-
+
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/25800-25899.xml b/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/25800-25899.xml
index 62c4c0d57a..d583c85905 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/25800-25899.xml
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/25800-25899.xml
@@ -3682,10 +3682,10 @@
DEMONIC
MALE
-
+
-
+
@@ -3708,66 +3708,86 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3793,10 +3813,10 @@
DEMONIC
MALE
-
+
-
+
@@ -3825,66 +3845,86 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3905,10 +3945,10 @@
DEMONIC
MALE
-
+
-
+
@@ -3937,67 +3977,92 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/14800-14899.xml b/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/14800-14899.xml
index c043df30c4..723beaff50 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/14800-14899.xml
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/14800-14899.xml
@@ -1090,7 +1090,7 @@
icon.skill10016
- A2
+ A1
600
500
1000
@@ -1112,8 +1112,7 @@
10-10
true
ENEMY
- RANGE
- NOT_FRIEND
+ SINGLE
600
@@ -1128,7 +1127,7 @@
icon.skill10016
- A2
+ A1
600
500
1000
@@ -1150,8 +1149,7 @@
10-10
true
ENEMY
- RANGE
- NOT_FRIEND
+ SINGLE
600
@@ -1166,7 +1164,7 @@
icon.skill10016
- A2
+ A1
600
500
1000
@@ -1188,8 +1186,7 @@
10-10
true
ENEMY
- RANGE
- NOT_FRIEND
+ SINGLE
600
@@ -1351,7 +1348,7 @@
0;0;150;180
STUN
true
- SELF
+ ENEMY
SINGLE
@@ -1387,7 +1384,7 @@
0;0;150;180
STUN
true
- SELF
+ ENEMY
SINGLE
@@ -1423,7 +1420,7 @@
0;0;150;180
STUN
true
- SELF
+ ENEMY
SINGLE
@@ -2709,7 +2706,6 @@
true
TARGET
SINGLE
- NOT_FRIEND
@@ -2738,7 +2734,6 @@
true
TARGET
SINGLE
- NOT_FRIEND
@@ -2767,7 +2762,6 @@
true
TARGET
SINGLE
- NOT_FRIEND
@@ -2925,11 +2919,6 @@
TARGET
RANGE
FRIEND
-
-
- 40
-
-
@@ -2950,8 +2939,8 @@
TARGET
SINGLE
-
- 1488
+
+ 20
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/Util.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/Util.java
index 850ae469e6..0508148f16 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/Util.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/Util.java
@@ -29,11 +29,13 @@ import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Date;
+import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
-import java.util.TreeMap;
import java.util.logging.Logger;
+import java.util.stream.Collectors;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.Rnd;
@@ -791,14 +793,24 @@ public final class Util
}
/**
- * Short an map by its integer values.
- * @param unsortedMap
- * @return
+ * This will sort a Map according to the values. Default sort direction is ascending.
+ * @param keyType
+ * @param valueType
+ * @param map Map to be sorted.
+ * @param descending If you want to sort descending.
+ * @return A new Map sorted by the values.
*/
- public static Map sortByValue(Map unsortedMap)
+ public static > Map sortByValue(Map map, boolean descending)
{
- Map sortedMap = new TreeMap<>(new ValueComparator(unsortedMap));
- sortedMap.putAll(unsortedMap);
- return sortedMap;
+ if (descending)
+ {
+ return map.entrySet().stream().sorted(Map.Entry.comparingByValue(Collections.reverseOrder())).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
+ }
+ return map.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
+ }
+
+ public static > Map sortByValue(Map map)
+ {
+ return map.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
}
}
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/ValueComparator.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/ValueComparator.java
deleted file mode 100644
index 32c494218d..0000000000
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/ValueComparator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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 .
- */
-package com.l2jmobius.gameserver.util;
-
-import java.util.Comparator;
-import java.util.Map;
-
-/**
- * @author Mobius
- */
-public class ValueComparator implements Comparator
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml
index 79319c9ba7..81d3df75c8 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85group.xml
@@ -12,8 +12,12 @@
-
-
+
+
+
+
+
+
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml
index 8e5d962638..afc416a820 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth85solo.xml
@@ -12,45 +12,48 @@
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
@@ -95,6 +98,11 @@
+
+
+
+
+
@@ -115,7 +123,6 @@
-
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml
index 10fdc99062..cc2bdd0cd9 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90group.xml
@@ -12,8 +12,12 @@
-
-
+
+
+
+
+
+
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml
index c469b93c64..fbb2cac4e8 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth90solo.xml
@@ -16,22 +16,37 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -41,16 +56,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -95,6 +100,11 @@
+
+
+
+
+
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml
index d04fc781ee..26f843c0b8 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95group.xml
@@ -12,8 +12,12 @@
-
-
+
+
+
+
+
+
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml
index a8235c88d7..4a4b8d99a4 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/instances/KartiasLabyrinth/KartiasLabyrinth95solo.xml
@@ -17,21 +17,36 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -41,16 +56,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -94,6 +99,11 @@
+
+
+
+
+
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/33647-9.htm b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/33647-9.htm
new file mode 100644
index 0000000000..f72bd6b6d6
--- /dev/null
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/33647-9.htm
@@ -0,0 +1,5 @@
+Kartia Researcher:
+Don't waste my time! I'm a researcher sent directly by the Kingdom of Aden after all.
+You must have the quest started in order to enter the labyrinth.
+
+
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java
index 0f7156ae8b..5ef95e7b46 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaBoss.java
@@ -28,7 +28,7 @@ import ai.AbstractNpcAI;
/**
* Kartia Boss AI.
- * @author St3eT
+ * @author flanagak
*/
public final class KartiaBoss extends AbstractNpcAI
{
@@ -139,8 +139,8 @@ public final class KartiaBoss extends AbstractNpcAI
{
for (int i = 0; i < 3; i++)
{
- addSpawn(fighter, npc, false, 0, false, npc.getInstanceId());
- addSpawn(mage, npc, false, 0, false, npc.getInstanceId());
+ addSpawn(fighter, npc, true, 0, false, npc.getInstanceId());
+ addSpawn(mage, npc, true, 0, false, npc.getInstanceId());
}
}
}
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java
index fe268f6cd0..63766759cc 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperAdolph.java
@@ -33,16 +33,14 @@ import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.instancezone.Instance;
-import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.skills.SkillCaster;
import com.l2jmobius.gameserver.network.NpcStringId;
-import com.l2jmobius.gameserver.util.Util;
import ai.AbstractNpcAI;
/**
* Kartia Helper Adolph AI.
- * @author St3eT
+ * @author flanagak
*/
public final class KartiaHelperAdolph extends AbstractNpcAI
{
@@ -59,6 +57,27 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
33799, // Life Plunderer (90)
33800, // Life Plunderer (95)
};
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -82,114 +101,161 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
final Instance instance = npc.getInstanceWorld();
if ((instance != null) && event.equals("CHECK_ACTION"))
{
- final StatsSet instParams = instance.getTemplateParameters();
- boolean actionFound = false;
-
- if (!npc.isInCombat() || !npc.isAttackingNow() || (npc.getTarget() == null))
+ final StatsSet npcVars = npc.getVariables();
+ player = npcVars.getObject("PLAYER_OBJECT", L2PcInstance.class);
+ if (player != null)
{
- final List monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 500);
- if (!monsterList.isEmpty())
+ final double distance = npc.calculateDistance(player, false, false);
+ if (distance > 300)
{
- final L2MonsterInstance monster = monsterList.get(getRandom(monsterList.size()));
-
- if (monster.isTargetable() && GeoEngine.getInstance().canSeeTarget(npc, monster) && !CommonUtil.contains(MIRRORS, monster.getId()))
+ final Location loc = new Location(player.getX(), player.getY(), player.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
{
- actionFound = true;
- addAttackDesire(npc, monster);
+ npc.teleToLocation(loc);
}
- }
- }
-
- if (!actionFound)
- {
- final SkillHolder hateSkill = instParams.getSkillHolder("adolphHate");
- if (npc.isInCombat() && (hateSkill != null) && SkillCaster.checkUseConditions(npc, hateSkill.getSkill()))
- {
- addSkillCastDesire(npc, npc.getTarget(), hateSkill, 23);
- }
- else
- {
- final L2PcInstance instancePlayer = npc.getVariables().getObject("PLAYER_OBJECT", L2PcInstance.class);
- if (instancePlayer != null)
+ else
{
- final double radian = Math.toRadians(Util.convertHeadingToDegree(instancePlayer.getHeading()));
- final int X = (int) (instancePlayer.getX() + (Math.cos(radian) * 150));
- final int Y = (int) (instancePlayer.getY() + (Math.sin(radian) * 150));
- final Location loc = GeoEngine.getInstance().canMoveToTargetLoc(instancePlayer.getX(), instancePlayer.getY(), instancePlayer.getZ(), X, Y, instancePlayer.getZ(), instance);
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final List monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 500);
+ if (!monsterList.isEmpty())
+ {
+ final L2MonsterInstance monster = monsterList.get(getRandom(monsterList.size()));
- if (!npc.isInsideRadius(loc, 50, true, true))
+ if (monster.isTargetable() && GeoEngine.getInstance().canSeeTarget(npc, monster) && !CommonUtil.contains(MIRRORS, monster.getId()) && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
{
- npc.setRunning();
- addMoveToDesire(npc, loc, 23);
+ addAttackDesire(npc, monster);
}
}
}
}
}
- }
-
- @Override
- public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill)
- {
- final Instance instance = npc.getInstanceWorld();
- if (instance != null)
+ else if ((instance != null) && event.equals("USE_SKILL"))
{
- final StatsSet instParams = instance.getTemplateParameters();
- final SkillHolder hateSkill = instParams.getSkillHolder("adolphHate");
- final SkillHolder shieldSkill = instParams.getSkillHolder("adolphShield");
- final SkillHolder punishSkill = instParams.getSkillHolder("adolphPunish");
-
- if ((hateSkill != null) && (skill.getId() == hateSkill.getSkillId()))
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
{
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_FILTHY_MONSTERS_I_WILL_TAKE_YOU_ON);
- }
- else if ((shieldSkill != null) && (skill.getId() == shieldSkill.getSkillId()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.STOP_RIGHT_THERE_I_WILL_BE_YOUR_OPPONENT);
- }
- else if ((punishSkill != null) && (skill.getId() == punishSkill.getSkillId()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
+ }
+
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("adolphHate");
+ final SkillHolder skill_02 = instParams.getSkillHolder("adolphPunish");
+ final SkillHolder skill_03 = instParams.getSkillHolder("adolphShield");
+ final SkillHolder skill_04 = instParams.getSkillHolder("adolphAggression");
+ final SkillHolder skill_05 = instParams.getSkillHolder("adolphChainHydra");
+ final SkillHolder lowHpSkill = instParams.getSkillHolder("adolphUltimate");
+ final int numberOfActiveSkills = 5;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ if ((lowHpSkill != null) && (npc.getCurrentHpPercent() < 50))
+ {
+ // NPC has low HP Skill and HP is < 50% HP
+ if (!npc.isAffectedBySkill(lowHpSkill.getSkillId()) && (SkillCaster.checkUseConditions(npc, lowHpSkill.getSkill())))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IT_S_NOT_OVER);
+ npc.doCast(lowHpSkill.getSkill());
+ }
+ }
+ else
+ {
+ switch (randomSkill)
+ {
+ case 0:
+ case 1:
+ {
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ final List monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 300);
+ if (!monsterList.isEmpty())
+ {
+ for (L2MonsterInstance monster : monsterList)
+ {
+ if (monster.isTargetable() && GeoEngine.getInstance().canSeeTarget(npc, monster) && !CommonUtil.contains(MIRRORS, monster.getId()) && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ monster.addDamageHate(npc, 100, 10000);
+ }
+ }
+ }
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 3:
+ {
+ if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
+ npc.doCast(skill_03.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 4:
+ {
+ if ((skill_04 != null) && SkillCaster.checkUseConditions(npc, skill_04.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_BE_DESTROYED);
+ npc.doCast(skill_04.getSkill());
+ }
+ break;
+ }
+ case 5:
+ {
+ if ((skill_05 != null) && SkillCaster.checkUseConditions(npc, skill_05.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_DIE);
+ npc.doCast(skill_05.getSkill(), null, true, false);
+ }
+ break;
+ }
+ }
}
}
- return super.onSpellFinished(npc, player, skill);
}
public void onCreatureAttacked(OnCreatureAttacked event)
{
final L2Npc npc = (L2Npc) event.getTarget();
- final Instance instance = npc.getInstanceWorld();
- if ((instance != null) && !event.getAttacker().isPlayable())
+ if (npc != null)
{
- final StatsSet instParams = instance.getTemplateParameters();
- final int random = getRandom(1000);
-
- if (random < 333)
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
{
- final SkillHolder shieldSkill = instParams.getSkillHolder("adolphShield");
- if ((shieldSkill != null) && SkillCaster.checkUseConditions(npc, shieldSkill.getSkill()))
+ if (!npc.isInCombat())
{
- addSkillCastDesire(npc, npc.getTarget(), shieldSkill, 23);
- }
- }
- else if (random < 666)
- {
- final SkillHolder punishSkill = instParams.getSkillHolder("adolphPunish");
- if ((punishSkill != null) && SkillCaster.checkUseConditions(npc, punishSkill.getSkill()))
- {
- addSkillCastDesire(npc, npc.getTarget(), punishSkill, 23);
- }
- }
-
- if ((npc.getCurrentHpPercent() < 30) && npc.isScriptValue(0))
- {
- final SkillHolder ultimateSkill = instParams.getSkillHolder("adolphUltimate");
- if ((ultimateSkill != null) && !npc.isAffectedBySkill(ultimateSkill.getSkillId()) && SkillCaster.checkUseConditions(npc, ultimateSkill.getSkill()))
- {
- npc.setScriptValue(1);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IT_S_NOT_OVER);
- addSkillCastDesire(npc, npc.getTarget(), ultimateSkill, 23);
- getTimers().addTimer("RESTORE_SCRIPTVAL", 10000, n -> npc.setScriptValue(0));
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder hateSkill = instParams.getSkillHolder("adolphHate");
+ if ((hateSkill != null) && SkillCaster.checkUseConditions(npc, hateSkill.getSkill()))
+ {
+ npc.doCast(hateSkill.getSkill(), null, true, false);
+ }
}
}
}
@@ -210,23 +276,10 @@ public final class KartiaHelperAdolph extends AbstractNpcAI
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
- {
- instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, adolph, null));
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("adolphTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> adolph.teleToLocation(loc));
- }
- break;
- }
+ instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, adolph, null));
+ instance.getAliveNpcs(KARTIA_ADOLPH).forEach(adolph -> getTimers().addRepeatingTimer("USE_SKILL", 6000, adolph, null));
}
}
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java
index 374348ece8..9ad2b19e13 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperBarton.java
@@ -35,8 +35,8 @@ import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Barton AI.
- * @author St3eT
+ * Kartia Helper Barton AI. Tyrr Warrior
+ * @author flanagak
*/
public final class KartiaHelperBarton extends AbstractNpcAI
{
@@ -53,6 +53,27 @@ public final class KartiaHelperBarton extends AbstractNpcAI
33620, // Adolph (Kartia 90)
33631, // Adolph (Kartia 95)
};
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -79,52 +100,50 @@ public final class KartiaHelperBarton extends AbstractNpcAI
if (adolph != null)
{
final double distance = npc.calculateDistance(adolph, false, false);
- if (distance > 200)
+ if (distance > 300)
{
- final Location loc = new Location(adolph.getX() + getRandom(-100, 100), adolph.getY() + getRandom(-100, 100), adolph.getZ() + 50);
- if (distance > 500)
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
{
npc.teleToLocation(loc);
}
else
{
npc.setRunning();
- addMoveToDesire(npc, loc, 23);
}
+ addMoveToDesire(npc, randLoc, 23);
}
- else if (!npc.isInCombat() || !npc.isAttackingNow() || (npc.getTarget() == null))
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
{
final L2Character monster = (L2Character) adolph.getTarget();
- if ((monster != null) && adolph.isInCombat())
+ if ((monster != null) && adolph.isInCombat() && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
{
addAttackDesire(npc, monster);
}
}
}
}
+ else if ((instance != null) && event.equals("USE_SKILL"))
+ {
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
+ {
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
}
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
- {
- instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, barton, null));
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("bartonTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> barton.teleToLocation(loc));
- }
- break;
- }
+ instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, barton, null));
+ instance.getAliveNpcs(KARTIA_BARTON).forEach(barton -> getTimers().addRepeatingTimer("USE_SKILL", 6000, barton, null));
}
}
@@ -142,33 +161,83 @@ public final class KartiaHelperBarton extends AbstractNpcAI
return super.onSeeCreature(npc, creature, isSummon);
}
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("bartonInfinity");
+ final SkillHolder skill_02 = instParams.getSkillHolder("bartonBerserker");
+ final SkillHolder skill_03 = instParams.getSkillHolder("bartonHurricane");
+ final SkillHolder skill_04 = instParams.getSkillHolder("bartonPowerBomber");
+ final SkillHolder skill_05 = instParams.getSkillHolder("bartonSonicStar");
+ final int numberOfActiveSkills = 5;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ switch (randomSkill)
+ {
+ case 0:
+ case 1:
+ {
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 3:
+ {
+ if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
+ npc.doCast(skill_03.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 4:
+ {
+ if ((skill_04 != null) && SkillCaster.checkUseConditions(npc, skill_04.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_BE_DESTROYED);
+ npc.doCast(skill_04.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 5:
+ {
+ if ((skill_05 != null) && SkillCaster.checkUseConditions(npc, skill_05.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_WILL_DIE);
+ npc.doCast(skill_05.getSkill(), null, true, false);
+ }
+ break;
+ }
+ }
+ }
+ }
+
public void onCreatureAttacked(OnCreatureAttacked event)
{
final L2Npc npc = (L2Npc) event.getTarget();
- final Instance instance = npc.getInstanceWorld();
- if ((instance != null) && !event.getAttacker().isPlayable())
+ if (npc != null)
{
- final StatsSet instParams = instance.getTemplateParameters();
- final int random = getRandom(1000);
-
- if (random < 333)
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !npc.isInCombat() && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
{
- final SkillHolder infinitySkill = instParams.getSkillHolder("bartonInfinity");
- if ((infinitySkill != null) && SkillCaster.checkUseConditions(npc, infinitySkill.getSkill()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
- addSkillCastDesire(npc, npc.getTarget(), infinitySkill, 23);
- }
- }
- else if ((npc.getCurrentHpPercent() < 50) && npc.isScriptValue(0))
- {
- final SkillHolder berserkerSkill = instParams.getSkillHolder("bartonBerserker");
- if ((berserkerSkill != null) && !npc.isAffectedBySkill(berserkerSkill.getSkillId()) && SkillCaster.checkUseConditions(npc, berserkerSkill.getSkill()))
- {
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAAAAAAAAHHHHHH);
- addSkillCastDesire(npc, npc.getTarget(), berserkerSkill, 23);
- getTimers().addTimer("RESTORE_SCRIPTVAL", 10000, n -> npc.setScriptValue(0));
- }
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
}
}
}
@@ -180,6 +249,7 @@ public final class KartiaHelperBarton extends AbstractNpcAI
if (world != null)
{
getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
}
}
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java
index a667ca8510..f1d14df41b 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperElise.java
@@ -16,8 +16,15 @@
*/
package instances.KartiasLabyrinth;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.enums.InstanceType;
+import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
@@ -34,8 +41,8 @@ import com.l2jmobius.gameserver.util.Util;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Elise AI.
- * @author St3eT
+ * Kartia Helper Elise AI. Healer
+ * @author flanagak
*/
public final class KartiaHelperElise extends AbstractNpcAI
{
@@ -70,9 +77,27 @@ public final class KartiaHelperElise extends AbstractNpcAI
33624, // Hayuk (Kartia 90)
33635, // Hayuk (Kartia 95)
};
- private static final int HEALING_TREE = 19256;
- // Skill
- private static final SkillHolder TREE_HEAL_SKILL = new SkillHolder(15003, 1); // Summon Tree of Life - NPC
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -95,167 +120,124 @@ public final class KartiaHelperElise extends AbstractNpcAI
if ((instance != null) && event.equals("CHECK_ACTION"))
{
final StatsSet npcVars = npc.getVariables();
- final StatsSet instParams = instance.getTemplateParameters();
-
- player = npcVars.getObject("PLAYER_OBJECT", L2PcInstance.class);
final FriendlyNpcInstance adolph = npcVars.getObject("ADOLPH_OBJECT", FriendlyNpcInstance.class);
- final FriendlyNpcInstance barton = npcVars.getObject("BARTON_OBJECT", FriendlyNpcInstance.class);
- final FriendlyNpcInstance eliyah = npcVars.getObject("ELIYAH_OBJECT", FriendlyNpcInstance.class);
- final FriendlyNpcInstance hayuk = npcVars.getObject("HAYUK_OBJECT", FriendlyNpcInstance.class);
-
- if ((player != null) && !player.isDead() && ((player.getCurrentHpPercent() < 75) || (player.getCurrentMpPercent() < 30)))
+ if (!npc.isCastingNow())
{
- final int hpPer = player.getCurrentHpPercent();
- if ((hpPer < 40) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, player);
- }
- else if (hpPer < 60)
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, player, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- else if (hpPer < 75)
- {
- final SkillHolder healSkill = instParams.getSkillHolder("eliseHeal");
- if (healSkill != null)
- {
- addSkillCastDesire(npc, player, healSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- else if (player.getCurrentMpPercent() < 30)
- {
- final SkillHolder rechargeSkill = instParams.getSkillHolder("eliseRecharge");
- if (rechargeSkill != null)
- {
- addSkillCastDesire(npc, player, rechargeSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.MEN_FOCUS_CHARGING_COMPLETE);
- }
- }
+ healFriends(npc, player);
}
- else if ((adolph != null) && !adolph.isDead() && (adolph.getCurrentHpPercent() < 75))
- {
- final int hpPer = adolph.getCurrentHpPercent();
- if ((hpPer < 40) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, adolph);
- }
- else if (hpPer < 60)
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, adolph, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- else
- {
- final SkillHolder healSkill = instParams.getSkillHolder("eliseHeal");
- if (healSkill != null)
- {
- addSkillCastDesire(npc, adolph, healSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if ((barton != null) && !barton.isDead() && (barton.getCurrentHpPercent() < 60))
- {
- final int hpPer = barton.getCurrentHpPercent();
- if ((hpPer < 30) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, barton);
- }
- else
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, barton, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if ((eliyah != null) && !eliyah.isDead() && (eliyah.getCurrentHpPercent() < 60))
- {
- final int hpPer = eliyah.getCurrentHpPercent();
- if ((hpPer < 30) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, eliyah);
- }
- else
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, eliyah, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if ((hayuk != null) && !hayuk.isDead() && (hayuk.getCurrentHpPercent() < 60))
- {
- final int hpPer = hayuk.getCurrentHpPercent();
- if ((hpPer < 30) && npcVars.getBoolean("CAN_USE_TREE", true))
- {
- summonHealingTree(npc, hayuk);
- }
- else
- {
- final SkillHolder chainSkill = instParams.getSkillHolder("eliseChainHeal");
- if (chainSkill != null)
- {
- addSkillCastDesire(npc, hayuk, chainSkill, 23);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
- }
- }
- }
- else if (adolph != null)
+ if (adolph != null)
{
final double distance = npc.calculateDistance(adolph, false, false);
- if (distance > 200)
+ if (distance > 300)
{
- final Location loc = new Location(adolph.getX() + getRandom(-100, 100), adolph.getY() + getRandom(-100, 100), adolph.getZ() + 50);
- if (distance > 500)
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
{
npc.teleToLocation(loc);
}
else
{
npc.setRunning();
- addMoveToDesire(npc, loc, 23);
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ }
+ npc.setTarget(npc);
+ }
+ }
+
+ private void healFriends(L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if (instance != null)
+ {
+ final StatsSet npcVars = npc.getVariables();
+ final StatsSet instParams = instance.getTemplateParameters();
+ if (!npc.isCastingNow())
+ {
+ player = npcVars.getObject("PLAYER_OBJECT", L2PcInstance.class);
+ final SkillHolder progressiveHeal = instParams.getSkillHolder("eliseProgressiveHeal"); // AOE heal
+ final SkillHolder radiantHeal = instParams.getSkillHolder("eliseRadiantHeal"); // Single target heal
+ final SkillHolder recharge = instParams.getSkillHolder("eliseRecharge");
+
+ // Get HP percentage for all friends
+ final Map hpMap = new HashMap<>();
+ instance.getAliveNpcs(KARTIA_FRIENDS).forEach(friend -> hpMap.put(friend, friend != null ? friend.getCurrentHpPercent() : 100));
+ hpMap.put(player, player != null ? player.getCurrentHpPercent() : 100);
+ Map sortedHpMap = new HashMap<>();
+ sortedHpMap = Util.sortByValue(hpMap, false);
+
+ // See if any friends are below 80% HP and add to list of people to heal.
+ final List peopleToHeal = new ArrayList<>();
+ for (L2Object friend : sortedHpMap.keySet())
+ {
+ if ((friend != null) && (sortedHpMap.get(friend) < 80) && (sortedHpMap.get(friend) > 1))
+ {
+ peopleToHeal.add(friend);
+ }
+ }
+
+ if (peopleToHeal.size() > 0)
+ {
+ // At least one friend was below 80% HP.
+ if (peopleToHeal.size() > 1)
+ {
+ // Helper NPC AOE skills affecting monsters so skill power has set to 0.
+ // Using skill is just for animation. Need to heal each NPC/Player manually.
+ npc.setTarget(npc);
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
+ npc.doCast(progressiveHeal.getSkill(), null, true, false);
+ npc.setTarget(npc);
+ for (L2Object personToHeal : peopleToHeal)
+ {
+ if (personToHeal.getInstanceType() == InstanceType.L2PcInstance)
+ {
+ L2PcInstance thePlayer = (L2PcInstance) personToHeal;
+ thePlayer.setCurrentHp((thePlayer.getMaxHp() * .20) + thePlayer.getCurrentHp());
+ }
+ else
+ {
+ L2Npc npcToHeal = (L2Npc) personToHeal;
+ npcToHeal.setCurrentHp((npcToHeal.getMaxHp() * .20) + npcToHeal.getCurrentHp());
+ }
+ }
+ }
+ else
+ {
+ // Only one person needs cure. Cast single target heal
+ for (L2Object personToHeal : peopleToHeal)
+ {
+ npc.setTarget(personToHeal);
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.POWER_OF_LIGHT_PROTECT_US);
+ npc.doCast(radiantHeal.getSkill(), null, true, false);
+ npc.setTarget(npc);
+ }
+ }
+ }
+ else
+ {
+ // No one needs healing. Check if player character needs recharge.
+ if ((player != null) && !player.isDead() && (player.getCurrentMpPercent() < 50))
+ {
+ npc.setTarget(player);
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ELECTRIFYING_RECHARGE);
+ npc.doCast(recharge.getSkill(), null, true, false);
+ npc.setTarget(npc);
}
}
}
}
+
}
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
- {
- instance.getAliveNpcs(KARTIA_ELISE).forEach(elise -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, elise, null));
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("eliseTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_ELISE).forEach(elise -> elise.teleToLocation(loc));
- }
- break;
- }
+ instance.getAliveNpcs(KARTIA_ELISE).forEach(elise -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, elise, null));
}
}
@@ -297,18 +279,10 @@ public final class KartiaHelperElise extends AbstractNpcAI
if (world != null)
{
getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
}
}
- private void summonHealingTree(L2Npc npc, L2Character target)
- {
- npc.getVariables().set("CAN_USE_TREE", false);
- npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.COME_FORTH_TREE_OF_LIFE);
- final L2Npc tree = addSpawn(HEALING_TREE, Util.getRandomPosition(target, 20, 50), false, 0, false, npc.getInstanceId());
- getTimers().addTimer("TREE_REUSE", 10000, evnt -> npc.getVariables().set("CAN_USE_TREE", true));
- getTimers().addTimer("TREE_HEAL", 3000, evnt -> addSkillCastDesire(tree, target, TREE_HEAL_SKILL, 23));
- }
-
public static void main(String[] args)
{
new KartiaHelperElise();
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java
index 80d3710a94..0b64d51602 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperEliyah.java
@@ -16,15 +16,23 @@
*/
package instances.KartiasLabyrinth;
+import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.model.Location;
+import com.l2jmobius.gameserver.model.StatsSet;
+import com.l2jmobius.gameserver.model.actor.L2Character;
+import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.FriendlyNpcInstance;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureAttacked;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Eliyah AI.
- * @author St3eT
+ * Kartia Helper Eliyah AI. Summoner
+ * @author flanagak
*/
public final class KartiaHelperEliyah extends AbstractNpcAI
{
@@ -35,6 +43,33 @@ public final class KartiaHelperEliyah extends AbstractNpcAI
33626, // Eliyah (Kartia 90)
33637, // Eliyah (Kartia 95)
};
+ private static final int[] KARTIA_ADOLPH =
+ {
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ };
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -45,33 +80,101 @@ public final class KartiaHelperEliyah extends AbstractNpcAI
private KartiaHelperEliyah()
{
+ setCreatureKillId(this::onCreatureKill, KARTIA_ELIYAH);
+ setCreatureAttackedId(this::onCreatureAttacked, KARTIA_ELIYAH);
+ addSeeCreatureId(KARTIA_ELIYAH);
setInstanceStatusChangeId(this::onInstanceStatusChange, KARTIA_SOLO_INSTANCES);
}
+ @Override
+ public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && event.equals("CHECK_ACTION"))
+ {
+ final FriendlyNpcInstance adolph = npc.getVariables().getObject("ADOLPH_OBJECT", FriendlyNpcInstance.class);
+ if (adolph != null)
+ {
+ final double distance = npc.calculateDistance(adolph, false, false);
+ if (distance > 300)
+ {
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
+ {
+ npc.teleToLocation(loc);
+ }
+ else
+ {
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final L2Character monster = (L2Character) adolph.getTarget();
+ if ((monster != null) && adolph.isInCombat() && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ npc.setTarget(monster);
+ }
+ }
+ }
+ }
+ }
+
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
+ instance.getAliveNpcs(KARTIA_ELIYAH).forEach(eliyah -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, eliyah, null));
+ if ((instance.getAliveNpcs(KARTIA_ELIYAH) != null) && (instance.getAliveNpcs(KARTIA_ELIYAH).size() > 0))
{
- // Nothing for now
- break;
+ instance.spawnGroup("GUARDIANS");
}
- case 2:
- case 3:
+ }
+ }
+
+ @Override
+ public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
+ {
+ if (creature.isPlayer())
+ {
+ npc.getVariables().set("PLAYER_OBJECT", creature.getActingPlayer());
+ }
+ else if (CommonUtil.contains(KARTIA_ADOLPH, creature.getId()))
+ {
+ npc.getVariables().set("ADOLPH_OBJECT", creature);
+ }
+ return super.onSeeCreature(npc, creature, isSummon);
+ }
+
+ public void onCreatureAttacked(OnCreatureAttacked event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ if (npc != null)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
{
- final Location loc = instance.getTemplateParameters().getLocation("eliyahTeleportStatus" + status);
- if (loc != null)
- {
- instance.getAliveNpcs(KARTIA_ELIYAH).forEach(eliyah -> eliyah.teleToLocation(loc));
- }
- break;
+ npc.setTarget(event.getAttacker());
}
}
}
+ public void onCreatureKill(OnCreatureDeath event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ final Instance world = npc.getInstanceWorld();
+ if (world != null)
+ {
+ getTimers().cancelTimersOf(npc);
+ world.despawnGroup("GUARDIANS");
+ npc.doDie(event.getAttacker());
+ }
+ }
+
public static void main(String[] args)
{
new KartiaHelperEliyah();
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperGuardian.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperGuardian.java
new file mode 100644
index 0000000000..0cc90ab787
--- /dev/null
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperGuardian.java
@@ -0,0 +1,237 @@
+/*
+ * 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 .
+ */
+package instances.KartiasLabyrinth;
+
+import com.l2jmobius.commons.util.CommonUtil;
+import com.l2jmobius.gameserver.model.Location;
+import com.l2jmobius.gameserver.model.StatsSet;
+import com.l2jmobius.gameserver.model.actor.L2Character;
+import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.FriendlyNpcInstance;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureAttacked;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
+import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
+import com.l2jmobius.gameserver.model.holders.SkillHolder;
+import com.l2jmobius.gameserver.model.instancezone.Instance;
+import com.l2jmobius.gameserver.model.skills.SkillCaster;
+
+import ai.AbstractNpcAI;
+
+/**
+ * Kartia Helper Eliyah's Guardian Spirit
+ * @author flanagak *
+ */
+public final class KartiaHelperGuardian extends AbstractNpcAI
+{
+ // NPCs
+ private static final int[] KARTIA_ELIYAH =
+ {
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ };
+ private static final int[] KARTIA_ADOLPH =
+ {
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ };
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
+ private static final int[] KARTIA_GUARDIANS =
+ {
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
+ // Misc
+ private static final int[] KARTIA_SOLO_INSTANCES =
+ {
+ 205, // Solo 85
+ 206, // Solo 90
+ 207, // Solo 95
+ };
+
+ private KartiaHelperGuardian()
+ {
+ setCreatureKillId(this::onCreatureKill, KARTIA_GUARDIANS);
+ setCreatureAttackedId(this::onCreatureAttacked, KARTIA_GUARDIANS);
+ addSeeCreatureId(KARTIA_GUARDIANS);
+ setInstanceStatusChangeId(this::onInstanceStatusChange, KARTIA_SOLO_INSTANCES);
+ }
+
+ @Override
+ public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && event.equals("CHECK_ACTION"))
+ {
+ final FriendlyNpcInstance eliyah = npc.getVariables().getObject("ELIYAH_OBJECT", FriendlyNpcInstance.class);
+ if (eliyah != null)
+ {
+ final double distance = npc.calculateDistance(eliyah, false, false);
+ if (distance > 300)
+ {
+ final Location loc = new Location(eliyah.getX(), eliyah.getY(), eliyah.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-50, 50), loc.getY() + getRandom(-50, 50), loc.getZ());
+ if (distance > 600)
+ {
+ npc.teleToLocation(loc);
+ }
+ else
+ {
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final L2Character monster = (L2Character) eliyah.getTarget();
+ if ((monster != null) && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ addAttackDesire(npc, monster);
+ }
+ }
+ }
+ }
+ else if ((instance != null) && event.equals("USE_SKILL"))
+ {
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
+ {
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
+ }
+
+ public void onInstanceStatusChange(OnInstanceStatusChange event)
+ {
+ final Instance instance = event.getWorld();
+ final int status = event.getStatus();
+ if (status == 1)
+ {
+ instance.getAliveNpcs(KARTIA_GUARDIANS).forEach(guardian -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, guardian, null));
+ instance.getAliveNpcs(KARTIA_GUARDIANS).forEach(guardian -> getTimers().addRepeatingTimer("USE_SKILL", 6000, guardian, null));
+ }
+ }
+
+ @Override
+ public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
+ {
+ if (creature.isPlayer())
+ {
+ npc.getVariables().set("PLAYER_OBJECT", creature.getActingPlayer());
+ }
+ else if (CommonUtil.contains(KARTIA_ADOLPH, creature.getId()))
+ {
+ npc.getVariables().set("ADOLPH_OBJECT", creature);
+ }
+ else if (CommonUtil.contains(KARTIA_ELIYAH, creature.getId()))
+ {
+ npc.getVariables().set("ELIYAH_OBJECT", creature);
+ }
+ return super.onSeeCreature(npc, creature, isSummon);
+ }
+
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("guardianSpiritsBlow");
+ final SkillHolder skill_02 = instParams.getSkillHolder("guardianSpiritsWrath");
+ final int numberOfActiveSkills = 2;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ switch (randomSkill)
+ {
+ case 0:
+ case 1:
+ {
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ public void onCreatureAttacked(OnCreatureAttacked event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ if (npc != null)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !npc.isInCombat() && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
+ {
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
+ }
+ }
+ }
+
+ public void onCreatureKill(OnCreatureDeath event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ final Instance world = npc.getInstanceWorld();
+ if (world != null)
+ {
+ getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ new KartiaHelperGuardian();
+ }
+
+}
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java
index be412bb83b..12d10d91c1 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiaHelperHayuk.java
@@ -16,25 +16,65 @@
*/
package instances.KartiasLabyrinth;
+import com.l2jmobius.commons.util.CommonUtil;
+import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.Location;
+import com.l2jmobius.gameserver.model.StatsSet;
+import com.l2jmobius.gameserver.model.actor.L2Character;
+import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.FriendlyNpcInstance;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureAttacked;
+import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
+import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.instancezone.Instance;
+import com.l2jmobius.gameserver.model.skills.SkillCaster;
+import com.l2jmobius.gameserver.network.NpcStringId;
import ai.AbstractNpcAI;
/**
- * Kartia Helper Hayuk AI.
- * @author St3eT
+ * Kartia Helper Hayuk AI. Archer
+ * @author flanagak
*/
public final class KartiaHelperHayuk extends AbstractNpcAI
{
// NPCs
+ private static final int[] KARTIA_ADOLPH =
+ {
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ };
private static final int[] KARTIA_HAYUK =
{
33613, // Hayuk (Kartia 85)
33624, // Hayuk (Kartia 90)
33635, // Hayuk (Kartia 95)
};
+ private static final int[] KARTIA_FRIENDS =
+ {
+ 33617, // Elise (Kartia 85)
+ 33628, // Elise (Kartia 90)
+ 33639, // Elise (Kartia 95)
+ 33609, // Adolph (Kartia 85)
+ 33620, // Adolph (Kartia 90)
+ 33631, // Adolph (Kartia 95)
+ 33611, // Barton (Kartia 85)
+ 33622, // Barton (Kartia 90)
+ 33633, // Barton (Kartia 95)
+ 33615, // Eliyah (Kartia 85)
+ 33626, // Eliyah (Kartia 90)
+ 33637, // Eliyah (Kartia 95)
+ 33613, // Hayuk (Kartia 85)
+ 33624, // Hayuk (Kartia 90)
+ 33635, // Hayuk (Kartia 95)
+ 33618, // Eliyah's Guardian Spirit (Kartia 85)
+ 33629, // Eliyah's Guardian Spirit (Kartia 90)
+ 33640, // Eliyah's Guardian Spirit (Kartia 95)
+ };
+
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
@@ -45,33 +85,155 @@ public final class KartiaHelperHayuk extends AbstractNpcAI
private KartiaHelperHayuk()
{
+ setCreatureKillId(this::onCreatureKill, KARTIA_HAYUK);
+ setCreatureAttackedId(this::onCreatureAttacked, KARTIA_HAYUK);
+ addSeeCreatureId(KARTIA_HAYUK);
setInstanceStatusChangeId(this::onInstanceStatusChange, KARTIA_SOLO_INSTANCES);
}
+ @Override
+ public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && event.equals("CHECK_ACTION"))
+ {
+ final FriendlyNpcInstance adolph = npc.getVariables().getObject("ADOLPH_OBJECT", FriendlyNpcInstance.class);
+ if (adolph != null)
+ {
+ final double distance = npc.calculateDistance(adolph, false, false);
+ if (distance > 300)
+ {
+ final Location loc = new Location(adolph.getX(), adolph.getY(), adolph.getZ() + 50);
+ final Location randLoc = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
+ if (distance > 600)
+ {
+ npc.teleToLocation(loc);
+ }
+ else
+ {
+ npc.setRunning();
+ }
+ addMoveToDesire(npc, randLoc, 23);
+ }
+ else if (!npc.isInCombat() || (npc.getTarget() == null))
+ {
+ final L2Character monster = (L2Character) adolph.getTarget();
+ if ((monster != null) && adolph.isInCombat() && !CommonUtil.contains(KARTIA_FRIENDS, monster.getId()))
+ {
+ addAttackDesire(npc, monster);
+ }
+ }
+ }
+ }
+ else if ((instance != null) && event.equals("USE_SKILL"))
+ {
+ if (npc.isInCombat() || npc.isAttackingNow() || (npc.getTarget() != null))
+ {
+ if ((npc.getCurrentMpPercent() > 25) && !CommonUtil.contains(KARTIA_FRIENDS, npc.getTargetId()))
+ {
+ useRandomSkill(npc);
+ }
+ }
+ }
+ }
+
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
- switch (status)
+ if (status == 1)
{
- case 1:
+ instance.getAliveNpcs(KARTIA_HAYUK).forEach(hayuk -> getTimers().addRepeatingTimer("CHECK_ACTION", 3000, hayuk, null));
+ instance.getAliveNpcs(KARTIA_HAYUK).forEach(hayuk -> getTimers().addRepeatingTimer("USE_SKILL", 6000, hayuk, null));
+ }
+ }
+
+ @Override
+ public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
+ {
+ if (creature.isPlayer())
+ {
+ npc.getVariables().set("PLAYER_OBJECT", creature.getActingPlayer());
+ }
+ else if (CommonUtil.contains(KARTIA_ADOLPH, creature.getId()))
+ {
+ npc.getVariables().set("ADOLPH_OBJECT", creature);
+ }
+ return super.onSeeCreature(npc, creature, isSummon);
+ }
+
+ public void useRandomSkill(L2Npc npc)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ final L2Npc target = (L2Npc) npc.getTarget();
+ if ((instance != null) && !npc.isCastingNow() && (target != null) && (!CommonUtil.contains(KARTIA_FRIENDS, target.getId())))
+ {
+ final StatsSet instParams = instance.getTemplateParameters();
+ final SkillHolder skill_01 = instParams.getSkillHolder("hayukPinpointShot");
+ final SkillHolder skill_02 = instParams.getSkillHolder("hayukRecoilShot");
+ final SkillHolder skill_03 = instParams.getSkillHolder("hayukMultipleArrow");
+ final int numberOfActiveSkills = 3;
+ final int randomSkill = getRandom(numberOfActiveSkills + 1);
+
+ switch (randomSkill)
{
- // Nothing for now
- break;
- }
- case 2:
- case 3:
- {
- final Location loc = instance.getTemplateParameters().getLocation("hayukTeleportStatus" + status);
- if (loc != null)
+ case 0:
+ case 1:
{
- instance.getAliveNpcs(KARTIA_HAYUK).forEach(hayuk -> hayuk.teleToLocation(loc));
+ if ((skill_01 != null) && SkillCaster.checkUseConditions(npc, skill_01.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_WILL_SHOW_YOU_THE_JUSTICE_OF_ADEN);
+ npc.doCast(skill_01.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 2:
+ {
+ if ((skill_02 != null) && SkillCaster.checkUseConditions(npc, skill_02.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DIE3);
+ npc.doCast(skill_02.getSkill(), null, true, false);
+ }
+ break;
+ }
+ case 3:
+ {
+ if ((skill_03 != null) && SkillCaster.checkUseConditions(npc, skill_03.getSkill()))
+ {
+ npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOR_THE_GODDESS);
+ npc.doCast(skill_03.getSkill(), null, true, false);
+ }
+ break;
}
- break;
}
}
}
+ public void onCreatureAttacked(OnCreatureAttacked event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ if (npc != null)
+ {
+ final Instance instance = npc.getInstanceWorld();
+ if ((instance != null) && !npc.isInCombat() && !event.getAttacker().isPlayable() && !CommonUtil.contains(KARTIA_FRIENDS, event.getAttacker().getId()))
+ {
+ npc.setTarget(event.getAttacker());
+ addAttackDesire(npc, (L2Character) npc.getTarget());
+ }
+ }
+ }
+
+ public void onCreatureKill(OnCreatureDeath event)
+ {
+ final L2Npc npc = (L2Npc) event.getTarget();
+ final Instance world = npc.getInstanceWorld();
+ if (world != null)
+ {
+ getTimers().cancelTimersOf(npc);
+ npc.doDie(event.getAttacker());
+ }
+ }
+
public static void main(String[] args)
{
new KartiaHelperHayuk();
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java
index b633afc228..fbb7d13161 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/KartiasLabyrinth/KartiasLabyrinth.java
@@ -19,13 +19,16 @@ package instances.KartiasLabyrinth;
import java.util.List;
import com.l2jmobius.commons.util.CommonUtil;
+import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType;
+import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.instancemanager.WalkingManager;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Npc;
+import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureDeath;
import com.l2jmobius.gameserver.model.events.impl.character.OnCreatureSee;
@@ -47,7 +50,7 @@ import quests.Q00499_IncarnationOfGluttonyKaliosSolo.Q00499_IncarnationOfGlutton
/**
* Kartia Labyrinth instance zone.
- * @author St3eT
+ * @author flanagak
*/
public final class KartiasLabyrinth extends AbstractInstance
{
@@ -84,17 +87,27 @@ public final class KartiasLabyrinth extends AbstractInstance
33623,
33634,
};
- // @formatter:off
private static final int[] MONSTERS =
{
- 19220, 19221, 19222, // Solo 85
- 19223, 19224, 19225, // Solo 90
- 19226, 19227, 19228, // Solo 95
- 19229, 19230, 19231, // Group 85
- 19232, 19233, 19234, // Group 90
- 19235, 19236, 19237, // Group 95
+ 19220,
+ 19221,
+ 19222, // Solo 85
+ 19223,
+ 19224,
+ 19225, // Solo 90
+ 19226,
+ 19227,
+ 19228, // Solo 95
+ 19229,
+ 19230,
+ 19231, // Group 85
+ 19232,
+ 19233,
+ 19234, // Group 90
+ 19235,
+ 19236,
+ 19237, // Group 95
};
- // @formatter:on
private static final int[] BOSSES =
{
19253, // Zellaka (Solo 85)
@@ -134,19 +147,10 @@ public final class KartiasLabyrinth extends AbstractInstance
// Zones
private static final int KARTIA_85_DETECT_1 = 12020;
private static final int KARTIA_85_DETECT_2 = 12021;
- // private static final int KARTIA_85_TELEPORT_1 = 12022;
- // private static final int KARTIA_85_TELEPORT_2 = 12023;
- // private static final int KARTIA_85_TELEPORT_3 = 12024;
private static final int KARTIA_90_DETECT_1 = 12025;
private static final int KARTIA_90_DETECT_2 = 12026;
- // private static final int KARTIA_90_TELEPORT_1 = 12027;
- // private static final int KARTIA_90_TELEPORT_2 = 12028;
- // private static final int KARTIA_90_TELEPORT_3 = 12029;
private static final int KARTIA_95_DETECT_1 = 12030;
private static final int KARTIA_95_DETECT_2 = 12031;
- // private static final int KARTIA_95_TELEPORT_1 = 12032;
- // private static final int KARTIA_95_TELEPORT_2 = 12033;
- // private static final int KARTIA_95_TELEPORT_3 = 12034;
// Misc
private static final int TEMPLATE_ID_SOLO_85 = 205;
private static final int TEMPLATE_ID_SOLO_90 = 206;
@@ -154,6 +158,22 @@ public final class KartiasLabyrinth extends AbstractInstance
private static final int TEMPLATE_ID_GROUP_85 = 208;
private static final int TEMPLATE_ID_GROUP_90 = 209;
private static final int TEMPLATE_ID_GROUP_95 = 210;
+ private static final long WAVE_DEALY = 30000;
+ private static final long WAVE_MONITOR_DELAY = 3000;
+ // Solo instance XP reward values
+ private static final int SOLO_BASE_EXP_85 = 480000000;
+ private static final int SOLO_RAND_EXP_85 = 8055934;
+ private static final int SOLO_BASE_EXP_90 = 670000000;
+ private static final int SOLO_RAND_EXP_90 = 6173918;
+ private static final int SOLO_BASE_EXP_95 = 970000000;
+ private static final int SOLO_RAND_EXP_95 = 6305195;
+ // Solo instance SP reward values
+ private static final int SOLO_BASE_SP_85 = 3800000;
+ private static final int SOLO_RAND_SP_85 = 73460;
+ private static final int SOLO_BASE_SP_90 = 5600000;
+ private static final int SOLO_RAND_SP_90 = 82134;
+ private static final int SOLO_BASE_SP_95 = 8500000;
+ private static final int SOLO_RAND_SP_95 = 39112;
public KartiasLabyrinth()
{
@@ -177,9 +197,9 @@ public final class KartiasLabyrinth extends AbstractInstance
setCreatureKillId(this::onCreatureKill, MONSTERS);
setCreatureKillId(this::onBossKill, BOSSES);
setCreatureSeeId(this::onCreatureSee, MONSTERS);
- addEnterZoneId(KARTIA_85_DETECT_1, KARTIA_85_DETECT_2 /* , KARTIA_85_TELEPORT_1, KARTIA_85_TELEPORT_2, KARTIA_85_TELEPORT_3 */);
- addEnterZoneId(KARTIA_90_DETECT_1, KARTIA_90_DETECT_2 /* , KARTIA_90_TELEPORT_1, KARTIA_90_TELEPORT_2, KARTIA_90_TELEPORT_3 */);
- addEnterZoneId(KARTIA_95_DETECT_1, KARTIA_95_DETECT_2 /* , KARTIA_95_TELEPORT_1, KARTIA_95_TELEPORT_2, KARTIA_95_TELEPORT_3 */);
+ addEnterZoneId(KARTIA_85_DETECT_1, KARTIA_85_DETECT_2);
+ addEnterZoneId(KARTIA_90_DETECT_1, KARTIA_90_DETECT_2);
+ addEnterZoneId(KARTIA_95_DETECT_1, KARTIA_95_DETECT_2);
addInstanceCreatedId(TEMPLATE_ID_SOLO_85, TEMPLATE_ID_SOLO_90, TEMPLATE_ID_SOLO_95, TEMPLATE_ID_GROUP_85, TEMPLATE_ID_GROUP_90, TEMPLATE_ID_GROUP_95);
}
@@ -197,33 +217,63 @@ public final class KartiasLabyrinth extends AbstractInstance
}
case "request_zellaka_solo":
{
- enterInstance(player, npc, TEMPLATE_ID_SOLO_85);
- return null;
+ final QuestState qs = player.getQuestState(Q00497_IncarnationOfGreedZellakaSolo.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_SOLO_85);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_pelline_solo":
{
- enterInstance(player, npc, TEMPLATE_ID_SOLO_90);
- return null;
+ final QuestState qs = player.getQuestState(Q00498_IncarnationOfJealousyPellineSolo.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_SOLO_90);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_kalios_solo":
{
- enterInstance(player, npc, TEMPLATE_ID_SOLO_95);
- return null;
+ final QuestState qs = player.getQuestState(Q00499_IncarnationOfGluttonyKaliosSolo.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_SOLO_95);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_zellaka_party":
{
- enterInstance(player, npc, TEMPLATE_ID_GROUP_85);
- return null;
+ final QuestState qs = player.getQuestState(Q00494_IncarnationOfGreedZellakaGroup.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_GROUP_85);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_pelline_party":
{
- enterInstance(player, npc, TEMPLATE_ID_GROUP_90);
- return null;
+ final QuestState qs = player.getQuestState(Q00495_IncarnationOfJealousyPellineGroup.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_GROUP_90);
+ return null;
+ }
+ return "33647-9.htm";
}
case "request_kalios_party":
{
- enterInstance(player, npc, TEMPLATE_ID_GROUP_95);
- return null;
+ final QuestState qs = player.getQuestState(Q00496_IncarnationOfGluttonyKaliosGroup.class.getSimpleName());
+ if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ {
+ enterInstance(player, npc, TEMPLATE_ID_GROUP_95);
+ return null;
+ }
+ return "33647-9.htm";
}
default:
{
@@ -280,16 +330,18 @@ public final class KartiasLabyrinth extends AbstractInstance
{
if (npc != null)
{
- if (npc.getInstanceWorld().getParameters().getInt("ROOM", 1) <= 2)
+ if (npc.getInstanceWorld().getParameters().getInt("ROOM", 1) < 2)
{
+ // Move mobs in Room 1 to the middle at top of the steps. Add timer to start moving towards prisoners.
final Location loc = instance.getTemplateParameters().getLocation("middlePointRoom1");
final Location moveTo = new Location(loc.getX() + getRandom(-100, 100), loc.getY() + getRandom(-100, 100), loc.getZ());
npc.setRunning();
addMoveToDesire(npc, moveTo, 6);
- getTimers().addTimer("START_MOVE", 15000, npc, null);
+ getTimers().addTimer("START_MOVE", 12000, npc, null);
}
else if (npc.getInstanceWorld().getParameters().getInt("ROOM", 1) == 3)
{
+ // Move mobs in Room 3 towards center of room.
final Location loc = instance.getTemplateParameters().getLocation("middlePointRoom3");
final Location moveTo = new Location(loc.getX() + getRandom(-200, 200), loc.getY() + getRandom(-200, 200), loc.getZ());
npc.setRunning();
@@ -302,18 +354,8 @@ public final class KartiasLabyrinth extends AbstractInstance
{
if (npc != null)
{
- WalkingManager.getInstance().startMoving(npc, instance.getTemplateParameters().getString(getRandomBoolean() ? "route1" : "route2"));
- getTimers().addTimer("CHANGE_TARGETABLE_STATUS", 5000, npc, null);
- }
- break;
- }
- case "CHANGE_TARGETABLE_STATUS":
- {
- if (npc != null)
- {
- npc.setTargetable(true);
- final L2PcInstance randomPlayer = instance.getPlayers().stream().findAny().get();
- npc.moveToLocation(randomPlayer.getX(), randomPlayer.getY(), randomPlayer.getZ(), 10);
+ final String selectedRoute = (getRandomBoolean() ? "route1_" : "route2_") + Integer.toString(getRandom(1, 3));
+ WalkingManager.getInstance().startMoving(npc, instance.getTemplateParameters().getString(selectedRoute));
}
break;
}
@@ -346,7 +388,6 @@ public final class KartiasLabyrinth extends AbstractInstance
});
- instance.getParameters().set("TELEPORT_1_ENABLED", true);
if (!isSoloKartia(instance))
{
getTimers().addTimer("CALL_PROGRESS", 2500, n -> manageProgressInInstance(instance));
@@ -375,6 +416,20 @@ public final class KartiasLabyrinth extends AbstractInstance
}
}
+ private void manageWaves(Instance instance)
+ {
+ if ((instance != null) && instance.getAliveNpcs(MONSTERS).isEmpty())
+ {
+ getTimers().cancelTimers("NEXT_WAVE_DELAY");
+ getTimers().cancelTimers("MONITOR_WAVE");
+ getTimers().addTimer("CALL_PROGRESS", 5000, n -> manageProgressInInstance(instance));
+ }
+ else
+ {
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
+ }
+ }
+
public void onBossKill(OnCreatureDeath event)
{
final L2Npc npc = (L2Npc) event.getTarget();
@@ -384,80 +439,29 @@ public final class KartiasLabyrinth extends AbstractInstance
{
if (isSoloKartia(instance))
{
- final StatsSet tempParam = instance.getTemplateParameters();
- final int xp = tempParam.getInt("soloEXP");
- final int xp_rnd = tempParam.getInt("SoloEXP_Rand");
- final int sp = tempParam.getInt("SoloSP");
- final int sp_rnd = tempParam.getInt("SoloSP_Rand");
-
- instance.getPlayers().forEach(player ->
+ final L2PcInstance player = instance.getFirstPlayer();
+ if (player != null)
{
- addExpAndSp(player, (xp + getRandom(xp_rnd)), (sp + getRandom(sp_rnd)));
- });
- }
-
- // Check Instance Quests.
- instance.getPlayers().forEach(player ->
- {
- switch (instance.getTemplateId())
- {
- case TEMPLATE_ID_SOLO_85:
+ switch (instance.getTemplateId())
{
- final QuestState qs = player.getQuestState(Q00497_IncarnationOfGreedZellakaSolo.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ case TEMPLATE_ID_SOLO_85:
{
- qs.setCond(2, true);
+ player.addExpAndSp(SOLO_BASE_EXP_85 + getRandom(SOLO_RAND_EXP_85), SOLO_BASE_SP_85 + getRandom(SOLO_RAND_SP_85));
+ break;
}
- break;
- }
- case TEMPLATE_ID_SOLO_90:
- {
- final QuestState qs = player.getQuestState(Q00498_IncarnationOfJealousyPellineSolo.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ case TEMPLATE_ID_SOLO_90:
{
- qs.setCond(2, true);
+ player.addExpAndSp(SOLO_BASE_EXP_90 + getRandom(SOLO_RAND_EXP_90), SOLO_BASE_SP_90 + getRandom(SOLO_RAND_SP_90));
+ break;
}
- break;
- }
- case TEMPLATE_ID_SOLO_95:
- {
- final QuestState qs = player.getQuestState(Q00499_IncarnationOfGluttonyKaliosSolo.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
+ case TEMPLATE_ID_SOLO_95:
{
- qs.setCond(2, true);
+ player.addExpAndSp(SOLO_BASE_EXP_95 + getRandom(SOLO_RAND_EXP_95), SOLO_BASE_SP_95 + getRandom(SOLO_RAND_SP_95));
+ break;
}
- break;
- }
- case TEMPLATE_ID_GROUP_85:
- {
- final QuestState qs = player.getQuestState(Q00494_IncarnationOfGreedZellakaGroup.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
- {
- qs.setCond(2, true);
- }
- break;
- }
- case TEMPLATE_ID_GROUP_90:
- {
- final QuestState qs = player.getQuestState(Q00495_IncarnationOfJealousyPellineGroup.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
- {
- qs.setCond(2, true);
- }
- break;
- }
- case TEMPLATE_ID_GROUP_95:
- {
- final QuestState qs = player.getQuestState(Q00496_IncarnationOfGluttonyKaliosGroup.class.getSimpleName());
- if ((qs != null) && (qs.getState() == State.STARTED) && qs.isCond(1))
- {
- qs.setCond(2, true);
- }
- break;
}
}
- });
-
+ }
instance.finishInstance();
}
}
@@ -475,8 +479,6 @@ public final class KartiasLabyrinth extends AbstractInstance
instance.setParameter("BOSS_CAN_ESCAPE", false);
npc.setScriptValue(1);
npc.broadcastSay(ChatType.NPC_SHOUT, NpcStringId.NOT_BAD_FOR_A_BUNCH_OF_HUMANS_I_M_LEAVING);
- npc.disableCoreAI(true);
- addMoveToDesire(npc, instance.getTemplateParameters().getLocation("bossEscapeLoc1"), 23);
}
}
else
@@ -503,7 +505,6 @@ public final class KartiasLabyrinth extends AbstractInstance
final Instance instance = character.getInstanceWorld();
if ((instance != null) && character.isPlayer())
{
- // final L2PcInstance player = character.getActingPlayer();
switch (zone.getId())
{
case KARTIA_85_DETECT_1:
@@ -532,11 +533,6 @@ public final class KartiasLabyrinth extends AbstractInstance
}
break;
}
- /*
- * case KARTIA_85_TELEPORT_1: case KARTIA_90_TELEPORT_1: case KARTIA_95_TELEPORT_1: { if (instance.getParameters().getBoolean("TELEPORT_1_ENABLED", false)) { player.teleToLocation(instance.getTemplateParameters().getLocation("teleportZone1_loc")); } break; } case
- * KARTIA_85_TELEPORT_2: case KARTIA_90_TELEPORT_2: case KARTIA_95_TELEPORT_2: { if (instance.getParameters().getBoolean("TELEPORT_2_ENABLED", false)) { player.teleToLocation(instance.getTemplateParameters().getLocation("teleportZone2_loc")); } break; } case KARTIA_85_TELEPORT_3:
- * case KARTIA_90_TELEPORT_3: case KARTIA_95_TELEPORT_3: { if (instance.getParameters().getBoolean("TELEPORT_3_ENABLED", false)) { player.teleToLocation(instance.getTemplateParameters().getLocation("teleportZone3_loc")); } break; }
- */
}
}
return super.onEnterZone(character, zone);
@@ -546,31 +542,15 @@ public final class KartiasLabyrinth extends AbstractInstance
public void onMoveFinished(L2Npc npc)
{
final Instance instance = npc.getInstanceWorld();
- if (instance != null)
+ if ((instance != null) && CommonUtil.contains(PRISONERS, npc.getId()))
{
- if (CommonUtil.contains(PRISONERS, npc.getId()))
+ if (npc.isScriptValue(0))
{
- if (npc.isScriptValue(0))
- {
- npc.setScriptValue(1);
- final Location moveTo = new Location(npc.getX() + getRandom(-500, 500), npc.getY() + getRandom(-500, 500), npc.getZ());
- addMoveToDesire(npc, moveTo, 23);
- }
- else
- {
- npc.deleteMe();
- }
+ final Location moveTo = new Location(npc.getX() + getRandom(-200, 200), npc.getY() + getRandom(-200, 200), npc.getZ());
+ addMoveToDesire(npc, moveTo, 23);
}
- else if (npc.isScriptValue(1))
+ else
{
- npc.setScriptValue(2);
- addMoveToDesire(npc, instance.getTemplateParameters().getLocation("bossEscapeLoc2"), 23);
- }
- else if (npc.isScriptValue(2))
- {
- instance.setParameter("MINIBOSS_SURVIVED", true);
- instance.openCloseDoor(instance.getTemplateParameters().getInt("thirdDoorId"), true);
- instance.setStatus(3); // Used for notify helper's AI
npc.deleteMe();
}
}
@@ -585,7 +565,7 @@ public final class KartiasLabyrinth extends AbstractInstance
{
final Location moveTo = new Location(npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ());
npc.setRandomWalking(true);
- addMoveToDesire(npc, moveTo, 0);
+ addMoveToDesire(npc, moveTo, 6);
}
}
@@ -608,6 +588,11 @@ public final class KartiasLabyrinth extends AbstractInstance
npc.setTargetable(false);
npc.setIsInvul(true);
}
+ else if (CommonUtil.contains(MONSTERS, npc.getId()) || CommonUtil.contains(MINI_BOSSES, npc.getId()))
+ {
+ npc.setTargetable(false);
+ npc.setIsInvul(true);
+ }
}
return super.onSpawn(npc);
}
@@ -632,14 +617,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE1_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE1_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -662,14 +649,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE2_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE2_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -692,14 +681,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE3_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE3_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -744,7 +735,7 @@ public final class KartiasLabyrinth extends AbstractInstance
}
break;
}
- case 4:
+ case 4: // Only used in group version of instance.
{
switch (wave)
{
@@ -753,14 +744,16 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE4_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
{
moveMonsters(instance.spawnGroup("ROOM1_STAGE4_WAVE2"));
param.set("WAVE", 3);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 3:
@@ -774,7 +767,7 @@ public final class KartiasLabyrinth extends AbstractInstance
}
break;
}
- case 5:
+ case 5: // Only used in group version of instance.
{
switch (wave)
{
@@ -783,7 +776,8 @@ public final class KartiasLabyrinth extends AbstractInstance
showOnScreenMsg(instance, NpcStringId.STAGE_S1, ExShowScreenMessage.TOP_CENTER, 5000, true, Integer.toString(stage));
moveMonsters(instance.spawnGroup("ROOM1_STAGE5_WAVE1"));
param.set("WAVE", 2);
- getTimers().addTimer("NEXT_WAVE_DELAY", 30000, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("NEXT_WAVE_DELAY", WAVE_DEALY, n -> manageProgressInInstance(instance));
+ getTimers().addTimer("MONITOR_WAVE", WAVE_MONITOR_DELAY, n -> manageWaves(instance));
break;
}
case 2:
@@ -815,8 +809,7 @@ public final class KartiasLabyrinth extends AbstractInstance
}
else if (room == 2)
{
- instance.getParameters().set("TELEPORT_1_ENABLED", false);
- instance.setParameter("BOSS_CAN_ESCAPE", true);
+ instance.setParameter("BOSS_CAN_ESCAPE", false);
instance.setParameter("BOSS_KILL_OPEN_DOOR", true);
instance.spawnGroup("ROOM2_STAGE1_WAVE1");
instance.openCloseDoor(instance.getTemplateParameters().getInt("secondDoorId"), true);
@@ -909,24 +902,23 @@ public final class KartiasLabyrinth extends AbstractInstance
private void moveMonsters(List monsterList)
{
int delay = 500;
- for (L2Npc npc : monsterList)
+ for (L2Npc monster : monsterList)
{
- final Instance world = npc.getInstanceWorld();
- if (npc.isAttackable() && (world != null))
+ final Instance world = monster.getInstanceWorld();
+ if (monster.isAttackable() && (world != null))
{
if (world.getParameters().getInt("ROOM", 1) <= 2)
{
- npc.setRandomWalking(false);
- npc.setTargetable(false);
- getTimers().addTimer("MOVE_TO_MIDDLE", delay, npc, null);
+ monster.setRandomWalking(false);
+ getTimers().addTimer("MOVE_TO_MIDDLE", delay, monster, null);
delay += 250;
}
else if (world.getParameters().getInt("ROOM", 1) == 3)
{
- onTimerEvent("MOVE_TO_MIDDLE", null, npc, null);
+ onTimerEvent("MOVE_TO_MIDDLE", null, monster, null);
}
- ((L2Attackable) npc).setCanReturnToSpawnPoint(false);
- npc.initSeenCreatures();
+ ((L2Attackable) monster).setCanReturnToSpawnPoint(false);
+ monster.initSeenCreatures();
}
}
}
@@ -937,10 +929,19 @@ public final class KartiasLabyrinth extends AbstractInstance
final L2Npc npc = (L2Npc) event.getSeer();
final Instance world = npc.getInstanceWorld();
- if ((world != null) && creature.isPlayer() && npc.isScriptValue(0))
+ if ((world != null) && (creature.isPlayer() || creature.getInstanceType().isType(InstanceType.FriendlyNpcInstance)) && npc.isScriptValue(0))
{
- npc.setScriptValue(1);
- addAttackDesire(npc, creature);
+ final double distance = npc.calculateDistance(creature, false, false);
+ if ((distance < 450) && !CommonUtil.contains(PRISONERS, creature.getId()))
+ {
+ npc.setTargetable(true);
+ npc.setIsInvul(false);
+ npc.setScriptValue(1);
+ WalkingManager.getInstance().cancelMoving(npc);
+ ((L2MonsterInstance) npc).addDamageHate(creature, 0, 1000);
+ npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
+ addAttackDesire(npc, creature);
+ }
}
}
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java
index 58760f2b2f..8b41bab529 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00494_IncarnationOfGreedZellakaGroup/Q00494_IncarnationOfGreedZellakaGroup.java
@@ -33,6 +33,8 @@ public class Q00494_IncarnationOfGreedZellakaGroup extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_KEEPER_BLUE_BOX = 34927;
+ // Boss
+ private static final int BOSS = 25882; // Zellaka (Group 85)
// Misc
private static final int MIN_LEVEL = 85;
private static final int MAX_LEVEL = 89;
@@ -42,6 +44,7 @@ public class Q00494_IncarnationOfGreedZellakaGroup extends Quest
super(494);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,21 @@ public class Q00494_IncarnationOfGreedZellakaGroup extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ executeForEachPlayer(player, npc, isSummon, true, false);
+ return super.onKill(npc, player, isSummon);
+ }
+
+ @Override
+ public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java
index e8ab074857..3ea2f7da89 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00495_IncarnationOfJealousyPellineGroup/Q00495_IncarnationOfJealousyPellineGroup.java
@@ -33,6 +33,8 @@ public class Q00495_IncarnationOfJealousyPellineGroup extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_KEEPER_RED_BOX = 34928;
+ // Boss
+ private static final int BOSS = 25883; // Pelline (Group 90)
// Misc
private static final int MIN_LEVEL = 90;
private static final int MAX_LEVEL = 94;
@@ -42,6 +44,7 @@ public class Q00495_IncarnationOfJealousyPellineGroup extends Quest
super(495);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,21 @@ public class Q00495_IncarnationOfJealousyPellineGroup extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ executeForEachPlayer(player, npc, isSummon, true, false);
+ return super.onKill(npc, player, isSummon);
+ }
+
+ @Override
+ public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java
index 89a9d09a7a..e7a6258abf 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00496_IncarnationOfGluttonyKaliosGroup/Q00496_IncarnationOfGluttonyKaliosGroup.java
@@ -33,6 +33,8 @@ public class Q00496_IncarnationOfGluttonyKaliosGroup extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_KEEPER_GOLDEN_BOX = 34929;
+ // Boss
+ private static final int BOSS = 25884; // Kalios (Group 95)
// Misc
private static final int MIN_LEVEL = 95;
private static final int MAX_LEVEL = 99;
@@ -42,6 +44,7 @@ public class Q00496_IncarnationOfGluttonyKaliosGroup extends Quest
super(496);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,21 @@ public class Q00496_IncarnationOfGluttonyKaliosGroup extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ executeForEachPlayer(player, npc, isSummon, true, false);
+ return super.onKill(npc, player, isSummon);
+ }
+
+ @Override
+ public void actionForEachPlayer(L2PcInstance player, L2Npc npc, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java
index 9905030179..6e089781b2 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00497_IncarnationOfGreedZellakaSolo/Q00497_IncarnationOfGreedZellakaSolo.java
@@ -33,6 +33,8 @@ public class Q00497_IncarnationOfGreedZellakaSolo extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_TRAVELERS_BLUE_BOX = 34930;
+ // Boss
+ private static final int BOSS = 19253; // Zellaka (Solo 85)
// Misc
private static final int MIN_LEVEL = 85;
private static final int MAX_LEVEL = 89;
@@ -42,6 +44,7 @@ public class Q00497_IncarnationOfGreedZellakaSolo extends Quest
super(497);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,15 @@ public class Q00497_IncarnationOfGreedZellakaSolo extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ return super.onKill(npc, player, isSummon);
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java
index cab1faa0cd..ce0d861ab5 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00498_IncarnationOfJealousyPellineSolo/Q00498_IncarnationOfJealousyPellineSolo.java
@@ -33,6 +33,8 @@ public class Q00498_IncarnationOfJealousyPellineSolo extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_TRAVELERS_RED_BOX = 34931;
+ // Boss
+ private static final int BOSS = 19254; // Pelline (Solo 90)
// Misc
private static final int MIN_LEVEL = 90;
private static final int MAX_LEVEL = 94;
@@ -42,6 +44,7 @@ public class Q00498_IncarnationOfJealousyPellineSolo extends Quest
super(498);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,15 @@ public class Q00498_IncarnationOfJealousyPellineSolo extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ return super.onKill(npc, player, isSummon);
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java
index d0f4108998..9ab232f31a 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00499_IncarnationOfGluttonyKaliosSolo/Q00499_IncarnationOfGluttonyKaliosSolo.java
@@ -33,6 +33,8 @@ public class Q00499_IncarnationOfGluttonyKaliosSolo extends Quest
private static final int KARTIA_RESEARCHER = 33647;
// Item
private static final int DIMENSION_TRAVELERS_GOLDEN_BOX = 34932;
+ // Boss
+ private static final int BOSS = 19255; // Kalios (Solo 95)
// Misc
private static final int MIN_LEVEL = 95;
private static final int MAX_LEVEL = 99;
@@ -42,6 +44,7 @@ public class Q00499_IncarnationOfGluttonyKaliosSolo extends Quest
super(499);
addStartNpc(KARTIA_RESEARCHER);
addTalkId(KARTIA_RESEARCHER);
+ addKillId(BOSS);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "33647-00.htm");
}
@@ -115,4 +118,15 @@ public class Q00499_IncarnationOfGluttonyKaliosSolo extends Quest
}
return htmltext;
}
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
+ {
+ final QuestState qs = getQuestState(player, false);
+ if ((qs != null) && qs.isCond(1))
+ {
+ qs.setCond(2, true);
+ }
+ return super.onKill(npc, player, isSummon);
+ }
}
\ No newline at end of file
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/npcs/19200-19299.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/npcs/19200-19299.xml
index a527e4438b..611c66442e 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/npcs/19200-19299.xml
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/npcs/19200-19299.xml
@@ -636,7 +636,7 @@
-
+
UNDEAD
@@ -2011,7 +2011,7 @@
DEMONIC
MALE
-
+
@@ -2057,7 +2057,7 @@
DEMONIC
MALE
-
+
@@ -2104,7 +2104,7 @@
DEMONIC
MALE
-
+
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/npcs/25800-25899.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/npcs/25800-25899.xml
index 4659ffe456..f1999e19b2 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/npcs/25800-25899.xml
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/npcs/25800-25899.xml
@@ -4700,10 +4700,10 @@
DEMONIC
MALE
-
+
-
+
@@ -4726,66 +4726,86 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -4811,10 +4831,10 @@
DEMONIC
MALE
-
+
-
+
@@ -4843,66 +4863,86 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -4923,10 +4963,10 @@
DEMONIC
MALE
-
+
-
+
@@ -4955,67 +4995,92 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/14800-14899.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/14800-14899.xml
index b1a0e072b6..5f55858bce 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/14800-14899.xml
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/skills/14800-14899.xml
@@ -1102,7 +1102,7 @@
icon.skill10016
- A2
+ A1
600
500
1000
@@ -1124,8 +1124,7 @@
10-10
true
ENEMY
- RANGE
- NOT_FRIEND
+ SINGLE
600
@@ -1140,7 +1139,7 @@
icon.skill10016
- A2
+ A1
600
500
1000
@@ -1162,8 +1161,7 @@
10-10
true
ENEMY
- RANGE
- NOT_FRIEND
+ SINGLE
600
@@ -1178,7 +1176,7 @@
icon.skill10016
- A2
+ A1
600
500
1000
@@ -1200,8 +1198,7 @@
10-10
true
ENEMY
- RANGE
- NOT_FRIEND
+ SINGLE
600
@@ -1363,7 +1360,7 @@
0;0;150;180
STUN
true
- SELF
+ ENEMY
SINGLE
@@ -1399,7 +1396,7 @@
0;0;150;180
STUN
true
- SELF
+ ENEMY
SINGLE
@@ -1435,7 +1432,7 @@
0;0;150;180
STUN
true
- SELF
+ ENEMY
SINGLE
@@ -2721,7 +2718,6 @@
true
TARGET
SINGLE
- NOT_FRIEND
@@ -2750,7 +2746,6 @@
true
TARGET
SINGLE
- NOT_FRIEND
@@ -2779,7 +2774,6 @@
true
TARGET
SINGLE
- NOT_FRIEND
@@ -2937,11 +2931,6 @@
TARGET
RANGE
FRIEND
-
-
- 40
-
-
@@ -2962,8 +2951,8 @@
TARGET
SINGLE
-
- 1488
+
+ 20
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/Util.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/Util.java
index 850ae469e6..0508148f16 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/Util.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/Util.java
@@ -29,11 +29,13 @@ import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Date;
+import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
-import java.util.TreeMap;
import java.util.logging.Logger;
+import java.util.stream.Collectors;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.Rnd;
@@ -791,14 +793,24 @@ public final class Util
}
/**
- * Short an map by its integer values.
- * @param unsortedMap
- * @return
+ * This will sort a Map according to the values. Default sort direction is ascending.
+ * @param keyType
+ * @param valueType
+ * @param map Map to be sorted.
+ * @param descending If you want to sort descending.
+ * @return A new Map sorted by the values.
*/
- public static Map sortByValue(Map unsortedMap)
+ public static > Map sortByValue(Map map, boolean descending)
{
- Map sortedMap = new TreeMap<>(new ValueComparator(unsortedMap));
- sortedMap.putAll(unsortedMap);
- return sortedMap;
+ if (descending)
+ {
+ return map.entrySet().stream().sorted(Map.Entry.comparingByValue(Collections.reverseOrder())).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
+ }
+ return map.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
+ }
+
+ public static > Map sortByValue(Map map)
+ {
+ return map.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
}
}
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/ValueComparator.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/ValueComparator.java
deleted file mode 100644
index 32c494218d..0000000000
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/ValueComparator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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 .
- */
-package com.l2jmobius.gameserver.util;
-
-import java.util.Comparator;
-import java.util.Map;
-
-/**
- * @author Mobius
- */
-public class ValueComparator implements Comparator