Addition of C4 branch.
This commit is contained in:
107
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/areas/HotSprings/HotSprings.java
vendored
Normal file
107
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/areas/HotSprings/HotSprings.java
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* 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.HotSprings;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.datatables.SkillTable;
|
||||
import org.l2jmobius.gameserver.model.Effect;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/**
|
||||
* Hot Springs AI.
|
||||
* @author Mobius
|
||||
*/
|
||||
public class HotSprings extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int BANDERSNATCHLING = 21314;
|
||||
private static final int FLAVA = 21316;
|
||||
private static final int ATROXSPAWN = 21317;
|
||||
private static final int NEPENTHES = 21319;
|
||||
private static final int ATROX = 21321;
|
||||
private static final int BANDERSNATCH = 21322;
|
||||
// Skills
|
||||
private static final int RHEUMATISM = 4551;
|
||||
private static final int CHOLERA = 4552;
|
||||
private static final int FLU = 4553;
|
||||
private static final int MALARIA = 4554;
|
||||
// Misc
|
||||
private static final int DISEASE_CHANCE = 10;
|
||||
|
||||
private HotSprings()
|
||||
{
|
||||
super(-1, "ai/areas");
|
||||
|
||||
addAttackId(BANDERSNATCHLING, FLAVA, ATROXSPAWN, NEPENTHES, ATROX, BANDERSNATCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isSummon)
|
||||
{
|
||||
if (Rnd.get(100) < DISEASE_CHANCE)
|
||||
{
|
||||
tryToInfect(npc, attacker, MALARIA);
|
||||
}
|
||||
|
||||
if (Rnd.get(100) < DISEASE_CHANCE)
|
||||
{
|
||||
switch (npc.getNpcId())
|
||||
{
|
||||
case BANDERSNATCHLING:
|
||||
case ATROX:
|
||||
{
|
||||
tryToInfect(npc, attacker, RHEUMATISM);
|
||||
break;
|
||||
}
|
||||
case FLAVA:
|
||||
case NEPENTHES:
|
||||
{
|
||||
tryToInfect(npc, attacker, CHOLERA);
|
||||
break;
|
||||
}
|
||||
case ATROXSPAWN:
|
||||
case BANDERSNATCH:
|
||||
{
|
||||
tryToInfect(npc, attacker, FLU);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isSummon);
|
||||
}
|
||||
|
||||
private void tryToInfect(NpcInstance npc, Creature creature, int diseaseId)
|
||||
{
|
||||
final Effect info = creature.getFirstEffect(diseaseId);
|
||||
final int skillLevel = (info == null) ? 1 : (info.getSkill().getLevel() < 10) ? info.getSkill().getLevel() + 1 : 10;
|
||||
final Skill skill = SkillTable.getInstance().getInfo(diseaseId, skillLevel);
|
||||
if ((skill != null) && !npc.isCastingNow() && !npc.isSkillDisabled(skill))
|
||||
{
|
||||
npc.setTarget(creature);
|
||||
npc.doCast(skill);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new HotSprings();
|
||||
}
|
||||
}
|
||||
20
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/areas/package-info.java
vendored
Normal file
20
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/areas/package-info.java
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
package ai.areas;
|
||||
989
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Antharas.java
vendored
Normal file
989
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Antharas.java
vendored
Normal file
@@ -0,0 +1,989 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.datatables.SkillTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.SpawnTable;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.GrandBossInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.spawn.Spawn;
|
||||
import org.l2jmobius.gameserver.model.zone.type.BossZone;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.Earthquake;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.GameServerPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.PlaySound;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SpecialCamera;
|
||||
|
||||
/**
|
||||
* @author L2J_JP SANDMAN
|
||||
*/
|
||||
public class Antharas extends Quest
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Antharas.class.getName());
|
||||
|
||||
// Config
|
||||
private static final int FWA_ACTIVITYTIMEOFANTHARAS = 120;
|
||||
// private static final int FWA_APPTIMEOFANTHARAS = 1800000;
|
||||
// private static final int FWA_INACTIVITYTIME = 900000;
|
||||
// private static final boolean FWA_OLDANTHARAS = true; // use antharas interlude with minions
|
||||
protected static final boolean FWA_OLDANTHARAS = Config.ANTHARAS_OLD; // use antharas interlude with minions
|
||||
private static final boolean FWA_MOVEATRANDOM = true;
|
||||
private static final boolean FWA_DOSERVEREARTHQUAKE = true;
|
||||
private static final int FWA_LIMITOFWEAK = 45;
|
||||
private static final int FWA_LIMITOFNORMAL = 63;
|
||||
|
||||
private static final int FWA_MAXMOBS = 10; // this includes Antharas itself
|
||||
private static final int FWA_INTERVALOFMOBSWEAK = 180000;
|
||||
private static final int FWA_INTERVALOFMOBSNORMAL = 150000;
|
||||
private static final int FWA_INTERVALOFMOBSSTRONG = 120000;
|
||||
private static final int FWA_PERCENTOFBEHEMOTH = 60;
|
||||
private static final int FWA_SELFDESTRUCTTIME = 15000;
|
||||
// Location of teleport cube.
|
||||
private static final int TELEPORT_CUBE = 31859;
|
||||
private static final int[] TELEPORT_CUBE_LOCATION =
|
||||
{
|
||||
177615,
|
||||
114941,
|
||||
-7709,
|
||||
0
|
||||
};
|
||||
|
||||
protected Collection<Spawn> _teleportCubeSpawn = ConcurrentHashMap.newKeySet();
|
||||
protected Collection<NpcInstance> _teleportCube = ConcurrentHashMap.newKeySet();
|
||||
|
||||
// Spawn data of monsters.
|
||||
protected Map<Integer, Spawn> _monsterSpawn = new ConcurrentHashMap<>();
|
||||
|
||||
// Instance of monsters.
|
||||
protected Collection<NpcInstance> _monsters = ConcurrentHashMap.newKeySet();
|
||||
protected GrandBossInstance _antharas = null;
|
||||
|
||||
// monstersId
|
||||
private static final int ANTHARASOLDID = 29019;
|
||||
private static final int ANTHARASWEAKID = 29066;
|
||||
private static final int ANTHARASNORMALID = 29067;
|
||||
private static final int ANTHARASSTRONGID = 29068;
|
||||
|
||||
// Tasks.
|
||||
protected ScheduledFuture<?> _cubeSpawnTask = null;
|
||||
protected ScheduledFuture<?> _monsterSpawnTask = null;
|
||||
protected ScheduledFuture<?> _activityCheckTask = null;
|
||||
protected ScheduledFuture<?> _socialTask = null;
|
||||
protected ScheduledFuture<?> _mobiliseTask = null;
|
||||
protected ScheduledFuture<?> _mobsSpawnTask = null;
|
||||
protected ScheduledFuture<?> _selfDestructionTask = null;
|
||||
protected ScheduledFuture<?> _moveAtRandomTask = null;
|
||||
protected ScheduledFuture<?> _movieTask = null;
|
||||
|
||||
// Antharas Status Tracking :
|
||||
private static final int DORMANT = 0; // Antharas is spawned and no one has entered yet. Entry is unlocked
|
||||
private static final int WAITING = 1; // Antharas is spawend and someone has entered, triggering a 30 minute window for additional people to enter
|
||||
// before he unleashes his attack. Entry is unlocked
|
||||
private static final int FIGHTING = 2; // Antharas is engaged in battle, annihilating his foes. Entry is locked
|
||||
private static final int DEAD = 3; // Antharas has been killed. Entry is locked
|
||||
|
||||
protected static long _LastAction = 0;
|
||||
|
||||
protected static BossZone _zone;
|
||||
|
||||
// Boss: Antharas
|
||||
public Antharas()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
final int[] mob =
|
||||
{
|
||||
ANTHARASOLDID,
|
||||
ANTHARASWEAKID,
|
||||
ANTHARASNORMALID,
|
||||
ANTHARASSTRONGID,
|
||||
29069,
|
||||
29070,
|
||||
29071,
|
||||
29072,
|
||||
29073,
|
||||
29074,
|
||||
29075,
|
||||
29076
|
||||
};
|
||||
registerMobs(mob);
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
if (event.equals("setAntharasSpawnTask"))
|
||||
{
|
||||
setAntharasSpawnTask();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Initialize
|
||||
private void init()
|
||||
{
|
||||
// Setting spawn data of monsters.
|
||||
try
|
||||
{
|
||||
_zone = GrandBossManager.getInstance().getZone(179700, 113800, -7709);
|
||||
NpcTemplate template1;
|
||||
Spawn tempSpawn;
|
||||
|
||||
// Old Antharas
|
||||
template1 = NpcTable.getInstance().getTemplate(ANTHARASOLDID);
|
||||
tempSpawn = new Spawn(template1);
|
||||
tempSpawn.setX(181323);
|
||||
tempSpawn.setY(114850);
|
||||
tempSpawn.setZ(-7623);
|
||||
tempSpawn.setHeading(32542);
|
||||
tempSpawn.setAmount(1);
|
||||
tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
|
||||
SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
|
||||
_monsterSpawn.put(29019, tempSpawn);
|
||||
|
||||
// Weak Antharas
|
||||
template1 = NpcTable.getInstance().getTemplate(ANTHARASWEAKID);
|
||||
tempSpawn = new Spawn(template1);
|
||||
tempSpawn.setX(181323);
|
||||
tempSpawn.setY(114850);
|
||||
tempSpawn.setZ(-7623);
|
||||
tempSpawn.setHeading(32542);
|
||||
tempSpawn.setAmount(1);
|
||||
tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
|
||||
SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
|
||||
_monsterSpawn.put(29066, tempSpawn);
|
||||
|
||||
// Normal Antharas
|
||||
template1 = NpcTable.getInstance().getTemplate(ANTHARASNORMALID);
|
||||
tempSpawn = new Spawn(template1);
|
||||
tempSpawn.setX(181323);
|
||||
tempSpawn.setY(114850);
|
||||
tempSpawn.setZ(-7623);
|
||||
tempSpawn.setHeading(32542);
|
||||
tempSpawn.setAmount(1);
|
||||
tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
|
||||
SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
|
||||
_monsterSpawn.put(29067, tempSpawn);
|
||||
|
||||
// Strong Antharas
|
||||
template1 = NpcTable.getInstance().getTemplate(ANTHARASSTRONGID);
|
||||
tempSpawn = new Spawn(template1);
|
||||
tempSpawn.setX(181323);
|
||||
tempSpawn.setY(114850);
|
||||
tempSpawn.setZ(-7623);
|
||||
tempSpawn.setHeading(32542);
|
||||
tempSpawn.setAmount(1);
|
||||
tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
|
||||
SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
|
||||
_monsterSpawn.put(29068, tempSpawn);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning(e.getMessage());
|
||||
}
|
||||
|
||||
// Setting spawn data of teleport cube.
|
||||
try
|
||||
{
|
||||
final NpcTemplate cube = NpcTable.getInstance().getTemplate(TELEPORT_CUBE);
|
||||
Spawn spawnDat;
|
||||
spawnDat = new Spawn(cube);
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(TELEPORT_CUBE_LOCATION[0]);
|
||||
spawnDat.setY(TELEPORT_CUBE_LOCATION[1]);
|
||||
spawnDat.setZ(TELEPORT_CUBE_LOCATION[2]);
|
||||
spawnDat.setHeading(TELEPORT_CUBE_LOCATION[3]);
|
||||
spawnDat.setRespawnDelay(60);
|
||||
spawnDat.setLocation(0);
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_teleportCubeSpawn.add(spawnDat);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning(e.getMessage());
|
||||
}
|
||||
|
||||
Integer status = GrandBossManager.getInstance().getBossStatus(ANTHARASOLDID);
|
||||
if (FWA_OLDANTHARAS || (status == WAITING))
|
||||
{
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ANTHARASOLDID);
|
||||
final Long respawnTime = info.getLong("respawn_time");
|
||||
if ((status == DEAD) && (respawnTime <= System.currentTimeMillis()))
|
||||
{
|
||||
// the time has already expired while the server was offline. Immediately spawn antharas in his cave.
|
||||
// also, the status needs to be changed to DORMANT
|
||||
GrandBossManager.getInstance().setBossStatus(ANTHARASOLDID, DORMANT);
|
||||
status = DORMANT;
|
||||
}
|
||||
else if (status == FIGHTING)
|
||||
{
|
||||
final int loc_x = info.getInt("loc_x");
|
||||
final int loc_y = info.getInt("loc_y");
|
||||
final int loc_z = info.getInt("loc_z");
|
||||
final int heading = info.getInt("heading");
|
||||
final int hp = info.getInt("currentHP");
|
||||
final int mp = info.getInt("currentMP");
|
||||
_antharas = (GrandBossInstance) addSpawn(ANTHARASOLDID, loc_x, loc_y, loc_z, heading, false, 0);
|
||||
GrandBossManager.getInstance().addBoss(_antharas);
|
||||
_antharas.setCurrentHpMp(hp, mp);
|
||||
_LastAction = System.currentTimeMillis();
|
||||
// Start repeating timer to check for inactivity
|
||||
_activityCheckTask = ThreadPool.scheduleAtFixedRate(new CheckActivity(), 60000, 60000);
|
||||
}
|
||||
else if (status == DEAD)
|
||||
{
|
||||
ThreadPool.schedule(new UnlockAntharas(ANTHARASOLDID), respawnTime - System.currentTimeMillis());
|
||||
}
|
||||
else if (status == DORMANT)
|
||||
{
|
||||
// Here status is 0 on Database, dont do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
setAntharasSpawnTask();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
final Integer statusWeak = GrandBossManager.getInstance().getBossStatus(ANTHARASWEAKID);
|
||||
final Integer statusNormal = GrandBossManager.getInstance().getBossStatus(ANTHARASNORMALID);
|
||||
final Integer statusStrong = GrandBossManager.getInstance().getBossStatus(ANTHARASSTRONGID);
|
||||
int antharasId = 0;
|
||||
if ((statusWeak == FIGHTING) || (statusWeak == DEAD))
|
||||
{
|
||||
antharasId = ANTHARASWEAKID;
|
||||
status = statusWeak;
|
||||
}
|
||||
else if ((statusNormal == FIGHTING) || (statusNormal == DEAD))
|
||||
{
|
||||
antharasId = ANTHARASNORMALID;
|
||||
status = statusNormal;
|
||||
}
|
||||
else if ((statusStrong == FIGHTING) || (statusStrong == DEAD))
|
||||
{
|
||||
antharasId = ANTHARASSTRONGID;
|
||||
status = statusStrong;
|
||||
}
|
||||
if ((antharasId != 0) && (status == FIGHTING))
|
||||
{
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(antharasId);
|
||||
final int loc_x = info.getInt("loc_x");
|
||||
final int loc_y = info.getInt("loc_y");
|
||||
final int loc_z = info.getInt("loc_z");
|
||||
final int heading = info.getInt("heading");
|
||||
final int hp = info.getInt("currentHP");
|
||||
final int mp = info.getInt("currentMP");
|
||||
_antharas = (GrandBossInstance) addSpawn(antharasId, loc_x, loc_y, loc_z, heading, false, 0);
|
||||
GrandBossManager.getInstance().addBoss(_antharas);
|
||||
_antharas.setCurrentHpMp(hp, mp);
|
||||
_LastAction = System.currentTimeMillis();
|
||||
// Start repeating timer to check for inactivity
|
||||
_activityCheckTask = ThreadPool.scheduleAtFixedRate(new CheckActivity(), 60000, 60000);
|
||||
}
|
||||
else if ((antharasId != 0) && (status == DEAD))
|
||||
{
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(antharasId);
|
||||
final Long respawnTime = info.getLong("respawn_time");
|
||||
if (respawnTime <= System.currentTimeMillis())
|
||||
{
|
||||
// the time has already expired while the server was offline. Immediately spawn antharas in his cave.
|
||||
// also, the status needs to be changed to DORMANT
|
||||
GrandBossManager.getInstance().setBossStatus(antharasId, DORMANT);
|
||||
status = DORMANT;
|
||||
}
|
||||
else
|
||||
{
|
||||
ThreadPool.schedule(new UnlockAntharas(antharasId), respawnTime - System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do spawn teleport cube.
|
||||
public void spawnCube()
|
||||
{
|
||||
if (_mobsSpawnTask != null)
|
||||
{
|
||||
_mobsSpawnTask.cancel(true);
|
||||
_mobsSpawnTask = null;
|
||||
}
|
||||
if (_selfDestructionTask != null)
|
||||
{
|
||||
_selfDestructionTask.cancel(true);
|
||||
_selfDestructionTask = null;
|
||||
}
|
||||
if (_activityCheckTask != null)
|
||||
{
|
||||
_activityCheckTask.cancel(false);
|
||||
_activityCheckTask = null;
|
||||
}
|
||||
|
||||
for (Spawn spawnDat : _teleportCubeSpawn)
|
||||
{
|
||||
_teleportCube.add(spawnDat.doSpawn());
|
||||
}
|
||||
}
|
||||
|
||||
// Setting Antharas spawn task.
|
||||
public void setAntharasSpawnTask()
|
||||
{
|
||||
if (_monsterSpawnTask == null)
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
if (_monsterSpawnTask == null)
|
||||
{
|
||||
GrandBossManager.getInstance().setBossStatus(ANTHARASOLDID, WAITING);
|
||||
_monsterSpawnTask = ThreadPool.schedule(new AntharasSpawn(1), 60000 * Config.ANTHARAS_WAIT_TIME);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void startMinionSpawns(int antharasId)
|
||||
{
|
||||
int intervalOfMobs;
|
||||
|
||||
// Interval of minions is decided by the type of Antharas
|
||||
// that invaded the lair.
|
||||
switch (antharasId)
|
||||
{
|
||||
case ANTHARASWEAKID:
|
||||
{
|
||||
intervalOfMobs = FWA_INTERVALOFMOBSWEAK;
|
||||
break;
|
||||
}
|
||||
case ANTHARASNORMALID:
|
||||
{
|
||||
intervalOfMobs = FWA_INTERVALOFMOBSNORMAL;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
intervalOfMobs = FWA_INTERVALOFMOBSSTRONG;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Spawn mobs.
|
||||
_mobsSpawnTask = ThreadPool.scheduleAtFixedRate(new MobsSpawn(), intervalOfMobs, intervalOfMobs);
|
||||
}
|
||||
|
||||
// Do spawn Antharas.
|
||||
private class AntharasSpawn implements Runnable
|
||||
{
|
||||
private int _taskId = 0;
|
||||
private Collection<Creature> _players;
|
||||
|
||||
AntharasSpawn(int taskId)
|
||||
{
|
||||
_taskId = taskId;
|
||||
if (_zone.getCharactersInside() != null)
|
||||
{
|
||||
_players = _zone.getCharactersInside();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
int npcId;
|
||||
Spawn antharasSpawn = null;
|
||||
|
||||
switch (_taskId)
|
||||
{
|
||||
case 1: // Spawn.
|
||||
{
|
||||
// Strength of Antharas is decided by the number of players that
|
||||
// invaded the lair.
|
||||
_monsterSpawnTask.cancel(false);
|
||||
_monsterSpawnTask = null;
|
||||
if (FWA_OLDANTHARAS)
|
||||
{
|
||||
npcId = 29019; // old
|
||||
}
|
||||
else if ((_players == null) || (_players.size() <= FWA_LIMITOFWEAK))
|
||||
{
|
||||
npcId = 29066; // weak
|
||||
}
|
||||
else if (_players.size() > FWA_LIMITOFNORMAL)
|
||||
{
|
||||
npcId = 29068; // strong
|
||||
}
|
||||
else
|
||||
{
|
||||
npcId = 29067; // normal
|
||||
}
|
||||
// Do spawn.
|
||||
antharasSpawn = _monsterSpawn.get(npcId);
|
||||
_antharas = (GrandBossInstance) antharasSpawn.doSpawn();
|
||||
GrandBossManager.getInstance().addBoss(_antharas);
|
||||
_monsters.add(_antharas);
|
||||
_antharas.setImmobilized(true);
|
||||
GrandBossManager.getInstance().setBossStatus(ANTHARASOLDID, DORMANT);
|
||||
GrandBossManager.getInstance().setBossStatus(npcId, FIGHTING);
|
||||
_LastAction = System.currentTimeMillis();
|
||||
// Start repeating timer to check for inactivity
|
||||
_activityCheckTask = ThreadPool.scheduleAtFixedRate(new CheckActivity(), 60000, 60000);
|
||||
// Setting 1st time of minions spawn task.
|
||||
if (!FWA_OLDANTHARAS)
|
||||
{
|
||||
startMinionSpawns(npcId);
|
||||
}
|
||||
// Set next task.
|
||||
if (_socialTask != null)
|
||||
{
|
||||
_socialTask.cancel(true);
|
||||
_socialTask = null;
|
||||
}
|
||||
_socialTask = ThreadPool.schedule(new AntharasSpawn(2), 16);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
// Set camera.
|
||||
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 700, 13, -19, 0, 20000));
|
||||
// Set next task.
|
||||
if (_socialTask != null)
|
||||
{
|
||||
_socialTask.cancel(true);
|
||||
_socialTask = null;
|
||||
}
|
||||
_socialTask = ThreadPool.schedule(new AntharasSpawn(3), 3000);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
// Do social.
|
||||
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 700, 13, 0, 6000, 20000));
|
||||
// Set next task.
|
||||
if (_socialTask != null)
|
||||
{
|
||||
_socialTask.cancel(true);
|
||||
_socialTask = null;
|
||||
}
|
||||
_socialTask = ThreadPool.schedule(new AntharasSpawn(4), 10000);
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 3700, 0, -3, 0, 10000));
|
||||
// Set next task.
|
||||
if (_socialTask != null)
|
||||
{
|
||||
_socialTask.cancel(true);
|
||||
_socialTask = null;
|
||||
}
|
||||
_socialTask = ThreadPool.schedule(new AntharasSpawn(5), 200);
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
// Do social.
|
||||
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 1100, 0, -3, 22000, 30000));
|
||||
// Set next task.
|
||||
if (_socialTask != null)
|
||||
{
|
||||
_socialTask.cancel(true);
|
||||
_socialTask = null;
|
||||
}
|
||||
_socialTask = ThreadPool.schedule(new AntharasSpawn(6), 10800);
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
// Set camera.
|
||||
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 1100, 0, -3, 300, 7000));
|
||||
// Set next task.
|
||||
if (_socialTask != null)
|
||||
{
|
||||
_socialTask.cancel(true);
|
||||
_socialTask = null;
|
||||
}
|
||||
_socialTask = ThreadPool.schedule(new AntharasSpawn(7), 1900);
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
_antharas.abortCast();
|
||||
_mobiliseTask = ThreadPool.schedule(new SetMobilised(_antharas), 16);
|
||||
// Move at random.
|
||||
if (FWA_MOVEATRANDOM)
|
||||
{
|
||||
final Location pos = new Location(Rnd.get(175000, 178500), Rnd.get(112400, 116000), -7707, 0);
|
||||
_moveAtRandomTask = ThreadPool.schedule(new MoveAtRandom(_antharas, pos), 500);
|
||||
}
|
||||
if (_socialTask != null)
|
||||
{
|
||||
_socialTask.cancel(true);
|
||||
_socialTask = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void broadcastPacket(GameServerPacket mov)
|
||||
{
|
||||
if (_zone != null)
|
||||
{
|
||||
for (Creature creatures : _zone.getCharactersInside())
|
||||
{
|
||||
if (creatures instanceof PlayerInstance)
|
||||
{
|
||||
creatures.sendPacket(mov);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do spawn Behemoth or Bomber.
|
||||
private class MobsSpawn implements Runnable
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
NpcTemplate template1;
|
||||
Spawn tempSpawn;
|
||||
final boolean isBehemoth = Rnd.get(100) < FWA_PERCENTOFBEHEMOTH;
|
||||
try
|
||||
{
|
||||
final int mobNumber = (isBehemoth ? 2 : 3);
|
||||
// Set spawn.
|
||||
for (int i = 0; i < mobNumber; i++)
|
||||
{
|
||||
if (_monsters.size() >= FWA_MAXMOBS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
int npcId;
|
||||
if (isBehemoth)
|
||||
{
|
||||
npcId = 29069;
|
||||
}
|
||||
else
|
||||
{
|
||||
npcId = Rnd.get(29070, 29076);
|
||||
}
|
||||
template1 = NpcTable.getInstance().getTemplate(npcId);
|
||||
tempSpawn = new Spawn(template1);
|
||||
// allocates it at random in the lair of Antharas.
|
||||
int tried = 0;
|
||||
boolean notFound = true;
|
||||
int x = 175000;
|
||||
int y = 112400;
|
||||
int dt = ((_antharas.getX() - x) * (_antharas.getX() - x)) + ((_antharas.getY() - y) * (_antharas.getY() - y));
|
||||
while ((tried++ < 25) && notFound)
|
||||
{
|
||||
final int rx = Rnd.get(175000, 179900);
|
||||
final int ry = Rnd.get(112400, 116000);
|
||||
final int rdt = ((_antharas.getX() - rx) * (_antharas.getX() - rx)) + ((_antharas.getY() - ry) * (_antharas.getY() - ry));
|
||||
final Location randomLocation = new Location(rx, ry, -7704);
|
||||
if (GeoEngine.getInstance().canSeeTarget(_antharas, randomLocation) && (rdt < dt))
|
||||
{
|
||||
x = rx;
|
||||
y = ry;
|
||||
dt = rdt;
|
||||
if (rdt <= 900000)
|
||||
{
|
||||
notFound = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
tempSpawn.setX(x);
|
||||
tempSpawn.setY(y);
|
||||
tempSpawn.setZ(-7704);
|
||||
tempSpawn.setHeading(0);
|
||||
tempSpawn.setAmount(1);
|
||||
tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
|
||||
SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
|
||||
// Do spawn.
|
||||
_monsters.add(tempSpawn.doSpawn());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAggroRangeEnter(NpcInstance npc, PlayerInstance player, boolean isPet)
|
||||
{
|
||||
switch (npc.getNpcId())
|
||||
{
|
||||
case 29070:
|
||||
case 29071:
|
||||
case 29072:
|
||||
case 29073:
|
||||
case 29074:
|
||||
case 29075:
|
||||
case 29076:
|
||||
{
|
||||
if ((_selfDestructionTask == null) && !npc.isDead())
|
||||
{
|
||||
_selfDestructionTask = ThreadPool.schedule(new SelfDestructionOfBomber(npc), FWA_SELFDESTRUCTTIME);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.onAggroRangeEnter(npc, player, isPet);
|
||||
}
|
||||
|
||||
// Do self destruction.
|
||||
private class SelfDestructionOfBomber implements Runnable
|
||||
{
|
||||
private final NpcInstance _bomber;
|
||||
|
||||
public SelfDestructionOfBomber(NpcInstance bomber)
|
||||
{
|
||||
_bomber = bomber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Skill skill = null;
|
||||
switch (_bomber.getNpcId())
|
||||
{
|
||||
case 29070:
|
||||
case 29071:
|
||||
case 29072:
|
||||
case 29073:
|
||||
case 29074:
|
||||
case 29075:
|
||||
{
|
||||
skill = SkillTable.getInstance().getInfo(5097, 1);
|
||||
break;
|
||||
}
|
||||
case 29076:
|
||||
{
|
||||
skill = SkillTable.getInstance().getInfo(5094, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_bomber.doCast(skill);
|
||||
|
||||
if (_selfDestructionTask != null)
|
||||
{
|
||||
_selfDestructionTask.cancel(false);
|
||||
_selfDestructionTask = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSpellFinished(NpcInstance npc, PlayerInstance player, Skill skill)
|
||||
{
|
||||
if (npc.isInvul())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if ((skill != null) && ((skill.getId() == 5097) || (skill.getId() == 5094)))
|
||||
{
|
||||
switch (npc.getNpcId())
|
||||
{
|
||||
case 29070:
|
||||
case 29071:
|
||||
case 29072:
|
||||
case 29073:
|
||||
case 29074:
|
||||
case 29075:
|
||||
case 29076:
|
||||
{
|
||||
npc.doDie(npc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onSpellFinished(npc, player, skill);
|
||||
}
|
||||
|
||||
// At end of activity time.
|
||||
protected class CheckActivity implements Runnable
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
final Long temp = (System.currentTimeMillis() - _LastAction);
|
||||
if (temp > (Config.ANTHARAS_DESPAWN_TIME * 60000))
|
||||
{
|
||||
GrandBossManager.getInstance().setBossStatus(_antharas.getNpcId(), DORMANT);
|
||||
setUnspawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clean Antharas's lair.
|
||||
public void setUnspawn()
|
||||
{
|
||||
// Eliminate players.
|
||||
_zone.oustAllPlayers();
|
||||
|
||||
// Not executed tasks is canceled.
|
||||
if (_cubeSpawnTask != null)
|
||||
{
|
||||
_cubeSpawnTask.cancel(true);
|
||||
_cubeSpawnTask = null;
|
||||
}
|
||||
if (_monsterSpawnTask != null)
|
||||
{
|
||||
_monsterSpawnTask.cancel(true);
|
||||
_monsterSpawnTask = null;
|
||||
}
|
||||
if (_activityCheckTask != null)
|
||||
{
|
||||
_activityCheckTask.cancel(false);
|
||||
_activityCheckTask = null;
|
||||
}
|
||||
if (_socialTask != null)
|
||||
{
|
||||
_socialTask.cancel(true);
|
||||
_socialTask = null;
|
||||
}
|
||||
if (_mobiliseTask != null)
|
||||
{
|
||||
_mobiliseTask.cancel(true);
|
||||
_mobiliseTask = null;
|
||||
}
|
||||
if (_mobsSpawnTask != null)
|
||||
{
|
||||
_mobsSpawnTask.cancel(true);
|
||||
_mobsSpawnTask = null;
|
||||
}
|
||||
if (_selfDestructionTask != null)
|
||||
{
|
||||
_selfDestructionTask.cancel(true);
|
||||
_selfDestructionTask = null;
|
||||
}
|
||||
if (_moveAtRandomTask != null)
|
||||
{
|
||||
_moveAtRandomTask.cancel(true);
|
||||
_moveAtRandomTask = null;
|
||||
}
|
||||
|
||||
// Delete monsters.
|
||||
for (NpcInstance mob : _monsters)
|
||||
{
|
||||
mob.getSpawn().stopRespawn();
|
||||
mob.deleteMe();
|
||||
}
|
||||
_monsters.clear();
|
||||
|
||||
// Delete teleport cube.
|
||||
for (NpcInstance cube : _teleportCube)
|
||||
{
|
||||
cube.getSpawn().stopRespawn();
|
||||
cube.deleteMe();
|
||||
}
|
||||
_teleportCube.clear();
|
||||
}
|
||||
|
||||
// Do spawn teleport cube.
|
||||
private class CubeSpawn implements Runnable
|
||||
{
|
||||
private final int _type;
|
||||
|
||||
CubeSpawn(int type)
|
||||
{
|
||||
_type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_type == 0)
|
||||
{
|
||||
spawnCube();
|
||||
_cubeSpawnTask = ThreadPool.schedule(new CubeSpawn(1), 1800000);
|
||||
}
|
||||
else
|
||||
{
|
||||
setUnspawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// UnLock Antharas.
|
||||
private static class UnlockAntharas implements Runnable
|
||||
{
|
||||
private final int _bossId;
|
||||
|
||||
public UnlockAntharas(int bossId)
|
||||
{
|
||||
_bossId = bossId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
GrandBossManager.getInstance().setBossStatus(_bossId, DORMANT);
|
||||
if (FWA_DOSERVEREARTHQUAKE)
|
||||
{
|
||||
for (PlayerInstance p : World.getInstance().getAllPlayers())
|
||||
{
|
||||
p.broadcastPacket(new Earthquake(185708, 114298, -8221, 20, 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Action is enabled the boss.
|
||||
private class SetMobilised implements Runnable
|
||||
{
|
||||
private final GrandBossInstance _boss;
|
||||
|
||||
public SetMobilised(GrandBossInstance boss)
|
||||
{
|
||||
_boss = boss;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_boss.setImmobilized(false);
|
||||
|
||||
// When it is possible to act, a social action is canceled.
|
||||
if (_socialTask != null)
|
||||
{
|
||||
_socialTask.cancel(true);
|
||||
_socialTask = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Move at random on after Antharas appears.
|
||||
private static class MoveAtRandom implements Runnable
|
||||
{
|
||||
private final NpcInstance _npc;
|
||||
private final Location _pos;
|
||||
|
||||
public MoveAtRandom(NpcInstance npc, Location pos)
|
||||
{
|
||||
_npc = npc;
|
||||
_pos = pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, _pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if ((npc.getNpcId() == 29019) || (npc.getNpcId() == 29066) || (npc.getNpcId() == 29067) || (npc.getNpcId() == 29068))
|
||||
{
|
||||
_LastAction = System.currentTimeMillis();
|
||||
if (!FWA_OLDANTHARAS && (_mobsSpawnTask == null))
|
||||
{
|
||||
startMinionSpawns(npc.getNpcId());
|
||||
}
|
||||
}
|
||||
else if ((npc.getNpcId() > 29069) && (npc.getNpcId() < 29077) && (npc.getCurrentHp() <= damage))
|
||||
{
|
||||
Skill skill = null;
|
||||
switch (npc.getNpcId())
|
||||
{
|
||||
case 29070:
|
||||
case 29071:
|
||||
case 29072:
|
||||
case 29073:
|
||||
case 29074:
|
||||
case 29075:
|
||||
{
|
||||
skill = SkillTable.getInstance().getInfo(5097, 1);
|
||||
break;
|
||||
}
|
||||
case 29076:
|
||||
{
|
||||
skill = SkillTable.getInstance().getInfo(5094, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
npc.doCast(skill);
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
if ((npc.getNpcId() == 29019) || (npc.getNpcId() == 29066) || (npc.getNpcId() == 29067) || (npc.getNpcId() == 29068))
|
||||
{
|
||||
npc.broadcastPacket(new PlaySound(1, "BS01_D", npc));
|
||||
_cubeSpawnTask = ThreadPool.schedule(new CubeSpawn(0), 10000);
|
||||
GrandBossManager.getInstance().setBossStatus(npc.getNpcId(), DEAD);
|
||||
final long respawnTime = (Config.ANTHARAS_RESP_FIRST + Rnd.get(Config.ANTHARAS_RESP_SECOND)) * 3600000;
|
||||
ThreadPool.schedule(new UnlockAntharas(npc.getNpcId()), respawnTime);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(npc.getNpcId());
|
||||
info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
|
||||
GrandBossManager.getInstance().setStatSet(npc.getNpcId(), info);
|
||||
}
|
||||
else if (npc.getNpcId() == 29069)
|
||||
{
|
||||
final int countHPHerb = Rnd.get(6, 18);
|
||||
final int countMPHerb = Rnd.get(6, 18);
|
||||
for (int i = 0; i < countHPHerb; i++)
|
||||
{
|
||||
((MonsterInstance) npc).dropItem(killer, 8602, 1);
|
||||
}
|
||||
for (int i = 0; i < countMPHerb; i++)
|
||||
{
|
||||
((MonsterInstance) npc).dropItem(killer, 8605, 1);
|
||||
}
|
||||
}
|
||||
if (_monsters.contains(npc))
|
||||
{
|
||||
_monsters.remove(npc);
|
||||
}
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Antharas();
|
||||
}
|
||||
}
|
||||
668
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Baium.java
vendored
Normal file
668
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Baium.java
vendored
Normal file
@@ -0,0 +1,668 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_FOLLOW;
|
||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.datatables.SkillTable;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.model.Effect;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.GrandBossInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.entity.Announcements;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestTimer;
|
||||
import org.l2jmobius.gameserver.model.zone.type.BossZone;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.Earthquake;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.MoveToPawn;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.PlaySound;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* Baium AI Note1: if the server gets rebooted while players are still fighting Baium, there is no lock, but players also lose their ability to wake baium up. However, should another person enter the room and wake him up, the players who had stayed inside may join the raid. This can be helpful for
|
||||
* players who became victims of a reboot (they only need 1 new player to enter and wake up baium) and is not too exploitable since any player wishing to exploit it would have to suffer 5 days of being parked in an empty room. Note2: Neither version of Baium should be a permanent spawn. This script
|
||||
* is fully capable of spawning the statue-version when the lock expires and switching it to the mob version promptly. Additional notes ( source http://aleenaresron.blogspot.com/2006_08_01_archive.html ): * Baium only first respawns five days after his last death. And from those five days he will
|
||||
* respawn within 1-8 hours of his last death. So, you have to know his last time of death. * If by some freak chance you are the only one in Baium's chamber and NO ONE comes in [ha, ha] you or someone else will have to wake Baium. There is a good chance that Baium will automatically kill whoever
|
||||
* wakes him. There are some people that have been able to wake him and not die, however if you've already gone through the trouble of getting the bloody fabric and camped him out and researched his spawn time, are you willing to take that chance that you'll wake him and not be able to finish your
|
||||
* quest? Doubtful. [ this powerful attack vs the player who wakes him up is NOT yet implemented here] * once someone starts attacking Baium no one else can port into the chamber where he is. Unlike with the other raid bosses, you can just show up at any time as long as you are there when they die.
|
||||
* Not true with Baium. Once he gets attacked, the port to Baium closes. byebye, see you in 5 days. If nobody attacks baium for 30 minutes, he auto-despawns and unlocks the vortex
|
||||
* @author Fulminus version 0.1
|
||||
*/
|
||||
public class Baium extends Quest
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Baium.class.getName());
|
||||
|
||||
private Creature _target;
|
||||
private Skill _skill;
|
||||
private static final int STONE_BAIUM = 29025;
|
||||
private static final int ANGELIC_VORTEX = 31862;
|
||||
private static final int LIVE_BAIUM = 29020;
|
||||
private static final int ARCHANGEL = 29021;
|
||||
|
||||
// Baium status tracking,
|
||||
private static final byte ASLEEP = 0; // baium is in the stone version, waiting to be woken up. Entry is unlocked,
|
||||
private static final byte AWAKE = 1; // baium is awake and fighting. Entry is locked.
|
||||
private static final byte DEAD = 2; // baium has been killed and has not yet spawned. Entry is locked,
|
||||
|
||||
// Archangel locations.
|
||||
// @formatter:off
|
||||
private static final int[][] ANGEL_LOCATION =
|
||||
{
|
||||
{114239, 17168, 10080, 63544},
|
||||
{115780, 15564, 10080, 13620},
|
||||
{114880, 16236, 10080, 5400},
|
||||
{115168, 17200, 10080, 0},
|
||||
{115792, 16608, 10080, 0},
|
||||
};
|
||||
// @formatter:on
|
||||
|
||||
private long _lastAttackVsBaiumTime = 0;
|
||||
private final List<NpcInstance> _minions = new CopyOnWriteArrayList<>();
|
||||
protected BossZone _zone;
|
||||
|
||||
public Baium()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
|
||||
final int[] mob =
|
||||
{
|
||||
LIVE_BAIUM
|
||||
};
|
||||
registerMobs(mob);
|
||||
|
||||
// Quest NPC starter initialization
|
||||
addStartNpc(STONE_BAIUM);
|
||||
addStartNpc(ANGELIC_VORTEX);
|
||||
addTalkId(STONE_BAIUM);
|
||||
addTalkId(ANGELIC_VORTEX);
|
||||
_zone = GrandBossManager.getInstance().getZone(113100, 14500, 10077);
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(LIVE_BAIUM);
|
||||
final Integer status = GrandBossManager.getInstance().getBossStatus(LIVE_BAIUM);
|
||||
if (status == DEAD)
|
||||
{
|
||||
// load the unlock date and time for baium from DB
|
||||
final long temp = (info.getLong("respawn_time") - System.currentTimeMillis());
|
||||
if (temp > 0)
|
||||
{
|
||||
// the unlock time has not yet expired. Mark Baium as currently locked (dead). Setup a timer
|
||||
// to fire at the correct time (calculate the time between now and the unlock time,
|
||||
// setup a timer to fire after that many msec)
|
||||
startQuestTimer("baium_unlock", temp, null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
// the time has already expired while the server was offline. Delete the saved time and
|
||||
// immediately spawn the stone-baium. Also the state need not be changed from ASLEEP
|
||||
addSpawn(STONE_BAIUM, 116033, 17447, 10104, 40188, false, 0);
|
||||
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Raid boss Baium Stone spawned in world.");
|
||||
}
|
||||
GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, ASLEEP);
|
||||
}
|
||||
}
|
||||
else if (status == AWAKE)
|
||||
{
|
||||
final int loc_x = info.getInt("loc_x");
|
||||
final int loc_y = info.getInt("loc_y");
|
||||
final int loc_z = info.getInt("loc_z");
|
||||
final int heading = info.getInt("heading");
|
||||
final int hp = info.getInt("currentHP");
|
||||
final int mp = info.getInt("currentMP");
|
||||
final GrandBossInstance baium = (GrandBossInstance) addSpawn(LIVE_BAIUM, loc_x, loc_y, loc_z, heading, false, 0);
|
||||
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Raid boss " + baium.getName() + " spawned in world.");
|
||||
}
|
||||
GrandBossManager.getInstance().addBoss(baium);
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
try
|
||||
{
|
||||
baium.setCurrentHpMp(hp, mp);
|
||||
baium.setInvul(true);
|
||||
// _baium.setImobilised(true);
|
||||
baium.broadcastPacket(new SocialAction(baium.getObjectId(), 2));
|
||||
startQuestTimer("baium_wakeup", 15000, baium, null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning(e.getMessage());
|
||||
}
|
||||
}, 100L);
|
||||
}
|
||||
else
|
||||
{
|
||||
addSpawn(STONE_BAIUM, 116033, 17447, 10104, 40188, false, 0);
|
||||
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Raid boss Baium Stone spawned in world.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
if (event.equals("baium_unlock"))
|
||||
{
|
||||
GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, ASLEEP);
|
||||
addSpawn(STONE_BAIUM, 116033, 17447, 10104, 40188, false, 0);
|
||||
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Raid boss Baium Stone spawned in world.");
|
||||
}
|
||||
}
|
||||
else if (event.equals("skill_range") && (npc != null))
|
||||
{
|
||||
callSkillAI(npc);
|
||||
}
|
||||
else if (event.equals("clean_player"))
|
||||
{
|
||||
_target = getRandomTarget(npc);
|
||||
}
|
||||
else if (event.equals("baium_wakeup") && (npc != null))
|
||||
{
|
||||
if (npc.getNpcId() == LIVE_BAIUM)
|
||||
{
|
||||
npc.broadcastPacket(new SocialAction(npc.getObjectId(), 1));
|
||||
npc.broadcastPacket(new Earthquake(npc.getX(), npc.getY(), npc.getZ(), 40, 5));
|
||||
// start monitoring baium's inactivity
|
||||
_lastAttackVsBaiumTime = System.currentTimeMillis();
|
||||
startQuestTimer("baium_despawn", 60000, npc, null, true);
|
||||
if (player != null)
|
||||
{
|
||||
player.reduceCurrentHp(99999999, player);
|
||||
}
|
||||
|
||||
npc.setRunning();
|
||||
|
||||
startQuestTimer("skill_range", 500, npc, null, true);
|
||||
final NpcInstance baium = npc;
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
try
|
||||
{
|
||||
baium.setInvul(false);
|
||||
// baium.setImobilised(false);
|
||||
// for (NpcInstance minion : _Minions)
|
||||
// minion.setShowSummonAnimation(false);
|
||||
baium.getAttackByList().addAll(_zone.getCharactersInside());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning(e.getMessage());
|
||||
}
|
||||
}, 11100L);
|
||||
// TODO: the person who woke baium up should be knocked across the room, onto a wall, and
|
||||
// lose massive amounts of HP.
|
||||
for (int[] element : ANGEL_LOCATION)
|
||||
{
|
||||
final MonsterInstance angel = (MonsterInstance) addSpawn(ARCHANGEL, element[0], element[1], element[2], element[3], false, 0);
|
||||
angel.setInvul(true);
|
||||
_minions.add(angel);
|
||||
angel.getAttackByList().addAll(_zone.getCharactersInside());
|
||||
angel.isAggressive();
|
||||
}
|
||||
}
|
||||
// despawn the live baium after 30 minutes of inactivity
|
||||
// also check if the players are cheating, having pulled Baium outside his zone...
|
||||
}
|
||||
else if (event.equals("baium_despawn") && (npc != null))
|
||||
{
|
||||
if (npc.getNpcId() == LIVE_BAIUM)
|
||||
{
|
||||
// just in case the zone reference has been lost (somehow...), restore the reference
|
||||
if (_zone == null)
|
||||
{
|
||||
_zone = GrandBossManager.getInstance().getZone(113100, 14500, 10077);
|
||||
}
|
||||
if ((_lastAttackVsBaiumTime + (Config.BAIUM_SLEEP * 1000)) < System.currentTimeMillis())
|
||||
{
|
||||
npc.deleteMe(); // despawn the live-baium
|
||||
for (NpcInstance minion : _minions)
|
||||
{
|
||||
if (minion != null)
|
||||
{
|
||||
minion.getSpawn().stopRespawn();
|
||||
minion.deleteMe();
|
||||
}
|
||||
}
|
||||
_minions.clear();
|
||||
addSpawn(STONE_BAIUM, 116033, 17447, 10104, 40188, false, 0); // spawn stone-baium
|
||||
GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, ASLEEP); // mark that Baium is not awake any more
|
||||
_zone.oustAllPlayers();
|
||||
cancelQuestTimer("baium_despawn", npc, null);
|
||||
}
|
||||
else if (((_lastAttackVsBaiumTime + 300000) < System.currentTimeMillis()) && (npc.getCurrentHp() < ((npc.getMaxHp() * 3) / 4.0)))
|
||||
{
|
||||
npc.setTarget(npc);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4135, 1));
|
||||
if (GrandBossManager.getInstance().getBossStatus(LIVE_BAIUM) != AWAKE)
|
||||
{
|
||||
cancelQuestTimer("baium_despawn", npc, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onTalk(NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
final int npcId = npc.getNpcId();
|
||||
String htmltext = "";
|
||||
if (_zone == null)
|
||||
{
|
||||
_zone = GrandBossManager.getInstance().getZone(113100, 14500, 10077);
|
||||
}
|
||||
if (_zone == null)
|
||||
{
|
||||
return "<html><body>Angelic Vortex:<br>You may not enter while admin disabled this zone</body></html>";
|
||||
}
|
||||
|
||||
final Integer status = GrandBossManager.getInstance().getBossStatus(LIVE_BAIUM);
|
||||
if ((npcId == STONE_BAIUM) && (status == ASLEEP))
|
||||
{
|
||||
if (Config.ALLOW_DIRECT_TP_TO_BOSS_ROOM || _zone.isPlayerAllowed(player))
|
||||
{
|
||||
// once Baium is awaken, no more people may enter until he dies, the server reboots, or
|
||||
// 30 minutes pass with no attacks made against Baium.
|
||||
GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, AWAKE);
|
||||
npc.deleteMe();
|
||||
final GrandBossInstance baium = (GrandBossInstance) addSpawn(LIVE_BAIUM, npc);
|
||||
GrandBossManager.getInstance().addBoss(baium);
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
try
|
||||
{
|
||||
baium.setInvul(true);
|
||||
baium.setRunning();
|
||||
baium.broadcastPacket(new SocialAction(baium.getObjectId(), 2));
|
||||
startQuestTimer("baium_wakeup", 15000, baium, player);
|
||||
// _baium.setShowSummonAnimation(false);
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
LOGGER.warning(e.getMessage());
|
||||
}
|
||||
}, 100L);
|
||||
}
|
||||
else
|
||||
{
|
||||
htmltext = "Conditions are not right to wake up Baium";
|
||||
}
|
||||
}
|
||||
else if (npcId == ANGELIC_VORTEX)
|
||||
{
|
||||
if (player.isFlying())
|
||||
{
|
||||
// print "Player "+player.getName()+" attempted to enter Baium's lair while flying!";
|
||||
return "<html><body>Angelic Vortex:<br>You may not enter while flying a wyvern</body></html>";
|
||||
}
|
||||
|
||||
if ((status == ASLEEP) && (player.getQuestState(getName()).getQuestItemsCount(4295) > 0)) // bloody fabric
|
||||
{
|
||||
player.getQuestState(getName()).takeItems(4295, 1);
|
||||
// allow entry for the player for the next 30 secs (more than enough time for the TP to happen)
|
||||
// Note: this just means 30secs to get in, no limits on how long it takes before we get out.
|
||||
_zone.allowPlayerEntry(player, 30);
|
||||
player.teleToLocation(113100, 14500, 10077);
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.showChatWindow(player, 1);
|
||||
}
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSpellFinished(NpcInstance npc, PlayerInstance player, Skill skill)
|
||||
{
|
||||
if (npc.isInvul())
|
||||
{
|
||||
npc.getAI().setIntention(AI_INTENTION_IDLE);
|
||||
return null;
|
||||
}
|
||||
else if ((npc.getNpcId() == LIVE_BAIUM) && !npc.isInvul())
|
||||
{
|
||||
callSkillAI(npc);
|
||||
}
|
||||
return super.onSpellFinished(npc, player, skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (!_zone.isInsideZone(attacker))
|
||||
{
|
||||
attacker.reduceCurrentHp(attacker.getCurrentHp(), attacker, false);
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
if (npc.isInvul())
|
||||
{
|
||||
npc.getAI().setIntention(AI_INTENTION_IDLE);
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
else if ((npc.getNpcId() == LIVE_BAIUM) && !npc.isInvul())
|
||||
{
|
||||
if (attacker.getMountType() == 1)
|
||||
{
|
||||
int sk4258 = 0;
|
||||
final Effect[] effects = attacker.getAllEffects();
|
||||
if ((effects != null) && (effects.length != 0))
|
||||
{
|
||||
for (Effect e : effects)
|
||||
{
|
||||
if (e.getSkill().getId() == 4258)
|
||||
{
|
||||
sk4258 = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sk4258 == 0)
|
||||
{
|
||||
npc.setTarget(attacker);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4258, 1));
|
||||
}
|
||||
}
|
||||
// update a variable with the last action against baium
|
||||
_lastAttackVsBaiumTime = System.currentTimeMillis();
|
||||
callSkillAI(npc);
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
npc.broadcastPacket(new PlaySound(1, "BS01_D", npc));
|
||||
cancelQuestTimer("baium_despawn", npc, null);
|
||||
// spawn the "Teleportation Cubic" for 15 minutes (to allow players to exit the lair)
|
||||
addSpawn(29055, 115203, 16620, 10078, 0, false, 900000); // //should we teleport everyone out if the cubic despawns??
|
||||
// "lock" baium for 5 days and 1 to 8 hours [i.e. 432,000,000 + 1*3,600,000 + random-less-than(8*3,600,000) millisecs]
|
||||
final long respawnTime = (Config.BAIUM_RESP_FIRST + Rnd.get(Config.BAIUM_RESP_SECOND)) * 3600000;
|
||||
GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, DEAD);
|
||||
startQuestTimer("baium_unlock", respawnTime, null, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(LIVE_BAIUM);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(LIVE_BAIUM, info);
|
||||
for (NpcInstance minion : _minions)
|
||||
{
|
||||
if (minion != null)
|
||||
{
|
||||
minion.getSpawn().stopRespawn();
|
||||
minion.deleteMe();
|
||||
}
|
||||
}
|
||||
_minions.clear();
|
||||
|
||||
if (getQuestTimer("skill_range", npc, null) != null)
|
||||
{
|
||||
getQuestTimer("skill_range", npc, null).cancel();
|
||||
}
|
||||
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public Creature getRandomTarget(NpcInstance npc)
|
||||
{
|
||||
final List<Creature> result = new ArrayList<>();
|
||||
final Collection<WorldObject> objs = npc.getKnownList().getKnownObjects().values();
|
||||
{
|
||||
for (WorldObject obj : objs)
|
||||
{
|
||||
if ((obj instanceof Creature) && (((((Creature) obj).getZ() < (npc.getZ() - 100)) && (((Creature) obj).getZ() > (npc.getZ() + 100))) || !GeoEngine.getInstance().canSeeTarget(obj, npc)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((obj instanceof PlayerInstance) && Util.checkIfInRange(9000, npc, obj, true) && !((Creature) obj).isDead())
|
||||
{
|
||||
result.add((PlayerInstance) obj);
|
||||
}
|
||||
if ((obj instanceof Summon) && Util.checkIfInRange(9000, npc, obj, true) && !((Creature) obj).isDead())
|
||||
{
|
||||
result.add((Summon) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result.isEmpty())
|
||||
{
|
||||
for (NpcInstance minion : _minions)
|
||||
{
|
||||
if (minion != null)
|
||||
{
|
||||
result.add(minion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final Object[] characters = result.toArray();
|
||||
final QuestTimer timer = getQuestTimer("clean_player", npc, null);
|
||||
if (timer != null)
|
||||
{
|
||||
timer.cancel();
|
||||
}
|
||||
startQuestTimer("clean_player", 20000, npc, null);
|
||||
return (Creature) characters[Rnd.get(characters.length)];
|
||||
}
|
||||
|
||||
public synchronized void callSkillAI(NpcInstance npc)
|
||||
{
|
||||
if (npc.isInvul() || npc.isCastingNow())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_target == null) || _target.isDead() || !(_zone.isInsideZone(_target)))
|
||||
{
|
||||
_target = getRandomTarget(npc);
|
||||
if (_target != null)
|
||||
{
|
||||
_skill = SkillTable.getInstance().getInfo(getRandomSkill(npc), 1);
|
||||
}
|
||||
}
|
||||
|
||||
final Creature target = _target;
|
||||
Skill skill = _skill;
|
||||
if (skill == null)
|
||||
{
|
||||
skill = SkillTable.getInstance().getInfo(getRandomSkill(npc), 1);
|
||||
}
|
||||
if ((target == null) || target.isDead() || !(_zone.isInsideZone(target)))
|
||||
{
|
||||
// npc.setCastingNow(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Util.checkIfInRange(skill.getCastRange(), npc, target, true))
|
||||
{
|
||||
npc.getAI().setIntention(AI_INTENTION_IDLE);
|
||||
npc.setTarget(target);
|
||||
// npc.setCastingNow(true);
|
||||
if (getDist(skill.getCastRange()) > 0)
|
||||
{
|
||||
npc.broadcastPacket(new MoveToPawn(npc, target, getDist(skill.getCastRange())));
|
||||
}
|
||||
try
|
||||
{
|
||||
wait(1000);
|
||||
npc.stopMove(null);
|
||||
npc.doCast(skill);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning(e.getMessage());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.getAI().setIntention(AI_INTENTION_FOLLOW, target, null);
|
||||
// npc.setCastingNow(false);
|
||||
}
|
||||
}
|
||||
|
||||
public int getRandomSkill(NpcInstance npc)
|
||||
{
|
||||
int skill;
|
||||
if (npc.getCurrentHp() > ((npc.getMaxHp() * 3) / 4.0))
|
||||
{
|
||||
if (Rnd.get(100) < 10)
|
||||
{
|
||||
skill = 4128;
|
||||
}
|
||||
else if (Rnd.get(100) < 10)
|
||||
{
|
||||
skill = 4129;
|
||||
}
|
||||
else
|
||||
{
|
||||
skill = 4127;
|
||||
}
|
||||
}
|
||||
else if (npc.getCurrentHp() > ((npc.getMaxHp() * 2) / 4.0))
|
||||
{
|
||||
if (Rnd.get(100) < 10)
|
||||
{
|
||||
skill = 4131;
|
||||
}
|
||||
else if (Rnd.get(100) < 10)
|
||||
{
|
||||
skill = 4128;
|
||||
}
|
||||
else if (Rnd.get(100) < 10)
|
||||
{
|
||||
skill = 4129;
|
||||
}
|
||||
else
|
||||
{
|
||||
skill = 4127;
|
||||
}
|
||||
}
|
||||
else if (npc.getCurrentHp() > ((npc.getMaxHp() * 1) / 4.0))
|
||||
{
|
||||
if (Rnd.get(100) < 10)
|
||||
{
|
||||
skill = 4130;
|
||||
}
|
||||
else if (Rnd.get(100) < 10)
|
||||
{
|
||||
skill = 4131;
|
||||
}
|
||||
else if (Rnd.get(100) < 10)
|
||||
{
|
||||
skill = 4128;
|
||||
}
|
||||
else if (Rnd.get(100) < 10)
|
||||
{
|
||||
skill = 4129;
|
||||
}
|
||||
else
|
||||
{
|
||||
skill = 4127;
|
||||
}
|
||||
}
|
||||
else if (Rnd.get(100) < 10)
|
||||
{
|
||||
skill = 4130;
|
||||
}
|
||||
else if (Rnd.get(100) < 10)
|
||||
{
|
||||
skill = 4131;
|
||||
}
|
||||
else if (Rnd.get(100) < 10)
|
||||
{
|
||||
skill = 4128;
|
||||
}
|
||||
else if (Rnd.get(100) < 10)
|
||||
{
|
||||
skill = 4129;
|
||||
}
|
||||
else
|
||||
{
|
||||
skill = 4127;
|
||||
}
|
||||
return skill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSkillUse(NpcInstance npc, PlayerInstance caster, Skill skill)
|
||||
{
|
||||
if (npc.isInvul())
|
||||
{
|
||||
npc.getAI().setIntention(AI_INTENTION_IDLE);
|
||||
return null;
|
||||
}
|
||||
npc.setTarget(caster);
|
||||
return super.onSkillUse(npc, caster, skill);
|
||||
}
|
||||
|
||||
public int getDist(int range)
|
||||
{
|
||||
int dist = 0;
|
||||
switch (range)
|
||||
{
|
||||
case -1:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 100:
|
||||
{
|
||||
dist = 85;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
dist = range - 85;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return dist;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Baium();
|
||||
}
|
||||
}
|
||||
43
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Barakiel.java
vendored
Normal file
43
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Barakiel.java
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import org.l2jmobius.gameserver.model.quest.EventType;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/*
|
||||
* @author m095 (L2EmuRT)
|
||||
*/
|
||||
public class Barakiel extends Quest
|
||||
{
|
||||
// Barakiel NpcID
|
||||
private static final int BARAKIEL = 25325;
|
||||
|
||||
public Barakiel()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
|
||||
addEventId(BARAKIEL, EventType.ON_ATTACK);
|
||||
}
|
||||
|
||||
// FIXME: Mobius - AI does nothing?
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Barakiel();
|
||||
}
|
||||
}
|
||||
345
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Benom.java
vendored
Normal file
345
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Benom.java
vendored
Normal file
@@ -0,0 +1,345 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.datatables.xml.DoorData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SpecialCamera;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class Benom extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int BENOM = 29054;
|
||||
private static final int BENOM_TELEPORT = 13101;
|
||||
// Locations
|
||||
private static final Location[] WALK_ROUTES =
|
||||
{
|
||||
new Location(12565, -49739, -547),
|
||||
new Location(11242, -49689, -33),
|
||||
new Location(10751, -49702, 83),
|
||||
new Location(10824, -50808, 316),
|
||||
new Location(9084, -50786, 972),
|
||||
new Location(9095, -49787, 1252),
|
||||
new Location(8371, -49711, 1252),
|
||||
new Location(8423, -48545, 1252),
|
||||
new Location(9105, -48474, 1252),
|
||||
new Location(9085, -47488, 972),
|
||||
new Location(10858, -47527, 316),
|
||||
new Location(10842, -48626, 75),
|
||||
new Location(12171, -48464, -547),
|
||||
new Location(13565, -49145, -535),
|
||||
new Location(15653, -49159, -1059),
|
||||
new Location(15423, -48402, -839),
|
||||
new Location(15066, -47438, -419),
|
||||
new Location(13990, -46843, -292),
|
||||
new Location(13685, -47371, -163),
|
||||
new Location(13384, -47470, -163),
|
||||
new Location(14609, -48608, 346),
|
||||
new Location(13878, -47449, 747),
|
||||
new Location(12894, -49109, 980),
|
||||
new Location(10135, -49150, 996),
|
||||
new Location(12894, -49109, 980),
|
||||
new Location(13738, -50894, 747),
|
||||
new Location(14579, -49698, 347),
|
||||
new Location(12896, -51135, -166),
|
||||
new Location(12971, -52046, -292),
|
||||
new Location(15140, -50781, -442),
|
||||
new Location(15328, -50406, -603),
|
||||
new Location(15594, -49192, -1059),
|
||||
new Location(13175, -49153, -537)
|
||||
};
|
||||
// Misc
|
||||
private static final int[] WALK_TIMES =
|
||||
{
|
||||
18000,
|
||||
17000,
|
||||
4500,
|
||||
16000,
|
||||
22000,
|
||||
14000,
|
||||
10500,
|
||||
14000,
|
||||
9500,
|
||||
12500,
|
||||
20500,
|
||||
14500,
|
||||
17000,
|
||||
20000,
|
||||
22000,
|
||||
11000,
|
||||
11000,
|
||||
20000,
|
||||
8000,
|
||||
5500,
|
||||
20000,
|
||||
18000,
|
||||
25000,
|
||||
28000,
|
||||
25000,
|
||||
25000,
|
||||
25000,
|
||||
25000,
|
||||
10000,
|
||||
24000,
|
||||
7000,
|
||||
12000,
|
||||
20000
|
||||
};
|
||||
private static final String[] TALK =
|
||||
{
|
||||
"You should have finished me when you had the chance!!!",
|
||||
"I will crush all of you!!!",
|
||||
"I am not finished here, come face me!!!",
|
||||
"You cowards!!! I will torture each and everyone of you!!!"
|
||||
};
|
||||
private static final int ALIVE = 0;
|
||||
private static final int DEAD = 1;
|
||||
private static int _benomWalkRouteStep = 0;
|
||||
private static int _benomIsSpawned = 0;
|
||||
private static NpcInstance _benomInstance;
|
||||
private static NpcInstance _teleportInstance;
|
||||
|
||||
public Benom()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
|
||||
addStartNpc(BENOM_TELEPORT);
|
||||
addTalkId(BENOM_TELEPORT);
|
||||
addFirstTalkId(BENOM_TELEPORT);
|
||||
addAttackId(BENOM);
|
||||
addKillId(BENOM);
|
||||
|
||||
final int castleOwner = CastleManager.getInstance().getCastleById(8).getOwnerId();
|
||||
final long siegeDate = CastleManager.getInstance().getCastleById(8).getSiegeDate().getTimeInMillis();
|
||||
long benomTeleporterSpawn = (siegeDate - System.currentTimeMillis()) - 86400000;
|
||||
final long benomRaidRoomSpawn = (siegeDate - System.currentTimeMillis()) - 86400000;
|
||||
long benomRaidSiegeSpawn = (siegeDate - System.currentTimeMillis());
|
||||
if (benomTeleporterSpawn < 0)
|
||||
{
|
||||
benomTeleporterSpawn = 1;
|
||||
}
|
||||
if (benomRaidSiegeSpawn < 0)
|
||||
{
|
||||
benomRaidSiegeSpawn = 1;
|
||||
}
|
||||
if (castleOwner > 0)
|
||||
{
|
||||
if (benomTeleporterSpawn >= 1)
|
||||
{
|
||||
startQuestTimer("BenomTeleSpawn", benomTeleporterSpawn, null, null);
|
||||
}
|
||||
if ((siegeDate - System.currentTimeMillis()) > 0)
|
||||
{
|
||||
startQuestTimer("BenomRaidRoomSpawn", benomRaidRoomSpawn, null, null);
|
||||
}
|
||||
startQuestTimer("BenomRaidSiegeSpawn", benomRaidSiegeSpawn, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case "BenomTeleSpawn":
|
||||
{
|
||||
_teleportInstance = addSpawn(BENOM_TELEPORT, 11013, -49629, -547, 13400, false, 0);
|
||||
break;
|
||||
}
|
||||
case "BenomRaidRoomSpawn":
|
||||
{
|
||||
if ((_benomIsSpawned == 0) && (GrandBossManager.getInstance().getBossStatus(BENOM) == 0))
|
||||
{
|
||||
_benomInstance = addSpawn(BENOM, 12047, -49211, -3009, 0, false, 0);
|
||||
_benomIsSpawned = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "BenomRaidSiegeSpawn":
|
||||
{
|
||||
if (GrandBossManager.getInstance().getBossStatus(BENOM) == 0)
|
||||
{
|
||||
if (_benomIsSpawned == 0)
|
||||
{
|
||||
_benomInstance = addSpawn(BENOM, 11025, -49152, -537, 0, false, 0);
|
||||
_benomIsSpawned = 1;
|
||||
}
|
||||
else if (_benomIsSpawned == 1)
|
||||
{
|
||||
_benomInstance.teleToLocation(11025, -49152, -537);
|
||||
}
|
||||
startQuestTimer("BenomSpawnEffect", 100, null, null);
|
||||
startQuestTimer("BenomBossDespawn", 5400000, null, null);
|
||||
_teleportInstance.deleteMe();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "BenomSpawnEffect":
|
||||
{
|
||||
_benomInstance.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
_benomInstance.broadcastPacket(new SpecialCamera(_benomInstance.getObjectId(), 200, 0, 150, 0, 5000));
|
||||
_benomInstance.broadcastPacket(new SocialAction(_benomInstance.getObjectId(), 3));
|
||||
startQuestTimer("BenomWalk", 5000, _benomInstance, null);
|
||||
_benomWalkRouteStep = 0;
|
||||
break;
|
||||
}
|
||||
case "Attacking":
|
||||
{
|
||||
final Collection<PlayerInstance> knownPlayers = npc.getKnownList().getKnownPlayers().values();
|
||||
if (!knownPlayers.isEmpty())
|
||||
{
|
||||
final PlayerInstance target = knownPlayers.stream().findAny().get();
|
||||
((MonsterInstance) npc).addDamageHate(target, 0, 999);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
startQuestTimer("Attacking", 2000, npc, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
startQuestTimer("BenomWalkFinish", 2000, npc, null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "BenomWalkFinish":
|
||||
{
|
||||
if (npc.getCastle().getSiege().isInProgress())
|
||||
{
|
||||
cancelQuestTimer("Attacking", npc, player);
|
||||
npc.teleToLocation(WALK_ROUTES[_benomWalkRouteStep], false);
|
||||
npc.setWalking();
|
||||
_benomWalkRouteStep = 0;
|
||||
startQuestTimer("BenomWalk", 2200, npc, null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "BenomWalk":
|
||||
{
|
||||
if (_benomWalkRouteStep == 33)
|
||||
{
|
||||
_benomWalkRouteStep = 0;
|
||||
startQuestTimer("BenomWalk", 100, npc, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
startQuestTimer("Talk", 100, npc, null);
|
||||
if (_benomWalkRouteStep == 14)
|
||||
{
|
||||
startQuestTimer("DoorOpen", 15000, null, null);
|
||||
startQuestTimer("DoorClose", 23000, null, null);
|
||||
}
|
||||
if (_benomWalkRouteStep == 32)
|
||||
{
|
||||
startQuestTimer("DoorOpen", 500, null, null);
|
||||
startQuestTimer("DoorClose", 4000, null, null);
|
||||
}
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, WALK_ROUTES[_benomWalkRouteStep]);
|
||||
startQuestTimer("BenomWalk", WALK_TIMES[_benomWalkRouteStep], npc, null);
|
||||
_benomWalkRouteStep = _benomWalkRouteStep + 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "DoorOpen":
|
||||
{
|
||||
DoorData.getInstance().getDoor(20160005).openMe();
|
||||
break;
|
||||
}
|
||||
case "DoorClose":
|
||||
{
|
||||
DoorData.getInstance().getDoor(20160005).closeMe();
|
||||
break;
|
||||
}
|
||||
case "Talk":
|
||||
{
|
||||
if (Rnd.get(100) < 40)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, "Benom", TALK[Rnd.get(4)]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "BenomBossDespawn":
|
||||
{
|
||||
GrandBossManager.getInstance().setBossStatus(BENOM, ALIVE);
|
||||
_benomIsSpawned = 0;
|
||||
_benomInstance.deleteMe();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
final int castleOwner = CastleManager.getInstance().getCastleById(8).getOwnerId();
|
||||
final int clanId = player.getClanId();
|
||||
if ((castleOwner > 0) && (clanId > 0))
|
||||
{
|
||||
if (castleOwner == clanId)
|
||||
{
|
||||
final int x = 12558 + (Rnd.get(200) - 100);
|
||||
final int y = -49279 + (Rnd.get(200) - 100);
|
||||
player.teleToLocation(x, y, -3007);
|
||||
return null;
|
||||
}
|
||||
return "<html><body>Benom's Avatar:<br>Your clan does not own this castle. Only members of this Castle's owning clan can challenge Benom.</body></html>";
|
||||
}
|
||||
return "<html><body>Benom's Avatar:<br>Your clan does not own this castle. Only members of this Castle's owning clan can challenge Benom.</body></html>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
cancelQuestTimer("BenomWalk", npc, null);
|
||||
cancelQuestTimer("BenomWalkFinish", npc, null);
|
||||
startQuestTimer("Attacking", 100, npc, attacker);
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
GrandBossManager.getInstance().setBossStatus(BENOM, DEAD);
|
||||
cancelQuestTimer("BenomWalk", npc, null);
|
||||
cancelQuestTimer("BenomWalkFinish", npc, null);
|
||||
cancelQuestTimer("BenomBossDespawn", npc, null);
|
||||
cancelQuestTimer("Talk", npc, null);
|
||||
cancelQuestTimer("Attacking", npc, null);
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Benom();
|
||||
}
|
||||
}
|
||||
257
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Core.java
vendored
Normal file
257
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Core.java
vendored
Normal file
@@ -0,0 +1,257 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
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.instance.GrandBossInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.entity.Announcements;
|
||||
import org.l2jmobius.gameserver.model.quest.EventType;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.PlaySound;
|
||||
|
||||
/**
|
||||
* Core AI
|
||||
* @author qwerty, Mobius
|
||||
*/
|
||||
public class Core extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int CORE = 29006;
|
||||
private static final int DEATH_KNIGHT = 29007;
|
||||
private static final int DOOM_WRAITH = 29008;
|
||||
private static final int SUSCEPTOR = 29011;
|
||||
// Spawns
|
||||
private static final Map<Integer, Location> MINNION_SPAWNS = new HashMap<>();
|
||||
static
|
||||
{
|
||||
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17191, 109298, -6488));
|
||||
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17564, 109548, -6488));
|
||||
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17855, 109552, -6488));
|
||||
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(18280, 109202, -6488));
|
||||
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(18784, 109253, -6488));
|
||||
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(18059, 108314, -6488));
|
||||
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17300, 108444, -6488));
|
||||
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17148, 110071, -6648));
|
||||
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(18318, 110077, -6648));
|
||||
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17726, 110391, -6648));
|
||||
MINNION_SPAWNS.put(DOOM_WRAITH, new Location(17113, 110970, -6648));
|
||||
MINNION_SPAWNS.put(DOOM_WRAITH, new Location(17496, 110880, -6648));
|
||||
MINNION_SPAWNS.put(DOOM_WRAITH, new Location(18061, 110990, -6648));
|
||||
MINNION_SPAWNS.put(DOOM_WRAITH, new Location(18384, 110698, -6648));
|
||||
MINNION_SPAWNS.put(DOOM_WRAITH, new Location(17993, 111458, -6584));
|
||||
MINNION_SPAWNS.put(SUSCEPTOR, new Location(17297, 111470, -6584));
|
||||
MINNION_SPAWNS.put(SUSCEPTOR, new Location(17893, 110198, -6648));
|
||||
MINNION_SPAWNS.put(SUSCEPTOR, new Location(17706, 109423, -6488));
|
||||
MINNION_SPAWNS.put(SUSCEPTOR, new Location(17849, 109388, -6480));
|
||||
}
|
||||
// Misc
|
||||
private static final byte ALIVE = 0;
|
||||
private static final byte DEAD = 1;
|
||||
|
||||
private static boolean _firstAttacked;
|
||||
|
||||
private static final Collection<Attackable> _minions = ConcurrentHashMap.newKeySet();
|
||||
|
||||
public Core()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
|
||||
final int[] mobs =
|
||||
{
|
||||
CORE,
|
||||
DEATH_KNIGHT,
|
||||
DOOM_WRAITH,
|
||||
SUSCEPTOR
|
||||
};
|
||||
|
||||
for (int mob : mobs)
|
||||
{
|
||||
addEventId(mob, EventType.ON_KILL);
|
||||
addEventId(mob, EventType.ON_ATTACK);
|
||||
}
|
||||
|
||||
_firstAttacked = false;
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(CORE);
|
||||
if (GrandBossManager.getInstance().getBossStatus(CORE) == DEAD)
|
||||
{
|
||||
// Load the unlock date and time for Core from DB.
|
||||
final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
|
||||
// If Core is locked until a certain time, mark it so and start the unlock timer the unlock time has not yet expired.
|
||||
if (temp > 0)
|
||||
{
|
||||
startQuestTimer("core_unlock", temp, null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The time has already expired while the server was offline. Immediately spawn Core.
|
||||
final GrandBossInstance core = (GrandBossInstance) addSpawn(CORE, 17726, 108915, -6480, 0, false, 0);
|
||||
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Raid boss " + core.getName() + " spawned in world.");
|
||||
}
|
||||
GrandBossManager.getInstance().setBossStatus(CORE, ALIVE);
|
||||
spawnBoss(core);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GlobalVariablesManager.getInstance().getBoolean("CoreAttacked", false))
|
||||
{
|
||||
_firstAttacked = true;
|
||||
}
|
||||
final GrandBossInstance core = (GrandBossInstance) addSpawn(CORE, 17726, 108915, -6480, 0, false, 0);
|
||||
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Raid boss " + core.getName() + " spawned in world.");
|
||||
}
|
||||
spawnBoss(core);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveGlobalData()
|
||||
{
|
||||
GlobalVariablesManager.getInstance().set("CoreAttacked", _firstAttacked);
|
||||
}
|
||||
|
||||
public void spawnBoss(GrandBossInstance npc)
|
||||
{
|
||||
GrandBossManager.getInstance().addBoss(npc);
|
||||
npc.broadcastPacket(new PlaySound(1, "BS01_A", npc));
|
||||
// Spawn minions
|
||||
Attackable mob;
|
||||
Location spawnLocation;
|
||||
for (Entry<Integer, Location> spawn : MINNION_SPAWNS.entrySet())
|
||||
{
|
||||
spawnLocation = spawn.getValue();
|
||||
mob = (Attackable) addSpawn(spawn.getKey(), spawnLocation.getX(), spawnLocation.getY(), spawnLocation.getZ(), Rnd.get(61794), false, 0);
|
||||
_minions.add(mob);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
final Integer status = GrandBossManager.getInstance().getBossStatus(CORE);
|
||||
if (event.equals("core_unlock"))
|
||||
{
|
||||
final GrandBossInstance core = (GrandBossInstance) addSpawn(CORE, 17726, 108915, -6480, 0, false, 0);
|
||||
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Raid boss " + core.getName() + " spawned in world.");
|
||||
}
|
||||
GrandBossManager.getInstance().setBossStatus(CORE, ALIVE);
|
||||
spawnBoss(core);
|
||||
}
|
||||
else if (status == null)
|
||||
{
|
||||
LOGGER.warning("GrandBoss with Id " + CORE + " has not valid status into GrandBossManager.");
|
||||
}
|
||||
else if (event.equals("spawn_minion") && (status == ALIVE))
|
||||
{
|
||||
_minions.add((Attackable) addSpawn(npc.getNpcId(), npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0));
|
||||
}
|
||||
else if (event.equals("despawn_minions"))
|
||||
{
|
||||
for (Attackable mob : _minions)
|
||||
{
|
||||
if (mob != null)
|
||||
{
|
||||
mob.decayMe();
|
||||
}
|
||||
}
|
||||
_minions.clear();
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.getNpcId() == CORE)
|
||||
{
|
||||
if (_firstAttacked)
|
||||
{
|
||||
if (Rnd.get(100) == 0)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "Removing intruders."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_firstAttacked = true;
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "A non-permitted target has been discovered."));
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "Starting intruder removal system."));
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
final int npcId = npc.getNpcId();
|
||||
final String name = npc.getName();
|
||||
if (npcId == CORE)
|
||||
{
|
||||
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, name, "A fatal error has occurred."));
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, name, "System is being shut down..."));
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, name, "......"));
|
||||
_firstAttacked = false;
|
||||
addSpawn(31842, 16502, 110165, -6394, 0, false, 900000);
|
||||
addSpawn(31842, 18948, 110166, -6397, 0, false, 900000);
|
||||
GrandBossManager.getInstance().setBossStatus(CORE, DEAD);
|
||||
// Calculate Min and Max respawn times randomly.
|
||||
final long respawnTime = (Config.CORE_RESP_FIRST + Rnd.get(Config.CORE_RESP_SECOND)) * 3600000;
|
||||
startQuestTimer("core_unlock", respawnTime, null, null);
|
||||
// Also save the respawn time so that the info is maintained past reboots.
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(CORE);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(CORE, info);
|
||||
startQuestTimer("despawn_minions", 20000, null, null);
|
||||
cancelQuestTimers("spawn_minion");
|
||||
}
|
||||
else if ((GrandBossManager.getInstance().getBossStatus(CORE) == ALIVE) && _minions.contains(npc))
|
||||
{
|
||||
_minions.remove(npc);
|
||||
startQuestTimer("spawn_minion", Config.CORE_RESP_MINION * 1000, npc, null);
|
||||
}
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Core();
|
||||
}
|
||||
}
|
||||
145
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/DrChaos.java
vendored
Normal file
145
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/DrChaos.java
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.datatables.sql.SpawnTable;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.spawn.Spawn;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.PlaySound;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SpecialCamera;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class DrChaos extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int STRANGE_MACHINE = 32032;
|
||||
private static final int DR_CHAOS = 32033;
|
||||
private static final int CHAOS_GOLEM = 25512;
|
||||
// Misc
|
||||
private static int _golemSpawned = 0;
|
||||
private static int _chaosSpawned = 1;
|
||||
|
||||
private DrChaos()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
|
||||
addFirstTalkId(DR_CHAOS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case "1":
|
||||
{
|
||||
final NpcInstance strangeMachine = findTemplate(STRANGE_MACHINE);
|
||||
if (strangeMachine != null)
|
||||
{
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, strangeMachine);
|
||||
strangeMachine.broadcastPacket(new SpecialCamera(strangeMachine.getObjectId(), 1, -200, 15, 10000, 20000));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning("Dr Chaos AI: problem finding Strange Machine (npcid = " + STRANGE_MACHINE + "). Error: not spawned!");
|
||||
}
|
||||
startQuestTimer("2", 2000, npc, player);
|
||||
startQuestTimer("3", 10000, npc, player);
|
||||
if (_chaosSpawned == 0)
|
||||
{
|
||||
addSpawn(DR_CHAOS, 96471, -111425, -3334, 0, false, 0);
|
||||
_chaosSpawned = 1;
|
||||
}
|
||||
startQuestTimer("2", 2000, npc, player);
|
||||
startQuestTimer("3", 10000, npc, player);
|
||||
break;
|
||||
}
|
||||
case "2":
|
||||
{
|
||||
npc.broadcastPacket(new SocialAction(npc.getObjectId(), 3));
|
||||
break;
|
||||
}
|
||||
case "3":
|
||||
{
|
||||
npc.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1, -150, 10, 3000, 20000));
|
||||
startQuestTimer("4", 2500, npc, player);
|
||||
break;
|
||||
}
|
||||
case "4":
|
||||
{
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(96055, -110759, -3312));
|
||||
startQuestTimer("5", 2000, npc, player);
|
||||
break;
|
||||
}
|
||||
case "5":
|
||||
{
|
||||
player.teleToLocation(94832, -112624, -3304);
|
||||
npc.teleToLocation(-113091, -243942, -15536);
|
||||
if (_golemSpawned == 0)
|
||||
{
|
||||
final NpcInstance golem = addSpawn(CHAOS_GOLEM, 94640, -112496, -3336, 0, false, 0);
|
||||
_golemSpawned = 1;
|
||||
startQuestTimer("6", 1000, golem, player);
|
||||
player.sendPacket(new PlaySound(1, "Rm03_A"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "6":
|
||||
{
|
||||
npc.broadcastPacket(new SpecialCamera(npc.getObjectId(), 30, -200, 20, 6000, 8000));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
player.setTarget(null);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(96323, -110914, -3328));
|
||||
startQuestTimer("1", 3000, npc, player);
|
||||
return null;
|
||||
}
|
||||
|
||||
private NpcInstance findTemplate(int npcId)
|
||||
{
|
||||
NpcInstance npcInstance = null;
|
||||
for (Spawn spawn : SpawnTable.getInstance().getSpawnTable().values())
|
||||
{
|
||||
if ((spawn != null) && (spawn.getNpcId() == npcId))
|
||||
{
|
||||
npcInstance = spawn.getLastSpawn();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return npcInstance;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new DrChaos();
|
||||
}
|
||||
}
|
||||
1828
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Frintezza.java
vendored
Normal file
1828
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Frintezza.java
vendored
Normal file
File diff suppressed because it is too large
Load Diff
43
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Golkonda.java
vendored
Normal file
43
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Golkonda.java
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import org.l2jmobius.gameserver.model.quest.EventType;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/*
|
||||
* @author m095 (L2EmuRT)
|
||||
*/
|
||||
public class Golkonda extends Quest
|
||||
{
|
||||
// Golkonda NpcID
|
||||
private static final int GOLKONDA = 25126;
|
||||
|
||||
public Golkonda()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
|
||||
addEventId(GOLKONDA, EventType.ON_ATTACK);
|
||||
}
|
||||
|
||||
// FIXME: Mobius - AI does nothing?
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Golkonda();
|
||||
}
|
||||
}
|
||||
302
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Gordon.java
vendored
Normal file
302
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Gordon.java
vendored
Normal file
@@ -0,0 +1,302 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.datatables.sql.SpawnTable;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.EventType;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.spawn.Spawn;
|
||||
|
||||
/**
|
||||
* Gordon AI
|
||||
* @author TOFIZ
|
||||
* @version $Revision: 1.1 $ $Date: 2008/08/21 $
|
||||
*/
|
||||
public class Gordon extends Quest
|
||||
{
|
||||
private static final int GORDON = 29095;
|
||||
private static int _npcMoveX = 0;
|
||||
private static int _npcMoveY = 0;
|
||||
private static int _isWalkTo = 0;
|
||||
private static int _npcBlock = 0;
|
||||
|
||||
// @formatter:off
|
||||
private static final int[][] WALKS =
|
||||
{
|
||||
{141569, -45908, -2387},
|
||||
{142494, -45456, -2397},
|
||||
{142922, -44561, -2395},
|
||||
{143672, -44130, -2398},
|
||||
{144557, -43378, -2325},
|
||||
{145839, -43267, -2301},
|
||||
{147044, -43601, -2307},
|
||||
{148140, -43206, -2303},
|
||||
{148815, -43434, -2328},
|
||||
{149862, -44151, -2558},
|
||||
{151037, -44197, -2708},
|
||||
{152555, -42756, -2836},
|
||||
{154808, -39546, -3236},
|
||||
{155333, -39962, -3272},
|
||||
{156531, -41240, -3470},
|
||||
{156863, -43232, -3707},
|
||||
{156783, -44198, -3764},
|
||||
{158169, -45163, -3541},
|
||||
{158952, -45479, -3473},
|
||||
{160039, -46514, -3634},
|
||||
{160244, -47429, -3656},
|
||||
{159155, -48109, -3665},
|
||||
{159558, -51027, -3523},
|
||||
{159396, -53362, -3244},
|
||||
{160872, -56556, -2789},
|
||||
{160857, -59072, -2613},
|
||||
{160410, -59888, -2647},
|
||||
{158770, -60173, -2673},
|
||||
{156368, -59557, -2638},
|
||||
{155188, -59868, -2642},
|
||||
{154118, -60591, -2731},
|
||||
{153571, -61567, -2821},
|
||||
{153457, -62819, -2886},
|
||||
{152939, -63778, -3003},
|
||||
{151816, -64209, -3120},
|
||||
{147655, -64826, -3433},
|
||||
{145422, -64576, -3369},
|
||||
{144097, -64320, -3404},
|
||||
{140780, -61618, -3096},
|
||||
{139688, -61450, -3062},
|
||||
{138267, -61743, -3056},
|
||||
{138613, -58491, -3465},
|
||||
{138139, -57252, -3517},
|
||||
{139555, -56044, -3310},
|
||||
{139107, -54537, -3240},
|
||||
{139279, -53781, -3091},
|
||||
{139810, -52687, -2866},
|
||||
{139657, -52041, -2793},
|
||||
{139215, -51355, -2698},
|
||||
{139334, -50514, -2594},
|
||||
{139817, -49715, -2449},
|
||||
{139824, -48976, -2263},
|
||||
{140130, -47578, -2213},
|
||||
{140483, -46339, -2382},
|
||||
{141569, -45908, -2387}
|
||||
};
|
||||
// @formatter:on
|
||||
|
||||
private static boolean _isAttacked = false;
|
||||
private static boolean _isSpawned = false;
|
||||
|
||||
public Gordon()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
|
||||
addEventId(GORDON, EventType.ON_KILL);
|
||||
addEventId(GORDON, EventType.ON_ATTACK);
|
||||
addEventId(GORDON, EventType.ON_SPAWN);
|
||||
|
||||
// wait 2 minutes after Start AI
|
||||
startQuestTimer("check_ai", 120000, null, null, true);
|
||||
|
||||
_isSpawned = false;
|
||||
_isAttacked = false;
|
||||
_isWalkTo = 1;
|
||||
_npcMoveX = 0;
|
||||
_npcMoveY = 0;
|
||||
_npcBlock = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
int x = WALKS[_isWalkTo - 1][0];
|
||||
int y = WALKS[_isWalkTo - 1][1];
|
||||
int z = WALKS[_isWalkTo - 1][2];
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case "time_isAttacked":
|
||||
{
|
||||
_isAttacked = false;
|
||||
if (npc.getNpcId() == GORDON)
|
||||
{
|
||||
npc.setWalking();
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(x, y, z, 0));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "check_ai":
|
||||
{
|
||||
cancelQuestTimer("check_ai", null, null);
|
||||
if (!_isSpawned)
|
||||
{
|
||||
final NpcInstance gordon = findTemplate(GORDON);
|
||||
if (gordon != null)
|
||||
{
|
||||
_isSpawned = true;
|
||||
startQuestTimer("Start", 1000, gordon, null, true);
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "Start":
|
||||
{
|
||||
// startQuestTimer("Start", 1000, npc, null);
|
||||
if ((npc != null) && _isSpawned)
|
||||
{
|
||||
// check if player have Cursed Weapon and in radius
|
||||
if (npc.getNpcId() == GORDON)
|
||||
{
|
||||
final Collection<PlayerInstance> chars = npc.getKnownList().getKnownPlayers().values();
|
||||
if ((chars != null) && !chars.isEmpty())
|
||||
{
|
||||
for (PlayerInstance pc : chars)
|
||||
{
|
||||
if (pc.isCursedWeaponEquipped() && pc.isInsideRadius(npc, 5000, false, false))
|
||||
{
|
||||
npc.setRunning();
|
||||
((Attackable) npc).addDamageHate(pc, 0, 9999);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, pc);
|
||||
_isAttacked = true;
|
||||
cancelQuestTimer("time_isAttacked", null, null);
|
||||
startQuestTimer("time_isAttacked", 180000, npc, null);
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// end check
|
||||
if (_isAttacked)
|
||||
{
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
if ((npc.getNpcId() == GORDON) && ((npc.getX() - 50) <= x) && ((npc.getX() + 50) >= x) && ((npc.getY() - 50) <= y) && ((npc.getY() + 50) >= y))
|
||||
{
|
||||
_isWalkTo++;
|
||||
if (_isWalkTo > 55)
|
||||
{
|
||||
_isWalkTo = 1;
|
||||
}
|
||||
x = WALKS[_isWalkTo - 1][0];
|
||||
y = WALKS[_isWalkTo - 1][1];
|
||||
z = WALKS[_isWalkTo - 1][2];
|
||||
npc.setWalking();
|
||||
// TODO: find better way to prevent teleporting to the home location
|
||||
npc.getSpawn().setX(x);
|
||||
npc.getSpawn().setY(y);
|
||||
npc.getSpawn().setZ(z);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(x, y, z, 0));
|
||||
}
|
||||
// Test for unblock Npc
|
||||
if ((npc.getX() != _npcMoveX) && (npc.getY() != _npcMoveY))
|
||||
{
|
||||
_npcMoveX = npc.getX();
|
||||
_npcMoveY = npc.getY();
|
||||
_npcBlock = 0;
|
||||
}
|
||||
else if (npc.getNpcId() == GORDON)
|
||||
{
|
||||
_npcBlock++;
|
||||
if (_npcBlock > 2)
|
||||
{
|
||||
npc.teleToLocation(x, y, z);
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
if (_npcBlock > 0)
|
||||
{
|
||||
// TODO: find better way to prevent teleporting to the home location
|
||||
npc.getSpawn().setX(x);
|
||||
npc.getSpawn().setY(y);
|
||||
npc.getSpawn().setZ(z);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(x, y, z, 0));
|
||||
}
|
||||
}
|
||||
// End Test unblock Npc
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSpawn(NpcInstance npc)
|
||||
{
|
||||
if ((npc.getNpcId() == GORDON) && (_npcBlock == 0))
|
||||
{
|
||||
_isSpawned = true;
|
||||
_isWalkTo = 1;
|
||||
startQuestTimer("Start", 1000, npc, null);
|
||||
}
|
||||
return super.onSpawn(npc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance player, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.getNpcId() == GORDON)
|
||||
{
|
||||
_isAttacked = true;
|
||||
cancelQuestTimer("time_isAttacked", null, null);
|
||||
startQuestTimer("time_isAttacked", 180000, npc, null);
|
||||
if (player != null)
|
||||
{
|
||||
npc.setRunning();
|
||||
((Attackable) npc).addDamageHate(player, 0, 100);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, player, damage, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
if (npc.getNpcId() == GORDON)
|
||||
{
|
||||
cancelQuestTimer("Start", null, null);
|
||||
cancelQuestTimer("time_isAttacked", null, null);
|
||||
_isSpawned = false;
|
||||
}
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public NpcInstance findTemplate(int npcId)
|
||||
{
|
||||
NpcInstance npc = null;
|
||||
for (Spawn spawn : SpawnTable.getInstance().getSpawnTable().values())
|
||||
{
|
||||
if ((spawn != null) && (spawn.getNpcId() == npcId))
|
||||
{
|
||||
npc = spawn.getLastSpawn();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return npc;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Gordon();
|
||||
}
|
||||
}
|
||||
103
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Gustav.java
vendored
Normal file
103
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Gustav.java
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.entity.siege.clanhalls.DevastatedCastle;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class Gustav extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int GUSTAV = 35410;
|
||||
private static final int MESSENGER = 35420;
|
||||
// Misc
|
||||
private static final Collection<Clan> _clans = ConcurrentHashMap.newKeySet();
|
||||
|
||||
private Gustav()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
|
||||
addTalkId(MESSENGER);
|
||||
addStartNpc(MESSENGER);
|
||||
addAttackId(GUSTAV);
|
||||
addKillId(GUSTAV);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onTalk(NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
final Clan playerClan = player.getClan();
|
||||
for (Clan clan : _clans)
|
||||
{
|
||||
if (clan == playerClan)
|
||||
{
|
||||
return "<html><body>You already registered!</body></html>";
|
||||
}
|
||||
}
|
||||
|
||||
if (DevastatedCastle.getInstance().Conditions(player))
|
||||
{
|
||||
if (!_clans.contains(playerClan))
|
||||
{
|
||||
_clans.add(playerClan);
|
||||
}
|
||||
return "<html><body>You have successful registered on a siege.</body></html>";
|
||||
}
|
||||
|
||||
return "<html><body>You are not allowed to do that!</body></html>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
final Clan playerClan = attacker.getClan();
|
||||
if (playerClan != null)
|
||||
{
|
||||
for (Clan clan : _clans)
|
||||
{
|
||||
if (clan == playerClan)
|
||||
{
|
||||
DevastatedCastle.getInstance().addSiegeDamage(clan, damage);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
DevastatedCastle.getInstance().SiegeFinish();
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Gustav();
|
||||
}
|
||||
}
|
||||
43
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Hallate.java
vendored
Normal file
43
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Hallate.java
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import org.l2jmobius.gameserver.model.quest.EventType;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/*
|
||||
* @author m095 (L2EmuRT)
|
||||
*/
|
||||
public class Hallate extends Quest
|
||||
{
|
||||
// Hallate NpcID
|
||||
private static final int HALLATE = 25220;
|
||||
|
||||
public Hallate()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
|
||||
addEventId(HALLATE, EventType.ON_ATTACK);
|
||||
}
|
||||
|
||||
// FIXME: Mobius - AI does nothing?
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Hallate();
|
||||
}
|
||||
}
|
||||
453
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/IceFairySirra.java
vendored
Normal file
453
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/IceFairySirra.java
vendored
Normal file
@@ -0,0 +1,453 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.SpawnTable;
|
||||
import org.l2jmobius.gameserver.datatables.xml.DoorData;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.DoorInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.EventType;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.spawn.Spawn;
|
||||
import org.l2jmobius.gameserver.model.zone.type.BossZone;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
|
||||
/**
|
||||
* Ice Fairy Sirra AI
|
||||
* @author Kerberos
|
||||
*/
|
||||
public class IceFairySirra extends Quest
|
||||
{
|
||||
private static final int STEWARD = 32029;
|
||||
private static final int SILVER_HEMOCYTE = 8057;
|
||||
private static BossZone _freyasZone;
|
||||
private static PlayerInstance _player = null;
|
||||
protected Collection<NpcInstance> _allMobs = ConcurrentHashMap.newKeySet();
|
||||
protected Future<?> _onDeadEventTask = null;
|
||||
|
||||
public IceFairySirra()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
final int[] mobs =
|
||||
{
|
||||
STEWARD,
|
||||
22100,
|
||||
22102,
|
||||
22104
|
||||
};
|
||||
|
||||
for (int mob : mobs)
|
||||
{
|
||||
// TODO:
|
||||
addEventId(mob, EventType.QUEST_START);
|
||||
addEventId(mob, EventType.QUEST_TALK);
|
||||
addEventId(mob, EventType.NPC_FIRST_TALK);
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
if (player.getQuestState(getName()) == null)
|
||||
{
|
||||
newQuestState(player);
|
||||
}
|
||||
player.setLastQuestNpcObject(npc.getObjectId());
|
||||
String filename = "";
|
||||
if (npc.isBusy())
|
||||
{
|
||||
filename = getHtmlPath(10);
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = getHtmlPath(0);
|
||||
}
|
||||
sendHtml(npc, player, filename);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
if (event.equals("check_condition"))
|
||||
{
|
||||
if (npc.isBusy())
|
||||
{
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
String filename = "";
|
||||
if (player.isInParty() && (player.getParty().getPartyLeaderOID() == player.getObjectId()))
|
||||
{
|
||||
if (checkItems(player))
|
||||
{
|
||||
startQuestTimer("start", 100000, null, player);
|
||||
_player = player;
|
||||
destroyItems(player);
|
||||
player.getInventory().addItem("Scroll", 8379, 3, player, null);
|
||||
npc.setBusy(true);
|
||||
screenMessage(player, "Steward: Please wait a moment.", 100000);
|
||||
filename = getHtmlPath(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = getHtmlPath(2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
filename = getHtmlPath(1);
|
||||
}
|
||||
sendHtml(npc, player, filename);
|
||||
}
|
||||
else if (event.equals("start"))
|
||||
{
|
||||
if (_freyasZone == null)
|
||||
{
|
||||
LOGGER.warning("IceFairySirraManager: Failed to load zone");
|
||||
cleanUp();
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
_freyasZone.setZoneEnabled(true);
|
||||
closeGates();
|
||||
doSpawns();
|
||||
startQuestTimer("Party_Port", 2000, null, player);
|
||||
startQuestTimer("End", 1802000, null, player);
|
||||
}
|
||||
else if (event.equals("Party_Port"))
|
||||
{
|
||||
teleportInside(player);
|
||||
screenMessage(player, "Steward: Please restore the Queen's appearance!", 10000);
|
||||
startQuestTimer("30MinutesRemaining", 300000, null, player);
|
||||
}
|
||||
else if (event.equals("30MinutesRemaining"))
|
||||
{
|
||||
screenMessage(player, "30 minute(s) are remaining.", 10000);
|
||||
startQuestTimer("20minutesremaining", 600000, null, player);
|
||||
}
|
||||
else if (event.equals("20MinutesRemaining"))
|
||||
{
|
||||
screenMessage(player, "20 minute(s) are remaining.", 10000);
|
||||
startQuestTimer("10minutesremaining", 600000, null, player);
|
||||
}
|
||||
else if (event.equals("10MinutesRemaining"))
|
||||
{
|
||||
screenMessage(player, "Steward: Waste no time! Please hurry!", 10000);
|
||||
}
|
||||
else if (event.equals("End"))
|
||||
{
|
||||
screenMessage(player, "Steward: Was it indeed too much to ask.", 10000);
|
||||
cleanUp();
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
_freyasZone = GrandBossManager.getInstance().getZone(105546, -127892, -2768);
|
||||
if (_freyasZone == null)
|
||||
{
|
||||
LOGGER.warning("IceFairySirraManager: Failed to load zone");
|
||||
return;
|
||||
}
|
||||
_freyasZone.setZoneEnabled(false);
|
||||
final NpcInstance steward = findTemplate(STEWARD);
|
||||
if (steward != null)
|
||||
{
|
||||
steward.setBusy(false);
|
||||
}
|
||||
openGates();
|
||||
}
|
||||
|
||||
public void cleanUp()
|
||||
{
|
||||
init();
|
||||
cancelQuestTimer("30MinutesRemaining", null, _player);
|
||||
cancelQuestTimer("20MinutesRemaining", null, _player);
|
||||
cancelQuestTimer("10MinutesRemaining", null, _player);
|
||||
cancelQuestTimer("End", null, _player);
|
||||
for (NpcInstance mob : _allMobs)
|
||||
{
|
||||
try
|
||||
{
|
||||
mob.getSpawn().stopRespawn();
|
||||
mob.deleteMe();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("IceFairySirraManager: Failed deleting mob. " + e);
|
||||
}
|
||||
}
|
||||
_allMobs.clear();
|
||||
}
|
||||
|
||||
public NpcInstance findTemplate(int npcId)
|
||||
{
|
||||
NpcInstance npc = null;
|
||||
for (Spawn spawn : SpawnTable.getInstance().getSpawnTable().values())
|
||||
{
|
||||
if ((spawn != null) && (spawn.getNpcId() == npcId))
|
||||
{
|
||||
npc = spawn.getLastSpawn();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return npc;
|
||||
}
|
||||
|
||||
protected void openGates()
|
||||
{
|
||||
for (int i = 23140001; i < 23140003; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
final DoorInstance door = DoorData.getInstance().getDoor(i);
|
||||
if (door != null)
|
||||
{
|
||||
door.openMe();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning("IceFairySirraManager: Attempted to open undefined door. doorId: " + i);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("IceFairySirraManager: Failed closing door " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void closeGates()
|
||||
{
|
||||
for (int i = 23140001; i < 23140003; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
final DoorInstance door = DoorData.getInstance().getDoor(i);
|
||||
if (door != null)
|
||||
{
|
||||
door.closeMe();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning("IceFairySirraManager: Attempted to close undefined door. doorId: " + i);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("IceFairySirraManager: Failed closing door " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkItems(PlayerInstance player)
|
||||
{
|
||||
if (player.getParty() != null)
|
||||
{
|
||||
for (PlayerInstance pc : player.getParty().getPartyMembers())
|
||||
{
|
||||
final ItemInstance i = pc.getInventory().getItemByItemId(SILVER_HEMOCYTE);
|
||||
if ((i == null) || (i.getCount() < 10))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void destroyItems(PlayerInstance player)
|
||||
{
|
||||
if (player.getParty() != null)
|
||||
{
|
||||
for (PlayerInstance pc : player.getParty().getPartyMembers())
|
||||
{
|
||||
final ItemInstance i = pc.getInventory().getItemByItemId(SILVER_HEMOCYTE);
|
||||
pc.destroyItem("Hemocytes", i.getObjectId(), 10, null, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cleanUp();
|
||||
}
|
||||
}
|
||||
|
||||
public void teleportInside(PlayerInstance player)
|
||||
{
|
||||
if (player.getParty() != null)
|
||||
{
|
||||
for (PlayerInstance pc : player.getParty().getPartyMembers())
|
||||
{
|
||||
pc.teleToLocation(113533, -126159, -3488, false);
|
||||
if (_freyasZone == null)
|
||||
{
|
||||
LOGGER.warning("IceFairySirraManager: Failed to load zone");
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
_freyasZone.allowPlayerEntry(pc, 2103);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cleanUp();
|
||||
}
|
||||
}
|
||||
|
||||
public void screenMessage(PlayerInstance player, String text, int time)
|
||||
{
|
||||
if (player.getParty() != null)
|
||||
{
|
||||
for (PlayerInstance pc : player.getParty().getPartyMembers())
|
||||
{
|
||||
pc.sendPacket(new ExShowScreenMessage(text, time));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cleanUp();
|
||||
}
|
||||
}
|
||||
|
||||
public void doSpawns()
|
||||
{
|
||||
final int[][] mobs =
|
||||
{
|
||||
{
|
||||
29060,
|
||||
105546,
|
||||
-127892,
|
||||
-2768
|
||||
},
|
||||
{
|
||||
29056,
|
||||
102779,
|
||||
-125920,
|
||||
-2840
|
||||
},
|
||||
{
|
||||
22100,
|
||||
111719,
|
||||
-126646,
|
||||
-2992
|
||||
},
|
||||
{
|
||||
22102,
|
||||
109509,
|
||||
-128946,
|
||||
-3216
|
||||
},
|
||||
{
|
||||
22104,
|
||||
109680,
|
||||
-125756,
|
||||
-3136
|
||||
}
|
||||
};
|
||||
Spawn spawnDat;
|
||||
NpcTemplate template;
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
template = NpcTable.getInstance().getTemplate(mobs[i][0]);
|
||||
if (template != null)
|
||||
{
|
||||
spawnDat = new Spawn(template);
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(mobs[i][1]);
|
||||
spawnDat.setY(mobs[i][2]);
|
||||
spawnDat.setZ(mobs[i][3]);
|
||||
spawnDat.setHeading(0);
|
||||
spawnDat.setRespawnDelay(60);
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_allMobs.add(spawnDat.doSpawn());
|
||||
spawnDat.stopRespawn();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning("IceFairySirraManager: Data missing in NPC table for ID: " + mobs[i][0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("IceFairySirraManager: Spawns could not be initialized: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getHtmlPath(int value)
|
||||
{
|
||||
String pom = "";
|
||||
pom = "32029-" + value;
|
||||
if (value == 0)
|
||||
{
|
||||
pom = "32029";
|
||||
}
|
||||
|
||||
final String temp = "data/html/default/" + pom + ".htm";
|
||||
if (!Config.LAZY_CACHE)
|
||||
{
|
||||
// If not running lazy cache the file must be in the cache or it doesnt exist
|
||||
if (HtmCache.getInstance().contains(temp))
|
||||
{
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
else if (HtmCache.getInstance().isLoadable(temp))
|
||||
{
|
||||
return temp;
|
||||
}
|
||||
|
||||
// If the file is not found, the standard message "I have nothing to say to you" is returned
|
||||
return "data/html/npcdefault.htm";
|
||||
}
|
||||
|
||||
public void sendHtml(NpcInstance npc, PlayerInstance player, String filename)
|
||||
{
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
|
||||
html.setFile(filename);
|
||||
html.replace("%objectId%", String.valueOf(npc.getObjectId()));
|
||||
player.sendPacket(html);
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new IceFairySirra();
|
||||
}
|
||||
}
|
||||
43
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Kernon.java
vendored
Normal file
43
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Kernon.java
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import org.l2jmobius.gameserver.model.quest.EventType;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/*
|
||||
* @author m095 (L2EmuRT)
|
||||
*/
|
||||
public class Kernon extends Quest
|
||||
{
|
||||
// Kernon NpcID
|
||||
private static final int KERNON = 25054;
|
||||
|
||||
public Kernon()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
|
||||
addEventId(KERNON, EventType.ON_ATTACK);
|
||||
}
|
||||
|
||||
// FIXME: Mobius - AI does nothing?
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Kernon();
|
||||
}
|
||||
}
|
||||
103
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Nurka.java
vendored
Normal file
103
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Nurka.java
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.entity.siege.clanhalls.FortressOfResistance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class Nurka extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int NURKA = 35368;
|
||||
private static final int MESSENGER = 35382;
|
||||
// Misc
|
||||
private static final Collection<Clan> _clans = ConcurrentHashMap.newKeySet();
|
||||
|
||||
private Nurka()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
|
||||
addTalkId(MESSENGER);
|
||||
addStartNpc(MESSENGER);
|
||||
addAttackId(NURKA);
|
||||
addKillId(NURKA);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onTalk(NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
final Clan playerClan = player.getClan();
|
||||
for (Clan clan : _clans)
|
||||
{
|
||||
if (clan == playerClan)
|
||||
{
|
||||
return "<html><body>You already registered!</body></html>";
|
||||
}
|
||||
}
|
||||
|
||||
if (FortressOfResistance.getInstance().Conditions(player))
|
||||
{
|
||||
if (!_clans.contains(playerClan))
|
||||
{
|
||||
_clans.add(playerClan);
|
||||
}
|
||||
return "<html><body>You have successful registered on a siege.</body></html>";
|
||||
}
|
||||
|
||||
return "<html><body>You are not allowed to do that!</body></html>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
final Clan playerClan = attacker.getClan();
|
||||
if (playerClan != null)
|
||||
{
|
||||
for (Clan clan : _clans)
|
||||
{
|
||||
if (clan == playerClan)
|
||||
{
|
||||
FortressOfResistance.getInstance().addSiegeDamage(clan, damage);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
FortressOfResistance.getInstance().CaptureFinish();
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Nurka();
|
||||
}
|
||||
}
|
||||
254
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Orfen.java
vendored
Normal file
254
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Orfen.java
vendored
Normal file
@@ -0,0 +1,254 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.datatables.SkillTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.GrandBossInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.entity.Announcements;
|
||||
import org.l2jmobius.gameserver.model.quest.EventType;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.PlaySound;
|
||||
|
||||
/**
|
||||
* @author Shyla
|
||||
*/
|
||||
public class Orfen extends Quest
|
||||
{
|
||||
private static final int ORFEN = 29014;
|
||||
private static final int LIVE = 0;
|
||||
private static final int DEAD = 1;
|
||||
|
||||
private boolean _firstAttacked = false;
|
||||
private boolean _teleported = false;
|
||||
|
||||
GrandBossInstance _orfen = null;
|
||||
|
||||
enum Event
|
||||
{
|
||||
ORFEN_SPAWN,
|
||||
ORFEN_REFRESH,
|
||||
ORFEN_RETURN
|
||||
}
|
||||
|
||||
public Orfen()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ORFEN);
|
||||
final Integer status = GrandBossManager.getInstance().getBossStatus(ORFEN);
|
||||
|
||||
addEventId(ORFEN, EventType.ON_KILL);
|
||||
addEventId(ORFEN, EventType.ON_ATTACK);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case DEAD:
|
||||
{
|
||||
final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
|
||||
if (temp > 0)
|
||||
{
|
||||
startQuestTimer("ORFEN_SPAWN", temp, null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
_orfen = (GrandBossInstance) addSpawn(ORFEN, 55024, 17368, -5412, 0, false, 0);
|
||||
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Raid boss " + _orfen.getName() + " spawned in world.");
|
||||
}
|
||||
GrandBossManager.getInstance().setBossStatus(ORFEN, LIVE);
|
||||
GrandBossManager.getInstance().addBoss(_orfen);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LIVE:
|
||||
{
|
||||
/*
|
||||
* int loc_x = info.getInteger("loc_x"); int loc_y = info.getInteger("loc_y"); int loc_z = info.getInteger("loc_z"); int heading = info.getInteger("heading");
|
||||
*/
|
||||
final int loc_x = 55024;
|
||||
final int loc_y = 17368;
|
||||
final int loc_z = -5412;
|
||||
final int heading = 0;
|
||||
final int hp = info.getInt("currentHP");
|
||||
final int mp = info.getInt("currentMP");
|
||||
_orfen = (GrandBossInstance) addSpawn(ORFEN, loc_x, loc_y, loc_z, heading, false, 0);
|
||||
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Raid boss " + _orfen.getName() + " spawned in world.");
|
||||
}
|
||||
GrandBossManager.getInstance().addBoss(_orfen);
|
||||
_orfen.setCurrentHpMp(hp, mp);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
final int loc_x = 55024;
|
||||
final int loc_y = 17368;
|
||||
final int loc_z = -5412;
|
||||
final int heading = 0;
|
||||
_orfen = (GrandBossInstance) addSpawn(ORFEN, loc_x, loc_y, loc_z, heading, false, 0);
|
||||
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Raid boss " + _orfen.getName() + " spawned in world.");
|
||||
}
|
||||
GrandBossManager.getInstance().setBossStatus(ORFEN, LIVE);
|
||||
GrandBossManager.getInstance().addBoss(_orfen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
final Event eventEnum = Event.valueOf(event.toUpperCase());
|
||||
|
||||
switch (eventEnum)
|
||||
{
|
||||
case ORFEN_SPAWN:
|
||||
{
|
||||
final int loc_x = 55024;
|
||||
final int loc_y = 17368;
|
||||
final int loc_z = -5412;
|
||||
final int heading = 0;
|
||||
_orfen = (GrandBossInstance) addSpawn(ORFEN, loc_x, loc_y, loc_z, heading, false, 0);
|
||||
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Raid boss " + _orfen.getName() + " spawned in world.");
|
||||
}
|
||||
GrandBossManager.getInstance().setBossStatus(ORFEN, LIVE);
|
||||
GrandBossManager.getInstance().addBoss(_orfen);
|
||||
break;
|
||||
}
|
||||
case ORFEN_REFRESH:
|
||||
{
|
||||
if ((npc == null) || (npc.getSpawn() == null))
|
||||
{
|
||||
cancelQuestTimer("ORFEN_REFRESH", npc, null);
|
||||
break;
|
||||
}
|
||||
double hp = -1;
|
||||
if (npc.getNpcId() == ORFEN)
|
||||
{
|
||||
hp = GrandBossManager.getInstance().getStatSet(ORFEN).getDouble("currentHP");
|
||||
if (hp < npc.getCurrentHp())
|
||||
{
|
||||
npc.setCurrentHp(hp);
|
||||
GrandBossManager.getInstance().getStatSet(ORFEN).set("currentHP", npc.getMaxHp());
|
||||
}
|
||||
}
|
||||
if ((_teleported && (npc.getCurrentHp() > (npc.getMaxHp() * 0.95))))
|
||||
{
|
||||
cancelQuestTimer("ORFEN_REFRESH", npc, null);
|
||||
startQuestTimer("ORFEN_RETURN", 10000, npc, null);
|
||||
}
|
||||
else
|
||||
{ // restart the refresh scheduling
|
||||
startQuestTimer("ORFEN_REFRESH", 10000, npc, null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ORFEN_RETURN:
|
||||
{
|
||||
if ((npc == null) || (npc.getSpawn() == null))
|
||||
{
|
||||
break;
|
||||
}
|
||||
_teleported = false;
|
||||
_firstAttacked = false;
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
npc.getSpawn().setX(55024);
|
||||
npc.getSpawn().setY(17368);
|
||||
npc.getSpawn().setZ(-5412);
|
||||
npc.teleToLocation(55024, 17368, -5412, false);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
LOGGER.info("ORFEN: Not defined event: " + event + "!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
final int npcId = npc.getNpcId();
|
||||
if (npcId == ORFEN)
|
||||
{
|
||||
if (_firstAttacked)
|
||||
{
|
||||
if (((npc.getCurrentHp() - damage) < (npc.getMaxHp() / 2)) && !_teleported)
|
||||
{
|
||||
GrandBossManager.getInstance().getStatSet(ORFEN).set("currentHP", npc.getCurrentHp());
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
_teleported = true;
|
||||
npc.getSpawn().setX(43577);
|
||||
npc.getSpawn().setY(15985);
|
||||
npc.getSpawn().setZ(-4396);
|
||||
npc.teleToLocation(43577, 15985, -4396, false);
|
||||
startQuestTimer("ORFEN_REFRESH", 10000, npc, null);
|
||||
}
|
||||
else if (npc.isInsideRadius(attacker, 1000, false, false) && !npc.isInsideRadius(attacker, 300, false, false) && (Rnd.get(10) == 0))
|
||||
{
|
||||
attacker.teleToLocation(npc.getX(), npc.getY(), npc.getZ());
|
||||
npc.setTarget(attacker);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4064, 1));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_firstAttacked = true;
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
if (npc.getNpcId() == ORFEN)
|
||||
{
|
||||
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
|
||||
GrandBossManager.getInstance().setBossStatus(ORFEN, DEAD);
|
||||
// time is 48hour +/- 20hour
|
||||
final long respawnTime = (Config.ORFEN_RESP_FIRST + Rnd.get(Config.ORFEN_RESP_SECOND)) * 3600000;
|
||||
cancelQuestTimer("ORFEN_REFRESH", npc, null);
|
||||
startQuestTimer("ORFEN_SPAWN", respawnTime, null, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ORFEN);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(ORFEN, info);
|
||||
}
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Orfen();
|
||||
}
|
||||
}
|
||||
419
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/QueenAnt.java
vendored
Normal file
419
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/QueenAnt.java
vendored
Normal file
@@ -0,0 +1,419 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.datatables.SkillTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.GrandBossInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.entity.Announcements;
|
||||
import org.l2jmobius.gameserver.model.quest.EventType;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.zone.type.BossZone;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.PlaySound;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
|
||||
public class QueenAnt extends Quest
|
||||
{
|
||||
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;
|
||||
|
||||
// QUEEN Status Tracking :
|
||||
private static final int LIVE = 0; // Queen Ant is spawned.
|
||||
private static final int DEAD = 1; // Queen Ant has been killed.
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static BossZone _zone;
|
||||
private MonsterInstance _larva = null;
|
||||
private MonsterInstance _queen = null;
|
||||
private final List<MonsterInstance> _minions = new CopyOnWriteArrayList<>();
|
||||
private final List<MonsterInstance> _nurses = new CopyOnWriteArrayList<>();
|
||||
|
||||
enum Event
|
||||
{
|
||||
QUEEN_SPAWN, /* CHECK_QA_ZONE, */
|
||||
CHECK_MINIONS_ZONE,
|
||||
CHECK_NURSE_ALIVE,
|
||||
ACTION,
|
||||
DESPAWN_MINIONS,
|
||||
SPAWN_ROYAL,
|
||||
NURSES_SPAWN,
|
||||
RESPAWN_ROYAL,
|
||||
RESPAWN_NURSE,
|
||||
LARVA_DESPAWN,
|
||||
HEAL
|
||||
}
|
||||
|
||||
public QueenAnt()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
|
||||
final int[] mobs =
|
||||
{
|
||||
QUEEN,
|
||||
LARVA,
|
||||
NURSE,
|
||||
GUARD,
|
||||
ROYAL
|
||||
};
|
||||
for (int mob : mobs)
|
||||
{
|
||||
addEventId(mob, EventType.ON_KILL);
|
||||
addEventId(mob, EventType.ON_ATTACK);
|
||||
}
|
||||
|
||||
_zone = GrandBossManager.getInstance().getZone(-21610, 181594, -5734);
|
||||
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(QUEEN);
|
||||
final Integer status = GrandBossManager.getInstance().getBossStatus(QUEEN);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case DEAD:
|
||||
{
|
||||
final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
|
||||
if (temp > 0)
|
||||
{
|
||||
startQuestTimer("QUEEN_SPAWN", temp, null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
final GrandBossInstance queen = (GrandBossInstance) addSpawn(QUEEN, -21610, 181594, -5734, 0, false, 0);
|
||||
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Raid boss " + queen.getName() + " spawned in world.");
|
||||
}
|
||||
GrandBossManager.getInstance().setBossStatus(QUEEN, LIVE);
|
||||
GrandBossManager.getInstance().addBoss(queen);
|
||||
spawnBoss(queen);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LIVE:
|
||||
{
|
||||
/*
|
||||
* int loc_x = info.getInteger("loc_x"); int loc_y = info.getInteger("loc_y"); int loc_z = info.getInteger("loc_z"); int heading = info.getInteger("heading");
|
||||
*/
|
||||
final int hp = info.getInt("currentHP");
|
||||
final int mp = info.getInt("currentMP");
|
||||
final GrandBossInstance queen = (GrandBossInstance) addSpawn(QUEEN, -21610, 181594, -5734, 0, false, 0);
|
||||
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Raid boss " + queen.getName() + " spawned in world.");
|
||||
}
|
||||
GrandBossManager.getInstance().addBoss(queen);
|
||||
queen.setCurrentHpMp(hp, mp);
|
||||
spawnBoss(queen);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
final GrandBossInstance queen = (GrandBossInstance) addSpawn(QUEEN, -21610, 181594, -5734, 0, false, 0);
|
||||
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Raid boss " + queen.getName() + " spawned in world.");
|
||||
}
|
||||
GrandBossManager.getInstance().setBossStatus(QUEEN, LIVE);
|
||||
GrandBossManager.getInstance().addBoss(queen);
|
||||
spawnBoss(queen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void spawnBoss(GrandBossInstance npc)
|
||||
{
|
||||
startQuestTimer("ACTION", 10000, npc, null, true);
|
||||
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
|
||||
startQuestTimer("SPAWN_ROYAL", 1000, npc, null);
|
||||
startQuestTimer("NURSES_SPAWN", 1000, npc, null);
|
||||
startQuestTimer("CHECK_MINIONS_ZONE", 30000, npc, null, true);
|
||||
startQuestTimer("HEAL", 1000, null, null, true);
|
||||
_queen = npc;
|
||||
_larva = (MonsterInstance) addSpawn(LARVA, -21600, 179482, -5846, Rnd.get(360), false, 0);
|
||||
_larva.setUnkillable(true);
|
||||
_larva.setImmobilized(true);
|
||||
_larva.setAttackDisabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
final Event eventEnum = Event.valueOf(event);
|
||||
|
||||
switch (eventEnum)
|
||||
{
|
||||
case QUEEN_SPAWN:
|
||||
{
|
||||
final GrandBossInstance queen = (GrandBossInstance) addSpawn(QUEEN, -21610, 181594, -5734, 0, false, 0);
|
||||
if (Config.ANNOUNCE_TO_ALL_SPAWN_RB)
|
||||
{
|
||||
Announcements.getInstance().announceToAll("Raid boss " + queen.getName() + " spawned in world.");
|
||||
}
|
||||
GrandBossManager.getInstance().setBossStatus(QUEEN, LIVE);
|
||||
GrandBossManager.getInstance().addBoss(queen);
|
||||
spawnBoss(queen);
|
||||
break;
|
||||
}
|
||||
case LARVA_DESPAWN:
|
||||
{
|
||||
_larva.decayMe();
|
||||
break;
|
||||
}
|
||||
case NURSES_SPAWN:
|
||||
{
|
||||
final int radius = 400;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
final int x = (int) (radius * Math.cos(i * 1.407)); // 1.407~2pi/6
|
||||
final int y = (int) (radius * Math.sin(i * 1.407));
|
||||
_nurses.add((MonsterInstance) addSpawn(NURSE, npc.getX() + x, npc.getY() + y, npc.getZ(), 0, false, 0));
|
||||
_nurses.get(i).setAttackDisabled(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPAWN_ROYAL:
|
||||
{
|
||||
final int radius = 400;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
final int x = (int) (radius * Math.cos(i * .7854)); // .7854~2pi/8
|
||||
final int y = (int) (radius * Math.sin(i * .7854));
|
||||
_minions.add((MonsterInstance) addSpawn(ROYAL, npc.getX() + x, npc.getY() + y, npc.getZ(), 0, false, 0));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RESPAWN_ROYAL:
|
||||
{
|
||||
_minions.add((MonsterInstance) addSpawn(ROYAL, npc.getX(), npc.getY(), npc.getZ(), 0, true, 0));
|
||||
break;
|
||||
}
|
||||
case RESPAWN_NURSE:
|
||||
{
|
||||
_nurses.add((MonsterInstance) addSpawn(NURSE, npc.getX(), npc.getY(), npc.getZ(), 0, true, 0));
|
||||
break;
|
||||
}
|
||||
case DESPAWN_MINIONS:
|
||||
{
|
||||
for (int i = 0; i < _minions.size(); i++)
|
||||
{
|
||||
final Attackable mob = _minions.get(i);
|
||||
if (mob != null)
|
||||
{
|
||||
mob.decayMe();
|
||||
}
|
||||
}
|
||||
for (int k = 0; k < _nurses.size(); k++)
|
||||
{
|
||||
final MonsterInstance nurse = _nurses.get(k);
|
||||
if (nurse != null)
|
||||
{
|
||||
nurse.decayMe();
|
||||
}
|
||||
}
|
||||
_nurses.clear();
|
||||
_minions.clear();
|
||||
break;
|
||||
}
|
||||
case CHECK_MINIONS_ZONE:
|
||||
{
|
||||
for (int i = 0; i < _minions.size(); i++)
|
||||
{
|
||||
final Attackable mob = _minions.get(i);
|
||||
if ((mob != null) && !mob.isInsideRadius(npc.getX(), npc.getY(), 700, false))/* !_Zone.isInsideZone(mob)) */
|
||||
{
|
||||
mob.teleToLocation(npc.getX(), npc.getY(), npc.getZ());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CHECK_NURSE_ALIVE:
|
||||
{
|
||||
int deadNurses = 0;
|
||||
for (MonsterInstance nurse : _nurses)
|
||||
{
|
||||
if (nurse.isDead())
|
||||
{
|
||||
deadNurses++;
|
||||
}
|
||||
}
|
||||
if (deadNurses == _nurses.size())
|
||||
{
|
||||
startQuestTimer("RESPAWN_NURSE", Config.QA_RESP_NURSE * 1000, npc, null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ACTION:
|
||||
{
|
||||
if (Rnd.get(3) == 0)
|
||||
{
|
||||
if (Rnd.nextBoolean())
|
||||
{
|
||||
npc.broadcastPacket(new SocialAction(npc.getObjectId(), 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.broadcastPacket(new SocialAction(npc.getObjectId(), 4));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HEAL:
|
||||
{
|
||||
boolean notCasting;
|
||||
final boolean larvaNeedHeal = (_larva != null) && (_larva.getCurrentHp() < _larva.getMaxHp());
|
||||
final boolean queenNeedHeal = (_queen != null) && (_queen.getCurrentHp() < _queen.getMaxHp());
|
||||
boolean nurseNeedHeal = false;
|
||||
for (MonsterInstance nurse : _nurses)
|
||||
{
|
||||
nurseNeedHeal = (nurse != null) && (nurse.getCurrentHp() < nurse.getMaxHp());
|
||||
if ((nurse == null) || nurse.isDead() || nurse.isCastingNow())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
notCasting = nurse.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST;
|
||||
if (larvaNeedHeal)
|
||||
{
|
||||
if ((nurse.getTarget() != _larva) || notCasting)
|
||||
{
|
||||
getIntoPosition(nurse, _larva);
|
||||
nurse.setTarget(_larva);
|
||||
nurse.doCast(SkillTable.getInstance().getInfo(4020, 1));
|
||||
nurse.doCast(SkillTable.getInstance().getInfo(4024, 1));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (queenNeedHeal)
|
||||
{
|
||||
if ((nurse.getTarget() != _queen) || notCasting)
|
||||
{
|
||||
getIntoPosition(nurse, _queen);
|
||||
nurse.setTarget(_queen);
|
||||
nurse.doCast(SkillTable.getInstance().getInfo(4020, 1));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (nurseNeedHeal && ((nurse.getTarget() != nurse) || notCasting))
|
||||
{
|
||||
for (int k = 0; k < _nurses.size(); k++)
|
||||
{
|
||||
getIntoPosition(_nurses.get(k), nurse);
|
||||
_nurses.get(k).setTarget(nurse);
|
||||
_nurses.get(k).doCast(SkillTable.getInstance().getInfo(4020, 1));
|
||||
}
|
||||
}
|
||||
if (notCasting && (nurse.getTarget() != null))
|
||||
{
|
||||
nurse.setTarget(null);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
LOGGER.info("QUEEN: Not defined event: " + event + "!");
|
||||
}
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
final int npcId = npc.getNpcId();
|
||||
if (npcId == NURSE)
|
||||
{
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null, null);
|
||||
return null;
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
final int npcId = npc.getNpcId();
|
||||
final Integer status = GrandBossManager.getInstance().getBossStatus(QUEEN);
|
||||
if (npcId == QUEEN)
|
||||
{
|
||||
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
|
||||
GrandBossManager.getInstance().setBossStatus(QUEEN, DEAD);
|
||||
// time is 36hour +/- 17hour
|
||||
final long respawnTime = (Config.QA_RESP_FIRST + Rnd.get(Config.QA_RESP_SECOND)) * 3600000;
|
||||
startQuestTimer("QUEEN_SPAWN", respawnTime, null, null);
|
||||
startQuestTimer("LARVA_DESPAWN", 4 * 60 * 60 * 1000, null, null);
|
||||
cancelQuestTimer("ACTION", npc, null);
|
||||
cancelQuestTimer("SPAWN_ROYAL", npc, null);
|
||||
cancelQuestTimer("CHECK_MINIONS_ZONE", npc, null);
|
||||
cancelQuestTimer("CHECK_NURSE_ALIVE", npc, null);
|
||||
cancelQuestTimer("HEAL", null, null);
|
||||
// cancelQuestTimer("CHECK_QA_ZONE", npc, 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", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(QUEEN, info);
|
||||
startQuestTimer("DESPAWN_MINIONS", 10000, null, null);
|
||||
}
|
||||
else if ((status == LIVE) && ((npcId == ROYAL) || (npcId == NURSE)))
|
||||
{
|
||||
npc.decayMe();
|
||||
if (_minions.contains(npc))
|
||||
{
|
||||
_minions.remove(npc);
|
||||
}
|
||||
else
|
||||
{
|
||||
_nurses.remove(npc);
|
||||
}
|
||||
|
||||
if (npcId == ROYAL)
|
||||
{
|
||||
startQuestTimer("RESPAWN_ROYAL", (Config.QA_RESP_ROYAL + Rnd.get(40)) * 1000, npc, null);
|
||||
}
|
||||
else // if (npcId == NURSE)
|
||||
{
|
||||
startQuestTimer("CHECK_NURSE_ALIVE", 1000, npc, null);
|
||||
}
|
||||
}
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public void getIntoPosition(MonsterInstance nurse, MonsterInstance caller)
|
||||
{
|
||||
if (!nurse.isInsideRadius(caller, 300, false, false))
|
||||
{
|
||||
nurse.getAI().moveToPawn(caller, 300);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new QueenAnt();
|
||||
}
|
||||
}
|
||||
183
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Sailren.java
vendored
Normal file
183
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Sailren.java
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.model.Party;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.zone.type.BossZone;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SpecialCamera;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class Sailren extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int STATUE = 32109;
|
||||
private static final int SAILREN = 29065;
|
||||
private static final int VELO = 22196;
|
||||
private static final int PTERO = 22199;
|
||||
private static final int TREX = 22215;
|
||||
private static final int STONE = 8784;
|
||||
// Misc
|
||||
private static NpcInstance _vlcInstance;
|
||||
private static NpcInstance _ptrInstance;
|
||||
private static NpcInstance _trxInstance;
|
||||
private static NpcInstance _slrnInstance;
|
||||
|
||||
private Sailren()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
|
||||
addStartNpc(STATUE);
|
||||
addTalkId(STATUE);
|
||||
addKillId(VELO, PTERO, TREX, SAILREN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case "start":
|
||||
{
|
||||
_vlcInstance = addSpawn(VELO, 27845, -5567, -1982, 45000, false, 0);
|
||||
startQuestTimer("camera", 2000, _vlcInstance, player);
|
||||
cancelQuestTimer("start", npc, null);
|
||||
break;
|
||||
}
|
||||
case "round2":
|
||||
{
|
||||
_ptrInstance = addSpawn(PTERO, 27838, -5578, -1982, 45000, false, 0);
|
||||
startQuestTimer("camera", 2000, _ptrInstance, player);
|
||||
cancelQuestTimer("round2", npc, null);
|
||||
break;
|
||||
}
|
||||
case "round3":
|
||||
{
|
||||
_trxInstance = addSpawn(TREX, 27838, -5578, -1982, 45000, false, 0);
|
||||
startQuestTimer("camera", 2000, _trxInstance, player);
|
||||
cancelQuestTimer("round3", npc, null);
|
||||
break;
|
||||
}
|
||||
case "sailren":
|
||||
{
|
||||
_slrnInstance = addSpawn(SAILREN, 27489, -6223, -1982, 45000, false, 0);
|
||||
startQuestTimer("camera", 2000, _slrnInstance, player);
|
||||
startQuestTimer("vkrovatku", 1200000, _slrnInstance, null);
|
||||
cancelQuestTimer("round4", npc, null);
|
||||
break;
|
||||
}
|
||||
case "camera":
|
||||
{
|
||||
player.broadcastPacket(new SpecialCamera(npc.getObjectId(), 400, -75, 3, -150, 5000));
|
||||
npc.broadcastPacket(new SocialAction(npc.getObjectId(), 1));
|
||||
break;
|
||||
}
|
||||
case "open":
|
||||
{
|
||||
GlobalVariablesManager.getInstance().remove("SailrenClose");
|
||||
cancelQuestTimer("open", npc, null);
|
||||
break;
|
||||
}
|
||||
case "vkrovatku":
|
||||
{
|
||||
npc.deleteMe();
|
||||
GlobalVariablesManager.getInstance().remove("SailrenClose");
|
||||
cancelQuestTimer("open", npc, null);
|
||||
cancelQuestTimer("vkrovatku", npc, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onTalk(NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
if (player.getInventory().getItemByItemId(STONE) != null)
|
||||
{
|
||||
if (!GlobalVariablesManager.getInstance().hasVariable("SailrenClose"))
|
||||
{
|
||||
final Party party = player.getParty();
|
||||
if (party != null)
|
||||
{
|
||||
player.destroyItemByItemId("Sailren", STONE, 1, player, true);
|
||||
GlobalVariablesManager.getInstance().set("SailrenClose", true);
|
||||
final BossZone zone = GrandBossManager.getInstance().getZone(27244, -7026, -1974);
|
||||
for (PlayerInstance member : party.getPartyMembers())
|
||||
{
|
||||
if (zone != null)
|
||||
{
|
||||
zone.allowPlayerEntry(member, 3600);
|
||||
}
|
||||
member.teleToLocation(27244, -7026, -1974);
|
||||
}
|
||||
startQuestTimer("start", 30000, npc, player);
|
||||
startQuestTimer("open", 1800000, npc, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<html><body><font color=LEVEL>Only with party...</font></body></html>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<html><body><font color=LEVEL>Some one else is inside...</font></body></html>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<html><body>You need quest item: <font color=LEVEL>Gazkh...</font></body></html>";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
if (npc == _vlcInstance)
|
||||
{
|
||||
startQuestTimer("round2", 30000, npc, killer);
|
||||
}
|
||||
else if (npc == _ptrInstance)
|
||||
{
|
||||
startQuestTimer("round3", 60000, npc, killer);
|
||||
}
|
||||
else if (npc == _trxInstance)
|
||||
{
|
||||
startQuestTimer("sailren", 180000, npc, killer);
|
||||
}
|
||||
else if (npc == _slrnInstance)
|
||||
{
|
||||
GlobalVariablesManager.getInstance().remove("SailrenClose");
|
||||
cancelQuestTimer("open", npc, null);
|
||||
}
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Sailren();
|
||||
}
|
||||
}
|
||||
72
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Tyrannosaurus.java
vendored
Normal file
72
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Tyrannosaurus.java
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class Tyrannosaurus extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int[] TREX =
|
||||
{
|
||||
22215, // Tyrannosaurus
|
||||
22216, // Tyrannosaurus
|
||||
22217, // Tyrannosaurus
|
||||
};
|
||||
// Locations
|
||||
private static final Location[] SPAWNS =
|
||||
{
|
||||
new Location(19506, -15772, -3080, 49220),
|
||||
new Location(22253, -17062, -2976, 47449),
|
||||
new Location(23348, -20888, -2672, 0),
|
||||
new Location(25047, -18477, -2712, 0),
|
||||
new Location(27331, -16669, -2664, 21125),
|
||||
new Location(27714, -14692, -2552, 0),
|
||||
new Location(26555, -11574, -2464, 28153),
|
||||
new Location(21295, -11123, -2784, 41953),
|
||||
new Location(19605, -11234, -2816, 57601),
|
||||
new Location(19220, -11806, -2776, 0),
|
||||
new Location(26740, -16596, -2688, 13790)
|
||||
};
|
||||
|
||||
public Tyrannosaurus()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
addKillId(TREX);
|
||||
addSpawn(TREX[Rnd.get(TREX.length)], SPAWNS[Rnd.get(SPAWNS.length)], false, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
ThreadPool.schedule(() -> addSpawn(TREX[Rnd.get(TREX.length)], SPAWNS[Rnd.get(SPAWNS.length)], false, 0), 1800000);
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Tyrannosaurus();
|
||||
}
|
||||
}
|
||||
1535
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Valakas.java
vendored
Normal file
1535
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Valakas.java
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1745
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/VanHalter.java
vendored
Normal file
1745
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/VanHalter.java
vendored
Normal file
File diff suppressed because it is too large
Load Diff
986
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Zaken.java
vendored
Normal file
986
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/bosses/Zaken.java
vendored
Normal file
@@ -0,0 +1,986 @@
|
||||
/*
|
||||
* 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.bosses;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.datatables.SkillTable;
|
||||
import org.l2jmobius.gameserver.datatables.xml.DoorData;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.model.Effect;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.GrandBossInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.EventType;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.zone.type.BossZone;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.PlaySound;
|
||||
|
||||
/**
|
||||
* Zaken AI
|
||||
*/
|
||||
public class Zaken extends Quest
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(Zaken.class.getName());
|
||||
|
||||
private static final int ZAKEN = 29022;
|
||||
private static final int DOLL_BLADER_B = 29023;
|
||||
private static final int VALE_MASTER_B = 29024;
|
||||
private static final int PIRATES_ZOMBIE_CAPTAIN_B = 29026;
|
||||
private static final int PIRATES_ZOMBIE_B = 29027;
|
||||
private static final int[] X_COORDS =
|
||||
{
|
||||
53950,
|
||||
55980,
|
||||
54950,
|
||||
55970,
|
||||
53930,
|
||||
55970,
|
||||
55980,
|
||||
54960,
|
||||
53950,
|
||||
53930,
|
||||
55970,
|
||||
55980,
|
||||
54960,
|
||||
53950,
|
||||
53930
|
||||
};
|
||||
private static final int[] Y_COORDS =
|
||||
{
|
||||
219860,
|
||||
219820,
|
||||
218790,
|
||||
217770,
|
||||
217760,
|
||||
217770,
|
||||
219920,
|
||||
218790,
|
||||
219860,
|
||||
217760,
|
||||
217770,
|
||||
219920,
|
||||
218790,
|
||||
219860,
|
||||
217760
|
||||
};
|
||||
private static final int[] Z_COORDS =
|
||||
{
|
||||
-3488,
|
||||
-3488,
|
||||
-3488,
|
||||
-3488,
|
||||
-3488,
|
||||
-3216,
|
||||
-3216,
|
||||
-3216,
|
||||
-3216,
|
||||
-3216,
|
||||
-2944,
|
||||
-2944,
|
||||
-2944,
|
||||
-2944,
|
||||
-2944
|
||||
};
|
||||
// Zaken status tracking
|
||||
private static final byte ALIVE = 0; // Zaken is spawned.
|
||||
private static final byte DEAD = 1; // Zaken has been killed.
|
||||
// Misc
|
||||
private static BossZone _zone;
|
||||
private int _1001 = 0; // used for first cancel of QuestTimer "1001"
|
||||
private int _ai0 = 0; // used for zaken coords updater
|
||||
private int _ai1 = 0; // used for X coord tracking for non-random teleporting in zaken's self teleport skill
|
||||
private int _ai2 = 0; // used for Y coord tracking for non-random teleporting in zaken's self teleport skill
|
||||
private int _ai3 = 0; // used for Z coord tracking for non-random teleporting in zaken's self teleport skill
|
||||
private int _ai4 = 0; // used for spawning minions cycles
|
||||
private int _quest0 = 0; // used for teleporting progress
|
||||
private int _quest1 = 0; // used for most hated players progress
|
||||
private int _quest2 = 0; // used for zaken HP check for teleport
|
||||
private PlayerInstance c_quest0 = null; // 1st player used for area teleport
|
||||
private PlayerInstance c_quest1 = null; // 2nd player used for area teleport
|
||||
private PlayerInstance c_quest2 = null; // 3rd player used for area teleport
|
||||
private PlayerInstance c_quest3 = null; // 4th player used for area teleport
|
||||
private PlayerInstance c_quest4 = null; // 5th player used for area teleport
|
||||
|
||||
public Zaken()
|
||||
{
|
||||
super(-1, "ai/bosses");
|
||||
|
||||
// Zaken doors handling
|
||||
ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
try
|
||||
{
|
||||
if (getTimeHour() == 0)
|
||||
{
|
||||
LOGGER.info("Zaken door id 21240006 opened, game time 00.00.");
|
||||
DoorData.getInstance().getDoor(21240006).openMe();
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
try
|
||||
{
|
||||
LOGGER.info("Zaken door id 21240006 closed.");
|
||||
DoorData.getInstance().getDoor(21240006).closeMe();
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
LOGGER.warning("Cannot close door ID: 21240006 " + e);
|
||||
}
|
||||
}, 300000L);
|
||||
}
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
LOGGER.warning("Cannot open door ID: 21240006 " + e);
|
||||
}
|
||||
}, 2000L, 600000L);
|
||||
|
||||
addEventId(ZAKEN, EventType.ON_KILL);
|
||||
addEventId(ZAKEN, EventType.ON_ATTACK);
|
||||
|
||||
_zone = GrandBossManager.getInstance().getZone(55312, 219168, -3223);
|
||||
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ZAKEN);
|
||||
final Integer status = GrandBossManager.getInstance().getBossStatus(ZAKEN);
|
||||
if (status == DEAD)
|
||||
{
|
||||
// load the unlock date and time for zaken from DB
|
||||
final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
|
||||
// if zaken is locked until a certain time, mark it so and start the unlock timer
|
||||
// the unlock time has not yet expired.
|
||||
if (temp > 0)
|
||||
{
|
||||
startQuestTimer("zaken_unlock", temp, null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
// the time has already expired while the server was offline. Immediately spawn zaken.
|
||||
final GrandBossInstance zaken = (GrandBossInstance) addSpawn(ZAKEN, 55312, 219168, -3223, 0, false, 0);
|
||||
GrandBossManager.getInstance().setBossStatus(ZAKEN, ALIVE);
|
||||
spawnBoss(zaken);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
final int loc_x = info.getInt("loc_x");
|
||||
final int loc_y = info.getInt("loc_y");
|
||||
final int loc_z = info.getInt("loc_z");
|
||||
final int heading = info.getInt("heading");
|
||||
final int hp = info.getInt("currentHP");
|
||||
final int mp = info.getInt("currentMP");
|
||||
final GrandBossInstance zaken = (GrandBossInstance) addSpawn(ZAKEN, loc_x, loc_y, loc_z, heading, false, 0);
|
||||
zaken.setCurrentHpMp(hp, mp);
|
||||
spawnBoss(zaken);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case "1001":
|
||||
{
|
||||
if (_1001 == 1)
|
||||
{
|
||||
_1001 = 0;
|
||||
cancelQuestTimer("1001", npc, null);
|
||||
}
|
||||
int sk4223 = 0;
|
||||
int sk4227 = 0;
|
||||
final Effect[] effects = npc.getAllEffects();
|
||||
if ((effects != null) && (effects.length != 0))
|
||||
{
|
||||
for (Effect e : effects)
|
||||
{
|
||||
if (e.getSkill().getId() == 4227)
|
||||
{
|
||||
sk4227 = 1;
|
||||
}
|
||||
if (e.getSkill().getId() == 4223)
|
||||
{
|
||||
sk4223 = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (getTimeHour() < 5)
|
||||
{
|
||||
if (sk4223 == 1) // use night face if zaken have day face
|
||||
{
|
||||
npc.setTarget(npc);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4224, 1));
|
||||
_ai1 = npc.getX();
|
||||
_ai2 = npc.getY();
|
||||
_ai3 = npc.getZ();
|
||||
}
|
||||
if (sk4227 == 0) // use zaken regeneration
|
||||
{
|
||||
npc.setTarget(npc);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4227, 1));
|
||||
}
|
||||
if ((npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK) && (_ai0 == 0))
|
||||
{
|
||||
int i0 = 0;
|
||||
int i1 = 1;
|
||||
if (((Attackable) npc).getMostHated() != null)
|
||||
{
|
||||
if ((((((Attackable) npc).getMostHated().getX() - _ai1) * (((Attackable) npc).getMostHated().getX() - _ai1)) + ((((Attackable) npc).getMostHated().getY() - _ai2) * (((Attackable) npc).getMostHated().getY() - _ai2))) > (1500 * 1500))
|
||||
{
|
||||
i0 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
if (i0 == 0)
|
||||
{
|
||||
i1 = 0;
|
||||
}
|
||||
if (_quest0 > 0)
|
||||
{
|
||||
if (c_quest0 == null)
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
else if ((((c_quest0.getX() - _ai1) * (c_quest0.getX() - _ai1)) + ((c_quest0.getY() - _ai2) * (c_quest0.getY() - _ai2))) > (1500 * 1500))
|
||||
{
|
||||
i0 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
if (i0 == 0)
|
||||
{
|
||||
i1 = 0;
|
||||
}
|
||||
}
|
||||
if (_quest0 > 1)
|
||||
{
|
||||
if (c_quest1 == null)
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
else if ((((c_quest1.getX() - _ai1) * (c_quest1.getX() - _ai1)) + ((c_quest1.getY() - _ai2) * (c_quest1.getY() - _ai2))) > (1500 * 1500))
|
||||
{
|
||||
i0 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
if (i0 == 0)
|
||||
{
|
||||
i1 = 0;
|
||||
}
|
||||
}
|
||||
if (_quest0 > 2)
|
||||
{
|
||||
if (c_quest2 == null)
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
else if ((((c_quest2.getX() - _ai1) * (c_quest2.getX() - _ai1)) + ((c_quest2.getY() - _ai2) * (c_quest2.getY() - _ai2))) > (1500 * 1500))
|
||||
{
|
||||
i0 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
if (i0 == 0)
|
||||
{
|
||||
i1 = 0;
|
||||
}
|
||||
}
|
||||
if (_quest0 > 3)
|
||||
{
|
||||
if (c_quest3 == null)
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
else if ((((c_quest3.getX() - _ai1) * (c_quest3.getX() - _ai1)) + ((c_quest3.getY() - _ai2) * (c_quest3.getY() - _ai2))) > (1500 * 1500))
|
||||
{
|
||||
i0 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
if (i0 == 0)
|
||||
{
|
||||
i1 = 0;
|
||||
}
|
||||
}
|
||||
if (_quest0 > 4)
|
||||
{
|
||||
if (c_quest4 == null)
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
else if ((((c_quest4.getX() - _ai1) * (c_quest4.getX() - _ai1)) + ((c_quest4.getY() - _ai2) * (c_quest4.getY() - _ai2))) > (1500 * 1500))
|
||||
{
|
||||
i0 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
if (i0 == 0)
|
||||
{
|
||||
i1 = 0;
|
||||
}
|
||||
}
|
||||
if (i1 == 1)
|
||||
{
|
||||
_quest0 = 0;
|
||||
final int i2 = Rnd.get(15);
|
||||
_ai1 = X_COORDS[i2] + Rnd.get(650);
|
||||
_ai2 = Y_COORDS[i2] + Rnd.get(650);
|
||||
_ai3 = Z_COORDS[i2];
|
||||
npc.setTarget(npc);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((Rnd.get(20) < 1) && (_ai0 == 0))
|
||||
{
|
||||
_ai1 = npc.getX();
|
||||
_ai2 = npc.getY();
|
||||
_ai3 = npc.getZ();
|
||||
}
|
||||
Creature cAi0 = null;
|
||||
if ((npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK) && (_quest1 == 0))
|
||||
{
|
||||
if (((Attackable) npc).getMostHated() != null)
|
||||
{
|
||||
cAi0 = ((Attackable) npc).getMostHated();
|
||||
_quest1 = 1;
|
||||
}
|
||||
}
|
||||
else if ((npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK) && (_quest1 != 0) && (((Attackable) npc).getMostHated() != null))
|
||||
{
|
||||
if (cAi0 == ((Attackable) npc).getMostHated())
|
||||
{
|
||||
_quest1 = (_quest1 + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_quest1 = 1;
|
||||
cAi0 = ((Attackable) npc).getMostHated();
|
||||
}
|
||||
}
|
||||
if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)
|
||||
{
|
||||
_quest1 = 0;
|
||||
}
|
||||
if (_quest1 > 5)
|
||||
{
|
||||
((Attackable) npc).stopHating(cAi0);
|
||||
final Creature nextTarget = ((Attackable) npc).getMostHated();
|
||||
if (nextTarget != null)
|
||||
{
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);
|
||||
}
|
||||
_quest1 = 0;
|
||||
}
|
||||
}
|
||||
else if (sk4223 == 0) // use day face if not night time
|
||||
{
|
||||
npc.setTarget(npc);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4223, 1));
|
||||
_quest2 = 3;
|
||||
}
|
||||
if (sk4227 == 1) // when switching to day time, cancel zaken night regen
|
||||
{
|
||||
npc.setTarget(npc);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4242, 1));
|
||||
}
|
||||
if (Rnd.get(40) < 1)
|
||||
{
|
||||
final int i2 = Rnd.get(15);
|
||||
_ai1 = X_COORDS[i2] + Rnd.get(650);
|
||||
_ai2 = Y_COORDS[i2] + Rnd.get(650);
|
||||
_ai3 = Z_COORDS[i2];
|
||||
npc.setTarget(npc);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
|
||||
}
|
||||
startQuestTimer("1001", 30000, npc, null);
|
||||
break;
|
||||
}
|
||||
case "1002":
|
||||
{
|
||||
_quest0 = 0;
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
|
||||
_ai0 = 0;
|
||||
break;
|
||||
}
|
||||
case "1003":
|
||||
{
|
||||
switch (_ai4)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
final int rr = Rnd.get(15);
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, X_COORDS[rr] + Rnd.get(650), Y_COORDS[rr] + Rnd.get(650), Z_COORDS[rr], Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
_ai4 = 2;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
final int rr = Rnd.get(15);
|
||||
addSpawn(DOLL_BLADER_B, X_COORDS[rr] + Rnd.get(650), Y_COORDS[rr] + Rnd.get(650), Z_COORDS[rr], Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
_ai4 = 3;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
addSpawn(VALE_MASTER_B, X_COORDS[Rnd.get(15)] + Rnd.get(650), Y_COORDS[Rnd.get(15)] + Rnd.get(650), Z_COORDS[Rnd.get(15)], Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, X_COORDS[Rnd.get(15)] + Rnd.get(650), Y_COORDS[Rnd.get(15)] + Rnd.get(650), Z_COORDS[Rnd.get(15)], Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
_ai4 = 4;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
addSpawn(PIRATES_ZOMBIE_B, X_COORDS[Rnd.get(15)] + Rnd.get(650), Y_COORDS[Rnd.get(15)] + Rnd.get(650), Z_COORDS[Rnd.get(15)], Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, X_COORDS[Rnd.get(15)] + Rnd.get(650), Y_COORDS[Rnd.get(15)] + Rnd.get(650), Z_COORDS[Rnd.get(15)], Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, X_COORDS[Rnd.get(15)] + Rnd.get(650), Y_COORDS[Rnd.get(15)] + Rnd.get(650), Z_COORDS[Rnd.get(15)], Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, X_COORDS[Rnd.get(15)] + Rnd.get(650), Y_COORDS[Rnd.get(15)] + Rnd.get(650), Z_COORDS[Rnd.get(15)], Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, X_COORDS[Rnd.get(15)] + Rnd.get(650), Y_COORDS[Rnd.get(15)] + Rnd.get(650), Z_COORDS[Rnd.get(15)], Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
_ai4 = 5;
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
addSpawn(DOLL_BLADER_B, 52675, 219371, -3290, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 52687, 219596, -3368, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 52672, 219740, -3418, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 52857, 219992, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 52959, 219997, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 53381, 220151, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 54236, 220948, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 54885, 220144, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 55264, 219860, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 55399, 220263, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 55679, 220129, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 56276, 220783, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 57173, 220234, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 56267, 218826, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 56294, 219482, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 56094, 219113, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 56364, 218967, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 57113, 218079, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 56186, 217153, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 55440, 218081, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 55202, 217940, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 55225, 218236, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 54973, 218075, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 53412, 218077, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 54226, 218797, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 54394, 219067, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 54139, 219253, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 54262, 219480, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
_ai4 = 6;
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
addSpawn(PIRATES_ZOMBIE_B, 53412, 218077, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 54413, 217132, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 54841, 217132, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 55372, 217128, -3343, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 55893, 217122, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 56282, 217237, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 56963, 218080, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 56267, 218826, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 56294, 219482, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 56094, 219113, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 56364, 218967, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 56276, 220783, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 57173, 220234, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 54885, 220144, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 55264, 219860, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 55399, 220263, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 55679, 220129, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 54236, 220948, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 54464, 219095, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 54226, 218797, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 54394, 219067, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 54139, 219253, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 54262, 219480, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 53412, 218077, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 55440, 218081, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 55202, 217940, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 55225, 218236, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 54973, 218075, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
_ai4 = 7;
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
addSpawn(PIRATES_ZOMBIE_B, 54228, 217504, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 54181, 217168, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 54714, 217123, -3168, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 55298, 217127, -3073, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 55787, 217130, -2993, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 56284, 217216, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 56963, 218080, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 56267, 218826, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 56294, 219482, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 56094, 219113, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 56364, 218967, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 56276, 220783, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 57173, 220234, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 54885, 220144, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 55264, 219860, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 55399, 220263, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 55679, 220129, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 54236, 220948, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 54464, 219095, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 54226, 218797, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(VALE_MASTER_B, 54394, 219067, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 54139, 219253, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(DOLL_BLADER_B, 54262, 219480, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 53412, 218077, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 54280, 217200, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 55440, 218081, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_CAPTAIN_B, 55202, 217940, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 55225, 218236, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
addSpawn(PIRATES_ZOMBIE_B, 54973, 218075, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
|
||||
_ai4 = 8;
|
||||
cancelQuestTimer("1003", null, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "zaken_unlock":
|
||||
{
|
||||
if (GrandBossManager.getInstance().getBossStatus(ZAKEN) != DEAD)
|
||||
{
|
||||
final GrandBossInstance zaken = (GrandBossInstance) addSpawn(ZAKEN, 55312, 219168, -3223, 0, false, 0);
|
||||
GrandBossManager.getInstance().setBossStatus(ZAKEN, ALIVE);
|
||||
spawnBoss(zaken);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "CreateOnePrivateEx":
|
||||
{
|
||||
addSpawn(npc.getNpcId(), npc.getX(), npc.getY(), npc.getZ(), 0, false, 0)/* .setIsRaidMinion(true) */;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFactionCall(NpcInstance npc, NpcInstance caller, PlayerInstance attacker, boolean isPet)
|
||||
{
|
||||
if ((caller == null) || (npc == null))
|
||||
{
|
||||
return super.onFactionCall(npc, caller, attacker, isPet);
|
||||
}
|
||||
|
||||
final int npcId = npc.getNpcId();
|
||||
final int callerId = caller.getNpcId();
|
||||
if ((getTimeHour() < 5) && (callerId != ZAKEN) && (npcId == ZAKEN))
|
||||
{
|
||||
final int damage = 0; // well damage required :x
|
||||
if ((npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE) && (_ai0 == 0) && (damage < 10) && (Rnd.get((30 * 15)) < 1))// todo - damage missing
|
||||
{
|
||||
_ai0 = 1;
|
||||
_ai1 = caller.getX();
|
||||
_ai2 = caller.getY();
|
||||
_ai3 = caller.getZ();
|
||||
startQuestTimer("1002", 300, caller, null);
|
||||
}
|
||||
}
|
||||
return super.onFactionCall(npc, caller, attacker, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSpellFinished(NpcInstance npc, PlayerInstance player, Skill skill)
|
||||
{
|
||||
if (npc.getNpcId() == ZAKEN)
|
||||
{
|
||||
final int skillId = skill.getId();
|
||||
if (skillId == 4222)
|
||||
{
|
||||
npc.teleToLocation(_ai1, _ai2, _ai3);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
}
|
||||
else if (skillId == 4216)
|
||||
{
|
||||
final int i1 = Rnd.get(15);
|
||||
player.teleToLocation(X_COORDS[i1] + Rnd.get(650), Y_COORDS[i1] + Rnd.get(650), Z_COORDS[i1]);
|
||||
((Attackable) npc).stopHating(player);
|
||||
final Creature nextTarget = ((Attackable) npc).getMostHated();
|
||||
if (nextTarget != null)
|
||||
{
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);
|
||||
}
|
||||
}
|
||||
else if (skillId == 4217)
|
||||
{
|
||||
int i0 = 0;
|
||||
int i1 = Rnd.get(15);
|
||||
player.teleToLocation(X_COORDS[i1] + Rnd.get(650), Y_COORDS[i1] + Rnd.get(650), Z_COORDS[i1]);
|
||||
((Attackable) npc).stopHating(player);
|
||||
if ((c_quest0 != null) && (_quest0 > 0) && (c_quest0 != player) && (c_quest0.getZ() > (player.getZ() - 100)) && (c_quest0.getZ() < (player.getZ() + 100)))
|
||||
{
|
||||
if ((((c_quest0.getX() - player.getX()) * (c_quest0.getX() - player.getX())) + ((c_quest0.getY() - player.getY()) * (c_quest0.getY() - player.getY()))) > (250 * 250))
|
||||
{
|
||||
i0 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
if (i0 == 0)
|
||||
{
|
||||
i1 = Rnd.get(15);
|
||||
c_quest0.teleToLocation(X_COORDS[i1] + Rnd.get(650), Y_COORDS[i1] + Rnd.get(650), Z_COORDS[i1]);
|
||||
((Attackable) npc).stopHating(c_quest0);
|
||||
}
|
||||
}
|
||||
if ((c_quest1 != null) && (_quest0 > 1) && (c_quest1 != player) && (c_quest1.getZ() > (player.getZ() - 100)) && (c_quest1.getZ() < (player.getZ() + 100)))
|
||||
{
|
||||
if ((((c_quest1.getX() - player.getX()) * (c_quest1.getX() - player.getX())) + ((c_quest1.getY() - player.getY()) * (c_quest1.getY() - player.getY()))) > (250 * 250))
|
||||
{
|
||||
i0 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
if (i0 == 0)
|
||||
{
|
||||
i1 = Rnd.get(15);
|
||||
c_quest1.teleToLocation(X_COORDS[i1] + Rnd.get(650), Y_COORDS[i1] + Rnd.get(650), Z_COORDS[i1]);
|
||||
((Attackable) npc).stopHating(c_quest1);
|
||||
}
|
||||
}
|
||||
if ((c_quest2 != null) && (_quest0 > 2) && (c_quest2 != player) && (c_quest2.getZ() > (player.getZ() - 100)) && (c_quest2.getZ() < (player.getZ() + 100)))
|
||||
{
|
||||
if ((((c_quest2.getX() - player.getX()) * (c_quest2.getX() - player.getX())) + ((c_quest2.getY() - player.getY()) * (c_quest2.getY() - player.getY()))) > (250 * 250))
|
||||
{
|
||||
i0 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
if (i0 == 0)
|
||||
{
|
||||
i1 = Rnd.get(15);
|
||||
c_quest2.teleToLocation(X_COORDS[i1] + Rnd.get(650), Y_COORDS[i1] + Rnd.get(650), Z_COORDS[i1]);
|
||||
((Attackable) npc).stopHating(c_quest2);
|
||||
}
|
||||
}
|
||||
if ((c_quest3 != null) && (_quest0 > 3) && (c_quest3 != player) && (c_quest3.getZ() > (player.getZ() - 100)) && (c_quest3.getZ() < (player.getZ() + 100)))
|
||||
{
|
||||
if ((((c_quest3.getX() - player.getX()) * (c_quest3.getX() - player.getX())) + ((c_quest3.getY() - player.getY()) * (c_quest3.getY() - player.getY()))) > (250 * 250))
|
||||
{
|
||||
i0 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
if (i0 == 0)
|
||||
{
|
||||
i1 = Rnd.get(15);
|
||||
c_quest3.teleToLocation(X_COORDS[i1] + Rnd.get(650), Y_COORDS[i1] + Rnd.get(650), Z_COORDS[i1]);
|
||||
((Attackable) npc).stopHating(c_quest3);
|
||||
}
|
||||
}
|
||||
if ((c_quest4 != null) && (_quest0 > 4) && (c_quest4 != player) && (c_quest4.getZ() > (player.getZ() - 100)) && (c_quest4.getZ() < (player.getZ() + 100)))
|
||||
{
|
||||
if ((((c_quest4.getX() - player.getX()) * (c_quest4.getX() - player.getX())) + ((c_quest4.getY() - player.getY()) * (c_quest4.getY() - player.getY()))) > (250 * 250))
|
||||
{
|
||||
i0 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i0 = 0;
|
||||
}
|
||||
if (i0 == 0)
|
||||
{
|
||||
i1 = Rnd.get(15);
|
||||
c_quest4.teleToLocation(X_COORDS[i1] + Rnd.get(650), Y_COORDS[i1] + Rnd.get(650), Z_COORDS[i1]);
|
||||
((Attackable) npc).stopHating(c_quest4);
|
||||
}
|
||||
}
|
||||
final Creature nextTarget = ((Attackable) npc).getMostHated();
|
||||
if (nextTarget != null)
|
||||
{
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onSpellFinished(npc, player, skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
final int npcId = npc.getNpcId();
|
||||
if (npcId == ZAKEN)
|
||||
{
|
||||
if (attacker.getMountType() == 1)
|
||||
{
|
||||
int sk4258 = 0;
|
||||
final Effect[] effects = attacker.getAllEffects();
|
||||
if ((effects != null) && (effects.length != 0))
|
||||
{
|
||||
for (Effect e : effects)
|
||||
{
|
||||
if (e.getSkill().getId() == 4258)
|
||||
{
|
||||
sk4258 = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sk4258 == 0)
|
||||
{
|
||||
npc.setTarget(attacker);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4258, 1));
|
||||
}
|
||||
}
|
||||
final Creature originalAttacker = isPet ? attacker.getPet() : attacker;
|
||||
final int hate = (int) (((damage / npc.getMaxHp()) / 0.05) * 20000);
|
||||
((Attackable) npc).addDamageHate(originalAttacker, 0, hate);
|
||||
if (Rnd.get(10) < 1)
|
||||
{
|
||||
final int i0 = Rnd.get((15 * 15));
|
||||
if (i0 < 1)
|
||||
{
|
||||
npc.setTarget(attacker);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4216, 1));
|
||||
}
|
||||
else if (i0 < 2)
|
||||
{
|
||||
npc.setTarget(attacker);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4217, 1));
|
||||
}
|
||||
else if (i0 < 4)
|
||||
{
|
||||
npc.setTarget(attacker);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4219, 1));
|
||||
}
|
||||
else if (i0 < 8)
|
||||
{
|
||||
npc.setTarget(attacker);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4218, 1));
|
||||
}
|
||||
else if (i0 < 15)
|
||||
{
|
||||
for (Creature creature : npc.getKnownList().getKnownCharactersInRadius(100))
|
||||
{
|
||||
if (creature != attacker)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (attacker != ((Attackable) npc).getMostHated())
|
||||
{
|
||||
npc.setTarget(attacker);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4221, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Rnd.nextBoolean() && (attacker == ((Attackable) npc).getMostHated()))
|
||||
{
|
||||
npc.setTarget(attacker);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4220, 1));
|
||||
}
|
||||
}
|
||||
if ((getTimeHour() >= 5) && (npc.getCurrentHp() < ((npc.getMaxHp() * _quest2) / 4.0)))
|
||||
{
|
||||
_quest2 = (_quest2 - 1);
|
||||
final int i2 = Rnd.get(15);
|
||||
_ai1 = X_COORDS[i2] + Rnd.get(650);
|
||||
_ai2 = Y_COORDS[i2] + Rnd.get(650);
|
||||
_ai3 = Z_COORDS[i2];
|
||||
npc.setTarget(npc);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
final int npcId = npc.getNpcId();
|
||||
final Integer status = GrandBossManager.getInstance().getBossStatus(ZAKEN);
|
||||
if (npcId == ZAKEN)
|
||||
{
|
||||
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
|
||||
GrandBossManager.getInstance().setBossStatus(ZAKEN, DEAD);
|
||||
// time is 36hour +/- 17hour
|
||||
final long respawnTime = (Config.ZAKEN_RESP_FIRST + Rnd.get(Config.ZAKEN_RESP_SECOND)) * 3600000;
|
||||
startQuestTimer("zaken_unlock", respawnTime, null, null);
|
||||
cancelQuestTimer("1001", npc, null);
|
||||
cancelQuestTimer("1003", npc, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ZAKEN);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(ZAKEN, info);
|
||||
}
|
||||
else if (status == ALIVE)
|
||||
{
|
||||
startQuestTimer("CreateOnePrivateEx", ((30 + Rnd.get(60)) * 1000), npc, null);
|
||||
}
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAggroRangeEnter(NpcInstance npc, PlayerInstance player, boolean isPet)
|
||||
{
|
||||
final int npcId = npc.getNpcId();
|
||||
if (npcId == ZAKEN)
|
||||
{
|
||||
if (_zone.isInsideZone(npc))
|
||||
{
|
||||
final Creature target = isPet ? player.getPet() : player;
|
||||
((Attackable) npc).addDamageHate(target, 1, 200);
|
||||
}
|
||||
if ((player.getZ() > (npc.getZ() - 100)) && (player.getZ() < (npc.getZ() + 100)))
|
||||
{
|
||||
if ((_quest0 < 5) && (Rnd.get(3) < 1))
|
||||
{
|
||||
if (_quest0 == 0)
|
||||
{
|
||||
c_quest0 = player;
|
||||
}
|
||||
else if (_quest0 == 1)
|
||||
{
|
||||
c_quest1 = player;
|
||||
}
|
||||
else if (_quest0 == 2)
|
||||
{
|
||||
c_quest2 = player;
|
||||
}
|
||||
else if (_quest0 == 3)
|
||||
{
|
||||
c_quest3 = player;
|
||||
}
|
||||
else if (_quest0 == 4)
|
||||
{
|
||||
c_quest4 = player;
|
||||
}
|
||||
_quest0++;
|
||||
}
|
||||
if (Rnd.get(15) < 1)
|
||||
{
|
||||
final int i0 = Rnd.get((15 * 15));
|
||||
if (i0 < 1)
|
||||
{
|
||||
npc.setTarget(player);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4216, 1));
|
||||
}
|
||||
else if (i0 < 2)
|
||||
{
|
||||
npc.setTarget(player);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4217, 1));
|
||||
}
|
||||
else if (i0 < 4)
|
||||
{
|
||||
npc.setTarget(player);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4219, 1));
|
||||
}
|
||||
else if (i0 < 8)
|
||||
{
|
||||
npc.setTarget(player);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4218, 1));
|
||||
}
|
||||
else if (i0 < 15)
|
||||
{
|
||||
for (Creature creature : npc.getKnownList().getKnownCharactersInRadius(100))
|
||||
{
|
||||
if (creature != player)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (player != ((Attackable) npc).getMostHated())
|
||||
{
|
||||
npc.setTarget(player);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4221, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Rnd.nextBoolean() && (player == ((Attackable) npc).getMostHated()))
|
||||
{
|
||||
npc.setTarget(player);
|
||||
npc.doCast(SkillTable.getInstance().getInfo(4220, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onAggroRangeEnter(npc, player, isPet);
|
||||
}
|
||||
|
||||
public void spawnBoss(GrandBossInstance npc)
|
||||
{
|
||||
if (npc == null)
|
||||
{
|
||||
LOGGER.warning("Zaken AI failed to load, missing Zaken in grandboss_data.sql");
|
||||
return;
|
||||
}
|
||||
GrandBossManager.getInstance().addBoss(npc);
|
||||
|
||||
npc.broadcastPacket(new PlaySound(1, "BS01_A", npc));
|
||||
_ai0 = 0;
|
||||
_ai1 = npc.getX();
|
||||
_ai2 = npc.getY();
|
||||
_ai3 = npc.getZ();
|
||||
_quest0 = 0;
|
||||
_quest1 = 0;
|
||||
_quest2 = 3;
|
||||
if (_zone == null)
|
||||
{
|
||||
LOGGER.warning("Zaken AI failed to load, missing zone for Zaken");
|
||||
return;
|
||||
}
|
||||
if (_zone.isInsideZone(npc))
|
||||
{
|
||||
_ai4 = 1;
|
||||
startQuestTimer("1003", 1700, null, null);
|
||||
}
|
||||
_1001 = 1;
|
||||
startQuestTimer("1001", 1000, npc, null); // buffs,random teleports
|
||||
}
|
||||
|
||||
public int getTimeHour()
|
||||
{
|
||||
return (GameTimeController.getInstance().getGameTime() / 60) % 24;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Zaken();
|
||||
}
|
||||
}
|
||||
53
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/AncientEgg.java
vendored
Normal file
53
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/AncientEgg.java
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import org.l2jmobius.gameserver.datatables.SkillTable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class AncientEgg extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int EGG = 18344; // Ancient Egg
|
||||
// Skill
|
||||
private static final int SIGNAL = 5088; // Signal
|
||||
|
||||
private AncientEgg()
|
||||
{
|
||||
super(-1, "ai");
|
||||
addAttackId(EGG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
attacker.setTarget(attacker);
|
||||
attacker.doCast(SkillTable.getInstance().getInfo(SIGNAL, 1));
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new AncientEgg();
|
||||
}
|
||||
}
|
||||
182
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Bingo.java
vendored
Normal file
182
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Bingo.java
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
|
||||
/**
|
||||
* Adapted from FirstTeam Interlude
|
||||
*/
|
||||
public class Bingo
|
||||
{
|
||||
protected static final String TEMPLATE = "%msg%<br><br>%choices%<br><br>%board%";
|
||||
protected static final String TEMPLATE_FINAL = "%msg%<br><br>%board%";
|
||||
protected static final String TEMPLATE_BOARD = "For your information, below is your current selection.<br><table border=\"1\" border color=\"white\" width=100><tr><td align=\"center\">%cell1%</td><td align=\"center\">%cell2%</td><td align=\"center\">%cell3%</td></tr><tr><td align=\"center\">%cell4%</td><td align=\"center\">%cell5%</td><td align=\"center\">%cell6%</td></tr><tr><td align=\"center\">%cell7%</td><td align=\"center\">%cell8%</td><td align=\"center\">%cell9%</td></tr></table>";
|
||||
protected static final String MSG_AGAIN = "You have already selected that number. Choose your %choicenum% number again.";
|
||||
protected static final String MSG_BEGIN = "I've arranged 9 numbers on the panel.<br>Now, select your %choicenum% number.";
|
||||
protected static final String MSG_NEXT = "Now, choose your %choicenum% number.";
|
||||
protected static final String MSG_ZERO_LINES = "You are spectacularly unlucky! The red-colored numbers on the panel below are the ones you chose. As you can see, they didn't create even a single line. Did you know that it is harder not to create a single line than creating all 3 lines?";
|
||||
protected static final String MSG_THREE_LINES = "You've created 3 lines! The red colored numbers on the bingo panel below are the numbers you chose. Congratulations!";
|
||||
protected static final String MSG_LOSE = "Hmm... You didn't make 3 lines. Why don't you try again? The red-colored numbers on the panel are the ones you chose.";
|
||||
protected static final String[] NUMBERS =
|
||||
{
|
||||
"first",
|
||||
"second",
|
||||
"third",
|
||||
"fourth",
|
||||
"fifth",
|
||||
"final"
|
||||
};
|
||||
|
||||
private final String _template_choice;
|
||||
private final List<Integer> board;
|
||||
private final List<Integer> guesses;
|
||||
protected int lines;
|
||||
|
||||
public Bingo(String templateChoice)
|
||||
{
|
||||
board = new ArrayList<>();
|
||||
guesses = new ArrayList<>();
|
||||
_template_choice = templateChoice;
|
||||
while (board.size() < 9)
|
||||
{
|
||||
final int num = Rnd.get(1, 9);
|
||||
if (!board.contains(num))
|
||||
{
|
||||
board.add(num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String Select(String s)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Select(Integer.parseInt(s));
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String Select(int choise)
|
||||
{
|
||||
if ((choise < 1) || (choise > 9))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (guesses.contains(choise))
|
||||
{
|
||||
return getDialog("You have already selected that number. Choose your %choicenum% number again.");
|
||||
}
|
||||
guesses.add(choise);
|
||||
if (guesses.size() == 6)
|
||||
{
|
||||
return getFinal();
|
||||
}
|
||||
return getDialog("");
|
||||
}
|
||||
|
||||
protected String getBoard()
|
||||
{
|
||||
if (guesses.isEmpty())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
String result = "For your information, below is your current selection.<br><table border=\"1\" border color=\"white\" width=100><tr><td align=\"center\">%cell1%</td><td align=\"center\">%cell2%</td><td align=\"center\">%cell3%</td></tr><tr><td align=\"center\">%cell4%</td><td align=\"center\">%cell5%</td><td align=\"center\">%cell6%</td></tr><tr><td align=\"center\">%cell7%</td><td align=\"center\">%cell8%</td><td align=\"center\">%cell9%</td></tr></table>";
|
||||
for (int i = 1; i <= 9; ++i)
|
||||
{
|
||||
final String cell = "%cell" + i + "%";
|
||||
final int num = board.get(i - 1);
|
||||
if (guesses.contains(num))
|
||||
{
|
||||
result = result.replaceFirst(cell, "<font color=\"" + ((guesses.size() == 6) ? "ff0000" : "ffff00") + "\">" + num + "</font>");
|
||||
}
|
||||
else
|
||||
{
|
||||
result = result.replaceFirst(cell, "?");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getDialog(String msg)
|
||||
{
|
||||
String result = "%msg%<br><br>%choices%<br><br>%board%";
|
||||
if (guesses.isEmpty())
|
||||
{
|
||||
result = result.replaceFirst("%msg%", "I've arranged 9 numbers on the panel.<br>Now, select your %choicenum% number.");
|
||||
}
|
||||
else
|
||||
{
|
||||
result = result.replaceFirst("%msg%", "".equalsIgnoreCase(msg) ? "Now, choose your %choicenum% number." : msg);
|
||||
}
|
||||
result = result.replaceFirst("%choicenum%", Bingo.NUMBERS[guesses.size()]);
|
||||
final StringBuilder choices = new StringBuilder();
|
||||
for (int i = 1; i <= 9; ++i)
|
||||
{
|
||||
if (!guesses.contains(i))
|
||||
{
|
||||
choices.append(_template_choice.replace("%n%", String.valueOf(i)));
|
||||
}
|
||||
}
|
||||
result = result.replaceFirst("%choices%", choices.toString());
|
||||
result = result.replaceFirst("%board%", getBoard());
|
||||
return result;
|
||||
}
|
||||
|
||||
protected String getFinal()
|
||||
{
|
||||
String result = "%msg%<br><br>%board%".replaceFirst("%board%", getBoard());
|
||||
calcLines();
|
||||
switch (lines)
|
||||
{
|
||||
case 3:
|
||||
result = result.replaceFirst("%msg%", "You've created 3 lines! The red colored numbers on the bingo panel below are the numbers you chose. Congratulations!");
|
||||
break;
|
||||
case 0:
|
||||
result = result.replaceFirst("%msg%", "You are spectacularly unlucky! The red-colored numbers on the panel below are the ones you chose. As you can see, they didn't create even a single line. Did you know that it is harder not to create a single line than creating all 3 lines?");
|
||||
break;
|
||||
default:
|
||||
result = result.replaceFirst("%msg%", "Hmm... You didn't make 3 lines. Why don't you try again? The red-colored numbers on the panel are the ones you chose.");
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public int calcLines()
|
||||
{
|
||||
lines = 0;
|
||||
lines += (checkLine(0, 1, 2) ? 1 : 0);
|
||||
lines += (checkLine(3, 4, 5) ? 1 : 0);
|
||||
lines += (checkLine(6, 7, 8) ? 1 : 0);
|
||||
lines += (checkLine(0, 3, 6) ? 1 : 0);
|
||||
lines += (checkLine(1, 4, 7) ? 1 : 0);
|
||||
lines += (checkLine(2, 5, 8) ? 1 : 0);
|
||||
lines += (checkLine(0, 4, 8) ? 1 : 0);
|
||||
return lines += (checkLine(2, 4, 6) ? 1 : 0);
|
||||
}
|
||||
|
||||
public boolean checkLine(int idx1, int idx2, int idx3)
|
||||
{
|
||||
return guesses.contains(board.get(idx1)) && guesses.contains(board.get(idx2)) && guesses.contains(board.get(idx3));
|
||||
}
|
||||
}
|
||||
74
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/CatsEyeBandit.java
vendored
Normal file
74
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/CatsEyeBandit.java
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class CatsEyeBandit extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int CATS_EYE_BANDIT = 27038;
|
||||
|
||||
private CatsEyeBandit()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addKillId(CATS_EYE_BANDIT);
|
||||
addAttackId(CATS_EYE_BANDIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 40)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "You childish fool, do you think you can catch me?"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
if (Rnd.get(100) < 80)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "I must do something about this shameful incident..."));
|
||||
}
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new CatsEyeBandit();
|
||||
}
|
||||
}
|
||||
135
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Chests.java
vendored
Normal file
135
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Chests.java
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.ChestInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class Chests extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int[] CHESTS =
|
||||
{// @formatter:off
|
||||
18265,18266,18267,18268,18269,18270,18271,18272,18273,18274,18275,
|
||||
18276,18277,18278,18279,18280,18281,18282,18283,18284,18285,18286,
|
||||
18287,18288,18289,18290,18291,18292,18293,18294,18295,18296,18297,
|
||||
18298,21671,21694,21717,21740,21763,21786,21801,21802,21803,21804,
|
||||
21805,21806,21807,21808,21809,21810,21811,21812,21813,21814,21815,
|
||||
21816,21817,21818,21819,21820,21821,21822
|
||||
}; // @formatter:on
|
||||
// Skill
|
||||
private static final int SKILL_DELUXE_KEY = 2229;
|
||||
// Misc
|
||||
private static final int BASE_CHANCE = 100;
|
||||
// Percent to decrease base chance when grade of DELUXE key not match.
|
||||
private static final int LEVEL_DECREASE = 40;
|
||||
// Chance for a chest to actually be a BOX (as opposed to being a mimic).
|
||||
private static final int IS_BOX = 40;
|
||||
|
||||
private Chests()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addSkillUseId(CHESTS);
|
||||
addAttackId(CHESTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSkillUse(NpcInstance npc, PlayerInstance caster, Skill skill)
|
||||
{
|
||||
// if this has already been interacted, no further ai decisions are needed
|
||||
// if it's the first interaction, check if this is a box or mimic
|
||||
final ChestInstance chest = (ChestInstance) npc;
|
||||
if (chest.isInteracted())
|
||||
{
|
||||
chest.setInteracted();
|
||||
if (Rnd.get(100) < IS_BOX)
|
||||
{
|
||||
// if it's a box, either it will be successfully openned by a proper key, or instantly disappear
|
||||
if (skill.getId() == SKILL_DELUXE_KEY)
|
||||
{
|
||||
// check the chance to open the box
|
||||
final int keyLevelNeeded = chest.getLevel() / 10;
|
||||
int levelDiff = keyLevelNeeded - skill.getLevel();
|
||||
if (levelDiff < 0)
|
||||
{
|
||||
levelDiff = levelDiff * (-1);
|
||||
}
|
||||
final int chance = BASE_CHANCE - (levelDiff * LEVEL_DECREASE);
|
||||
|
||||
// success, pretend-death with rewards: npc.reduceCurrentHp(99999999, player)
|
||||
if (Rnd.get(100) < chance)
|
||||
{
|
||||
chest.setMustRewardExpSp(false);
|
||||
chest.setSpecialDrop();
|
||||
chest.reduceCurrentHp(99999999, caster);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// used a skill other than chest-key, or used a chest-key but failed to open: disappear with no rewards
|
||||
chest.onDecay();
|
||||
}
|
||||
else
|
||||
{
|
||||
final Creature target = chest.getAttackByList().contains(caster.getPet()) ? caster.getPet() : caster;
|
||||
chest.setRunning();
|
||||
chest.addDamageHate(target, 0, 999);
|
||||
chest.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
}
|
||||
return super.onSkillUse(npc, caster, skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
final ChestInstance chest = (ChestInstance) npc;
|
||||
if (!chest.isInteracted())
|
||||
{
|
||||
chest.setInteracted();
|
||||
if (Rnd.get(100) < IS_BOX)
|
||||
{
|
||||
chest.onDecay();
|
||||
}
|
||||
else
|
||||
{
|
||||
// if this weren't a box, upon interaction start the mimic behaviors...
|
||||
// TODO: perhaps a self-buff (skill id 4245) with random chance goes here?
|
||||
final Creature target = isPet ? attacker.getPet() : attacker;
|
||||
chest.setRunning();
|
||||
chest.addDamageHate(target, 0, (damage * 100) / (chest.getLevel() + 7));
|
||||
chest.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Chests();
|
||||
}
|
||||
}
|
||||
64
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/DeluLizardmanSpecialAgent.java
vendored
Normal file
64
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/DeluLizardmanSpecialAgent.java
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class DeluLizardmanSpecialAgent extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int DELU_LIZARDMAN_SPECIAL_AGENT = 21105;
|
||||
|
||||
private DeluLizardmanSpecialAgent()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addAttackId(DELU_LIZARDMAN_SPECIAL_AGENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 40)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "Hey! We're having a duel here!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "How dare you interrupt our fight! Hey guys, help!"));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new DeluLizardmanSpecialAgent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class DeluLizardmanSpecialCommander extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int DELU_LIZARDMAN_SPECIAL_COMMANDER = 21107;
|
||||
|
||||
private DeluLizardmanSpecialCommander()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addAttackId(DELU_LIZARDMAN_SPECIAL_COMMANDER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 40)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "Come on, Ill take you on!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "How dare you interrupt a sacred duel! You must be taught a lesson!"));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new DeluLizardmanSpecialCommander();
|
||||
}
|
||||
}
|
||||
79
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/EvaBox.java
vendored
Normal file
79
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/EvaBox.java
vendored
Normal 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.others;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import org.l2jmobius.gameserver.model.Effect;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class EvaBox extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int BOX = 32342;
|
||||
// Skills
|
||||
private static final List<Integer> KISS_OF_EVA = new ArrayList<>();
|
||||
static
|
||||
{
|
||||
KISS_OF_EVA.add(1073);
|
||||
KISS_OF_EVA.add(3141);
|
||||
KISS_OF_EVA.add(3252);
|
||||
}
|
||||
// Items
|
||||
private static final int[] REWARDS =
|
||||
{
|
||||
9692,
|
||||
9693
|
||||
};
|
||||
|
||||
private EvaBox()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addKillId(BOX);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
for (Effect effect : killer.getAllEffects())
|
||||
{
|
||||
if (KISS_OF_EVA.contains(effect.getSkill().getId()))
|
||||
{
|
||||
final ItemInstance reward = ItemTable.getInstance().createItem("EvaBox", Rnd.get(REWARDS.length), 1, killer);
|
||||
reward.dropMe(npc, npc.getX(), npc.getY(), npc.getZ());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new EvaBox();
|
||||
}
|
||||
}
|
||||
559
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/FeedableBeasts.java
vendored
Normal file
559
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/FeedableBeasts.java
vendored
Normal file
@@ -0,0 +1,559 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.TamedBeastInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import org.l2jmobius.gameserver.model.spawn.Spawn;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
import quests.Q020_BringUpWithLove.Q020_BringUpWithLove;
|
||||
|
||||
/**
|
||||
* Growth-capable mobs: Polymorphing upon successful feeding.
|
||||
* @author Fulminus, Mobius
|
||||
*/
|
||||
public class FeedableBeasts extends Quest
|
||||
{
|
||||
private static final int GOLDEN_SPICE = 6643;
|
||||
private static final int CRYSTAL_SPICE = 6644;
|
||||
private static final int SKILL_GOLDEN_SPICE = 2188;
|
||||
private static final int SKILL_CRYSTAL_SPICE = 2189;
|
||||
|
||||
// @formatter:off
|
||||
private static final int[] TAMED_BEASTS =
|
||||
{
|
||||
16013, 16014, 16015, 16016, 16017, 16018
|
||||
};
|
||||
|
||||
private static final int[] FEEDABLE_BEASTS =
|
||||
{
|
||||
21451, 21452, 21453, 21454, 21455, 21456, 21457, 21458, 21459, 21460, 21461, 21462, 21463, 21464, 21465, 21466, 21467, 21468, 21469, // Alpen Kookaburra
|
||||
21470, 21471, 21472, 21473, 21474, 21475, 21476, 21477, 21478, 21479, 21480, 21481, 21482, 21483, 21484, 21485, 21486, 21487, 21488, // Alpen Buffalo
|
||||
21489, 21490, 21491, 21492, 21493, 21494, 21495, 21496, 21497, 21498, 21499, 21500, 21501, 21502, 21503, 21504, 21505, 21506, 21507, // Alpen Cougar
|
||||
21824, 21825, 21826, 21827, 21828, 21829 // Alpen Kookaburra, Buffalo, Cougar
|
||||
};
|
||||
// @formatter:on
|
||||
|
||||
private static final Map<Integer, Integer> MAD_COW_POLYMORPH = new HashMap<>();
|
||||
static
|
||||
{
|
||||
MAD_COW_POLYMORPH.put(21824, 21468);
|
||||
MAD_COW_POLYMORPH.put(21825, 21469);
|
||||
MAD_COW_POLYMORPH.put(21826, 21487);
|
||||
MAD_COW_POLYMORPH.put(21827, 21488);
|
||||
MAD_COW_POLYMORPH.put(21828, 21506);
|
||||
MAD_COW_POLYMORPH.put(21829, 21507);
|
||||
}
|
||||
|
||||
private static final String[][] TEXT =
|
||||
{
|
||||
{
|
||||
"What did you just do to me?",
|
||||
"You want to tame me, huh?",
|
||||
"Do not give me this. Perhaps you will be in danger.",
|
||||
"Bah bah. What is this unpalatable thing?",
|
||||
"My belly has been complaining. This hit the spot.",
|
||||
"What is this? Can I eat it?",
|
||||
"You don't need to worry about me.",
|
||||
"Delicious food, thanks.",
|
||||
"I am starting to like you!",
|
||||
"Gulp!"
|
||||
},
|
||||
{
|
||||
"I do not think you have given up on the idea of taming me.",
|
||||
"That is just food to me. Perhaps I can eat your hand too.",
|
||||
"Will eating this make me fat? Ha ha.",
|
||||
"Why do you always feed me?",
|
||||
"Do not trust me. I may betray you."
|
||||
},
|
||||
{
|
||||
"Destroy!",
|
||||
"Look what you have done!",
|
||||
"Strange feeling...! Evil intentions grow in my heart...!",
|
||||
"It is happening!",
|
||||
"This is sad...Good is sad...!"
|
||||
}
|
||||
};
|
||||
|
||||
private static final String[] SPAWN_CHATS =
|
||||
{
|
||||
"$s1, will you show me your hideaway?",
|
||||
"$s1, whenever I look at spice, I think about you.",
|
||||
"$s1, you do not need to return to the village. I will give you strength.",
|
||||
"Thanks, $s1. I hope I can help you.",
|
||||
"$s1, what can I do to help you?",
|
||||
};
|
||||
|
||||
private static final Map<Integer, Integer> FEED_INFO = new ConcurrentHashMap<>();
|
||||
private static final Map<Integer, GrowthCapableMob> GROWTH_CAPABLE_MONSTERS = new HashMap<>();
|
||||
|
||||
private static class GrowthCapableMob
|
||||
{
|
||||
private final int _growthLevel;
|
||||
private final int _chance;
|
||||
|
||||
private final Map<Integer, int[][]> _spiceToMob = new HashMap<>();
|
||||
|
||||
public GrowthCapableMob(int growthLevel, int chance)
|
||||
{
|
||||
_growthLevel = growthLevel;
|
||||
_chance = chance;
|
||||
}
|
||||
|
||||
public void addMobs(int spice, int[][] mobs)
|
||||
{
|
||||
_spiceToMob.put(spice, mobs);
|
||||
}
|
||||
|
||||
public Integer getMob(int spice, int mobType, int classType)
|
||||
{
|
||||
if (_spiceToMob.containsKey(spice))
|
||||
{
|
||||
return _spiceToMob.get(spice)[mobType][classType];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Integer getRandomMob(int spice)
|
||||
{
|
||||
int[][] temp;
|
||||
temp = _spiceToMob.get(spice);
|
||||
return temp[0][Rnd.get(temp[0].length)];
|
||||
}
|
||||
|
||||
public Integer getChance()
|
||||
{
|
||||
return _chance;
|
||||
}
|
||||
|
||||
public Integer getGrowthLevel()
|
||||
{
|
||||
return _growthLevel;
|
||||
}
|
||||
}
|
||||
|
||||
private FeedableBeasts()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addKillId(FEEDABLE_BEASTS);
|
||||
addSkillUseId(FEEDABLE_BEASTS);
|
||||
|
||||
// TODO: no grendels?
|
||||
GrowthCapableMob temp;
|
||||
|
||||
//@formatter:off
|
||||
final int[][] Kookabura_0_Gold = {{ 21452, 21453, 21454, 21455 }};
|
||||
final int[][] Kookabura_0_Crystal = {{ 21456, 21457, 21458, 21459 }};
|
||||
final int[][] Kookabura_1_Gold_1= {{ 21460, 21462 }};
|
||||
final int[][] Kookabura_1_Gold_2 = {{ 21461, 21463 }};
|
||||
final int[][] Kookabura_1_Crystal_1 = {{ 21464, 21466 }};
|
||||
final int[][] Kookabura_1_Crystal_2 = {{ 21465, 21467 }};
|
||||
final int[][] Kookabura_2_1 = {{ 21468, 21824}, { 16017, 16018 }};
|
||||
final int[][] Kookabura_2_2 = {{ 21469, 21825}, { 16017, 16018 }};
|
||||
final int[][] Buffalo_0_Gold = {{ 21471, 21472, 21473, 21474 }};
|
||||
final int[][] Buffalo_0_Crystal = {{ 21475, 21476, 21477, 21478 }};
|
||||
final int[][] Buffalo_1_Gold_1 = {{ 21479, 21481 }};
|
||||
final int[][] Buffalo_1_Gold_2 = {{ 21481, 21482 }};
|
||||
final int[][] Buffalo_1_Crystal_1 = {{ 21483, 21485 }};
|
||||
final int[][] Buffalo_1_Crystal_2 = {{ 21484, 21486 }};
|
||||
final int[][] Buffalo_2_1 = {{ 21487,21826}, {16013, 16014 }};
|
||||
final int[][] Buffalo_2_2 = {{ 21488,21827}, {16013, 16014 }};
|
||||
final int[][] Cougar_0_Gold = {{ 21490, 21491, 21492, 21493 }};
|
||||
final int[][] Cougar_0_Crystal = {{ 21494,21495, 21496, 21497 }};
|
||||
final int[][] Cougar_1_Gold_1 = {{ 21498, 21500 }};
|
||||
final int[][] Cougar_1_Gold_2 = {{ 21499, 21501 }};
|
||||
final int[][] Cougar_1_Crystal_1 = {{ 21502,21504 }};
|
||||
final int[][] Cougar_1_Crystal_2 = {{ 21503,21505 }};
|
||||
final int[][] Cougar_2_1 = {{ 21506, 21828 }, { 16015,16016 }};
|
||||
final int[][] Cougar_2_2 = {{ 21507, 21829 }, { 16015,16016 }};
|
||||
//@formatter:on
|
||||
|
||||
// Alpen Kookabura
|
||||
temp = new GrowthCapableMob(0, 100);
|
||||
temp.addMobs(GOLDEN_SPICE, Kookabura_0_Gold);
|
||||
temp.addMobs(CRYSTAL_SPICE, Kookabura_0_Crystal);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21451, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(GOLDEN_SPICE, Kookabura_1_Gold_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21452, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21454, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(GOLDEN_SPICE, Kookabura_1_Gold_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21453, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21455, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(CRYSTAL_SPICE, Kookabura_1_Crystal_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21456, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21458, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(CRYSTAL_SPICE, Kookabura_1_Crystal_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21457, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21459, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(GOLDEN_SPICE, Kookabura_2_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21460, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21462, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(GOLDEN_SPICE, Kookabura_2_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21461, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21463, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(CRYSTAL_SPICE, Kookabura_2_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21464, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21466, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(CRYSTAL_SPICE, Kookabura_2_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21465, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21467, temp);
|
||||
|
||||
// Alpen Buffalo
|
||||
temp = new GrowthCapableMob(0, 100);
|
||||
temp.addMobs(GOLDEN_SPICE, Buffalo_0_Gold);
|
||||
temp.addMobs(CRYSTAL_SPICE, Buffalo_0_Crystal);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21470, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(GOLDEN_SPICE, Buffalo_1_Gold_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21471, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21473, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(GOLDEN_SPICE, Buffalo_1_Gold_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21472, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21474, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(CRYSTAL_SPICE, Buffalo_1_Crystal_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21475, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21477, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(CRYSTAL_SPICE, Buffalo_1_Crystal_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21476, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21478, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(GOLDEN_SPICE, Buffalo_2_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21479, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21481, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(GOLDEN_SPICE, Buffalo_2_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21480, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21482, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(CRYSTAL_SPICE, Buffalo_2_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21483, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21485, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(CRYSTAL_SPICE, Buffalo_2_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21484, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21486, temp);
|
||||
|
||||
// Alpen Cougar
|
||||
temp = new GrowthCapableMob(0, 100);
|
||||
temp.addMobs(GOLDEN_SPICE, Cougar_0_Gold);
|
||||
temp.addMobs(CRYSTAL_SPICE, Cougar_0_Crystal);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21489, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(GOLDEN_SPICE, Cougar_1_Gold_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21490, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21492, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(GOLDEN_SPICE, Cougar_1_Gold_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21491, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21493, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(CRYSTAL_SPICE, Cougar_1_Crystal_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21494, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21496, temp);
|
||||
|
||||
temp = new GrowthCapableMob(1, 40);
|
||||
temp.addMobs(CRYSTAL_SPICE, Cougar_1_Crystal_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21495, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21497, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(GOLDEN_SPICE, Cougar_2_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21498, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21500, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(GOLDEN_SPICE, Cougar_2_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21499, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21501, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(CRYSTAL_SPICE, Cougar_2_1);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21502, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21504, temp);
|
||||
|
||||
temp = new GrowthCapableMob(2, 25);
|
||||
temp.addMobs(CRYSTAL_SPICE, Cougar_2_2);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21503, temp);
|
||||
GROWTH_CAPABLE_MONSTERS.put(21505, temp);
|
||||
}
|
||||
|
||||
private void spawnNext(NpcInstance npc, int growthLevel, PlayerInstance player, int food)
|
||||
{
|
||||
final int npcId = npc.getNpcId();
|
||||
int nextNpcId = 0;
|
||||
|
||||
// Find the next mob to spawn, based on the current npcId, growthlevel, and food.
|
||||
if (growthLevel == 2)
|
||||
{
|
||||
// If tamed, the mob that will spawn depends on the class type (fighter/mage) of the player!
|
||||
if (Rnd.get(2) == 0)
|
||||
{
|
||||
if (player.isMageClass())
|
||||
{
|
||||
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 1, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* If not tamed, there is a small chance that have "mad cow" disease. that is a stronger-than-normal animal that attacks its feeder
|
||||
*/
|
||||
if (Rnd.get(5) == 0)
|
||||
{
|
||||
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
// All other levels of growth are straight-forward
|
||||
else
|
||||
{
|
||||
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getRandomMob(food);
|
||||
}
|
||||
|
||||
// Remove the feedinfo of the mob that got despawned, if any
|
||||
if (FEED_INFO.getOrDefault(npc.getObjectId(), 0) == player.getObjectId())
|
||||
{
|
||||
FEED_INFO.remove(npc.getObjectId());
|
||||
}
|
||||
|
||||
// Despawn the old mob
|
||||
npc.deleteMe();
|
||||
final Spawn spawn = npc.getSpawn();
|
||||
if (spawn != null)
|
||||
{
|
||||
spawn.decreaseCount(npc);
|
||||
}
|
||||
|
||||
// if this is finally a trained mob, then despawn any other trained mobs that the player might have and initialize the Tamed Beast.
|
||||
if (Util.contains(TAMED_BEASTS, nextNpcId))
|
||||
{
|
||||
if (player.getTrainedBeast() != null)
|
||||
{
|
||||
player.getTrainedBeast().deleteMe();
|
||||
}
|
||||
|
||||
final NpcTemplate template = NpcTable.getInstance().getTemplate(nextNpcId);
|
||||
final TamedBeastInstance nextNpc = new TamedBeastInstance(IdFactory.getNextId(), template, player, food, npc.getX(), npc.getY(), npc.getZ());
|
||||
nextNpc.setRunning();
|
||||
|
||||
// If player has Q020 going, give quest item
|
||||
final QuestState st = player.getQuestState(Q020_BringUpWithLove.class.getSimpleName());
|
||||
if ((st != null) && (Rnd.get(100) < 5) && !st.hasQuestItems(7185))
|
||||
{
|
||||
st.giveItems(7185, 1);
|
||||
st.set("cond", "2");
|
||||
}
|
||||
|
||||
// Also, perform a rare random chat
|
||||
final int rand = Rnd.get(20);
|
||||
if (rand < 5)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(nextNpc.getObjectId(), ChatType.GENERAL, nextNpc.getName(), SPAWN_CHATS[rand].replace("$s1", player.getName())));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If not trained, the newly spawned mob will automatically be aggro against its feeder
|
||||
// (what happened to "never bite the hand that feeds you" anyway?!)
|
||||
final Attackable nextNpc = (Attackable) addSpawn(nextNpcId, npc);
|
||||
if (MAD_COW_POLYMORPH.containsKey(nextNpcId))
|
||||
{
|
||||
startQuestTimer("polymorph Mad Cow", 10000, nextNpc, player, false);
|
||||
}
|
||||
|
||||
// Register the player in the feedinfo for the mob that just spawned
|
||||
FEED_INFO.put(nextNpc.getObjectId(), player.getObjectId());
|
||||
|
||||
nextNpc.setRunning();
|
||||
nextNpc.addDamageHate(player, 0, 99999);
|
||||
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
if (event.equalsIgnoreCase("polymorph Mad Cow") && (npc != null) && (player != null) && MAD_COW_POLYMORPH.containsKey(npc.getNpcId()))
|
||||
{
|
||||
// remove the feed info from the previous mob
|
||||
if (FEED_INFO.getOrDefault(npc.getObjectId(), 0) == player.getObjectId())
|
||||
{
|
||||
FEED_INFO.remove(npc.getObjectId());
|
||||
}
|
||||
|
||||
// despawn the mad cow
|
||||
npc.deleteMe();
|
||||
|
||||
// spawn the new mob
|
||||
final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getNpcId()), npc);
|
||||
|
||||
// register the player in the feedinfo for the mob that just spawned
|
||||
FEED_INFO.put(nextNpc.getObjectId(), player.getObjectId());
|
||||
|
||||
nextNpc.setRunning();
|
||||
nextNpc.addDamageHate(player, 0, 99999);
|
||||
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
|
||||
}
|
||||
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSkillUse(NpcInstance npc, PlayerInstance caster, Skill skill)
|
||||
{
|
||||
// Gather some values on local variables
|
||||
final int npcId = npc.getNpcId();
|
||||
final int skillId = skill.getId();
|
||||
|
||||
// Check if the npc and skills used are valid for this script. Exit if invalid.
|
||||
if (!Util.contains(FEEDABLE_BEASTS, npcId) || ((skillId != SKILL_GOLDEN_SPICE) && (skillId != SKILL_CRYSTAL_SPICE)))
|
||||
{
|
||||
return super.onSkillUse(npc, caster, skill);
|
||||
}
|
||||
|
||||
// First gather some values on local variables
|
||||
final int objectId = npc.getObjectId();
|
||||
int growthLevel = 3; // if a mob is in FEEDABLE_BEASTS but not in GROWTH_CAPABLE_MOBS, then it's at max growth (3)
|
||||
if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId))
|
||||
{
|
||||
growthLevel = GROWTH_CAPABLE_MONSTERS.get(npcId).getGrowthLevel();
|
||||
}
|
||||
|
||||
// Prevent exploit which allows 2 players to simultaneously raise the same 0-growth beast
|
||||
// If the mob is at 0th level (when it still listens to all feeders) lock it to the first feeder!
|
||||
if ((growthLevel == 0) && FEED_INFO.containsKey(objectId))
|
||||
{
|
||||
return super.onSkillUse(npc, caster, skill);
|
||||
}
|
||||
|
||||
FEED_INFO.put(objectId, caster.getObjectId());
|
||||
|
||||
int food = 0;
|
||||
if (skillId == SKILL_GOLDEN_SPICE)
|
||||
{
|
||||
food = GOLDEN_SPICE;
|
||||
}
|
||||
else // if (skillId == SKILL_CRYSTAL_SPICE)
|
||||
{
|
||||
food = CRYSTAL_SPICE;
|
||||
}
|
||||
|
||||
// Display the social action of the beast eating the food.
|
||||
npc.broadcastPacket(new SocialAction(objectId, 2));
|
||||
|
||||
// If the pet can grow
|
||||
if (GROWTH_CAPABLE_MONSTERS.containsKey(npcId))
|
||||
{
|
||||
// Do nothing if this mob doesn't eat the specified food (food gets consumed but has no effect).
|
||||
if (GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 0) == null)
|
||||
{
|
||||
return super.onSkillUse(npc, caster, skill);
|
||||
}
|
||||
|
||||
// Rare random talk...
|
||||
if (Rnd.get(20) == 0)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(objectId, ChatType.GENERAL, npc.getName(), TEXT[growthLevel][Rnd.get(TEXT[growthLevel].length)]));
|
||||
}
|
||||
|
||||
if ((growthLevel > 0) && (FEED_INFO.getOrDefault(objectId, 0) != caster.getObjectId()))
|
||||
{
|
||||
// check if this is the same player as the one who raised it from growth 0.
|
||||
// if no, then do not allow a chance to raise the pet (food gets consumed but has no effect).
|
||||
return super.onSkillUse(npc, caster, skill);
|
||||
}
|
||||
|
||||
// Polymorph the mob, with a certain chance, given its current growth level
|
||||
if (Rnd.get(100) < GROWTH_CAPABLE_MONSTERS.get(npcId).getChance())
|
||||
{
|
||||
spawnNext(npc, growthLevel, caster, food);
|
||||
}
|
||||
}
|
||||
|
||||
return super.onSkillUse(npc, caster, skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isSummon)
|
||||
{
|
||||
// Remove the feedinfo of the mob that got killed, if any
|
||||
FEED_INFO.remove(npc.getObjectId());
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new FeedableBeasts();
|
||||
}
|
||||
}
|
||||
67
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/KarulBugbear.java
vendored
Normal file
67
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/KarulBugbear.java
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class KarulBugbear extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int KARUL_BUGBEAR = 20600;
|
||||
|
||||
private KarulBugbear()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addAttackId(KARUL_BUGBEAR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 4)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "Your rear is practically unguarded!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
if (Rnd.get(100) < 4)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "Watch your back!"));
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new KarulBugbear();
|
||||
}
|
||||
}
|
||||
186
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Monastery.java
vendored
Normal file
186
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Monastery.java
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.datatables.SkillTable;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
import org.l2jmobius.gameserver.model.Skill.SkillType;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Playable;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.EventType;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
public class Monastery extends Quest
|
||||
{
|
||||
private static final int[] MOBS_1 =
|
||||
{
|
||||
22124,
|
||||
22125,
|
||||
22126,
|
||||
22127,
|
||||
22129
|
||||
};
|
||||
private static final int[] MOBS_2 =
|
||||
{
|
||||
22134,
|
||||
22135
|
||||
};
|
||||
private static final String[] TEXT =
|
||||
{
|
||||
"You cannot carry a weapon without authorization!",
|
||||
"name, why would you choose the path of darkness?!",
|
||||
"name! How dare you defy the will of Einhasad!"
|
||||
};
|
||||
|
||||
public Monastery()
|
||||
{
|
||||
super(-1, "ai");
|
||||
registerMobs(MOBS_1, EventType.ON_AGGRO_RANGE_ENTER, EventType.ON_SPAWN, EventType.ON_SPELL_FINISHED);
|
||||
registerMobs(MOBS_2, EventType.ON_SPELL_FINISHED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAggroRangeEnter(NpcInstance npc, PlayerInstance player, boolean isPet)
|
||||
{
|
||||
if (Util.contains(MOBS_1, npc.getNpcId()) && !npc.isInCombat() && (npc.getTarget() == null))
|
||||
{
|
||||
if ((player.getActiveWeaponInstance() != null) && !player.isSilentMoving())
|
||||
{
|
||||
npc.setTarget(player);
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), TEXT[0]));
|
||||
|
||||
switch (npc.getNpcId())
|
||||
{
|
||||
case 22124:
|
||||
case 22126:
|
||||
{
|
||||
final Skill skill = SkillTable.getInstance().getInfo(4589, 8);
|
||||
npc.doCast(skill);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
npc.setRunning(true);
|
||||
((Attackable) npc).addDamageHate(player, 0, 999);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (((Attackable) npc).getMostHated() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return super.onAggroRangeEnter(npc, player, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSpawn(NpcInstance npc)
|
||||
{
|
||||
if (Util.contains(MOBS_1, npc.getNpcId()))
|
||||
{
|
||||
final List<Playable> result = new ArrayList<>();
|
||||
final Collection<WorldObject> objs = npc.getKnownList().getKnownObjects().values();
|
||||
for (WorldObject obj : objs)
|
||||
{
|
||||
if (((obj instanceof PlayerInstance) || (obj instanceof PetInstance)) && Util.checkIfInRange(npc.getAggroRange(), npc, obj, true) && !((Creature) obj).isDead())
|
||||
{
|
||||
result.add((Playable) obj);
|
||||
}
|
||||
}
|
||||
if (!result.isEmpty())
|
||||
{
|
||||
final Object[] characters = result.toArray();
|
||||
for (Object obj : characters)
|
||||
{
|
||||
final Playable target = (Playable) (obj instanceof PlayerInstance ? obj : ((Summon) obj).getOwner());
|
||||
if ((target.getActiveWeaponInstance() == null) || ((target instanceof PlayerInstance) && ((PlayerInstance) target).isSilentMoving()) || ((target instanceof Summon) && ((Summon) target).getOwner().isSilentMoving()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((target.getActiveWeaponInstance() != null) && !npc.isInCombat() && (npc.getTarget() == null))
|
||||
{
|
||||
npc.setTarget(target);
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), TEXT[0]));
|
||||
switch (npc.getNpcId())
|
||||
{
|
||||
case 22124:
|
||||
case 22126:
|
||||
case 22127:
|
||||
{
|
||||
final Skill skill = SkillTable.getInstance().getInfo(4589, 8);
|
||||
npc.doCast(skill);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
npc.setRunning(true);
|
||||
((Attackable) npc).addDamageHate(target, 0, 999);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.onSpawn(npc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSpellFinished(NpcInstance npc, PlayerInstance player, Skill skill)
|
||||
{
|
||||
if (Util.contains(MOBS_1, npc.getNpcId()) && (skill.getId() == 4589))
|
||||
{
|
||||
npc.setRunning(true);
|
||||
((Attackable) npc).addDamageHate(player, 0, 999);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
|
||||
}
|
||||
|
||||
if (Util.contains(MOBS_2, npc.getNpcId()) && (skill.getSkillType() == SkillType.AGGDAMAGE))
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), TEXT[Rnd.get(2) + 1].replace("name", player.getName())));
|
||||
((Attackable) npc).addDamageHate(player, 0, 999);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
|
||||
}
|
||||
|
||||
return super.onSpellFinished(npc, player, skill);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Monastery();
|
||||
}
|
||||
}
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30008-01.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30008-01.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Grand Master Roien:<br>
|
||||
First, you must learn the basic methods of control in the game. You should meet the<font color="LEVEL"> Newbie Helper</font> over there.<br>
|
||||
Listen carefully to what he tells you, you will find it very useful later in the game.<br>
|
||||
</body></html>
|
||||
5
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30008-02.htm
vendored
Normal file
5
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30008-02.htm
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<html><body>Grand Master Roien:<br>
|
||||
Welcome. I am Grand Master Roien, of Cedric's Training Hall. This school was established by the renowned Paladin Sir Cedric, famous for producing many competent Fighters..<br>
|
||||
Did you get the recommendation from the Newbie helper?<br>
|
||||
<a action="bypass -h Quest NewbieHelper 30008_02">"I brought the recommendation."</a><br>
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30008-03.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30008-03.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Grand Master Roien:<br>
|
||||
You've learned the basic methods of control in the game. Now your adventures may begin!<br>
|
||||
Please accept this gift. I'm sure you know how to use it, right?<br>
|
||||
Go to<font color="LEVEL"> Talking Island Village</font> and meet the<font color="LEVEL"> Newbie Helper</font> there. He will give you much useful advice. He also has a gift for you.<br>
|
||||
Follow the arrow above your head to find him. Off you go! Good luck!
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30008-04.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30008-04.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Grand Master Roien:<br>
|
||||
Go to <font color="LEVEL">Talking Island Village</font> and meet the <font color="LEVEL">Newbie Helper.</font> He will give you much important advice. He also has a gift for you.<br>
|
||||
<a action="bypass -h npc_%objectId%_Quest">Quest</a>
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30009-03.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30009-03.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
You got a blue gem! Good!<br>
|
||||
As I promised, I'll give you a gift. This is called a soulshot. Soulshots make it possible for you to launch much stronger attacks. However, it only works once, so use it carefully.<br>
|
||||
<img src="L2UI_CH3.tutorial_img18" width=64 height=64><br>
|
||||
Take this letter of recommendation to<font color="LEVEL"> Grand Master Roien</font> over there. He's been eager to meet you. He has a gift for you.
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30009-04.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30009-04.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
Speak with<font color="LEVEL"> Grand Master Roien</font> over there. He's eager to meet you. He has a gift for you.<br>
|
||||
May the goddess of luck be with you!
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30017-01.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30017-01.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Grand Master Gallin:<br>
|
||||
First, you must learn the basic methods of control in the game. Let me introduce my little friend, the<font color="LEVEL"> newbie helper</font>.<br>
|
||||
The newbie helper will teach you many things you will find useful in the game.<br>
|
||||
</body></html>
|
||||
5
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30017-02.htm
vendored
Normal file
5
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30017-02.htm
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<html><body>Grand Magister Gallint:<br>
|
||||
Welcome to my school of wizardry. It was founded by the famed alchemist Einhovant, and many excellent Wizards have been trained here.<br>
|
||||
Have you brought a letter of recommendation from the Newbie Helper?<br>
|
||||
<a action="bypass -h Quest NewbieHelper 30017_02">I've brought the letter of recommendation."</a><br>
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30017-03.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30017-03.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Grand Master Gallin:<br>
|
||||
You've learned the basic control methods in the game. Now your adventures can begin!<br>
|
||||
Please accept this gift. You know how to use it, right?<br>
|
||||
Go to<font color="LEVEL"> Talking Island Village</font> and meet the<font color="LEVEL"> newbie helper</font> there. The newbie helper will teach you many things you need to know about the game. He has gifts for you, too!<br>
|
||||
Follow the arrow above your head to find the newbie helper. Get going! Good luck!
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30017-04.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30017-04.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Grand Magister Gallint:<br>
|
||||
Go to <font color="LEVEL">Talking Island Village</font> and meet the <font color="LEVEL">newbie helper.</font> The newbie helper will teach you many things you need to know about the game. He also has a gift for you!<br>
|
||||
<a action="bypass -h npc_%objectId%_Quest">Quest</a>
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30019-03.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30019-03.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
You got a blue gem! Good!<br>
|
||||
As I promised, I'll give you a gift. This is called a spiritshot. Spiritshots make your magical attacks much stronger. However, it only works once, so you should save it for the right moment.<br>
|
||||
<img src="L2UI_CH3.tutorial_img19" width=64 height=64><br>
|
||||
Take this letter of recommendation to<font color="LEVEL"> Grand Master Gallint</font> over there. He's been looking forward to meeting you. He has something for you.
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30019-03a.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30019-03a.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
You got a blue gem! Good!<br>
|
||||
As I promised, I'll give you a gift. This is called a spiritshot. Spiritshots make your magical attacks much stronger. However, it only works once, so you should save it for the right moment.<br>
|
||||
<img src="L2UI_CH3.tutorial_img19" width=64 height=64><br>
|
||||
Take this letter of recommendation to<font color="LEVEL"> Grand Master Gallint</font> over there. He's been looking forward to meeting you. He has something for you.
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30019-04.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30019-04.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
Speak with<font color="LEVEL"> Grand Master Gallint</font> over there. He's been waiting for you. He has a gift for you.<br>
|
||||
May the goddess of luck be with you!
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30129-01.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30129-01.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Hierarch Mitraell:<br>
|
||||
First, you must learn the basic methods of control in the game. Let me introduce my little friend, the<font color="LEVEL"> newbie helper</font>.<br>
|
||||
Follow his instructions, you'll quickly learn things that you'll need in the game.<br>
|
||||
</body></html>
|
||||
5
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30129-02.htm
vendored
Normal file
5
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30129-02.htm
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<html><body>Hierarch Mitraell:<br>
|
||||
I, the Hierarch of all Dark Elves offer you the blessings of the abyss. I am the prisoner of a magic seal, barely able to function, but I still manage to teach my students.<br>
|
||||
Have you brought the blood of Mitraell from the Newbie Helper?<br>
|
||||
<a action="bypass -h Quest NewbieHelper 30129_02">"I brought the blood of Mitraell."</a><br>
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30129-03.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30129-03.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Hierarch Mitraell:<br>
|
||||
You've learned the basic methods of control in the game. Now your adventures can begin.<br>
|
||||
Please accept this gift. You know how to use it, right?<br>
|
||||
Go to the<font color="LEVEL"> Dark Elven Village</font> and meet the<font color="LEVEL"> newbie helper</font> there. The newbie helper will teach you many things that will help you in the game. You'll also get a gift!<br>
|
||||
Follow the arrow above your head to find the newbie helper. Get going! Good luck!
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30129-04.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30129-04.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Hierarch Mitraell:<br>
|
||||
Go to the<font color="LEVEL"> Dark Elven Village</font> and meet the<font color="LEVEL"> newbie helper.</font> The newbie helper will teach you many things.<br>
|
||||
<a action="bypass -h npc_%objectId%_Quest">Quest</a>
|
||||
</body></html>
|
||||
8
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30131-01.htm
vendored
Normal file
8
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30131-01.htm
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
Welcome! Are you ready for a mission?<br>
|
||||
Have you seen the gremlins around here? They've stolen the precious blue gemstone!<br>
|
||||
<font color="LEVEL">You must recover it from them! </font><br>
|
||||
I'll tell you again how to kill the gremlins. Place your cursor over a gremlin and click the <font color="FF0000">left button</font>. The cursor will change to a sword. Click the <font color="FF0000">F2 key</font> to attack with<font color="LEVEL"> Wind Strike</font> magic.<br>
|
||||
<img src="L2UI_CH3.tutorial_img12" width=64 height=64><table border=0><tr><td><img src="L2UI_CH3.tutorial_img133" width=64 height=64></td><td><img src="L2UI_CH3.tutorial_img16" width=64 height=64></td></tr></table><br>
|
||||
Complete this mission and I'll reward you with useful items. Good luck!
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30131-03.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30131-03.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
You got a blue gem! Good!<br>
|
||||
As I promised, I'll give you a gift. This is called a soulshot. Soulshots make it possible for you to launch much stronger attacks. However, it only works once, so use it carefully.<br>
|
||||
<img src="L2UI_CH3.tutorial_img18" width=64 height=64><br>
|
||||
Take this blood to<font color="LEVEL"> Mitraell</font> over there. He has a gift for you.
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30131-03a.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30131-03a.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
You got a blue gem! Good!<br>
|
||||
As I promised, I'll give you a gift. This is called a spiritshot. Spiritshots make your magical attacks much stronger. However, it only works once, so you should save it for the right moment.<br>
|
||||
<img src="L2UI_CH3.tutorial_img19" width=64 height=64><br>
|
||||
Take this blood to<font color="LEVEL"> Mitraell</font> over there. He has a gift for you.
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30131-04.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30131-04.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
Speak with<font color="LEVEL"> Hierarch Mitraell</font> over there. He has a gift for you.<br>
|
||||
May the goddess of luck be with you!
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30370-01.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30370-01.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Nerupa:<br>
|
||||
First, you must learn the basic methods of control in the game. Let me introduce the<font color="LEVEL"> newbie helper</font>.<br>
|
||||
Follow his instructions and you'll quickly learn things that you need to know.<br>
|
||||
</body></html>
|
||||
5
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30370-02.htm
vendored
Normal file
5
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30370-02.htm
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<html><body>Nerupa:<br>
|
||||
I am a proud warrior of the Arachne tribe. Long ago, I made a pact with the Mother Tree, and have protected this forest and young Elves for centuries.<br>
|
||||
Have you brought a leaf of the Mother Tree from the Newbie Guide?<br>
|
||||
<a action="bypass -h Quest NewbieHelper 30370_02">"I brought a leaf of the Mother Tree."</a><br>
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30370-03.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30370-03.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Nerupa:<br>
|
||||
You have learned the basic methods of control in the game. Now your adventure may begin.<br>
|
||||
Here is a gift. You know how to use it, right?<br>
|
||||
Go to the<font color="LEVEL"> Elven Village</font> and meet the<font color="LEVEL"> newbie helper</font> there. He will give you much important advice. Not to mention a few gifts!<br>
|
||||
Follow the arrow above your head to find the newbie helper. Get going! Good luck!
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30370-04.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30370-04.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Nerupa:<br>
|
||||
Go to the<font color="LEVEL"> Elven Village</font> and meet the<font color="LEVEL"> newbie helper.</font> He will give you a lot of important advice. Not to mention a few gifts!<br>
|
||||
<a action="bypass -h npc_%objectId%_Quest">Quest</a>
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30400-03.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30400-03.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
You got a blue gem! Good work.<br>
|
||||
As promised, I'll give you a gift. This is a soulshot. It will greatly strengthen your magic. Take heed, it only works once, so use it wisely.<br>
|
||||
<img src="L2UI_CH3.tutorial_img18" width=64 height=64><br>
|
||||
Take this leaf of the mother tree to<font color="LEVEL"> Nerupa</font> over there. She has a gift for you.
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30400-03a.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30400-03a.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
You got a blue gem! Good work.<br>
|
||||
As promised, I'll give you a gift. This is a soulshot. It will greatly enhance your magic. Take heed, it only works once, so use it wisely...<br>
|
||||
<img src="L2UI_CH3.tutorial_img19" width=64 height=64><br>
|
||||
Take this leaf of the mother tree to<font color="LEVEL"> Nerupa</font> over there. She has a gift for you.
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30400-04.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30400-04.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
Speak with<font color="LEVEL"> Nerupa</font> over there. She has a gift for you.<br>
|
||||
May the goddess of luck be with you!
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30430-03a.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30430-03a.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
You got a blue gem! Good work.<br>
|
||||
As promised, I'll give you a gift. This is a soulshot. It will greatly enhance your magic. Take heed, it only works once, so use it wisely...<br>
|
||||
<img src="L2UI_CH3.tutorial_img18" width=64 height=64><br>
|
||||
Take this leaf of the mother tree to<font color="LEVEL"> Nerupa</font> over there. She has a gift for you.
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30528-01.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30528-01.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Foreman Laferon:<br>
|
||||
First, you must learn the basic methods of control in the game. Let me introduce my little friend, the<font color="LEVEL"> newbie helper</font>.<br>
|
||||
He will teach you many things you need to know about the game.<br>
|
||||
</body></html>
|
||||
5
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30528-02.htm
vendored
Normal file
5
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30528-02.htm
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<html><body>Foreman Laferon:<br>
|
||||
Pleased to meet you, my young friend! I'm foreman of this strip mine, and have trained many fine young Dwarves here.<br>
|
||||
Have you gotten a mining license from the Newbie Helper?<br>
|
||||
<a action="bypass -h Quest NewbieHelper 30528_02">"I have a mining license."</a><br>
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30528-03.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30528-03.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Foreman Laferon:<br>
|
||||
You've learned the basic methods of control in the game. Now your adventures can begin.<br>
|
||||
First, please accept this gift. You know how to use it, right?<br>
|
||||
Go to the<font color="LEVEL"> Dwarven Village</font> and meet the<font color="LEVEL"> newbie helper</font> there. The newbie helper will give you some very important advice. He has gifts for you, too!<br>
|
||||
Follow the arrow above your head and you'll find the newbie helper. Get going! Good luck!
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30528-04.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30528-04.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Foreman Laferon:<br>
|
||||
Go to the<font color="LEVEL"> Dwarven Village</font> and meet the<font color="LEVEL"> newbie helper</font>. The newbie helper will teach you many things you need to know about the game.<br>
|
||||
<a action="bypass -h npc_%objectId%_Quest">Quest</a>
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30530-03.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30530-03.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
You got a blue gem! Good work.<br>
|
||||
As promised, I'll give you a gift. This is a soulshot. It will make your attacks much stronger. Take heed, it only works once, so use it wisely.<br>
|
||||
<img src="L2UI_CH3.tutorial_img18" width=64 height=64><br>
|
||||
Take this mining license to<font color="LEVEL"> Foreman Laferon</font> over there. He has a gift for you.
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30530-04.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30530-04.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
Speak with<font color="LEVEL"> Foreman Laferon</font> over there. He has a gift for you.<br>
|
||||
May the goddess of luck be with you!
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30573-01.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30573-01.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Flame Guardian Vulkus:<br>
|
||||
First, you must learn the basic methods of control in the game. Let me introduce my little friend, the<font color="LEVEL"> newbie helper</font>.<br>
|
||||
Follow his instructions, you'll quickly learn things that you'll need in the game.<br>
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30573-02.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30573-02.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Flame Guardian Vulkus:<br>
|
||||
Tejakar Oroka! I am Flame Guardian Vulkus! My role is to teach the fighting spirit of Paagrio to young orcs!<br>
|
||||
Did you get the Voucher of Flame from the Newbie Helper?<br>
|
||||
<a action="bypass -h Quest NewbieHelper 30573_02">"I brought the Voucher of Flame."</a></body></html>
|
||||
5
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30573-03.htm
vendored
Normal file
5
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30573-03.htm
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<html><body>Flame Guardian Vulkus:<br>
|
||||
You've learned the basic methods of control in the game. Now your adventures can begin.<br>
|
||||
Please accept this gift. You know how to use it, right?<br>
|
||||
Go to the<font color="LEVEL"> Orc Village</font> and meet the<font color="LEVEL"> newbie helper</font> there. The newbie helper will teach you many things that will help you in the game. You'll also get a gift!<br>
|
||||
Follow the arrow above your head to find the newbie helper. Get going! Good luck!</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30573-04.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30573-04.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Flame Guardian Vulkus:<br>
|
||||
Go to the<font color="LEVEL"> Orc Village</font> and meet the<font color="LEVEL"> newbie helper.</font> The newbie helper will teach you many things.<br>
|
||||
<a action="bypass -h npc_%objectId%_Quest">Quest</a>
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30575-03.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30575-03.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
You got a blue gem! Good work.<br>
|
||||
As promised, I'll give you a gift. This is a soulshot. It will make your attacks much stronger. Take heed, it only works once, so use it wisely.<br>
|
||||
<img src="L2UI_CH3.tutorial_img18" width=64 height=64><br>
|
||||
Take this voucher of flame to<font color="LEVEL"> Flame Guardian Vulkus</font> over there. He has a gift for you.
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30575-03a.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30575-03a.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
You got a blue gem! Good!<br>
|
||||
As I promised, I'll give you a gift. This is called a spiritshot. Spiritshots make your magical attacks much stronger. However, it only works once, so you should save it for the right moment.<br>
|
||||
<img src="L2UI_CH3.tutorial_img19" width=64 height=64><br>
|
||||
Take this voucher of flame to<font color="LEVEL"> Flame Guardian Vulkus</font> over there. He has a gift for you.
|
||||
</body></html>
|
||||
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30575-04.htm
vendored
Normal file
4
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30575-04.htm
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
Speak with<font color="LEVEL"> Flame Guardian Vulkus</font> over there. He has a gift for you.<br>
|
||||
May the goddess of luck be with you!
|
||||
</body></html>
|
||||
3
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30575-05.htm
vendored
Normal file
3
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/30575-05.htm
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
I've taught you all I can, my child. Go now, out into the world! Live every day like it was your last! It very well might be!
|
||||
</body></html>
|
||||
426
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/NewbieHelper.java
vendored
Normal file
426
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/NewbieHelper/NewbieHelper.java
vendored
Normal file
@@ -0,0 +1,426 @@
|
||||
/*
|
||||
* 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.others.NewbieHelper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import org.l2jmobius.gameserver.model.quest.State;
|
||||
|
||||
import ai.others.Tutorial.Tutorial;
|
||||
|
||||
public class NewbieHelper extends Quest
|
||||
{
|
||||
// Quest Items
|
||||
// Human
|
||||
private static final int RECOMMENDATION_01 = 1067;
|
||||
private static final int RECOMMENDATION_02 = 1068;
|
||||
// Elf
|
||||
private static final int LEAF_OF_MOTHERTREE = 1069;
|
||||
// Dark Elf
|
||||
private static final int BLOOD_OF_JUNDIN = 1070;
|
||||
// Dwarf
|
||||
private static final int LICENSE_OF_MINER = 1498;
|
||||
// Orc
|
||||
private static final int VOUCHER_OF_FLAME = 1496;
|
||||
|
||||
// Items Reward
|
||||
private static final int SOULSHOT_NOVICE = 5789;
|
||||
private static final int SPIRITSHOT_NOVICE = 5790;
|
||||
private static final int BLUE_GEM = 6353;
|
||||
private static final int TOKEN = 8542;
|
||||
private static final int SCROLL = 8594;
|
||||
|
||||
private static final Map<String, Event> _events = new HashMap<>();
|
||||
static
|
||||
{
|
||||
_events.put("30008_02", new Event("30008-03.htm", -84058, 243239, -3730, RECOMMENDATION_01, 0x00, SOULSHOT_NOVICE, 200, 0x00, 0, 0));
|
||||
_events.put("30017_02", new Event("30017-03.htm", -84058, 243239, -3730, RECOMMENDATION_02, 0x0a, SPIRITSHOT_NOVICE, 100, 0x00, 0, 0));
|
||||
_events.put("30129_02", new Event("30129-03.htm", 12116, 16666, -4610, BLOOD_OF_JUNDIN, 0x26, SPIRITSHOT_NOVICE, 100, 0x1f, SOULSHOT_NOVICE, 200));
|
||||
_events.put("30370_02", new Event("30370-03.htm", 45491, 48359, -3086, LEAF_OF_MOTHERTREE, 0x19, SPIRITSHOT_NOVICE, 100, 0x12, SOULSHOT_NOVICE, 200));
|
||||
_events.put("30528_02", new Event("30528-03.htm", 115642, -178046, -941, LICENSE_OF_MINER, 0x35, SOULSHOT_NOVICE, 200, 0x00, 0, 0));
|
||||
_events.put("30573_02", new Event("30573-03.htm", -45067, -113549, -235, VOUCHER_OF_FLAME, 0x31, SOULSHOT_NOVICE, 200, 0x2c, SOULSHOT_NOVICE, 200));
|
||||
}
|
||||
|
||||
// @formatter:off
|
||||
private static final Map<Integer, Talk> _talks = new HashMap<>();
|
||||
static
|
||||
{
|
||||
// Grand Master - Roien - Human
|
||||
_talks.put(30008, new Talk(0, new String[]{"30008-01.htm", "30008-02.htm", "30008-04.htm"}, 0, 0));
|
||||
_talks.put(30009, new Talk(0, new String[]{"newbiehelper_fig_01.htm", "30009-03.htm", "", "30009-04.htm"}, 1, RECOMMENDATION_01));
|
||||
// Grand Master - Gallint - Human
|
||||
_talks.put(30017, new Talk(0, new String[]{"30017-01.htm", "30017-02.htm", "30017-04.htm"}, 0, 0));
|
||||
_talks.put(30019, new Talk(0, new String[]{"newbiehelper_fig_01.htm", "", "30019-03a.htm", "30019-04.htm"}, 1, RECOMMENDATION_02));
|
||||
// Hierarch - Dark Elf
|
||||
_talks.put(30129, new Talk(2, new String[]{"30129-01.htm", "30129-02.htm", "30129-04.htm"}, 0, 0));
|
||||
_talks.put(30131, new Talk(2, new String[]{"newbiehelper_fig_01.htm", "30131-03.htm", "30131-03a.htm", "30131-04.htm"}, 1, BLOOD_OF_JUNDIN));
|
||||
// Nerupa - Elf
|
||||
_talks.put(30370, new Talk(1, new String[]{"30370-01.htm", "30370-02.htm", "30370-04.htm"}, 0, 0));
|
||||
_talks.put(30400, new Talk(1, new String[]{"newbiehelper_fig_01.htm", "30400-03.htm", "30400-03a.htm", "30400-04.htm"}, 1, LEAF_OF_MOTHERTREE));
|
||||
// Foreman - Dwarf
|
||||
_talks.put(30528, new Talk(4, new String[]{"30528-01.htm", "30528-02.htm", "30528-04.htm"}, 0, 0));
|
||||
_talks.put(30530, new Talk(4, new String[]{"newbiehelper_fig_01.htm", "30530-03.htm", "", "30530-04.htm"}, 1, LICENSE_OF_MINER));
|
||||
// Flame Guardian - Orc
|
||||
_talks.put(30573, new Talk(3, new String[]{"30573-01.htm", "30573-02.htm", "30573-04.htm"}, 0, 0));
|
||||
_talks.put(30575, new Talk(3, new String[]{"newbiehelper_fig_01.htm", "30575-03.htm", "30575-03a.htm", "30575-04.htm"}, 1, VOUCHER_OF_FLAME));
|
||||
}
|
||||
// @formatter:on
|
||||
|
||||
public NewbieHelper()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addStartNpc(30009, 30019, 30131, 30400, 30530, 30575);
|
||||
|
||||
addTalkId(30009, 30019, 30131, 30400, 30530, 30575, 30008, 30017, 30129, 30370, 30528, 30573);
|
||||
|
||||
addFirstTalkId(new int[]
|
||||
{
|
||||
30009, // Newbie Helper - Human
|
||||
30019, // Newbie Helper - Human
|
||||
30131, // Newbie Helper - Dark Elf
|
||||
30400, // Newbie Helper - Elf
|
||||
30530, // Newbie Helper - Dwarf
|
||||
30575, // Newbie Helper - Orc
|
||||
|
||||
30598, // Newbie Guide
|
||||
30599, // Newbie Guide
|
||||
30600, // Newbie Guide
|
||||
30601, // Newbie Guide
|
||||
30602, // Newbie Guide
|
||||
|
||||
30008, // Grand Master - Roien - Human
|
||||
30017, // Grand Master - Gallint - Human
|
||||
30129, // Hierarch - Dark Elf
|
||||
30370, // Nerupa - Elf
|
||||
30528, // Foreman - Dwarf
|
||||
30573 // Flame Guardian - Orc
|
||||
});
|
||||
|
||||
addKillId(18342);
|
||||
}
|
||||
|
||||
private static class Talk
|
||||
{
|
||||
int _raceId;
|
||||
String[] _htmlfiles;
|
||||
int _npcType;
|
||||
int _item;
|
||||
|
||||
public Talk(int raceId, String[] htmlfiles, int npcTyp, int item)
|
||||
{
|
||||
_raceId = raceId;
|
||||
_htmlfiles = htmlfiles;
|
||||
_npcType = npcTyp;
|
||||
_item = item;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Event
|
||||
{
|
||||
String _htmlfile;
|
||||
int _radarX;
|
||||
int _radarY;
|
||||
int _radarZ;
|
||||
int _item;
|
||||
int _classId1;
|
||||
int _gift1;
|
||||
int _count1;
|
||||
int _classId2;
|
||||
int _gift2;
|
||||
int _count2;
|
||||
|
||||
public Event(String htmlfile, int x, int y, int z, int item, int classId1, int gift1, int count1, int classId2, int gift2, int count2)
|
||||
{
|
||||
_htmlfile = htmlfile;
|
||||
_radarX = x;
|
||||
_radarY = y;
|
||||
_radarZ = z;
|
||||
_item = item;
|
||||
_classId1 = classId1;
|
||||
_gift1 = gift1;
|
||||
_count1 = count1;
|
||||
_classId2 = classId2;
|
||||
_gift2 = gift2;
|
||||
_count2 = count2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
final QuestState qs1 = player.getQuestState(getName());
|
||||
final QuestState qs2 = player.getQuestState(Tutorial.class.getSimpleName());
|
||||
if ((qs1 == null) || (qs2 == null))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String htmltext = event;
|
||||
// player = qs1.getPlayer();
|
||||
|
||||
final int ex = qs2.getInt("Ex");
|
||||
final int classId = qs1.getPlayer().getClassId().getId();
|
||||
if (event.equalsIgnoreCase("TimerEx_NewbieHelper"))
|
||||
{
|
||||
if (ex == 0)
|
||||
{
|
||||
qs1.playTutorialVoice(player.isMageClass() ? "tutorial_voice_009b" : "tutorial_voice_009a");
|
||||
qs2.set("Ex", "1");
|
||||
}
|
||||
else if (ex == 3)
|
||||
{
|
||||
qs1.playTutorialVoice("tutorial_voice_010a");
|
||||
qs2.set("Ex", "4");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else if (event.equalsIgnoreCase("TimerEx_GrandMaster"))
|
||||
{
|
||||
if (ex >= 4)
|
||||
{
|
||||
qs1.showQuestionMark(7);
|
||||
qs1.playSound("ItemSound.quest_tutorial");
|
||||
qs1.playTutorialVoice("tutorial_voice_025");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
final Event ev = _events.get(event);
|
||||
if (ev != null)
|
||||
{
|
||||
if (ev._radarX != 0)
|
||||
{
|
||||
qs1.addRadar(ev._radarX, ev._radarY, ev._radarZ);
|
||||
}
|
||||
htmltext = ev._htmlfile;
|
||||
if ((qs1.getQuestItemsCount(ev._item) == 1) && (qs1.getInt("onlyone") == 0))
|
||||
{
|
||||
qs1.rewardExpAndSp(0, 50);
|
||||
startQuestTimer("TimerEx_GrandMaster", 60000, null, player, false);
|
||||
qs1.takeItems(ev._item, 1);
|
||||
if (ex <= 3)
|
||||
{
|
||||
qs2.set("Ex", "4");
|
||||
}
|
||||
if (classId == ev._classId1)
|
||||
{
|
||||
qs1.giveItems(ev._gift1, ev._count1);
|
||||
qs1.playTutorialVoice(ev._gift1 == SPIRITSHOT_NOVICE ? "tutorial_voice_027" : "tutorial_voice_026");
|
||||
}
|
||||
else if ((classId == ev._classId2) && (ev._gift2 != 0))
|
||||
{
|
||||
qs1.giveItems(ev._gift2, ev._count2);
|
||||
qs1.playTutorialVoice("tutorial_voice_026");
|
||||
}
|
||||
qs1.unset("step");
|
||||
qs1.set("onlyone", "1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onFirstTalk(NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
String htmltext = "";
|
||||
QuestState qs1 = player.getQuestState(getName());
|
||||
final QuestState qs2 = player.getQuestState(Tutorial.class.getSimpleName());
|
||||
if (qs1 == null)
|
||||
{
|
||||
qs1 = newQuestState(player);
|
||||
}
|
||||
|
||||
if ((qs2 == null) || Config.DISABLE_TUTORIAL)
|
||||
{
|
||||
npc.showChatWindow(player);
|
||||
return null;
|
||||
}
|
||||
|
||||
final int npcId = npc.getNpcId();
|
||||
final int level = player.getLevel();
|
||||
final boolean isMage = player.isMageClass();
|
||||
final boolean isOrcMage = player.getClassId().getId() == 49;
|
||||
int npcType = 0;
|
||||
int raceId = 0;
|
||||
int item = 0;
|
||||
String[] htmlfiles = {};
|
||||
final Talk talk = _talks.get(npcId);
|
||||
try
|
||||
{
|
||||
if (talk != null)
|
||||
{
|
||||
raceId = talk._raceId;
|
||||
htmlfiles = talk._htmlfiles;
|
||||
npcType = talk._npcType;
|
||||
item = talk._item;
|
||||
}
|
||||
if (((level >= 10) || (qs1.getInt("onlyone") == 1)) && (npcType == 1))
|
||||
{
|
||||
htmltext = "newbiehelper_03.htm";
|
||||
}
|
||||
else if ((qs1.getInt("onlyone") == 0) && (level < 10))
|
||||
{
|
||||
if (player.getRace().ordinal() == raceId)
|
||||
{
|
||||
htmltext = htmlfiles[0];
|
||||
if (npcType == 1)
|
||||
{
|
||||
if ((qs1.getInt("step") == 0) && (qs2.get("Ex") == null))
|
||||
{
|
||||
qs2.set("Ex", "0");
|
||||
qs1.set("step", "1");
|
||||
startQuestTimer("TimerEx_NewbieHelper", 30000, null, player, false);
|
||||
htmltext = !isMage ? "newbiehelper_fig_01.htm" : isOrcMage ? "newbiehelper_mage_01a.htm" : "newbiehelper_mage_01.htm";
|
||||
qs1.setState(State.STARTED);
|
||||
}
|
||||
else if ((qs1.getInt("step") == 1) && (qs2.getInt("Ex") <= 2) && (qs1.getQuestItemsCount(item) == 0))
|
||||
{
|
||||
if (qs1.hasAtLeastOneQuestItem(BLUE_GEM))
|
||||
{
|
||||
qs1.takeItems(BLUE_GEM, -1);
|
||||
qs1.giveItems(item, 1);
|
||||
qs1.set("step", "2");
|
||||
qs2.set("ucMemo", "3");
|
||||
qs2.set("Ex", "3");
|
||||
startQuestTimer("TimerEx_NewbieHelper", 30000, null, player, false);
|
||||
if (isMage && !isOrcMage)
|
||||
{
|
||||
qs1.playTutorialVoice("tutorial_voice_027");
|
||||
qs1.giveItems(SPIRITSHOT_NOVICE, 100);
|
||||
htmltext = htmlfiles[2];
|
||||
if (htmltext.equalsIgnoreCase(""))
|
||||
{
|
||||
htmltext = "<html><body>I am sorry. I only help warriors. Please go to another Newbie Helper who may assist you.</body></html>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qs1.playTutorialVoice("tutorial_voice_026");
|
||||
qs1.giveItems(SOULSHOT_NOVICE, 200);
|
||||
htmltext = htmlfiles[1];
|
||||
if (htmltext.equalsIgnoreCase(""))
|
||||
{
|
||||
htmltext = "<html><body>I am sorry. I only help mystics. Please go to another Newbie Helper who may assist you.</body></html>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
htmltext = !isMage ? "newbiehelper_fig_02.htm" : isOrcMage ? "newbiehelper_mage_02a.htm" : "newbiehelper_mage_02.htm";
|
||||
}
|
||||
}
|
||||
else if (qs1.getInt("step") == 2)
|
||||
{
|
||||
htmltext = htmlfiles[3];
|
||||
}
|
||||
}
|
||||
else if (npcType == 0)
|
||||
{
|
||||
final int step = qs1.getInt("step");
|
||||
if (step == 1)
|
||||
{
|
||||
htmltext = htmlfiles[0];
|
||||
}
|
||||
else if (step == 2)
|
||||
{
|
||||
htmltext = htmlfiles[1];
|
||||
}
|
||||
else if (step == 3)
|
||||
{
|
||||
htmltext = htmlfiles[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((npcId >= 30598) && (npcId <= 30602))
|
||||
{
|
||||
if ((qs2.getInt("reward") == 0) && (qs1.getInt("onlyone") == 1))
|
||||
{
|
||||
qs1.playTutorialVoice(isMage && !isOrcMage ? "tutorial_voice_027" : "tutorial_voice_026");
|
||||
qs1.giveItems(isMage && !isOrcMage ? SPIRITSHOT_NOVICE : SOULSHOT_NOVICE, isMage && !isOrcMage ? 100 : 200);
|
||||
qs1.giveItems(TOKEN, 12);
|
||||
if (Rnd.get(100) < 50)
|
||||
{
|
||||
qs1.giveItems(SCROLL, 2);
|
||||
}
|
||||
qs2.set("reward", "1");
|
||||
qs1.setState(State.COMPLETED);
|
||||
}
|
||||
npc.showChatWindow(player);
|
||||
return null;
|
||||
}
|
||||
else if ((npcType == 0) && (qs1.getState() == State.COMPLETED))
|
||||
{
|
||||
htmltext = "" + npcId + "-04.htm";
|
||||
}
|
||||
if ((htmltext == null) || htmltext.equalsIgnoreCase(""))
|
||||
{
|
||||
npc.showChatWindow(player);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
|
||||
{
|
||||
final QuestState qs1 = player.getQuestState(getName());
|
||||
final QuestState qs2 = player.getQuestState(Tutorial.class.getSimpleName());
|
||||
if ((qs1 == null) || (qs2 == null))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final int ex = qs2.getInt("Ex");
|
||||
if (ex <= 1)
|
||||
{
|
||||
qs1.setState(State.STARTED);
|
||||
qs2.playTutorialVoice("tutorial_voice_011");
|
||||
qs2.showQuestionMark(3);
|
||||
qs2.set("Ex", "2");
|
||||
}
|
||||
else if ((ex <= 2) && (qs1.getState() == State.STARTED) && (qs2.getInt("Gemstone") == 0) && (Rnd.get(100) < 50))
|
||||
{
|
||||
((MonsterInstance) npc).dropItem(player, BLUE_GEM, 1);
|
||||
qs1.playSound("ItemSound.quest_tutorial");
|
||||
qs1.set("step", "1");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new NewbieHelper();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
I've taught you all I can, my child. Go now, out into the world! Live every day like it was your last! It very well might be!
|
||||
</body></html>
|
||||
@@ -0,0 +1,7 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
Welcome! Are you ready for a mission?<br>
|
||||
Have you seen the Gremlins around here? They've stolen the precious Blue Gemstone!<br>
|
||||
<font color="LEVEL">You must recover it from them! </font><br>
|
||||
Place your cursor over a Gremlin and click the <font color="FF0000">left button</font>. The cursor will change to a sword. Click again to attack.<img src="L2UI_CH3.tutorial_img12" width=64 height=64><br>
|
||||
Complete this mission and I'll reward you with useful items. Good luck!
|
||||
</body></html>
|
||||
@@ -0,0 +1,5 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
Did you forget what to do? Get a blue gem! <font color="LEVEL">You must kill Gremlins to get a blue gem.</font> <br>
|
||||
Kill, kill, kill the Gremlins! Put your cursor over a Gremlin and click the <font color="FF0000">left mouse button</font>. It turns into a knife. Left-click again to slice up the Gremlin!<img src="L2UI_CH3.tutorial_img12" width=64 height=64><br>
|
||||
Do it quick and I'll give you something cool.
|
||||
</body></html>
|
||||
@@ -0,0 +1,8 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
Welcome! Are you ready for a mission?<br>
|
||||
Have you seen the gremlins around here? They've stolen the precious blue gemstone!<br>
|
||||
<font color="LEVEL">You must recover it from them! </font><br>
|
||||
I'll tell you again how to kill the gremlins. Place your cursor over a gremlin and click the <font color="FF0000">left button</font>. The cursor will change to a sword. Click the <font color="FF0000">F2 key</font> to attack with<font color="LEVEL"> Wind Strike</font> magic.<br>
|
||||
<img src="L2UI_CH3.tutorial_img12" width=64 height=64><table border=0><tr><td><img src="L2UI_CH3.tutorial_img133" width=64 height=64></td><td><img src="L2UI_CH3.tutorial_img16" width=64 height=64></td></tr></table><br>
|
||||
Complete this mission and I'll reward you with useful items. Good luck!
|
||||
</body></html>
|
||||
@@ -0,0 +1,8 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
Welcome! Are you ready for a mission? <br>
|
||||
Have you seen the Gremlins around here? They've stolen the precious Blue Gemstone!<br>
|
||||
<font color="LEVEL">You must recover it from them! </font><br>
|
||||
Place your cursor over a Gremlin and click the <font color="FF0000">left button</font>. The cursor will change to a sword. Click the left button again to attack.<img src="L2UI_CH3.tutorial_img12" width=64 height=64><br>
|
||||
Before striking, to enhance the strength of your attack, use <font color="LEVEL">Soul Cry</font> magic by clicking the <font color="FF0000">F2 key</font>. Click it again to turn off the magic.<table border=0><tr><td><img src="L2UI_CH3.tutorial_img133" width=64 height=64></td><td><img src="L2UI_CH3.tutorial_img17" width=64 height=64></td></tr></table><br>
|
||||
You shall be well-rewarded for your efforts. Good luck.
|
||||
</body></html>
|
||||
@@ -0,0 +1,6 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
Did you forget what to do? Get a blue gem! <font color="LEVEL">You must kill Gremlins to get a blue gem.</font> <br>
|
||||
Kill, kill, kill the Gremlins! Put your cursor over a Gremlin and click the <font color="FF0000">left mouse button</font>. It turns into a knife. Press the <font color="FF0000">F2 key</font> to attack using <font color="LEVEL">wind strike</font> magic.<br>
|
||||
<img src="L2UI_CH3.tutorial_img12" width=64 height=64><table border=0><tr><td><img src="L2UI_CH3.tutorial_img133" width=64 height=64></td><td><img src="L2UI_CH3.tutorial_img16" width=64 height=64></td></tr></table><br>
|
||||
Do it quick and I'll give you something you'll need later.
|
||||
</body></html>
|
||||
@@ -0,0 +1,6 @@
|
||||
<html><body>Newbie Helper:<br>
|
||||
Go and get a blue gem! <font color="LEVEL">Don't you remember? You've got to kill Gremlins!</font> <br>
|
||||
As I said, move your cursor over a Gremlin and click the <font color="FF0000">left mouse button</font>. This will transform the cursor into the shape of a knife. Click the left mouse button again to attack. <img src="L2UI_CH3.tutorial_img12" width=64 height=64><br>
|
||||
Use <font color="LEVEL">Soul Cry</font> magic before attacking. This will improve your chances greatly. To activate Soul Cry magic, press <font color="FF0000">F2 key</font>, and again to de-activate it.<table border=0><tr><td><img src="L2UI_CH3.tutorial_img133" width=64 height=64></td><td><img src="L2UI_CH3.tutorial_img17" width=64 height=64></td></tr></table><br>
|
||||
Do this and you shall be well-rewarded. Good luck!
|
||||
</body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><head><body>
|
||||
64
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/OlMahumGeneral.java
vendored
Normal file
64
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/OlMahumGeneral.java
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class OlMahumGeneral extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int OL_MAHUM_GENERAL = 20438;
|
||||
|
||||
private OlMahumGeneral()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addAttackId(OL_MAHUM_GENERAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 10)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "We shall see about that!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "I will definitely repay this humiliation!"));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new OlMahumGeneral();
|
||||
}
|
||||
}
|
||||
101
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/RetreatOnAttack.java
vendored
Normal file
101
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/RetreatOnAttack.java
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class RetreatOnAttack extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int EPLY = 20432;
|
||||
private static final int OL_MAHUM_GUARD = 20058;
|
||||
// Misc
|
||||
private static final String[] OL_MAHUM_GUARD_TEXT =
|
||||
{
|
||||
"I'll be back!",
|
||||
"You are stronger than expected..."
|
||||
};
|
||||
|
||||
private RetreatOnAttack()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addAttackId(EPLY, OL_MAHUM_GUARD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
if (event.equals("Retreat") && (npc != null) && (player != null))
|
||||
{
|
||||
npc.setAfraid(false);
|
||||
((Attackable) npc).addDamageHate(player, 0, 100);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
final int npcId = npc.getNpcId();
|
||||
if ((npcId == EPLY) || ((npc.getStatus().getCurrentHp() <= ((npc.getMaxHp() * 50) / 100)) && (Rnd.get(100) < 10)))
|
||||
{
|
||||
if (npcId == OL_MAHUM_GUARD)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), OL_MAHUM_GUARD_TEXT[Rnd.get(OL_MAHUM_GUARD_TEXT.length)]));
|
||||
}
|
||||
int posX = npc.getX();
|
||||
int posY = npc.getY();
|
||||
final int posZ = npc.getZ();
|
||||
int signX = -500;
|
||||
int signY = -500;
|
||||
if (npc.getX() > attacker.getX())
|
||||
{
|
||||
signX = 500;
|
||||
}
|
||||
if (npc.getY() > attacker.getY())
|
||||
{
|
||||
signY = 500;
|
||||
}
|
||||
posX = posX + signX;
|
||||
posY = posY + signY;
|
||||
npc.setAfraid(true);
|
||||
npc.setRunning();
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(posX, posY, posZ));
|
||||
startQuestTimer("Retreat", 10000, npc, attacker);
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new RetreatOnAttack();
|
||||
}
|
||||
}
|
||||
59
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/ScarletStakatoNoble.java
vendored
Normal file
59
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/ScarletStakatoNoble.java
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class ScarletStakatoNoble extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final int SCARLET_STAKATO_NOBLE = 21378;
|
||||
private static final int SCARLET_STAKATO_NOBLE_B = 21652;
|
||||
|
||||
private ScarletStakatoNoble()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addKillId(SCARLET_STAKATO_NOBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
if (Rnd.get(100) < 20)
|
||||
{
|
||||
addSpawn(SCARLET_STAKATO_NOBLE_B, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), true, 0);
|
||||
addSpawn(SCARLET_STAKATO_NOBLE_B, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), true, 0);
|
||||
addSpawn(SCARLET_STAKATO_NOBLE_B, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), true, 0);
|
||||
addSpawn(SCARLET_STAKATO_NOBLE_B, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), true, 0);
|
||||
addSpawn(SCARLET_STAKATO_NOBLE_B, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), true, 0);
|
||||
}
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new ScarletStakatoNoble();
|
||||
}
|
||||
}
|
||||
95
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Splendor.java
vendored
Normal file
95
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Splendor.java
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class Splendor extends Quest
|
||||
{
|
||||
// NPCs
|
||||
private static final Map<Integer, List<Integer>> NPCS = new HashMap<>();
|
||||
static
|
||||
{
|
||||
// Npc, [NewNpc,% for chance by shot,ModeSpawn]
|
||||
// Modespawn 1=> delete and spawn the new npc
|
||||
// Modespawn 2=> just add 1 spawn
|
||||
// if Quest_Drop = 5 => 25% by shot to change mob
|
||||
NPCS.put(21521, Arrays.asList(21522, 5, 1)); // Claw of Splendor
|
||||
NPCS.put(21524, Arrays.asList(21525, 5, 1)); // Blade of Splendor
|
||||
NPCS.put(21527, Arrays.asList(21528, 5, 1)); // Anger of Splendor
|
||||
NPCS.put(21537, Arrays.asList(21538, 5, 1)); // Fang of Splendor
|
||||
NPCS.put(21539, Arrays.asList(21540, 100, 2)); // Wailing of Splendor
|
||||
}
|
||||
|
||||
private Splendor()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
for (int npcId : NPCS.keySet())
|
||||
{
|
||||
addAttackId(npcId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
final List<Integer> npcData = NPCS.get(npc.getNpcId());
|
||||
if (Rnd.get(100) < (npcData.get(1) * Config.RATE_DROP_QUEST))
|
||||
{
|
||||
if (npcData.get(2) == 1)
|
||||
{
|
||||
npc.deleteMe();
|
||||
final MonsterInstance newNpc = (MonsterInstance) addSpawn(npcData.get(0), npc);
|
||||
newNpc.addDamageHate(attacker, 0, 999);
|
||||
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
|
||||
}
|
||||
else if (npc.isScriptValue(1))
|
||||
{
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
else if (npcData.get(2) == 2)
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
final MonsterInstance newNpc = (MonsterInstance) addSpawn(npcData.get(0), npc);
|
||||
newNpc.addDamageHate(attacker, 0, 999);
|
||||
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Splendor();
|
||||
}
|
||||
}
|
||||
283
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/SummonMinions.java
vendored
Normal file
283
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/SummonMinions.java
vendored
Normal file
@@ -0,0 +1,283 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.EventType;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
public class SummonMinions extends Quest
|
||||
{
|
||||
private static int hasSpawned;
|
||||
private static Set<Integer> myTrackingSet = new CopyOnWriteArraySet<>(); // Used to track instances of npcs
|
||||
private final Map<Integer, List<PlayerInstance>> _attackersList = new ConcurrentHashMap<>();
|
||||
private static final Map<Integer, Integer[]> MINIONS = new HashMap<>();
|
||||
static
|
||||
{
|
||||
MINIONS.put(20767, new Integer[]
|
||||
{
|
||||
20768,
|
||||
20769,
|
||||
20770
|
||||
}); // Timak Orc Troop
|
||||
// MINIONS.put(22030, new Integer[]{22045, 22047, 22048}); //Ragna Orc Shaman
|
||||
// MINIONS.put(22032, new Integer[]{22036}); //Ragna Orc Warrior - summons shaman but not 22030 ><
|
||||
// MINIONS.put(22038, new Integer[]{22037}); //Ragna Orc Hero
|
||||
MINIONS.put(21524, new Integer[]
|
||||
{
|
||||
21525
|
||||
}); // Blade of Splendor
|
||||
MINIONS.put(21531, new Integer[]
|
||||
{
|
||||
21658
|
||||
}); // Punishment of Splendor
|
||||
MINIONS.put(21539, new Integer[]
|
||||
{
|
||||
21540
|
||||
}); // Wailing of Splendor
|
||||
MINIONS.put(22257, new Integer[]
|
||||
{
|
||||
18364,
|
||||
18364
|
||||
}); // Island Guardian
|
||||
MINIONS.put(22258, new Integer[]
|
||||
{
|
||||
18364,
|
||||
18364
|
||||
}); // White Sand Mirage
|
||||
MINIONS.put(22259, new Integer[]
|
||||
{
|
||||
18364,
|
||||
18364
|
||||
}); // Muddy Coral
|
||||
MINIONS.put(22260, new Integer[]
|
||||
{
|
||||
18364,
|
||||
18364
|
||||
}); // Kleopora
|
||||
MINIONS.put(22261, new Integer[]
|
||||
{
|
||||
18365,
|
||||
18365
|
||||
}); // Seychelles
|
||||
MINIONS.put(22262, new Integer[]
|
||||
{
|
||||
18365,
|
||||
18365
|
||||
}); // Naiad
|
||||
MINIONS.put(22263, new Integer[]
|
||||
{
|
||||
18365,
|
||||
18365
|
||||
}); // Sonneratia
|
||||
MINIONS.put(22264, new Integer[]
|
||||
{
|
||||
18366,
|
||||
18366
|
||||
}); // Castalia
|
||||
MINIONS.put(22265, new Integer[]
|
||||
{
|
||||
18366,
|
||||
18366
|
||||
}); // Chrysocolla
|
||||
MINIONS.put(22266, new Integer[]
|
||||
{
|
||||
18366,
|
||||
18366
|
||||
}); // Pythia
|
||||
}
|
||||
|
||||
public SummonMinions()
|
||||
{
|
||||
super(-1, "ai");
|
||||
final int[] mobs =
|
||||
{
|
||||
20767,
|
||||
21524,
|
||||
21531,
|
||||
21539,
|
||||
22257,
|
||||
22258,
|
||||
22259,
|
||||
22260,
|
||||
22261,
|
||||
22262,
|
||||
22263,
|
||||
22264,
|
||||
22265,
|
||||
22266
|
||||
};
|
||||
|
||||
for (int mob : mobs)
|
||||
{
|
||||
addEventId(mob, EventType.ON_KILL);
|
||||
addEventId(mob, EventType.ON_ATTACK);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
final int npcId = npc.getNpcId();
|
||||
final int npcObjId = npc.getObjectId();
|
||||
|
||||
if (MINIONS.containsKey(npcId))
|
||||
{
|
||||
if (!myTrackingSet.contains(npcObjId)) // this allows to handle multiple instances of npc
|
||||
{
|
||||
myTrackingSet.add(npcObjId);
|
||||
hasSpawned = npcObjId;
|
||||
}
|
||||
|
||||
if (hasSpawned == npcObjId)
|
||||
{
|
||||
if ((npcId == 22030) || (npcId == 22032) || (npcId == 22038)) // mobs that summon minions only on certain hp
|
||||
{
|
||||
if (npc.getStatus().getCurrentHp() < (npc.getMaxHp() / 2))
|
||||
{
|
||||
hasSpawned = 0;
|
||||
if (Rnd.get(100) < 33) // mobs that summon minions only on certain chance
|
||||
{
|
||||
final Integer[] minions = MINIONS.get(npcId);
|
||||
for (Integer minion : minions)
|
||||
{
|
||||
final Attackable newNpc = (Attackable) addSpawn(minion, (npc.getX() + Rnd.get(-150, 150)), (npc.getY() + Rnd.get(-150, 150)), npc.getZ(), 0, false, 0);
|
||||
newNpc.setRunning();
|
||||
newNpc.addDamageHate(attacker, 0, 999);
|
||||
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((npcId == 22257) || (npcId == 22258) || (npcId == 22259) || (npcId == 22260) || (npcId == 22261) || (npcId == 22262) || (npcId == 22263) || (npcId == 22264) || (npcId == 22265) || (npcId == 22266))
|
||||
{
|
||||
PlayerInstance currentAttacker = attacker;
|
||||
if (isPet)
|
||||
{
|
||||
currentAttacker = attacker.getPet().getOwner();
|
||||
}
|
||||
|
||||
if (currentAttacker.getParty() != null)
|
||||
{
|
||||
for (PlayerInstance member : currentAttacker.getParty().getPartyMembers())
|
||||
{
|
||||
if (_attackersList.get(npcObjId) == null)
|
||||
{
|
||||
final List<PlayerInstance> player = new ArrayList<>();
|
||||
player.add(member);
|
||||
_attackersList.put(npcObjId, player);
|
||||
}
|
||||
else if (!_attackersList.get(npcObjId).contains(member))
|
||||
{
|
||||
_attackersList.get(npcObjId).add(member);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_attackersList.get(npcObjId) == null)
|
||||
{
|
||||
final List<PlayerInstance> player = new ArrayList<>();
|
||||
player.add(currentAttacker);
|
||||
_attackersList.put(npcObjId, player);
|
||||
}
|
||||
else if (!_attackersList.get(npcObjId).contains(currentAttacker))
|
||||
{
|
||||
_attackersList.get(npcObjId).add(currentAttacker);
|
||||
}
|
||||
|
||||
if (((currentAttacker.getParty() != null) && (currentAttacker.getParty().getMemberCount() > 2)) || (_attackersList.get(npcObjId).size() > 2)) // Just to make sure..
|
||||
{
|
||||
hasSpawned = 0;
|
||||
final Integer[] minions = MINIONS.get(npcId);
|
||||
for (Integer minion : minions)
|
||||
{
|
||||
final Attackable newNpc = (Attackable) addSpawn(minion, npc.getX() + Rnd.get(-150, 150), npc.getY() + Rnd.get(-150, 150), npc.getZ(), 0, false, 0);
|
||||
newNpc.setRunning();
|
||||
newNpc.addDamageHate(currentAttacker, 0, 999);
|
||||
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, currentAttacker);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // mobs without special conditions
|
||||
{
|
||||
hasSpawned = 0;
|
||||
final Integer[] minions = MINIONS.get(npcId);
|
||||
if (npcId != 20767)
|
||||
{
|
||||
for (Integer minion : minions)
|
||||
{
|
||||
final Attackable newNpc = (Attackable) addSpawn(minion, npc.getX() + Rnd.get(-150, 150), npc.getY() + Rnd.get(-150, 150), npc.getZ(), 0, false, 0);
|
||||
newNpc.setRunning();
|
||||
newNpc.addDamageHate(attacker, 0, 999);
|
||||
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Integer minion : minions)
|
||||
{
|
||||
addSpawn(minion, (npc.getX() + Rnd.get(-100, 100)), (npc.getY() + Rnd.get(-100, 100)), npc.getZ(), 0, false, 0);
|
||||
}
|
||||
}
|
||||
if (npcId == 20767)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npcObjId, ChatType.GENERAL, npc.getName(), "Come out, you children of darkness!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_attackersList.get(npcObjId) != null)
|
||||
{
|
||||
_attackersList.get(npcObjId).clear();
|
||||
}
|
||||
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
final int npcId = npc.getNpcId();
|
||||
final int npcObjId = npc.getObjectId();
|
||||
|
||||
if (MINIONS.containsKey(npcId))
|
||||
{
|
||||
myTrackingSet.remove(npcObjId);
|
||||
}
|
||||
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new SummonMinions();
|
||||
}
|
||||
}
|
||||
63
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/TimakOrcOverlord.java
vendored
Normal file
63
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/TimakOrcOverlord.java
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class TimakOrcOverlord extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int TIMAK_ORC_OVERLORD = 20588;
|
||||
|
||||
private TimakOrcOverlord()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addAttackId(TIMAK_ORC_OVERLORD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 50)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "Dear ultimate power!!!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new TimakOrcOverlord();
|
||||
}
|
||||
}
|
||||
63
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/TimakOrcTroopLeader.java
vendored
Normal file
63
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/TimakOrcTroopLeader.java
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class TimakOrcTroopLeader extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int TIMAK_ORC_TROOP_LEADER = 20767;
|
||||
|
||||
private TimakOrcTroopLeader()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addAttackId(TIMAK_ORC_TROOP_LEADER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 50)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "Destroy the enemy, my brothers!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new TimakOrcTroopLeader();
|
||||
}
|
||||
}
|
||||
232
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Transform.java
vendored
Normal file
232
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Transform.java
vendored
Normal file
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.EventType;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
public class Transform extends Quest
|
||||
{
|
||||
private final ArrayList<Transformer> _mobs = new ArrayList<>();
|
||||
|
||||
private static class Transformer
|
||||
{
|
||||
private final int _id;
|
||||
private final int _idPoly;
|
||||
private final int _chance;
|
||||
private final int _message;
|
||||
|
||||
protected Transformer(int id, int idPoly, int chance, int message)
|
||||
{
|
||||
_id = id;
|
||||
_idPoly = idPoly;
|
||||
_chance = chance;
|
||||
_message = message;
|
||||
}
|
||||
|
||||
protected int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
protected int getIdPoly()
|
||||
{
|
||||
return _idPoly;
|
||||
}
|
||||
|
||||
protected int getChance()
|
||||
{
|
||||
return _chance;
|
||||
}
|
||||
|
||||
protected int getMessage()
|
||||
{
|
||||
return _message;
|
||||
}
|
||||
}
|
||||
|
||||
private static String[] Message =
|
||||
{
|
||||
"I cannot despise the fellow! I see his sincerity in the duel.",
|
||||
"Nows we truly begin!",
|
||||
"Fool! Right now is only practice!",
|
||||
"Have a look at my true strength.",
|
||||
"This time at the last! The end!"
|
||||
};
|
||||
|
||||
public Transform()
|
||||
{
|
||||
super(-1, "ai");
|
||||
|
||||
_mobs.add(new Transformer(21261, 21262, 1, 5)); // 1st mutation Ol Mahum Transcender
|
||||
_mobs.add(new Transformer(21262, 21263, 1, 5)); // 2st mutation Ol Mahum Transcender
|
||||
_mobs.add(new Transformer(21263, 21264, 1, 5)); // 3rd mutation Ol Mahum Transcender
|
||||
_mobs.add(new Transformer(21258, 21259, 100, 5)); // always mutation on atk Fallen Orc Shaman
|
||||
_mobs.add(new Transformer(20835, 21608, 1, 5)); // zaken's seer to zaken's watchman
|
||||
_mobs.add(new Transformer(21608, 21609, 1, 5)); // zaken's watchman
|
||||
_mobs.add(new Transformer(20832, 21602, 1, 5)); // Zaken's pikeman
|
||||
_mobs.add(new Transformer(21602, 21603, 1, 5)); // Zaken's pikeman
|
||||
_mobs.add(new Transformer(20833, 21605, 1, 5)); // Zaken's archet
|
||||
_mobs.add(new Transformer(21605, 21606, 1, 5)); // Zaken's archet
|
||||
_mobs.add(new Transformer(21625, 21623, 1, 5)); // zaken's Elite Guard to zaken's Guard
|
||||
_mobs.add(new Transformer(21623, 21624, 1, 5)); // zaken's Guard
|
||||
_mobs.add(new Transformer(20842, 21620, 1, 5)); // Musveren
|
||||
_mobs.add(new Transformer(21620, 21621, 1, 5)); // Musveren
|
||||
_mobs.add(new Transformer(20830, 20859, 100, 0)); //
|
||||
_mobs.add(new Transformer(21067, 21068, 100, 0)); //
|
||||
_mobs.add(new Transformer(21062, 21063, 100, 0)); // Angels
|
||||
_mobs.add(new Transformer(20831, 20860, 100, 0)); //
|
||||
_mobs.add(new Transformer(21070, 21071, 100, 0)); //
|
||||
|
||||
final int[] mobsKill =
|
||||
{
|
||||
20830,
|
||||
21067,
|
||||
21062,
|
||||
20831,
|
||||
21070
|
||||
};
|
||||
|
||||
for (int mob : mobsKill)
|
||||
{
|
||||
addEventId(mob, EventType.ON_KILL);
|
||||
}
|
||||
|
||||
final int[] mobsAttack =
|
||||
{
|
||||
21620,
|
||||
20842,
|
||||
21623,
|
||||
21625,
|
||||
21605,
|
||||
20833,
|
||||
21602,
|
||||
20832,
|
||||
21608,
|
||||
20835,
|
||||
21258
|
||||
};
|
||||
|
||||
for (int mob : mobsAttack)
|
||||
{
|
||||
addEventId(mob, EventType.ON_ATTACK);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
for (Transformer monster : _mobs)
|
||||
{
|
||||
if ((npc.getNpcId() == monster.getId()) && (Rnd.get(100) <= (monster.getChance() * Config.RATE_DROP_QUEST)))
|
||||
{
|
||||
if (monster.getMessage() != 0)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), Message[Rnd.get(monster.getMessage())]));
|
||||
}
|
||||
npc.onDecay();
|
||||
final Attackable newNpc = (Attackable) addSpawn(monster.getIdPoly(), npc);
|
||||
final Creature originalAttacker = isPet ? attacker.getPet() : attacker;
|
||||
newNpc.setRunning();
|
||||
newNpc.addDamageHate(originalAttacker, 0, 999);
|
||||
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalAttacker);
|
||||
|
||||
// NPC Spawn Effect L2OFF
|
||||
final NPCSpawnTask spawnEffectTask = new NPCSpawnTask(newNpc, 4000, 800000);
|
||||
final Thread effectThread = new Thread(spawnEffectTask);
|
||||
effectThread.start();
|
||||
|
||||
// Like L2OFF auto target new mob (like an aggression)
|
||||
originalAttacker.setTargetTrasformedNpc(newNpc);
|
||||
}
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onKill(NpcInstance npc, PlayerInstance killer, boolean isPet)
|
||||
{
|
||||
for (Transformer monster : _mobs)
|
||||
{
|
||||
if (npc.getNpcId() == monster.getId())
|
||||
{
|
||||
if (monster.getMessage() != 0)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), Message[Rnd.get(monster.getMessage())]));
|
||||
}
|
||||
final Attackable newNpc = (Attackable) addSpawn(monster.getIdPoly(), npc);
|
||||
final Creature originalAttacker = isPet ? killer.getPet() : killer;
|
||||
newNpc.setRunning();
|
||||
newNpc.addDamageHate(originalAttacker, 0, 999);
|
||||
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalAttacker);
|
||||
}
|
||||
}
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
private class NPCSpawnTask implements Runnable
|
||||
{
|
||||
private final NpcInstance spawn;
|
||||
private final long spawnEffectTime;
|
||||
private final int spawnAbnormalEffect;
|
||||
|
||||
/**
|
||||
* @param spawn
|
||||
* @param spawnEffectTime
|
||||
* @param spawnAbnormalEffect
|
||||
*/
|
||||
public NPCSpawnTask(NpcInstance spawn, long spawnEffectTime, int spawnAbnormalEffect)
|
||||
{
|
||||
super();
|
||||
this.spawn = spawn;
|
||||
this.spawnEffectTime = spawnEffectTime;
|
||||
this.spawnAbnormalEffect = Integer.decode("0x" + spawnAbnormalEffect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
spawn.startAbnormalEffect(spawnAbnormalEffect);
|
||||
|
||||
try
|
||||
{
|
||||
Thread.sleep(spawnEffectTime);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
}
|
||||
|
||||
spawn.stopAbnormalEffect(spawnAbnormalEffect);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Transform();
|
||||
}
|
||||
}
|
||||
64
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/TurekOrcFootman.java
vendored
Normal file
64
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/TurekOrcFootman.java
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class TurekOrcFootman extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int TUREK_ORC_FOOTMAN = 20499;
|
||||
|
||||
private TurekOrcFootman()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addAttackId(TUREK_ORC_FOOTMAN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 40)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "There is no reason for you to kill me! I have nothing you need!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "We shall see about that!"));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new TurekOrcFootman();
|
||||
}
|
||||
}
|
||||
64
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/TurekOrcSupplier.java
vendored
Normal file
64
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/TurekOrcSupplier.java
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class TurekOrcSupplier extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int TUREK_ORC_SUPPLIER = 20498;
|
||||
|
||||
private TurekOrcSupplier()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addAttackId(TUREK_ORC_SUPPLIER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 40)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "You wont take me down easily."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "We shall see about that!"));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new TurekOrcSupplier();
|
||||
}
|
||||
}
|
||||
64
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/TurekOrcWarlord.java
vendored
Normal file
64
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/TurekOrcWarlord.java
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.others;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @note Based on python script
|
||||
*/
|
||||
public class TurekOrcWarlord extends Quest
|
||||
{
|
||||
// NPC
|
||||
private static final int TUREK_ORC_WARLORD = 20495;
|
||||
|
||||
private TurekOrcWarlord()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
|
||||
addAttackId(TUREK_ORC_WARLORD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||
{
|
||||
if (npc.isScriptValue(1))
|
||||
{
|
||||
if (Rnd.get(100) < 40)
|
||||
{
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "You wont take me down easily."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.GENERAL, npc.getName(), "The battle has just begun!"));
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new TurekOrcWarlord();
|
||||
}
|
||||
}
|
||||
735
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Tutorial/Tutorial.java
vendored
Normal file
735
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Tutorial/Tutorial.java
vendored
Normal file
@@ -0,0 +1,735 @@
|
||||
/*
|
||||
* 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.others.Tutorial;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.TutorialCloseHtml;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.TutorialEnableClientEvent;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.TutorialShowHtml;
|
||||
|
||||
public class Tutorial extends Quest
|
||||
{
|
||||
// @formatter:off
|
||||
// table for Quest Timer ( Ex == -2 ) [raceId, voice, html]
|
||||
private static final String[][] QTEXMTWO =
|
||||
{
|
||||
{"0", "tutorial_voice_001a", "tutorial_human_fighter001.htm"},
|
||||
{"10", "tutorial_voice_001b", "tutorial_human_mage001.htm"},
|
||||
{"18", "tutorial_voice_001c", "tutorial_elven_fighter001.htm"},
|
||||
{"25", "tutorial_voice_001d", "tutorial_elven_mage001.htm"},
|
||||
{"31", "tutorial_voice_001e", "tutorial_delf_fighter001.htm"},
|
||||
{"38", "tutorial_voice_001f", "tutorial_delf_mage001.htm"},
|
||||
{"44", "tutorial_voice_001g", "tutorial_orc_fighter001.htm"},
|
||||
{"49", "tutorial_voice_001h", "tutorial_orc_mage001.htm"},
|
||||
{"53", "tutorial_voice_001i", "tutorial_dwarven_fighter001.htm"}
|
||||
};
|
||||
// table for Client Event Enable (8) [raceId, html, x, y, z]
|
||||
private static final String[][] CEEa =
|
||||
{
|
||||
{"0", "tutorial_human_fighter007.htm", "-71424", "258336", "-3109"},
|
||||
{"10", "tutorial_human_mage007.htm", "-91036", "248044", "-3568"},
|
||||
{"18", "tutorial_elf007.htm", "46112", "41200", "-3504"},
|
||||
{"25", "tutorial_elf007.htm", "46112", "41200", "-3504"},
|
||||
{"31", "tutorial_delf007.htm", "28384", "11056", "-4233"},
|
||||
{"38", "tutorial_delf007.htm", "28384", "11056", "-4233"},
|
||||
{"44", "tutorial_orc007.htm", "-56736", "-113680", "-672"},
|
||||
{"49", "tutorial_orc007.htm", "-56736", "-113680", "-672"},
|
||||
{"53", "tutorial_dwarven_fighter007.htm", "108567", "-173994", "-406"}
|
||||
};
|
||||
// table for Question Mark Clicked (9 & 11) learning skills [raceId, html, x, y, z]
|
||||
private static final String[][] QMCa =
|
||||
{
|
||||
{"0", "tutorial_fighter017.htm", "-83165", "242711", "-3720"},
|
||||
{"10", "tutorial_mage017.htm", "-85247", "244718", "-3720"},
|
||||
{"18", "tutorial_fighter017.htm", "45610", "52206", "-2792"},
|
||||
{"25", "tutorial_mage017.htm", "45610", "52206", "-2792"},
|
||||
{"31", "tutorial_fighter017.htm", "10344", "14445", "-4242"},
|
||||
{"38", "tutorial_mage017.htm", "10344", "14445", "-4242"},
|
||||
{"44", "tutorial_fighter017.htm", "-46324", "-114384", "-200"},
|
||||
{"49", "tutorial_fighter017.htm", "-46305", "-112763", "-200"},
|
||||
{"53", "tutorial_fighter017.htm", "115447", "-182672", "-1440"}
|
||||
};
|
||||
// @formatter:on
|
||||
// table for Question Mark Clicked (24) newbie lvl [raceId, html]
|
||||
private static final Map<Integer, String> QMCb = new HashMap<>();
|
||||
static
|
||||
{
|
||||
QMCb.put(0, "tutorial_human009.htm");
|
||||
QMCb.put(10, "tutorial_human009.htm");
|
||||
QMCb.put(18, "tutorial_elf009.htm");
|
||||
QMCb.put(25, "tutorial_elf009.htm");
|
||||
QMCb.put(31, "tutorial_delf009.htm");
|
||||
QMCb.put(38, "tutorial_delf009.htm");
|
||||
QMCb.put(44, "tutorial_orc009.htm");
|
||||
QMCb.put(49, "tutorial_orc009.htm");
|
||||
QMCb.put(53, "tutorial_dwarven009.htm");
|
||||
}
|
||||
// table for Question Mark Clicked (35) 1st class transfer [raceId, html]
|
||||
private static final Map<Integer, String> QMCc = new HashMap<>();
|
||||
static
|
||||
{
|
||||
QMCc.put(0, "tutorial_21.htm");
|
||||
QMCc.put(10, "tutorial_21a.htm");
|
||||
QMCc.put(18, "tutorial_21b.htm");
|
||||
QMCc.put(25, "tutorial_21c.htm");
|
||||
QMCc.put(31, "tutorial_21g.htm");
|
||||
QMCc.put(38, "tutorial_21h.htm");
|
||||
QMCc.put(44, "tutorial_21d.htm");
|
||||
QMCc.put(49, "tutorial_21e.htm");
|
||||
QMCc.put(53, "tutorial_21f.htm");
|
||||
}
|
||||
// table for Tutorial Close Link (26) 2nd class transfer [raceId, html]
|
||||
private static final Map<Integer, String> TCLa = new HashMap<>();
|
||||
static
|
||||
{
|
||||
TCLa.put(1, "tutorial_22w.htm");
|
||||
TCLa.put(4, "tutorial_22.htm");
|
||||
TCLa.put(7, "tutorial_22b.htm");
|
||||
TCLa.put(11, "tutorial_22c.htm");
|
||||
TCLa.put(15, "tutorial_22d.htm");
|
||||
TCLa.put(19, "tutorial_22e.htm");
|
||||
TCLa.put(22, "tutorial_22f.htm");
|
||||
TCLa.put(26, "tutorial_22g.htm");
|
||||
TCLa.put(29, "tutorial_22h.htm");
|
||||
TCLa.put(32, "tutorial_22n.htm");
|
||||
TCLa.put(35, "tutorial_22o.htm");
|
||||
TCLa.put(39, "tutorial_22p.htm");
|
||||
TCLa.put(42, "tutorial_22q.htm");
|
||||
TCLa.put(45, "tutorial_22i.htm");
|
||||
TCLa.put(47, "tutorial_22j.htm");
|
||||
TCLa.put(50, "tutorial_22k.htm");
|
||||
TCLa.put(54, "tutorial_22l.htm");
|
||||
TCLa.put(56, "tutorial_22m.htm");
|
||||
}
|
||||
// table for Tutorial Close Link (23) 2nd class transfer [raceId, html]
|
||||
private static final Map<Integer, String> TCLb = new HashMap<>();
|
||||
static
|
||||
{
|
||||
TCLb.put(4, "tutorial_22aa.htm");
|
||||
TCLb.put(7, "tutorial_22ba.htm");
|
||||
TCLb.put(11, "tutorial_22ca.htm");
|
||||
TCLb.put(15, "tutorial_22da.htm");
|
||||
TCLb.put(19, "tutorial_22ea.htm");
|
||||
TCLb.put(22, "tutorial_22fa.htm");
|
||||
TCLb.put(26, "tutorial_22ga.htm");
|
||||
TCLb.put(32, "tutorial_22na.htm");
|
||||
TCLb.put(35, "tutorial_22oa.htm");
|
||||
TCLb.put(39, "tutorial_22pa.htm");
|
||||
TCLb.put(50, "tutorial_22ka.htm");
|
||||
}
|
||||
// table for Tutorial Close Link (24) 2nd class transfer [raceId, html]
|
||||
private static final Map<Integer, String> TCLc = new HashMap<>();
|
||||
static
|
||||
{
|
||||
TCLc.put(4, "tutorial_22ab.htm");
|
||||
TCLc.put(7, "tutorial_22bb.htm");
|
||||
TCLc.put(11, "tutorial_22cb.htm");
|
||||
TCLc.put(15, "tutorial_22db.htm");
|
||||
TCLc.put(19, "tutorial_22eb.htm");
|
||||
TCLc.put(22, "tutorial_22fb.htm");
|
||||
TCLc.put(26, "tutorial_22gb.htm");
|
||||
TCLc.put(32, "tutorial_22nb.htm");
|
||||
TCLc.put(35, "tutorial_22ob.htm");
|
||||
TCLc.put(39, "tutorial_22pb.htm");
|
||||
TCLc.put(50, "tutorial_22kb.htm");
|
||||
}
|
||||
|
||||
public Tutorial()
|
||||
{
|
||||
super(-1, "ai/others");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
|
||||
{
|
||||
final QuestState qs = player.getQuestState(getName());
|
||||
if ((qs == null) || Config.DISABLE_TUTORIAL)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String html = "";
|
||||
|
||||
final int classId = player.getClassId().getId();
|
||||
final int ex = qs.getInt("Ex");
|
||||
if (event.startsWith("UC"))
|
||||
{
|
||||
if ((player.getLevel() < 6) && (qs.getInt("onlyone") == 0))
|
||||
{
|
||||
switch (qs.getInt("ucMemo"))
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
qs.set("ucMemo", "0");
|
||||
startQuestTimer("QT", 10000, null, player, false);
|
||||
qs.set("Ex", "-2");
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
qs.showQuestionMark(1);
|
||||
qs.playTutorialVoice("tutorial_voice_006");
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if (ex == 2)
|
||||
{
|
||||
qs.showQuestionMark(3);
|
||||
}
|
||||
else if (qs.getQuestItemsCount(6353) > 0)
|
||||
{
|
||||
qs.showQuestionMark(5);
|
||||
}
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
qs.showQuestionMark(12);
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
onTutorialClientEvent(player, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (event.startsWith("QT"))
|
||||
{
|
||||
if (ex == -2)
|
||||
{
|
||||
String voice = "";
|
||||
for (String[] element : QTEXMTWO)
|
||||
{
|
||||
if (classId == Integer.parseInt(element[0]))
|
||||
{
|
||||
voice = element[1];
|
||||
html = element[2];
|
||||
}
|
||||
}
|
||||
qs.playTutorialVoice(voice);
|
||||
qs.set("Ex", "-3");
|
||||
cancelQuestTimers("QT");
|
||||
startQuestTimer("QT", 30000, null, player, false);
|
||||
}
|
||||
else if (ex == -3)
|
||||
{
|
||||
qs.playTutorialVoice("tutorial_voice_002");
|
||||
qs.set("Ex", "0");
|
||||
}
|
||||
else if (ex == -4)
|
||||
{
|
||||
qs.playTutorialVoice("tutorial_voice_008");
|
||||
qs.set("Ex", "-5");
|
||||
}
|
||||
}
|
||||
// Tutorial close
|
||||
else if (event.startsWith("TE"))
|
||||
{
|
||||
cancelQuestTimers("TE");
|
||||
if (!event.equalsIgnoreCase("TE"))
|
||||
{
|
||||
switch (Integer.parseInt(event.substring(2)))
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
closeTutorialHtml(player);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
closeTutorialHtml(player);
|
||||
qs.playTutorialVoice("tutorial_voice_006");
|
||||
qs.showQuestionMark(1);
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
startQuestTimer("QT", 30000, null, player, false);
|
||||
qs.set("Ex", "-4");
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
qs.playTutorialVoice("tutorial_voice_003");
|
||||
html = "tutorial_02.htm";
|
||||
onTutorialClientEvent(player, 1);
|
||||
qs.set("Ex", "-5");
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
html = "tutorial_03.htm";
|
||||
onTutorialClientEvent(player, 2);
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
html = "tutorial_05.htm";
|
||||
onTutorialClientEvent(player, 8);
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
html = "tutorial_100.htm";
|
||||
onTutorialClientEvent(player, 0);
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
html = "tutorial_101.htm";
|
||||
onTutorialClientEvent(player, 0);
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
{
|
||||
html = "tutorial_103.htm";
|
||||
onTutorialClientEvent(player, 0);
|
||||
break;
|
||||
}
|
||||
case 12:
|
||||
{
|
||||
closeTutorialHtml(player);
|
||||
break;
|
||||
}
|
||||
case 23:
|
||||
{
|
||||
if (TCLb.containsKey(classId))
|
||||
{
|
||||
html = TCLb.get(classId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 24:
|
||||
{
|
||||
if (TCLc.containsKey(classId))
|
||||
{
|
||||
html = TCLc.get(classId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 25:
|
||||
{
|
||||
html = "tutorial_22cc.htm";
|
||||
break;
|
||||
}
|
||||
case 26:
|
||||
{
|
||||
if (TCLa.containsKey(classId))
|
||||
{
|
||||
html = TCLa.get(classId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 27:
|
||||
{
|
||||
html = "tutorial_29.htm";
|
||||
break;
|
||||
}
|
||||
case 28:
|
||||
{
|
||||
html = "tutorial_28.htm";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Client Event
|
||||
else if (event.startsWith("CE"))
|
||||
{
|
||||
final int eventId = Integer.parseInt(event.substring(2));
|
||||
if ((eventId == 1) && (player.getLevel() < 6))
|
||||
{
|
||||
qs.playTutorialVoice("tutorial_voice_004");
|
||||
html = "tutorial_03.htm";
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
onTutorialClientEvent(player, 2);
|
||||
}
|
||||
else if ((eventId == 2) && (player.getLevel() < 6))
|
||||
{
|
||||
qs.playTutorialVoice("tutorial_voice_005");
|
||||
html = "tutorial_05.htm";
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
onTutorialClientEvent(player, 8);
|
||||
}
|
||||
else if ((eventId == 8) && (player.getLevel() < 6))
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int z = 0;
|
||||
for (String[] element : CEEa)
|
||||
{
|
||||
if (classId == Integer.parseInt(element[0]))
|
||||
{
|
||||
html = element[1];
|
||||
x = Integer.parseInt(element[2]);
|
||||
y = Integer.parseInt(element[3]);
|
||||
z = Integer.parseInt(element[4]);
|
||||
}
|
||||
}
|
||||
if (x != 0)
|
||||
{
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
qs.addRadar(x, y, z);
|
||||
qs.playTutorialVoice("tutorial_voice_007");
|
||||
qs.set("ucMemo", "1");
|
||||
qs.set("Ex", "-5");
|
||||
}
|
||||
}
|
||||
else if ((eventId == 30) && (player.getLevel() < 10) && (qs.getInt("Die") == 0))
|
||||
{
|
||||
qs.playTutorialVoice("tutorial_voice_016");
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
qs.set("Die", "1");
|
||||
qs.showQuestionMark(8);
|
||||
onTutorialClientEvent(player, 0);
|
||||
}
|
||||
else if ((eventId == 800000) && (player.getLevel() < 6) && (qs.getInt("sit") == 0))
|
||||
{
|
||||
qs.playTutorialVoice("tutorial_voice_018");
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
qs.set("sit", "1");
|
||||
onTutorialClientEvent(player, 0);
|
||||
html = "tutorial_21z.htm";
|
||||
}
|
||||
else if (eventId == 40)
|
||||
{
|
||||
switch (player.getLevel())
|
||||
{
|
||||
case 5:
|
||||
{
|
||||
if (((qs.getInt("lvl") < 5) && !player.isMageClass()) || (classId == 49))
|
||||
{
|
||||
qs.playTutorialVoice("tutorial_voice_014");
|
||||
qs.showQuestionMark(9);
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
qs.set("lvl", "5");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
if ((qs.getInt("lvl") < 6) && (player.getClassId().level() == 0))
|
||||
{
|
||||
qs.playTutorialVoice("tutorial_voice_020");
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
qs.showQuestionMark(24);
|
||||
qs.set("lvl", "6");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
if ((qs.getInt("lvl") < 7) && player.isMageClass() && (classId != 49) && (player.getClassId().level() == 0))
|
||||
{
|
||||
qs.playTutorialVoice("tutorial_voice_019");
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
qs.set("lvl", "7");
|
||||
qs.showQuestionMark(11);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 15:
|
||||
{
|
||||
if (qs.getInt("lvl") < 15)
|
||||
{
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
qs.set("lvl", "15");
|
||||
qs.showQuestionMark(33);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 19:
|
||||
{
|
||||
if ((qs.getInt("lvl") < 19) && (player.getClassId().level() == 0))
|
||||
{
|
||||
switch (classId)
|
||||
{
|
||||
case 0:
|
||||
case 10:
|
||||
case 18:
|
||||
case 25:
|
||||
case 31:
|
||||
case 38:
|
||||
case 44:
|
||||
case 49:
|
||||
case 52:
|
||||
{
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
qs.set("lvl", "19");
|
||||
qs.showQuestionMark(35);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 35:
|
||||
{
|
||||
if ((qs.getInt("lvl") < 35) && (player.getClassId().level() == 1))
|
||||
{
|
||||
switch (classId)
|
||||
{
|
||||
case 1:
|
||||
case 4:
|
||||
case 7:
|
||||
case 11:
|
||||
case 15:
|
||||
case 19:
|
||||
case 22:
|
||||
case 26:
|
||||
case 29:
|
||||
case 32:
|
||||
case 35:
|
||||
case 39:
|
||||
case 42:
|
||||
case 45:
|
||||
case 47:
|
||||
case 50:
|
||||
case 54:
|
||||
case 56:
|
||||
{
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
qs.set("lvl", "35");
|
||||
qs.showQuestionMark(34);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((eventId == 45) && (player.getLevel() < 10) && (qs.getInt("HP") == 0))
|
||||
{
|
||||
qs.playTutorialVoice("tutorial_voice_017");
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
qs.set("HP", "1");
|
||||
qs.showQuestionMark(10);
|
||||
onTutorialClientEvent(player, 800000);
|
||||
}
|
||||
else if ((eventId == 57) && (player.getLevel() < 6) && (qs.getInt("Adena") == 0))
|
||||
{
|
||||
qs.playTutorialVoice("tutorial_voice_012");
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
qs.set("Adena", "1");
|
||||
qs.showQuestionMark(23);
|
||||
}
|
||||
else if ((eventId == 6353) && (player.getLevel() < 6) && (qs.getInt("Gemstone") == 0))
|
||||
{
|
||||
qs.playTutorialVoice("tutorial_voice_013");
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
qs.set("Gemstone", "1");
|
||||
qs.showQuestionMark(5);
|
||||
}
|
||||
else if ((eventId == 1048576) && (player.getLevel() < 6))
|
||||
{
|
||||
qs.showQuestionMark(5);
|
||||
qs.playTutorialVoice("tutorial_voice_013");
|
||||
qs.playSound("ItemSound.quest_tutorial");
|
||||
}
|
||||
}
|
||||
// Question mark clicked
|
||||
else if (event.startsWith("QM"))
|
||||
{
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int z = 0;
|
||||
switch (Integer.parseInt(event.substring(2)))
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
qs.playTutorialVoice("tutorial_voice_007");
|
||||
qs.set("Ex", "-5");
|
||||
for (String[] element : CEEa)
|
||||
{
|
||||
if (classId == Integer.parseInt(element[0]))
|
||||
{
|
||||
html = element[1];
|
||||
x = Integer.parseInt(element[2]);
|
||||
y = Integer.parseInt(element[3]);
|
||||
z = Integer.parseInt(element[4]);
|
||||
}
|
||||
}
|
||||
qs.addRadar(x, y, z);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
html = "tutorial_09.htm";
|
||||
onTutorialClientEvent(player, 1048576);
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
for (String[] element : CEEa)
|
||||
{
|
||||
if (classId == Integer.parseInt(element[0]))
|
||||
{
|
||||
html = element[1];
|
||||
x = Integer.parseInt(element[2]);
|
||||
y = Integer.parseInt(element[3]);
|
||||
z = Integer.parseInt(element[4]);
|
||||
}
|
||||
}
|
||||
qs.addRadar(x, y, z);
|
||||
html = "tutorial_11.htm";
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
html = "tutorial_15.htm";
|
||||
qs.set("ucMemo", "3");
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
html = "tutorial_18.htm";
|
||||
break;
|
||||
}
|
||||
case 9:
|
||||
{
|
||||
for (String[] element : QMCa)
|
||||
{
|
||||
if (classId == Integer.parseInt(element[0]))
|
||||
{
|
||||
html = element[1];
|
||||
x = Integer.parseInt(element[2]);
|
||||
y = Integer.parseInt(element[3]);
|
||||
z = Integer.parseInt(element[4]);
|
||||
}
|
||||
}
|
||||
if (x != 0)
|
||||
{
|
||||
qs.addRadar(x, y, z);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
{
|
||||
html = "tutorial_19.htm";
|
||||
break;
|
||||
}
|
||||
case 11:
|
||||
{
|
||||
for (String[] element : QMCa)
|
||||
{
|
||||
if (classId == Integer.parseInt(element[0]))
|
||||
{
|
||||
html = element[1];
|
||||
x = Integer.parseInt(element[2]);
|
||||
y = Integer.parseInt(element[3]);
|
||||
z = Integer.parseInt(element[4]);
|
||||
}
|
||||
}
|
||||
if (x != 0)
|
||||
{
|
||||
qs.addRadar(x, y, z);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 12:
|
||||
{
|
||||
html = "tutorial_15.htm";
|
||||
qs.set("ucMemo", "4");
|
||||
break;
|
||||
}
|
||||
case 17:
|
||||
{
|
||||
html = "tutorial_30.htm";
|
||||
break;
|
||||
}
|
||||
case 23:
|
||||
{
|
||||
html = "tutorial_24.htm";
|
||||
break;
|
||||
}
|
||||
case 24:
|
||||
{
|
||||
if (QMCb.containsKey(classId))
|
||||
{
|
||||
html = QMCb.get(classId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 26:
|
||||
{
|
||||
html = player.isMageClass() && (classId != 49) ? "tutorial_newbie004b.htm" : "tutorial_newbie004a.htm";
|
||||
break;
|
||||
}
|
||||
case 33:
|
||||
{
|
||||
html = "tutorial_27.htm";
|
||||
break;
|
||||
}
|
||||
case 34:
|
||||
{
|
||||
html = "tutorial_28.htm";
|
||||
break;
|
||||
}
|
||||
case 35:
|
||||
{
|
||||
if (QMCc.containsKey(classId))
|
||||
{
|
||||
html = QMCc.get(classId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (html.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
showTutorialHTML(player, html);
|
||||
return null;
|
||||
}
|
||||
|
||||
private void showTutorialHTML(PlayerInstance player, String html)
|
||||
{
|
||||
String text = HtmCache.getInstance().getHtm("data/scripts/ai/others/Tutorial/" + html);
|
||||
if (text == null)
|
||||
{
|
||||
LOGGER.warning("missing html page data/scripts/ai/others/Tutorial/" + html);
|
||||
text = "<html><body>File data/scripts/ai/others/Tutorial/" + html + " not found or file is empty.</body></html>";
|
||||
}
|
||||
|
||||
player.sendPacket(new TutorialShowHtml(text));
|
||||
}
|
||||
|
||||
private void closeTutorialHtml(PlayerInstance player)
|
||||
{
|
||||
player.sendPacket(TutorialCloseHtml.STATIC_PACKET);
|
||||
}
|
||||
|
||||
private void onTutorialClientEvent(PlayerInstance player, int number)
|
||||
{
|
||||
player.sendPacket(new TutorialEnableClientEvent(number));
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new Tutorial();
|
||||
}
|
||||
}
|
||||
5
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Tutorial/tutorial_02.htm
vendored
Normal file
5
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Tutorial/tutorial_02.htm
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<html><body>
|
||||
<center><font color="LEVEL">[Movement ]</font></center><br>
|
||||
Move your mouse cursor to the spot to which you want to move and <font color="FF0000">left-click</font>. Then, you will be moved to that location.<img src="L2UI_CH3.tutorial_img01" width=64 height=64><img src="L2UI_CH3.tutorial_img021" width=64 height=64><br>
|
||||
<a action="link TE07">Exit the Tutorial</a>
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Tutorial/tutorial_03.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Tutorial/tutorial_03.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body>
|
||||
<center><font color="LEVEL">[Changing Point-Of-View]</font></center><br>
|
||||
Good work! Now, I will explain to you how you can change your point-of-view.<br>
|
||||
<font color="FF0000">Try moving your mouse while pressing down the right button. </font> You can set your viewpoint in any direction.<img src="L2UI_CH3.tutorial_img04" width=128 height=64><br>When you need to examine the area around your character, you can use this feature to change your viewpoint as needed.<br>
|
||||
<a action="link TE08">Exit the Tutorial</a>
|
||||
</body></html>
|
||||
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Tutorial/tutorial_04.htm
vendored
Normal file
6
L2J_Mobius_C4_ScionsOfDestiny/dist/game/data/scripts/ai/others/Tutorial/tutorial_04.htm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<html><body><center><font color="LEVEL">Using the Mouse Wheel</font></center><br>
|
||||
Good work. Now you will learn about enlarging and shrinking the screen using the mouse wheel.<br>
|
||||
If you rotate the <font color="LEVEL">mouse wheel</font> down, you enlarge the game screen. Rotate the wheel up to reduce the screen.<br>
|
||||
The more you turn the wheel, the larger or smaller the screen becomes, but notice that there is a limit to how far you can go in either direction.<br>
|
||||
<a action="link TE09">Close Window</a>
|
||||
</body></html>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user