Kartia rework.

Contributed by flanagan.
This commit is contained in:
MobiusDev
2017-12-27 23:54:11 +00:00
parent d2d2c5862e
commit 0a67610966
110 changed files with 6500 additions and 3295 deletions

View File

@@ -0,0 +1,5 @@
<html><body>Kartia Researcher:<br>
Don't waste my time! I'm a researcher sent directly by the Kingdom of Aden after all.<br>
You must have the quest started in order to enter the labyrinth.<br>
<Button ALIGN=LEFT ICON="QUEST" action="bypass -h npc_%objectId%_Quest">Quest</Button>
</body></html>

View File

@@ -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());
}
}
}

View File

@@ -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<L2MonsterInstance> 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<L2MonsterInstance> 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<L2MonsterInstance> 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));
}
}

View File

@@ -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());
}
}

View File

@@ -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<L2Object, Integer> 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<L2Object, Integer> 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<L2Object> 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();

View File

@@ -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();

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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();
}
}

View File

@@ -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();

View File

@@ -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<L2Npc> 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);
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}