Script adjustments.
This commit is contained in:
@@ -230,6 +230,7 @@ public final class Alarm extends AbstractNpcAI
|
||||
@Override
|
||||
public String onSpawn(Npc npc)
|
||||
{
|
||||
cancelQuestTimer("SELF_DESTRUCT_IN_60", npc, null);
|
||||
startQuestTimer("SELF_DESTRUCT_IN_60", 60000, npc, null);
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.INTRUDER_ALERT_THE_ALARM_WILL_SELF_DESTRUCT_IN_2_MINUTES);
|
||||
final PlayerInstance player = npc.getVariables().getObject("player0", PlayerInstance.class);
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* 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.DenOfDevil;
|
||||
package ai.areas.DenOfEvil;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
@@ -28,6 +28,7 @@ import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.model.zone.type.EffectZone;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.scripting.annotations.Disabled;
|
||||
|
||||
import ai.AbstractNpcAI;
|
||||
|
||||
@@ -35,6 +36,7 @@ import ai.AbstractNpcAI;
|
||||
* Dummy AI for spawns/respawns only for testing.
|
||||
* @author Gnacik
|
||||
*/
|
||||
@Disabled // Mobius: this needs to be rewritten.
|
||||
public final class DenOfEvil extends AbstractNpcAI
|
||||
{
|
||||
// private static final int _buffer_id = 32656;
|
@@ -14,7 +14,7 @@
|
||||
* 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.DenOfDevil;
|
||||
package ai.areas.DenOfEvil;
|
||||
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
@@ -14,7 +14,7 @@
|
||||
* 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.DenOfDevil;
|
||||
package ai.areas.DenOfEvil;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* 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.DenOfDevil;
|
||||
package ai.areas.DenOfEvil;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* 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.DenOfDevil;
|
||||
package ai.areas.DenOfEvil;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
|
@@ -84,6 +84,7 @@ public class GardenWatchman extends AbstractNpcAI
|
||||
@Override
|
||||
public String onSpawn(Npc npc)
|
||||
{
|
||||
cancelQuestTimer("SPAWN_TRAP", npc, null);
|
||||
startQuestTimer("SPAWN_TRAP", 50000, npc, null);
|
||||
return super.onSpawn(npc);
|
||||
}
|
||||
|
@@ -66,6 +66,8 @@ public final class GenesisVines extends AbstractNpcAI
|
||||
{
|
||||
npc.disableCoreAI(true);
|
||||
npc.setScriptValue(1);
|
||||
cancelQuestTimer("CAST_SKILL", npc, null);
|
||||
cancelQuestTimer("DELETE", npc, null);
|
||||
startQuestTimer("CAST_SKILL", 3000, npc, null);
|
||||
startQuestTimer("DELETE", 150000, npc, null);
|
||||
return super.onSpawn(npc);
|
||||
|
@@ -112,16 +112,19 @@ public final class Spirit extends AbstractNpcAI
|
||||
{
|
||||
case EXECUTED_MAIDEN_VENGEFUL_SPIRIT:
|
||||
{
|
||||
cancelQuestTimer("SPAM_TEXT1", npc, null);
|
||||
startQuestTimer("SPAM_TEXT1", 50000, npc, null, true);
|
||||
break;
|
||||
}
|
||||
case SPIRIT_OF_THE_TORTURED_DWARF:
|
||||
{
|
||||
cancelQuestTimer("SPAM_TEXT2", npc, null);
|
||||
startQuestTimer("SPAM_TEXT2", 50000, npc, null, true);
|
||||
break;
|
||||
}
|
||||
case SPIRIT_OF_ONE_BURNED_ALIVE:
|
||||
{
|
||||
cancelQuestTimer("SPAM_TEXT3", npc, null);
|
||||
startQuestTimer("SPAM_TEXT3", 50000, npc, null, true);
|
||||
break;
|
||||
}
|
||||
|
@@ -403,6 +403,7 @@ public final class FourSepulchers extends AbstractNpcAI implements IXmlReader
|
||||
((Attackable) npc).setCanReturnToSpawnPoint(false);
|
||||
npc.setTargetable(false);
|
||||
npc.setIsInvul(true);
|
||||
cancelQuestTimer("REMOVE_PETRIFY", npc, null);
|
||||
startQuestTimer("REMOVE_PETRIFY", 5 * 60 * 1000, npc, null, false); // 5 minutes
|
||||
}
|
||||
return super.onSpawn(npc);
|
||||
|
@@ -215,6 +215,12 @@ public final class DarkWaterDragon extends AbstractNpcAI
|
||||
addSpawn(DETRACTOR1, x + 100, y - 100, npc.getZ(), 0, false, 40000);
|
||||
addSpawn(DETRACTOR2, x - 100, y + 100, npc.getZ(), 0, false, 40000);
|
||||
addSpawn(DETRACTOR1, x - 100, y - 100, npc.getZ(), 0, false, 40000);
|
||||
cancelQuestTimer("first_spawn", npc, null);
|
||||
cancelQuestTimer("second_spawn", npc, null);
|
||||
cancelQuestTimer("third_spawn", npc, null);
|
||||
cancelQuestTimer("fourth_spawn", npc, null);
|
||||
cancelQuestTimer("fafurion_poison", npc, null);
|
||||
cancelQuestTimer("fafurion_despawn", npc, null);
|
||||
startQuestTimer("first_spawn", 2000, npc, null); // timer to delay timer "1"
|
||||
startQuestTimer("second_spawn", 4000, npc, null); // timer to delay timer "2"
|
||||
startQuestTimer("third_spawn", 8000, npc, null); // timer to delay timer "3"
|
||||
|
@@ -73,7 +73,7 @@ public final class HillsOfGold extends AbstractNpcAI
|
||||
return;
|
||||
}
|
||||
});
|
||||
startQuestTimer("SPICULA_AGGRO" + npc.getObjectId(), 10000, npc, null);
|
||||
startQuestTimer("SPICULA_AGGRO", 10000, npc, null);
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public final class HillsOfGold extends AbstractNpcAI
|
||||
{
|
||||
if ((npc.getId() == SPICULA_1) || (npc.getId() == SPICULA_2))
|
||||
{
|
||||
startQuestTimer("SPICULA_AGGRO" + npc.getObjectId(), 5000, npc, null);
|
||||
startQuestTimer("SPICULA_AGGRO", 5000, npc, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -282,6 +282,7 @@ public final class MonasteryOfSilence extends AbstractNpcAI
|
||||
{
|
||||
npc.setIsInvul(true);
|
||||
npc.disableCoreAI(true);
|
||||
cancelQuestTimer("TRAINING", npc, null);
|
||||
startQuestTimer("TRAINING", 30000, npc, null, true);
|
||||
return super.onSpawn(npc);
|
||||
}
|
||||
|
@@ -75,7 +75,7 @@ public final class OrcBarracks extends AbstractNpcAI
|
||||
@Override
|
||||
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
|
||||
{
|
||||
if (killer.getRace() == Race.ERTHEIA && (SPAWN_RATE > getRandom(100)))
|
||||
if ((killer.getRace() == Race.ERTHEIA) && (SPAWN_RATE > getRandom(100)))
|
||||
{
|
||||
final int npcId = (killer.isMageClass()) ? CHERTUBA_ILLUSION : CHERTUBA_MIRAGE;
|
||||
showOnScreenMsg(killer, NpcStringId.A_POWERFUL_MONSTER_HAS_COME_TO_FACE_YOU, ExShowScreenMessage.TOP_CENTER, 5000);
|
||||
|
@@ -486,6 +486,7 @@ public final class PrimevalIsle extends AbstractNpcAI
|
||||
{
|
||||
if (CommonUtil.contains(SPRIGNANT, npc.getId()))
|
||||
{
|
||||
cancelQuestTimer("USE_SKILL", npc, null);
|
||||
startQuestTimer("USE_SKILL", 15000, npc, null);
|
||||
}
|
||||
else if (CommonUtil.contains(TREX, npc.getId()))
|
||||
@@ -495,6 +496,7 @@ public final class PrimevalIsle extends AbstractNpcAI
|
||||
|
||||
if (collectGhost == 1)
|
||||
{
|
||||
cancelQuestTimer("GHOST_DESPAWN", npc, null);
|
||||
startQuestTimer("GHOST_DESPAWN", collectDespawn * 60000, npc, null);
|
||||
}
|
||||
}
|
||||
|
@@ -263,6 +263,7 @@ public final class SelMahumDrill extends AbstractNpcAI
|
||||
{
|
||||
if (CommonUtil.contains(MAHUM_CHIEFS, npc.getId()))
|
||||
{
|
||||
cancelQuestTimer("do_social_action", npc, null);
|
||||
startQuestTimer("do_social_action", 15000, npc, null);
|
||||
}
|
||||
|
||||
|
@@ -68,7 +68,6 @@ public final class SelMahumSquad extends AbstractNpcAI
|
||||
|
||||
private SelMahumSquad()
|
||||
{
|
||||
|
||||
addAttackId(CHEF);
|
||||
addAttackId(SQUAD_LEADERS);
|
||||
addEventReceivedId(CHEF, FIRE, STOVE);
|
||||
@@ -320,7 +319,7 @@ public final class SelMahumSquad extends AbstractNpcAI
|
||||
@Override
|
||||
public void onMoveFinished(Npc npc)
|
||||
{
|
||||
// Npc moves to fire
|
||||
// NPC moves to fire.
|
||||
if (!npc.isRandomWalkingEnabled() && (npc.getX() == npc.getVariables().getInt("DESTINATION_X")) && (npc.getY() == npc.getVariables().getInt("DESTINATION_Y")))
|
||||
{
|
||||
npc.setRHandId(OHS_Weapon);
|
||||
@@ -354,6 +353,7 @@ public final class SelMahumSquad extends AbstractNpcAI
|
||||
}
|
||||
else if (npc.getId() == FIRE)
|
||||
{
|
||||
cancelQuestTimer("fire", npc, null);
|
||||
startQuestTimer("fire", 1000, npc, null);
|
||||
}
|
||||
else if (CommonUtil.contains(SQUAD_LEADERS, npc.getId()))
|
||||
|
@@ -72,7 +72,9 @@ public final class BoyAndGirl extends AbstractNpcAI
|
||||
@Override
|
||||
public String onSpawn(Npc npc)
|
||||
{
|
||||
cancelQuestTimer("NPC_CHANGEWEAP", npc, null);
|
||||
startQuestTimer("NPC_CHANGEWEAP", 15000 + (getRandom(5) * 1000), npc, null);
|
||||
cancelQuestTimer("NPC_SHOUT", npc, null);
|
||||
startQuestTimer("NPC_SHOUT", 10000 + (getRandom(5) * 1000), npc, null);
|
||||
npc.setRunning();
|
||||
final Location randomLoc = Util.getRandomPosition(npc.getSpawn().getLocation(), 200, 600);
|
||||
|
@@ -61,6 +61,7 @@ public final class Handermonkey extends AbstractNpcAI
|
||||
public String onSpawn(Npc npc)
|
||||
{
|
||||
npc.setRunning();
|
||||
cancelQuestTimer("NPC_MOVE", npc, null);
|
||||
startQuestTimer("NPC_MOVE", 5000, npc, null, true);
|
||||
return super.onSpawn(npc);
|
||||
}
|
||||
|
@@ -123,11 +123,11 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
|
||||
|
||||
private static final class changeZoneStage implements Runnable
|
||||
{
|
||||
private final ZoneType zone;
|
||||
private final ZoneType _zone;
|
||||
|
||||
public changeZoneStage(ZoneType a)
|
||||
public changeZoneStage(ZoneType zone)
|
||||
{
|
||||
zone = a;
|
||||
_zone = zone;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -135,50 +135,50 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
|
||||
{
|
||||
try
|
||||
{
|
||||
zoneInfo currentInfo = _roomInfo.get(zone);
|
||||
zoneInfo currentInfo = _roomInfo.get(_zone);
|
||||
switch (currentInfo.getZoneStage())
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.MONITOR_THE_DAMAGE_FOR_30_SEC, ExShowScreenMessage.TOP_CENTER, 3000));
|
||||
_zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.MONITOR_THE_DAMAGE_FOR_30_SEC, ExShowScreenMessage.TOP_CENTER, 3000));
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.TWENTY_FIVE_SECONDS_LEFT, ExShowScreenMessage.TOP_CENTER, 3000));
|
||||
_zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.TWENTY_FIVE_SECONDS_LEFT, ExShowScreenMessage.TOP_CENTER, 3000));
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.TWENTY_SECONDS_LEFT, ExShowScreenMessage.TOP_CENTER, 3000));
|
||||
_zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.TWENTY_SECONDS_LEFT, ExShowScreenMessage.TOP_CENTER, 3000));
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.FIFTEEN_SECONDS_LEFT, ExShowScreenMessage.TOP_CENTER, 3000));
|
||||
_zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.FIFTEEN_SECONDS_LEFT, ExShowScreenMessage.TOP_CENTER, 3000));
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.TEN_SECONDS_LEFT, ExShowScreenMessage.TOP_CENTER, 3000));
|
||||
_zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.TEN_SECONDS_LEFT, ExShowScreenMessage.TOP_CENTER, 3000));
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.FIVE_SECONDS_LEFT, ExShowScreenMessage.TOP_CENTER, 3000));
|
||||
_zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.FIVE_SECONDS_LEFT, ExShowScreenMessage.TOP_CENTER, 3000));
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
if (currentInfo.getCurrentMonitorizedDamage() >= 10)
|
||||
{
|
||||
zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.DEMONIC_SYSTEM_WILL_ACTIVATE, ExShowScreenMessage.TOP_CENTER, 3000));
|
||||
String zoneName = zone.getName().toLowerCase().replace(" ", "_");
|
||||
_zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.DEMONIC_SYSTEM_WILL_ACTIVATE, ExShowScreenMessage.TOP_CENTER, 3000));
|
||||
String zoneName = _zone.getName().toLowerCase().replace(" ", "_");
|
||||
_templates.stream().forEach(t -> t.despawn(g -> String.valueOf(g.getName()).equalsIgnoreCase(zoneName)));
|
||||
_templates.stream().forEach(t -> t.spawn(g -> String.valueOf(g.getName()).equalsIgnoreCase(zoneName + "_demonic"), null));
|
||||
zone.getPlayersInside().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 600, 0, NpcStringId.DEMONIC_SYSTEM_ACTIVATED)));
|
||||
_zone.getPlayersInside().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 600, 0, NpcStringId.DEMONIC_SYSTEM_ACTIVATED)));
|
||||
currentInfo.setZoneStage(7);
|
||||
ThreadPool.schedule(new changeZoneStage(zone), 600000); // 10min
|
||||
ThreadPool.schedule(new changeZoneStage(_zone), 600000); // 10min
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -190,14 +190,14 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
|
||||
case 7:
|
||||
{
|
||||
currentInfo.reset();
|
||||
for (PlayerInstance player : zone.getPlayersInside())
|
||||
for (PlayerInstance player : _zone.getPlayersInside())
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
player.sendPacket(new ExSendUIEvent(player));
|
||||
}
|
||||
}
|
||||
String zoneName = zone.getName().toLowerCase().replace(" ", "_");
|
||||
String zoneName = _zone.getName().toLowerCase().replace(" ", "_");
|
||||
_templates.stream().forEach(t -> t.despawn(g -> String.valueOf(g.getName()).equalsIgnoreCase(zoneName + "_demonic")));
|
||||
_templates.stream().forEach(t -> t.spawn(g -> String.valueOf(g.getName()).equalsIgnoreCase(zoneName), null));
|
||||
return;
|
||||
@@ -206,7 +206,7 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
|
||||
if (currentInfo.getZoneStage() < 6)
|
||||
{
|
||||
currentInfo.setZoneStage(currentInfo.getZoneStage() + 1);
|
||||
ThreadPool.schedule(new changeZoneStage(zone), 5000);
|
||||
ThreadPool.schedule(new changeZoneStage(_zone), 5000);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -223,7 +223,7 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
|
||||
{
|
||||
if (currentZone.getKey().isInsideZone(npc))
|
||||
{
|
||||
zoneInfo currentInfo = currentZone.getValue();
|
||||
final zoneInfo currentInfo = currentZone.getValue();
|
||||
int currentPoints = currentInfo.getCurrentPoints();
|
||||
if (currentPoints == 300)
|
||||
{
|
||||
|
@@ -85,6 +85,11 @@ public final class Wastelands extends AbstractNpcAI
|
||||
@Override
|
||||
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
|
||||
{
|
||||
if ((npc == null) || !npc.isSpawned())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case "SOCIAL_SHOW":
|
||||
|
@@ -54,8 +54,7 @@ public final class ZealotOfShilen extends AbstractNpcAI
|
||||
return null;
|
||||
}
|
||||
|
||||
startQuestTimer("WATCHING", 10000, npc, null, true);
|
||||
if (event.equalsIgnoreCase("WATCHING") && !npc.isAttackingNow())
|
||||
if (event.equals("WATCHING") && !npc.isAttackingNow() && !npc.isAlikeDead())
|
||||
{
|
||||
World.getInstance().forEachVisibleObject(npc, MonsterInstance.class, character ->
|
||||
{
|
||||
@@ -66,6 +65,7 @@ public final class ZealotOfShilen extends AbstractNpcAI
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, character, null);
|
||||
}
|
||||
});
|
||||
startQuestTimer("WATCHING", 10000, npc, null);
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
@@ -81,13 +81,14 @@ public final class ZealotOfShilen extends AbstractNpcAI
|
||||
{
|
||||
if (npc.getId() == ZEALOT)
|
||||
{
|
||||
npc.setRandomWalking(true);
|
||||
npc.setRandomWalking(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setIsInvul(true);
|
||||
((Attackable) npc).setCanReturnToSpawnPoint(false);
|
||||
startQuestTimer("WATCHING", 10000, npc, null, true);
|
||||
cancelQuestTimer("WATCHING", npc, null);
|
||||
startQuestTimer("WATCHING", 10000, npc, null);
|
||||
}
|
||||
return super.onSpawn(npc);
|
||||
}
|
||||
|
@@ -588,6 +588,7 @@ public final class IstinaCavern extends AbstractInstance
|
||||
npc.setUndying(true);
|
||||
npc.setIsInvul(true);
|
||||
npc.setTargetable(false);
|
||||
getTimers().cancelTimer("BALLISTA_START_TIMER", npc, null);
|
||||
getTimers().addTimer("BALLISTA_START_TIMER", 10000, npc, null);
|
||||
}
|
||||
}
|
||||
|
@@ -18,10 +18,8 @@ package ai.bosses.QueenAnt;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
@@ -84,7 +82,6 @@ public final class QueenAnt extends AbstractNpcAI
|
||||
MonsterInstance _queen = null;
|
||||
private MonsterInstance _larva = null;
|
||||
private final Set<MonsterInstance> _nurses = ConcurrentHashMap.newKeySet();
|
||||
ScheduledFuture<?> _task = null;
|
||||
|
||||
private QueenAnt()
|
||||
{
|
||||
@@ -160,68 +157,87 @@ public final class QueenAnt extends AbstractNpcAI
|
||||
@Override
|
||||
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
|
||||
{
|
||||
if (event.equalsIgnoreCase("heal"))
|
||||
switch (event)
|
||||
{
|
||||
boolean notCasting;
|
||||
final boolean larvaNeedHeal = (_larva != null) && (_larva.getCurrentHp() < _larva.getMaxHp());
|
||||
final boolean queenNeedHeal = (_queen != null) && (_queen.getCurrentHp() < _queen.getMaxHp());
|
||||
for (MonsterInstance nurse : _nurses)
|
||||
case "heal":
|
||||
{
|
||||
if ((nurse == null) || nurse.isDead() || nurse.isCastingNow(SkillCaster::isAnyNormalType))
|
||||
boolean notCasting;
|
||||
final boolean larvaNeedHeal = (_larva != null) && (_larva.getCurrentHp() < _larva.getMaxHp());
|
||||
final boolean queenNeedHeal = (_queen != null) && (_queen.getCurrentHp() < _queen.getMaxHp());
|
||||
for (MonsterInstance nurse : _nurses)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
notCasting = nurse.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST;
|
||||
if (larvaNeedHeal)
|
||||
{
|
||||
if ((nurse.getTarget() != _larva) || notCasting)
|
||||
{
|
||||
nurse.setTarget(_larva);
|
||||
nurse.useMagic(getRandomBoolean() ? HEAL1.getSkill() : HEAL2.getSkill());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (queenNeedHeal)
|
||||
{
|
||||
if (nurse.getLeader() == _larva)
|
||||
if ((nurse == null) || nurse.isDead() || nurse.isCastingNow(SkillCaster::isAnyNormalType))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((nurse.getTarget() != _queen) || notCasting)
|
||||
notCasting = nurse.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST;
|
||||
if (larvaNeedHeal)
|
||||
{
|
||||
nurse.setTarget(_queen);
|
||||
nurse.useMagic(HEAL1.getSkill());
|
||||
if ((nurse.getTarget() != _larva) || notCasting)
|
||||
{
|
||||
nurse.setTarget(_larva);
|
||||
nurse.useMagic(getRandomBoolean() ? HEAL1.getSkill() : HEAL2.getSkill());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (queenNeedHeal)
|
||||
{
|
||||
if (nurse.getLeader() == _larva)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((nurse.getTarget() != _queen) || notCasting)
|
||||
{
|
||||
nurse.setTarget(_queen);
|
||||
nurse.useMagic(HEAL1.getSkill());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// if nurse not casting - remove target
|
||||
if (notCasting && (nurse.getTarget() != null))
|
||||
{
|
||||
nurse.setTarget(null);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// if nurse not casting - remove target
|
||||
if (notCasting && (nurse.getTarget() != null))
|
||||
{
|
||||
nurse.setTarget(null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (event.equalsIgnoreCase("action") && (npc != null))
|
||||
{
|
||||
if (getRandom(3) == 0)
|
||||
case "action":
|
||||
{
|
||||
if (getRandom(2) == 0)
|
||||
if ((npc != null) && (getRandom(3) == 0))
|
||||
{
|
||||
npc.broadcastSocialAction(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.broadcastSocialAction(4);
|
||||
if (getRandom(2) == 0)
|
||||
{
|
||||
npc.broadcastSocialAction(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.broadcastSocialAction(4);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "queen_unlock":
|
||||
{
|
||||
final GrandBossInstance queen = (GrandBossInstance) addSpawn(QUEEN, QUEEN_X, QUEEN_Y, QUEEN_Z, 0, false, 0);
|
||||
GrandBossManager.getInstance().setBossStatus(QUEEN, ALIVE);
|
||||
spawnBoss(queen);
|
||||
break;
|
||||
}
|
||||
case "ANT_QUEEN_TASK":
|
||||
{
|
||||
if ((_queen == null) || _queen.isDead())
|
||||
{
|
||||
cancelQuestTimers("ANT_QUEEN_TASK");
|
||||
}
|
||||
else if (_queen.calculateDistance2D(QUEEN_X, QUEEN_Y, QUEEN_Z) > 2000)
|
||||
{
|
||||
_queen.clearAggroList();
|
||||
_queen.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(QUEEN_X, QUEEN_Y, QUEEN_Z, 0));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (event.equalsIgnoreCase("queen_unlock"))
|
||||
{
|
||||
final GrandBossInstance queen = (GrandBossInstance) addSpawn(QUEEN, QUEEN_X, QUEEN_Y, QUEEN_Z, 0, false, 0);
|
||||
GrandBossManager.getInstance().setBossStatus(QUEEN, ALIVE);
|
||||
spawnBoss(queen);
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
@@ -258,7 +274,8 @@ public final class QueenAnt extends AbstractNpcAI
|
||||
{
|
||||
((MonsterInstance) npc).getMinionList().spawnMinions(npc.getParameters().getMinionList("Privates"));
|
||||
}
|
||||
_task = ThreadPool.scheduleAtFixedRate(new QueenAntTask(), 5 * 1000, 5 * 1000);
|
||||
cancelQuestTimer("ANT_QUEEN_TASK", npc, null);
|
||||
startQuestTimer("ANT_QUEEN_TASK", 5000, npc, null, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -360,11 +377,7 @@ public final class QueenAnt extends AbstractNpcAI
|
||||
_larva.deleteMe();
|
||||
_larva = null;
|
||||
_queen = null;
|
||||
if (_task != null)
|
||||
{
|
||||
_task.cancel(false);
|
||||
_task = null;
|
||||
}
|
||||
cancelQuestTimers("ANT_QUEEN_TASK");
|
||||
}
|
||||
else if ((_queen != null) && !_queen.isAlikeDead())
|
||||
{
|
||||
@@ -389,29 +402,6 @@ public final class QueenAnt extends AbstractNpcAI
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
|
||||
private class QueenAntTask implements Runnable
|
||||
{
|
||||
public QueenAntTask()
|
||||
{
|
||||
// Constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if ((_queen == null) || _queen.isDead())
|
||||
{
|
||||
_task.cancel(false);
|
||||
_task = null;
|
||||
}
|
||||
else if (_queen.calculateDistance2D(QUEEN_X, QUEEN_Y, QUEEN_Z) > 2000.)
|
||||
{
|
||||
_queen.clearAggroList();
|
||||
_queen.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(QUEEN_X, QUEEN_Y, QUEEN_Z, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new QueenAnt();
|
||||
|
@@ -92,12 +92,16 @@ public final class AreaSkillNpc extends AbstractNpcAI
|
||||
final int castTime = npc.getTemplate().getParameters().getInt("i_use_term_time", 5000);
|
||||
final int despawnTime = npc.getTemplate().getParameters().getInt("i_despawn_time", 30000);
|
||||
onTimerEvent("SKILL_CAST_BASIC", null, npc, null); // Trigger cast instantly
|
||||
getTimers().cancelTimer("SKILL_CAST_TIMED", npc, null);
|
||||
getTimers().cancelTimer("DELETE_ME", npc, null);
|
||||
getTimers().addTimer("SKILL_CAST_TIMED", castTime, npc, null);
|
||||
getTimers().addTimer("DELETE_ME", despawnTime, npc, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
final int despawnTime = npc.getTemplate().getParameters().getInt("despawn_time", 7);
|
||||
getTimers().cancelTimer("SKILL_CAST_TIMED", npc, null);
|
||||
getTimers().cancelTimer("DELETE_ME", npc, null);
|
||||
getTimers().addTimer("SKILL_CAST_TIMED", 100, npc, null);
|
||||
getTimers().addTimer("DELETE_ME", (despawnTime * 1000), npc, null);
|
||||
}
|
||||
|
@@ -250,6 +250,7 @@ public final class Minigame extends AbstractNpcAI
|
||||
case TREASURE_BOX:
|
||||
{
|
||||
npc.disableCoreAI(true);
|
||||
cancelQuestTimer("afterthat", npc, null);
|
||||
startQuestTimer("afterthat", 180000, npc, null);
|
||||
break;
|
||||
}
|
||||
|
@@ -128,6 +128,8 @@ public final class WarriorFishingBlock extends AbstractNpcAI
|
||||
@Override
|
||||
public String onSpawn(Npc npc)
|
||||
{
|
||||
cancelQuestTimer("SPAWN", npc, null);
|
||||
cancelQuestTimer("DESPAWN", npc, null);
|
||||
startQuestTimer("SPAWN", 2000, npc, null);
|
||||
return super.onSpawn(npc);
|
||||
}
|
||||
|
@@ -55,49 +55,51 @@ public class DimensionalTrap extends AbstractNpcAI
|
||||
@Override
|
||||
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
|
||||
{
|
||||
if (npc != null)
|
||||
if ((npc == null) || npc.isAlikeDead())
|
||||
{
|
||||
switch (event)
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case "debuff_player":
|
||||
{
|
||||
case "debuff_player":
|
||||
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, _type, p ->
|
||||
{
|
||||
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, _type, p ->
|
||||
if ((p != null) && p.isPlayer() && !p.isDead())
|
||||
{
|
||||
if ((p != null) && p.isPlayer() && !p.isDead())
|
||||
{
|
||||
npc.setTarget(p);
|
||||
npc.doCast((getRandom(10) < 5) ? TRAP_HOLD.getSkill() : TRAP_ARIALL_YOKE.getSkill());
|
||||
}
|
||||
});
|
||||
startQuestTimer("debuff_player", 10000, npc, null);
|
||||
break;
|
||||
}
|
||||
case "demage_player":
|
||||
npc.setTarget(p);
|
||||
npc.doCast((getRandom(10) < 5) ? TRAP_HOLD.getSkill() : TRAP_ARIALL_YOKE.getSkill());
|
||||
}
|
||||
});
|
||||
startQuestTimer("debuff_player", 10000, npc, null);
|
||||
break;
|
||||
}
|
||||
case "damage_player":
|
||||
{
|
||||
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, _type, p ->
|
||||
{
|
||||
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, _type, p ->
|
||||
if ((p != null) && p.isPlayer() && !p.isDead())
|
||||
{
|
||||
if ((p != null) && p.isPlayer() && !p.isDead())
|
||||
{
|
||||
npc.setTarget(p);
|
||||
npc.doCast((getRandom(10) < 5) ? TRAP_STUN.getSkill() : TRAP_POYSON.getSkill());
|
||||
}
|
||||
});
|
||||
startQuestTimer("demage_player", 10000, npc, null);
|
||||
break;
|
||||
}
|
||||
case "heal_player":
|
||||
npc.setTarget(p);
|
||||
npc.doCast((getRandom(10) < 5) ? TRAP_STUN.getSkill() : TRAP_POYSON.getSkill());
|
||||
}
|
||||
});
|
||||
startQuestTimer("damage_player", 10000, npc, null);
|
||||
break;
|
||||
}
|
||||
case "heal_player":
|
||||
{
|
||||
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, _type, p ->
|
||||
{
|
||||
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, _type, p ->
|
||||
if ((p != null) && p.isPlayer() && !p.isDead())
|
||||
{
|
||||
if ((p != null) && p.isPlayer() && !p.isDead())
|
||||
{
|
||||
npc.setTarget(p);
|
||||
npc.doCast(PEACE_ZONE_CURE.getSkill());
|
||||
}
|
||||
});
|
||||
startQuestTimer("heal_player", 10000, npc, null);
|
||||
break;
|
||||
}
|
||||
npc.setTarget(p);
|
||||
npc.doCast(PEACE_ZONE_CURE.getSkill());
|
||||
}
|
||||
});
|
||||
startQuestTimer("heal_player", 10000, npc, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
@@ -133,21 +135,21 @@ public class DimensionalTrap extends AbstractNpcAI
|
||||
case DIMENSIONAL_DEMAGE_TRAP_1:
|
||||
{
|
||||
npc.setDisplayEffect(4);
|
||||
startQuestTimer("demage_player", 3000, npc, null);
|
||||
startQuestTimer("damage_player", 3000, npc, null);
|
||||
_type = 50;
|
||||
break;
|
||||
}
|
||||
case DIMENSIONAL_DEMAGE_TRAP_2:
|
||||
{
|
||||
npc.setDisplayEffect(5);
|
||||
startQuestTimer("demage_player", 3000, npc, null);
|
||||
startQuestTimer("damage_player", 3000, npc, null);
|
||||
_type = 100;
|
||||
break;
|
||||
}
|
||||
case DIMENSIONAL_DEMAGE_TRAP_3:
|
||||
{
|
||||
npc.setDisplayEffect(6);
|
||||
startQuestTimer("demage_player", 3000, npc, null);
|
||||
startQuestTimer("damage_player", 3000, npc, null);
|
||||
_type = 150;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user