Merged with released L2J-Unity files.

This commit is contained in:
mobiusdev
2016-06-12 01:34:09 +00:00
parent e003e87887
commit 635557f5da
18352 changed files with 3245113 additions and 2892959 deletions

View File

@@ -0,0 +1,152 @@
/*
* 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 ai.areas.KartiasLabyrinth;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc;
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.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Kartia Boss AI.
* @author St3eT
*/
public final class KartiaBoss extends AbstractNpcAI
{
// NPCs
private static final int[] BOSSES =
{
19253, // Zellaka (solo 85)
25882, // Zellaka (group 85)
19254, // Pelline (solo 90)
25883, // Pelline (group 90)
19255, // Kalios (solo 95)
25884, // Kalios (group 95)
};
private static final int FIGHTER_SOLO_85 = 19220;
private static final int MAGE_SOLO_85 = 19221;
private static final int FIGHTER_GROUP_85 = 19229;
private static final int MAGE_GROUP_85 = 19230;
private static final int FIGHTER_SOLO_90 = 19223;
private static final int MAGE_SOLO_90 = 19224;
private static final int FIGHTER_GROUP_90 = 19232;
private static final int MAGE_GROUP_90 = 19233;
private static final int FIGHTER_SOLO_95 = 19226;
private static final int MAGE_SOLO_95 = 19227;
private static final int FIGHTER_GROUP_95 = 19235;
private static final int MAGE_GROUP_95 = 19236;
private KartiaBoss()
{
addSpawnId(BOSSES);
setCreatureKillId(this::onCreatureKill, BOSSES);
setCreatureAttackedId(this::onCreatureAttacked, BOSSES);
}
@Override
public String onSpawn(L2Npc npc)
{
getTimers().addRepeatingTimer("NPC_SAY", 20000, npc, null);
return super.onSpawn(npc);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
if (event.equals("NPC_SAY") && npc.isTargetable())
{
npc.broadcastSay(ChatType.NPC_SHOUT, NpcStringId.YOU_PUNY_INSECTS_DON_T_KNOW_YOUR_PLACE_YOU_CANNOT_STOP_ME);
}
}
public void onCreatureKill(OnCreatureDeath event)
{
final L2Npc npc = (L2Npc) event.getTarget();
npc.broadcastSay(ChatType.NPC_SHOUT, NpcStringId.NO_HOW_COULD_THIS_BE_I_CAN_T_GO_BACK_TO_NIHIL_LIKE_THIS);
getTimers().cancelTimersOf(npc);
}
public void onCreatureAttacked(OnCreatureAttacked event)
{
final L2Npc npc = (L2Npc) event.getTarget();
if ((npc.getCurrentHpPercent() <= 75) && npc.isScriptValue(0))
{
spawnMinions(npc);
npc.setScriptValue(1);
}
else if ((npc.getCurrentHpPercent() <= 50) && npc.isScriptValue(1))
{
spawnMinions(npc);
npc.setScriptValue(2);
}
else if ((npc.getCurrentHpPercent() <= 25) && npc.isScriptValue(2))
{
spawnMinions(npc);
npc.setScriptValue(3);
}
}
public void spawnMinions(L2Npc npc)
{
final StatsSet param = npc.getParameters();
final int kartiaLevel = param.getInt("cartia_level", 0);
final boolean isParty = param.getInt("party_type", 0) == 1;
int fighter = 0;
int mage = 0;
switch (kartiaLevel)
{
case 85:
{
fighter = isParty ? FIGHTER_GROUP_85 : FIGHTER_SOLO_85;
mage = isParty ? MAGE_GROUP_85 : MAGE_SOLO_85;
break;
}
case 90:
{
fighter = isParty ? FIGHTER_GROUP_90 : FIGHTER_SOLO_90;
mage = isParty ? MAGE_GROUP_90 : MAGE_SOLO_90;
break;
}
case 95:
{
fighter = isParty ? FIGHTER_GROUP_95 : FIGHTER_SOLO_95;
mage = isParty ? MAGE_GROUP_95 : MAGE_SOLO_95;
break;
}
}
if ((fighter > 0) && (mage > 0))
{
for (int i = 0; i < 3; i++)
{
addSpawn(fighter, npc, false, 0, false, npc.getInstanceId());
addSpawn(mage, npc, false, 0, false, npc.getInstanceId());
}
}
}
public static void main(String[] args)
{
new KartiaBoss();
}
}

View File

@@ -0,0 +1,247 @@
/*
* 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 ai.areas.KartiasLabyrinth;
import java.util.List;
import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.GeoData;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.L2World;
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.L2MonsterInstance;
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.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
*/
public final class KartiaHelperAdolph 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[] MIRRORS =
{
33798, // Life Plunderer (85)
33799, // Life Plunderer (90)
33800, // Life Plunderer (95)
};
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
205, // Solo 85
206, // Solo 90
207, // Solo 95
};
private KartiaHelperAdolph()
{
setCreatureKillId(this::onCreatureKill, KARTIA_ADOLPH);
setCreatureAttackedId(this::onCreatureAttacked, KARTIA_ADOLPH);
addSpellFinishedId(KARTIA_ADOLPH);
addSeeCreatureId(KARTIA_ADOLPH);
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 StatsSet instParams = instance.getTemplateParameters();
boolean actionFound = false;
if (!npc.isInCombat() || !npc.isAttackingNow() || (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 (monster.isTargetable() && GeoData.getInstance().canSeeTarget(npc, monster) && !CommonUtil.contains(MIRRORS, monster.getId()))
{
actionFound = true;
addAttackDesire(npc, monster);
}
}
}
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)
{
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 = GeoData.getInstance().moveCheck(instancePlayer.getX(), instancePlayer.getY(), instancePlayer.getZ(), X, Y, instancePlayer.getZ(), instance);
if (!npc.isInsideRadius(loc, 50, true, true))
{
npc.setIsRunning(true);
addMoveToDesire(npc, loc, 23);
}
}
}
}
}
}
@Override
public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill)
{
final Instance instance = npc.getInstanceWorld();
if (instance != null)
{
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()))
{
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);
}
}
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())
{
final StatsSet instParams = instance.getTemplateParameters();
final int random = getRandom(1000);
if (random < 333)
{
final SkillHolder shieldSkill = instParams.getSkillHolder("adolphShield");
if ((shieldSkill != null) && SkillCaster.checkUseConditions(npc, shieldSkill.getSkill()))
{
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));
}
}
}
}
public void onCreatureKill(OnCreatureDeath event)
{
final L2Npc npc = (L2Npc) event.getTarget();
final Instance world = npc.getInstanceWorld();
if (world != null)
{
getTimers().cancelTimersOf(npc);
world.destroy(); // Kartia can't continue without Adolph
}
}
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
switch (status)
{
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;
}
}
}
@Override
public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
{
if (creature.isPlayer())
{
npc.getVariables().set("PLAYER_OBJECT", creature.getActingPlayer());
}
return super.onSeeCreature(npc, creature, isSummon);
}
public static void main(String[] args)
{
new KartiaHelperAdolph();
}
}

View File

@@ -0,0 +1,190 @@
/*
* 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 ai.areas.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 Barton AI.
* @author St3eT
*/
public final class KartiaHelperBarton extends AbstractNpcAI
{
// NPCs
private static final int[] KARTIA_BARTON =
{
33611, // Barton (Kartia 85)
33622, // Barton (Kartia 90)
33633, // Barton (Kartia 95)
};
private static final int[] KARTIA_ADOLPH =
{
33609, // Adolph (Kartia 85)
33620, // Adolph (Kartia 90)
33631, // Adolph (Kartia 95)
};
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
205, // Solo 85
206, // Solo 90
207, // Solo 95
};
private KartiaHelperBarton()
{
setCreatureKillId(this::onCreatureKill, KARTIA_BARTON);
setCreatureAttackedId(this::onCreatureAttacked, KARTIA_BARTON);
addSeeCreatureId(KARTIA_BARTON);
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 > 200)
{
final Location loc = new Location(adolph.getX() + getRandom(-100, 100), adolph.getY() + getRandom(-100, 100), adolph.getZ() + 50);
if (distance > 500)
{
npc.teleToLocation(loc);
}
else
{
npc.setIsRunning(true);
addMoveToDesire(npc, loc, 23);
}
}
else if (!npc.isInCombat() || !npc.isAttackingNow() || (npc.getTarget() == null))
{
final L2Character monster = (L2Character) adolph.getTarget();
if ((monster != null) && adolph.isInCombat())
{
addAttackDesire(npc, monster);
}
}
}
}
}
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
switch (status)
{
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;
}
}
}
@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();
final Instance instance = npc.getInstanceWorld();
if ((instance != null) && !event.getAttacker().isPlayable())
{
final StatsSet instParams = instance.getTemplateParameters();
final int random = getRandom(1000);
if (random < 333)
{
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));
}
}
}
}
public void onCreatureKill(OnCreatureDeath event)
{
final L2Npc npc = (L2Npc) event.getTarget();
final Instance world = npc.getInstanceWorld();
if (world != null)
{
getTimers().cancelTimersOf(npc);
}
}
public static void main(String[] args)
{
new KartiaHelperBarton();
}
}

View File

@@ -0,0 +1,316 @@
/*
* 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 ai.areas.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.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.network.NpcStringId;
import com.l2jmobius.gameserver.util.Util;
import ai.AbstractNpcAI;
/**
* Kartia Helper Elise AI.
* @author St3eT
*/
public final class KartiaHelperElise extends AbstractNpcAI
{
// NPCs
private static final int[] KARTIA_ELISE =
{
33617, // Elise (Kartia 85)
33628, // Elise (Kartia 90)
33639, // Elise (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_BARTON =
{
33611, // Barton (Kartia 85)
33622, // Barton (Kartia 90)
33633, // Barton (Kartia 95)
};
private static final int[] KARTIA_ELIYAH =
{
33615, // Eliyah (Kartia 85)
33626, // Eliyah (Kartia 90)
33637, // Eliyah (Kartia 95)
};
private static final int[] KARTIA_HAYUK =
{
33613, // Hayuk (Kartia 85)
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
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
205, // Solo 85
206, // Solo 90
207, // Solo 95
};
private KartiaHelperElise()
{
setInstanceStatusChangeId(this::onInstanceStatusChange, KARTIA_SOLO_INSTANCES);
addSeeCreatureId(KARTIA_ELISE);
setCreatureKillId(this::onCreatureKill, KARTIA_ELISE);
}
@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 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)))
{
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);
}
}
}
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)
{
final double distance = npc.calculateDistance(adolph, false, false);
if (distance > 200)
{
final Location loc = new Location(adolph.getX() + getRandom(-100, 100), adolph.getY() + getRandom(-100, 100), adolph.getZ() + 50);
if (distance > 500)
{
npc.teleToLocation(loc);
}
else
{
npc.setIsRunning(true);
addMoveToDesire(npc, loc, 23);
}
}
}
}
}
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
switch (status)
{
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;
}
}
}
@Override
public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
{
if (creature.isPlayer() || (creature instanceof FriendlyNpcInstance))
{
final StatsSet npcVars = npc.getVariables();
if (creature.isPlayer())
{
npcVars.set("PLAYER_OBJECT", creature.getActingPlayer());
}
else if (CommonUtil.contains(KARTIA_ADOLPH, creature.getId()))
{
npcVars.set("ADOLPH_OBJECT", creature);
}
else if (CommonUtil.contains(KARTIA_BARTON, creature.getId()))
{
npcVars.set("BARTON_OBJECT", creature);
}
else if (CommonUtil.contains(KARTIA_ELIYAH, creature.getId()))
{
npcVars.set("ELIYAH_OBJECT", creature);
}
else if (CommonUtil.contains(KARTIA_HAYUK, creature.getId()))
{
npcVars.set("HAYUK_OBJECT", creature);
}
}
return super.onSeeCreature(npc, creature, isSummon);
}
public void onCreatureKill(OnCreatureDeath event)
{
final L2Npc npc = (L2Npc) event.getTarget();
final Instance world = npc.getInstanceWorld();
if (world != null)
{
getTimers().cancelTimersOf(npc);
}
}
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

@@ -0,0 +1,79 @@
/*
* 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 ai.areas.KartiasLabyrinth;
import com.l2jmobius.gameserver.model.Location;
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
*/
public final class KartiaHelperEliyah extends AbstractNpcAI
{
// NPCs
private static final int[] KARTIA_ELIYAH =
{
33615, // Eliyah (Kartia 85)
33626, // Eliyah (Kartia 90)
33637, // Eliyah (Kartia 95)
};
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
205, // Solo 85
206, // Solo 90
207, // Solo 95
};
private KartiaHelperEliyah()
{
setInstanceStatusChangeId(this::onInstanceStatusChange, KARTIA_SOLO_INSTANCES);
}
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
switch (status)
{
case 1:
{
// Nothing for now
break;
}
case 2:
case 3:
{
final Location loc = instance.getTemplateParameters().getLocation("eliyahTeleportStatus" + status);
if (loc != null)
{
instance.getAliveNpcs(KARTIA_ELIYAH).forEach(eliyah -> eliyah.teleToLocation(loc));
}
break;
}
}
}
public static void main(String[] args)
{
new KartiaHelperEliyah();
}
}

View File

@@ -0,0 +1,79 @@
/*
* 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 ai.areas.KartiasLabyrinth;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.events.impl.instance.OnInstanceStatusChange;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import ai.AbstractNpcAI;
/**
* Kartia Helper Hayuk AI.
* @author St3eT
*/
public final class KartiaHelperHayuk extends AbstractNpcAI
{
// NPCs
private static final int[] KARTIA_HAYUK =
{
33613, // Hayuk (Kartia 85)
33624, // Hayuk (Kartia 90)
33635, // Hayuk (Kartia 95)
};
// Misc
private static final int[] KARTIA_SOLO_INSTANCES =
{
205, // Solo 85
206, // Solo 90
207, // Solo 95
};
private KartiaHelperHayuk()
{
setInstanceStatusChangeId(this::onInstanceStatusChange, KARTIA_SOLO_INSTANCES);
}
public void onInstanceStatusChange(OnInstanceStatusChange event)
{
final Instance instance = event.getWorld();
final int status = event.getStatus();
switch (status)
{
case 1:
{
// Nothing for now
break;
}
case 2:
case 3:
{
final Location loc = instance.getTemplateParameters().getLocation("hayukTeleportStatus" + status);
if (loc != null)
{
instance.getAliveNpcs(KARTIA_HAYUK).forEach(hayuk -> hayuk.teleToLocation(loc));
}
break;
}
}
}
public static void main(String[] args)
{
new KartiaHelperHayuk();
}
}

View File

@@ -0,0 +1,92 @@
/*
* 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 ai.areas.KartiasLabyrinth;
import java.util.List;
import com.l2jmobius.gameserver.GeoData;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.StatsSet;
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.network.NpcStringId;
import ai.AbstractNpcAI;
/**
* Kartia Support Troop AI.
* @author St3eT
*/
public final class KartiaSupportTroop extends AbstractNpcAI
{
// NPCs
private static final int[] SUPPORT_TROOPS =
{
33642, // Support Troop (Kartia 85)
33644, // Support Troop (Kartia 90)
33646, // Support Troop (Kartia 95)
};
private KartiaSupportTroop()
{
addSpawnId(SUPPORT_TROOPS);
}
@Override
public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player)
{
if (event.equals("NPC_SAY"))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DEFEAT_ALL_THE_MONSTERS);
}
else if (event.equals("CHECK_TARGET"))
{
if (!npc.isInCombat() || !npc.isAttackingNow() || (npc.getTarget() == null))
{
final List<L2MonsterInstance> monsterList = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class);
if (!monsterList.isEmpty())
{
final L2MonsterInstance monster = monsterList.get(getRandom(monsterList.size()));
if (monster.isTargetable() && GeoData.getInstance().canSeeTarget(npc, monster))
{
addAttackDesire(npc, monster);
}
}
}
}
}
@Override
public String onSpawn(L2Npc npc)
{
if (npc.getInstanceWorld() != null)
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.VANGUARD_OF_ADEN_WE_HAVE_RETURNED);
getTimers().addRepeatingTimer("NPC_SAY", 20000, npc, null);
getTimers().addRepeatingTimer("CHECK_TARGET", 1000, npc, null);
}
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new KartiaSupportTroop();
}
}