From 8ed2401490a565d8c0e0f38c0cb717f7336b6d1a Mon Sep 17 00:00:00 2001
From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com>
Date: Mon, 24 May 2021 23:50:05 +0000
Subject: [PATCH] Initial changes for Queen Ant raid.
---
.../db_installer/sql/game/grandboss_data.sql | 2 +-
.../admin/teleports/raid/raid_special.htm | 2 +-
.../scripts/ai/bosses/QueenAnt/QueenAnt.java | 355 ++----------------
.../dist/game/data/stats/npcs/29300-29399.xml | 97 ++++-
4 files changed, 124 insertions(+), 332 deletions(-)
diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/db_installer/sql/game/grandboss_data.sql b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/db_installer/sql/game/grandboss_data.sql
index 853bbd704b..0fd9caf1d9 100644
--- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/db_installer/sql/game/grandboss_data.sql
+++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/db_installer/sql/game/grandboss_data.sql
@@ -13,7 +13,7 @@ CREATE TABLE IF NOT EXISTS `grandboss_data` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
INSERT IGNORE INTO `grandboss_data` (`boss_id`,`loc_x`,`loc_y`,`loc_z`,`heading`,`currentHP`,`currentMP`) VALUES
-(29001, -21610, 181594, -5734, 0, 40218408, 300), -- Queen Ant
+(29381, -6505, 183040, -3419, 0, 1342845023, 133301), -- Queen Ant
(29006, 17726, 108915, -6480, 0, 622493.58388, 3793.536), -- Core
(29325, 43400, 16504, -4395, 0, 247117958, 177258), -- Orfen
(29020, 116033, 17447, 10107, -25348, 53342293, 18000), -- Baium
diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/teleports/raid/raid_special.htm b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/teleports/raid/raid_special.htm
index 5d03d0878c..fa3f5057ba 100644
--- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/teleports/raid/raid_special.htm
+++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/teleports/raid/raid_special.htm
@@ -12,7 +12,7 @@
- |
+ |
|
diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/ai/bosses/QueenAnt/QueenAnt.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/ai/bosses/QueenAnt/QueenAnt.java
index 7e910557b1..ea6cce198d 100644
--- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/ai/bosses/QueenAnt/QueenAnt.java
+++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/ai/bosses/QueenAnt/QueenAnt.java
@@ -16,99 +16,50 @@
*/
package ai.bosses.QueenAnt;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Chronos;
-import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
-import org.l2jmobius.gameserver.instancemanager.ZoneManager;
-import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.StatSet;
-import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Npc;
-import org.l2jmobius.gameserver.model.actor.Playable;
import org.l2jmobius.gameserver.model.actor.instance.GrandBossInstance;
-import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
-import org.l2jmobius.gameserver.model.holders.SkillHolder;
-import org.l2jmobius.gameserver.model.skills.CommonSkill;
-import org.l2jmobius.gameserver.model.skills.Skill;
-import org.l2jmobius.gameserver.model.skills.SkillCaster;
-import org.l2jmobius.gameserver.model.zone.ZoneType;
-import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
import org.l2jmobius.gameserver.network.serverpackets.PlaySound;
import ai.AbstractNpcAI;
/**
* Queen Ant's AI
- * @author Emperorc
+ * @author Mobius
*/
public class QueenAnt extends AbstractNpcAI
{
- private static final int QUEEN = 29001;
- private static final int LARVA = 29002;
- private static final int NURSE = 29003;
- private static final int GUARD = 29004;
- private static final int ROYAL = 29005;
-
- private static final int[] MOBS =
- {
- QUEEN,
- LARVA,
- NURSE,
- GUARD,
- ROYAL
- };
-
- private static final Location OUST_LOC_1 = new Location(-19480, 187344, -5600);
- private static final Location OUST_LOC_2 = new Location(-17928, 180912, -5520);
- private static final Location OUST_LOC_3 = new Location(-23808, 182368, -5600);
-
- private static final int QUEEN_X = -21610;
- private static final int QUEEN_Y = 181594;
- private static final int QUEEN_Z = -5734;
-
- // QUEEN Status Tracking :
+ // NPC
+ private static final int QUEEN_ANT = 29381;
+ // Status
private static final byte ALIVE = 0; // Queen Ant is spawned.
private static final byte DEAD = 1; // Queen Ant has been killed.
-
- private static ZoneType _zone;
-
- private static SkillHolder HEAL1 = new SkillHolder(4020, 1);
- private static SkillHolder HEAL2 = new SkillHolder(4024, 1);
-
- MonsterInstance _queen = null;
- private MonsterInstance _larva = null;
- private final Set _nurses = ConcurrentHashMap.newKeySet();
+ // Location
+ private static final int QUEEN_X = -6505;
+ private static final int QUEEN_Y = 183040;
+ private static final int QUEEN_Z = -3419;
private QueenAnt()
{
- addSpawnId(MOBS);
- addKillId(MOBS);
- addAggroRangeEnterId(MOBS);
- addFactionCallId(NURSE);
+ addKillId(QUEEN_ANT);
- _zone = ZoneManager.getInstance().getZoneById(12012);
- final StatSet info = GrandBossManager.getInstance().getStatSet(QUEEN);
- final int status = GrandBossManager.getInstance().getBossStatus(QUEEN);
- if (status == DEAD)
+ final StatSet info = GrandBossManager.getInstance().getStatSet(QUEEN_ANT);
+ if (GrandBossManager.getInstance().getBossStatus(QUEEN_ANT) == DEAD)
{
- // load the unlock date and time for queen ant from DB
+ // Load the unlock date and time for queen ant from DB.
final long temp = info.getLong("respawn_time") - Chronos.currentTimeMillis();
- // if queen ant is locked until a certain time, mark it so and start the unlock timer
- // the unlock time has not yet expired.
- if (temp > 0)
+ if (temp > 0) // If queen ant is locked until a certain time, mark it so and start the unlock timer the unlock time has not yet expired.
{
startQuestTimer("queen_unlock", temp, null, null);
}
- else
+ else // The time has already expired while the server was offline. Immediately spawn queen ant.
{
- // the time has already expired while the server was offline. Immediately spawn queen ant.
- final GrandBossInstance queen = (GrandBossInstance) addSpawn(QUEEN, QUEEN_X, QUEEN_Y, QUEEN_Z, 0, false, 0);
- GrandBossManager.getInstance().setBossStatus(QUEEN, ALIVE);
+ final GrandBossInstance queen = (GrandBossInstance) addSpawn(QUEEN_ANT, QUEEN_X, QUEEN_Y, QUEEN_Z, 0, false, 0);
+ GrandBossManager.getInstance().setBossStatus(QUEEN_ANT, ALIVE);
spawnBoss(queen);
}
}
@@ -120,13 +71,7 @@ public class QueenAnt extends AbstractNpcAI
final int heading = info.getInt("heading");
final double hp = info.getDouble("currentHP");
final double mp = info.getDouble("currentMP");
- if (!_zone.isInsideZone(locX, locY, locZ))
- {
- locX = QUEEN_X;
- locY = QUEEN_Y;
- locZ = QUEEN_Z;
- }
- final GrandBossInstance queen = (GrandBossInstance) addSpawn(QUEEN, locX, locY, locZ, heading, false, 0);
+ final GrandBossInstance queen = (GrandBossInstance) addSpawn(QUEEN_ANT, locX, locY, locZ, heading, false, 0);
queen.setCurrentHpMp(hp, mp);
spawnBoss(queen);
}
@@ -135,270 +80,36 @@ public class QueenAnt extends AbstractNpcAI
private void spawnBoss(GrandBossInstance npc)
{
GrandBossManager.getInstance().addBoss(npc);
- if (getRandom(100) < 33)
- {
- _zone.movePlayersTo(OUST_LOC_1);
- }
- else if (getRandom(100) < 50)
- {
- _zone.movePlayersTo(OUST_LOC_2);
- }
- else
- {
- _zone.movePlayersTo(OUST_LOC_3);
- }
- GrandBossManager.getInstance().addBoss(npc);
- startQuestTimer("action", 10000, npc, null, true);
- startQuestTimer("heal", 1000, null, null, true);
npc.broadcastPacket(new PlaySound(1, "BS01_A", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
- _queen = npc;
- _larva = (MonsterInstance) addSpawn(LARVA, -21600, 179482, -5846, getRandom(360), false, 0);
}
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
- switch (event)
+ if ("queen_unlock".equals(event))
{
- case "heal":
- {
- boolean notCasting;
- final boolean larvaNeedHeal = (_larva != null) && (_larva.getCurrentHp() < _larva.getMaxHp());
- final boolean queenNeedHeal = (_queen != null) && (_queen.getCurrentHp() < _queen.getMaxHp());
- for (MonsterInstance nurse : _nurses)
- {
- if ((nurse == null) || nurse.isDead() || nurse.isCastingNow(SkillCaster::isAnyNormalType))
- {
- 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)
- {
- 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);
- }
- }
- break;
- }
- case "action":
- {
- if ((npc != null) && (getRandom(3) == 0))
- {
- 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;
- }
+ final GrandBossInstance queen = (GrandBossInstance) addSpawn(QUEEN_ANT, QUEEN_X, QUEEN_Y, QUEEN_Z, 0, false, 0);
+ GrandBossManager.getInstance().setBossStatus(QUEEN_ANT, ALIVE);
+ spawnBoss(queen);
}
return super.onAdvEvent(event, npc, player);
}
- @Override
- public String onSpawn(Npc npc)
- {
- final MonsterInstance mob = (MonsterInstance) npc;
- switch (npc.getId())
- {
- case LARVA:
- {
- mob.setImmobilized(true);
- mob.setUndying(true);
- mob.setIsRaidMinion(true);
- break;
- }
- case NURSE:
- {
- mob.disableCoreAI(true);
- mob.setIsRaidMinion(true);
- _nurses.add(mob);
- break;
- }
- case ROYAL:
- case GUARD:
- {
- mob.setIsRaidMinion(true);
- break;
- }
- case QUEEN:
- {
- if (mob.getMinionList().getSpawnedMinions().isEmpty())
- {
- ((MonsterInstance) npc).getMinionList().spawnMinions(npc.getParameters().getMinionList("Privates"));
- }
- cancelQuestTimer("ANT_QUEEN_TASK", npc, null);
- startQuestTimer("ANT_QUEEN_TASK", 5000, npc, null, true);
- break;
- }
- }
- return super.onSpawn(npc);
- }
-
- @Override
- public String onFactionCall(Npc npc, Npc caller, PlayerInstance attacker, boolean isSummon)
- {
- if ((caller == null) || (npc == null))
- {
- return super.onFactionCall(npc, caller, attacker, isSummon);
- }
-
- if (!npc.isCastingNow(SkillCaster::isAnyNormalType) && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST) && (caller.getCurrentHp() < caller.getMaxHp()))
- {
- npc.setTarget(caller);
- ((Attackable) npc).useMagic(HEAL1.getSkill());
- }
- return null;
- }
-
- @Override
- public String onAggroRangeEnter(Npc npc, PlayerInstance player, boolean isSummon)
- {
- if ((npc == null) || (player.isGM() && player.isInvisible()))
- {
- return null;
- }
-
- final boolean isMage;
- final Playable character;
- if (isSummon)
- {
- isMage = false;
- character = player.getServitors().values().stream().findFirst().orElse(player.getPet());
- }
- else
- {
- isMage = player.isMageClass();
- character = player;
- }
-
- if (character == null)
- {
- return null;
- }
-
- if (!Config.RAID_DISABLE_CURSE && ((character.getLevel() - npc.getLevel()) > 8))
- {
- Skill curse = null;
- if (isMage)
- {
- if (!character.hasAbnormalType(CommonSkill.RAID_CURSE.getSkill().getAbnormalType()) && (getRandom(4) == 0))
- {
- curse = CommonSkill.RAID_CURSE.getSkill();
- }
- }
- else if (!character.hasAbnormalType(CommonSkill.RAID_CURSE2.getSkill().getAbnormalType()) && (getRandom(4) == 0))
- {
- curse = CommonSkill.RAID_CURSE2.getSkill();
- }
-
- if (curse != null)
- {
- npc.broadcastPacket(new MagicSkillUse(npc, character, curse.getId(), curse.getLevel(), 300, 0));
- curse.applyEffects(npc, character);
- }
-
- ((Attackable) npc).stopHating(character); // for calling again
- return null;
- }
-
- return super.onAggroRangeEnter(npc, player, isSummon);
- }
-
@Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
- final int npcId = npc.getId();
- if (npcId == QUEEN)
- {
- npc.broadcastPacket(new PlaySound(1, "BS02_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
- GrandBossManager.getInstance().setBossStatus(QUEEN, DEAD);
- // Calculate Min and Max respawn times randomly.
- final long respawnTime = (Config.QUEEN_ANT_SPAWN_INTERVAL + getRandom(-Config.QUEEN_ANT_SPAWN_RANDOM, Config.QUEEN_ANT_SPAWN_RANDOM)) * 3600000;
- startQuestTimer("queen_unlock", respawnTime, null, null);
- cancelQuestTimer("action", npc, null);
- cancelQuestTimer("heal", null, null);
- // also save the respawn time so that the info is maintained past reboots
- final StatSet info = GrandBossManager.getInstance().getStatSet(QUEEN);
- info.set("respawn_time", Chronos.currentTimeMillis() + respawnTime);
- GrandBossManager.getInstance().setStatSet(QUEEN, info);
- _nurses.clear();
- if (_larva != null)
- {
- _larva.deleteMe();
- }
- _larva = null;
- _queen = null;
- cancelQuestTimers("ANT_QUEEN_TASK");
- }
- else if ((_queen != null) && !_queen.isAlikeDead())
- {
- if (npcId == ROYAL)
- {
- final MonsterInstance mob = (MonsterInstance) npc;
- if (mob.getLeader() != null)
- {
- mob.getLeader().getMinionList().onMinionDie(mob, (280 + getRandom(40)) * 1000);
- }
- }
- else if (npcId == NURSE)
- {
- final MonsterInstance mob = (MonsterInstance) npc;
- _nurses.remove(mob);
- if (mob.getLeader() != null)
- {
- mob.getLeader().getMinionList().onMinionDie(mob, 10000);
- }
- }
- }
+ npc.broadcastPacket(new PlaySound(1, "BS02_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
+ GrandBossManager.getInstance().setBossStatus(QUEEN_ANT, DEAD);
+
+ // Calculate Min and Max respawn times randomly.
+ final long respawnTime = (Config.QUEEN_ANT_SPAWN_INTERVAL + getRandom(-Config.QUEEN_ANT_SPAWN_RANDOM, Config.QUEEN_ANT_SPAWN_RANDOM)) * 3600000;
+ startQuestTimer("queen_unlock", respawnTime, null, null);
+
+ // Also save the respawn time so that the info is maintained past restarts.
+ final StatSet info = GrandBossManager.getInstance().getStatSet(QUEEN_ANT);
+ info.set("respawn_time", Chronos.currentTimeMillis() + respawnTime);
+ GrandBossManager.getInstance().setStatSet(QUEEN_ANT, info);
+
return super.onKill(npc, killer, isSummon);
}
diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/stats/npcs/29300-29399.xml b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/stats/npcs/29300-29399.xml
index 62b6cb18f3..4e3a411049 100644
--- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/stats/npcs/29300-29399.xml
+++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/stats/npcs/29300-29399.xml
@@ -4410,20 +4410,101 @@
-
-
- ETC
+
+ BUG
FEMALE
-
-
+
+
+
+
+
+
+
+
-
-
+ 370
+
-
+
+
+
+
+
+
+
+
+
+
+ 300
+ true
+
+
+ QUEEN_ANT
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+