Code review Part 4.

This commit is contained in:
MobiusDevelopment
2019-12-21 21:39:37 +00:00
parent cd1f62cc68
commit 4a563b8832
8097 changed files with 41111 additions and 57926 deletions

View File

@@ -230,20 +230,13 @@ public class BeastFarm extends AbstractNpcAI
public void spawnNext(Npc npc, PlayerInstance player, int nextNpcId, int food)
{
// remove the feedinfo of the mob that got despawned, if any
if (_feedInfo.containsKey(npc.getObjectId()))
if (_feedInfo.containsKey(npc.getObjectId()) && (_feedInfo.get(npc.getObjectId()) == player.getObjectId()))
{
if (_feedInfo.get(npc.getObjectId()) == player.getObjectId())
{
_feedInfo.remove(npc.getObjectId());
}
_feedInfo.remove(npc.getObjectId());
}
// despawn the old mob
// TODO: same code? FIXED?
/*
* if (_GrowthCapableMobs.get(npc.getNpcId()).getGrowthLevel() == 0) { npc.deleteMe(); } else {
*/
npc.deleteMe();
// }
// if this is finally a trained mob, then despawn any other trained mobs that the
// player might have and initialize the Tamed Beast.

View File

@@ -144,12 +144,9 @@ public class ImprovedBabyPets extends AbstractNpcAI
if (!owner.hasAbnormalType(skill.getSkill().getAbnormalType()) && SkillCaster.checkUseConditions(summon, skill.getSkill()) && !owner.isDead())
{
if (mergedSkill != null)
if ((mergedSkill != null) && owner.hasAbnormalType(mergedSkill.getSkill().getAbnormalType()))
{
if (owner.hasAbnormalType(mergedSkill.getSkill().getAbnormalType()))
{
return false;
}
return false;
}
if (!previousFollowStatus && !summon.isInsideRadius3D(owner, skill.getSkill().getCastRange()))
@@ -188,17 +185,14 @@ public class ImprovedBabyPets extends AbstractNpcAI
return;
}
if (!owner.hasAbnormalType(skill.getSkill().getAbnormalType()))
if (!owner.hasAbnormalType(skill.getSkill().getAbnormalType()) && (targetType >= 0) && (targetType <= 2))
{
if ((targetType >= 0) && (targetType <= 2))
summon.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, skill.getSkill(), (targetType == 1) ? summon : owner);
summon.sendPacket(new SystemMessage(SystemMessageId.YOUR_PET_USES_S1).addSkillName(skill.getSkill()));
if (previousFollowStatus != summon.getFollowStatus())
{
summon.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, skill.getSkill(), (targetType == 1) ? summon : owner);
summon.sendPacket(new SystemMessage(SystemMessageId.YOUR_PET_USES_S1).addSkillName(skill.getSkill()));
if (previousFollowStatus != summon.getFollowStatus())
{
summon.setFollowStatus(previousFollowStatus);
}
summon.setFollowStatus(previousFollowStatus);
}
}
}

View File

@@ -75,22 +75,19 @@ public class Alarm extends AbstractNpcAI
}
case "RECORDER_CRUSHED":
{
if (npc0 != null)
if ((npc0 != null) && npc0.getVariables().getBoolean("SPAWNED"))
{
if (npc0.getVariables().getBoolean("SPAWNED"))
npc0.getVariables().set("SPAWNED", false);
if (player0 != null)
{
npc0.getVariables().set("SPAWNED", false);
if (player0 != null)
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.RECORDER_CRUSHED);
if (verifyMemoState(player0, ART_OF_PERSUASION_ID, -1))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.RECORDER_CRUSHED);
if (verifyMemoState(player0, ART_OF_PERSUASION_ID, -1))
{
setMemoState(player0, ART_OF_PERSUASION_ID, 5);
}
else if (verifyMemoState(player0, NIKOLAS_COOPERATION_ID, -1))
{
setMemoState(player0, NIKOLAS_COOPERATION_ID, 5);
}
setMemoState(player0, ART_OF_PERSUASION_ID, 5);
}
else if (verifyMemoState(player0, NIKOLAS_COOPERATION_ID, -1))
{
setMemoState(player0, NIKOLAS_COOPERATION_ID, 5);
}
}
}

View File

@@ -207,16 +207,13 @@ public class DenOfEvil extends AbstractNpcAI
final Skill skill = SkillData.getInstance().getSkill(6149, 1);
skill.applyEffects(creature, creature);
}
else if (creature.doDie(null)) // mobs die
else if (creature.doDie(null) && creature.isNpc())
{
if (creature.isNpc())
// respawn eye
final Npc npc = (Npc) creature;
if (CommonUtil.contains(EYE_IDS, npc.getId()))
{
// respawn eye
final Npc npc = (Npc) creature;
if (CommonUtil.contains(EYE_IDS, npc.getId()))
{
ThreadPool.schedule(new RespawnNewEye(npc.getLocation()), 15000);
}
ThreadPool.schedule(new RespawnNewEye(npc.getLocation()), 15000);
}
}
}

View File

@@ -171,10 +171,6 @@ public class Parade extends AbstractNpcAI
private class Start implements Runnable
{
public Start()
{
}
@Override
public void run()
{
@@ -187,10 +183,6 @@ public class Parade extends AbstractNpcAI
private class Spawn implements Runnable
{
public Spawn()
{
}
@Override
public void run()
{
@@ -221,14 +213,10 @@ public class Parade extends AbstractNpcAI
private class Delete implements Runnable
{
public Delete()
{
}
@Override
public void run()
{
if (spawns.size() <= 0)
if (spawns.isEmpty())
{
return;
}
@@ -247,7 +235,7 @@ public class Parade extends AbstractNpcAI
}
}
}
if ((spawns.size() == 0) && (deleteTask != null))
if ((spawns.isEmpty()) && (deleteTask != null))
{
deleteTask.cancel(false);
}
@@ -256,10 +244,6 @@ public class Parade extends AbstractNpcAI
private class Clean implements Runnable
{
public Clean()
{
}
@Override
public void run()
{

View File

@@ -164,14 +164,11 @@ public class GainakSiege extends AbstractNpcAI
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
public void onPlayerDeath(OnCreatureDeath event)
{
if (_isInSiege && GAINAK_SIEGE_ZONE.getCharactersInside().contains(event.getTarget()))
if (_isInSiege && GAINAK_SIEGE_ZONE.getCharactersInside().contains(event.getTarget()) && event.getAttacker().isPlayer() && event.getTarget().isPlayer())
{
if (event.getAttacker().isPlayer() && event.getTarget().isPlayer())
{
final PlayerInstance attackerPlayer = event.getAttacker().getActingPlayer();
attackerPlayer.setPvpKills(attackerPlayer.getPvpKills() + 1);
attackerPlayer.sendPacket(new UserInfo(attackerPlayer));
}
final PlayerInstance attackerPlayer = event.getAttacker().getActingPlayer();
attackerPlayer.setPvpKills(attackerPlayer.getPvpKills() + 1);
attackerPlayer.sendPacket(new UserInfo(attackerPlayer));
}
}

View File

@@ -58,7 +58,7 @@ import quests.Q00620_FourGoblets.Q00620_FourGoblets;
*/
public class FourSepulchers extends AbstractNpcAI implements IXmlReader
{
Logger LOGGER = Logger.getLogger(FourSepulchers.class.getName());
private static final Logger LOGGER = Logger.getLogger(FourSepulchers.class.getName());
// NPCs
private static final int CONQUEROR_MANAGER = 31921;
@@ -259,10 +259,7 @@ public class FourSepulchers extends AbstractNpcAI implements IXmlReader
if ((doorInfo[0] == sepulcherId) && (doorInfo[1] == currentWave))
{
openDoor(doorInfo[2], 0);
ThreadPool.schedule(() ->
{
closeDoor(doorInfo[2], 0);
}, 15000);
ThreadPool.schedule(() -> closeDoor(doorInfo[2], 0), 15000);
break;
}
}
@@ -582,10 +579,7 @@ public class FourSepulchers extends AbstractNpcAI implements IXmlReader
showHtmlFile(player, npcId + "-OK.html", npc, null);
// Kick all players when/if time is over
ThreadPool.schedule(() ->
{
ZoneManager.getInstance().getZoneById(MANAGER_ZONES.get(npcId)).oustAllPlayers();
}, TIME_ATTACK * 60 * 1000);
ThreadPool.schedule(() -> ZoneManager.getInstance().getZoneById(MANAGER_ZONES.get(npcId)).oustAllPlayers(), TIME_ATTACK * 60 * 1000);
// Save attack time
vars.set("FourSepulchers" + npcId, System.currentTimeMillis());

View File

@@ -204,30 +204,27 @@ public class DarkWaterDragon extends AbstractNpcAI
{
final int npcId = npc.getId();
final int npcObjId = npc.getObjectId();
if (npcId == FAFURION)
if ((npcId == FAFURION) && MY_TRACKING_SET.add(npcObjId))
{
if (MY_TRACKING_SET.add(npcObjId))
{
// Spawn 4 Detractors on spawn of Fafurion
final int x = npc.getX();
final int y = npc.getY();
addSpawn(DETRACTOR2, x + 100, y + 100, npc.getZ(), 0, false, 40000);
addSpawn(DETRACTOR1, x + 100, y - 100, npc.getZ(), 0, false, 40000);
addSpawn(DETRACTOR2, x - 100, y + 100, npc.getZ(), 0, false, 40000);
addSpawn(DETRACTOR1, x - 100, y - 100, npc.getZ(), 0, false, 40000);
cancelQuestTimer("first_spawn", npc, null);
cancelQuestTimer("second_spawn", npc, null);
cancelQuestTimer("third_spawn", npc, null);
cancelQuestTimer("fourth_spawn", npc, null);
cancelQuestTimer("fafurion_poison", npc, null);
cancelQuestTimer("fafurion_despawn", npc, null);
startQuestTimer("first_spawn", 2000, npc, null); // timer to delay timer "1"
startQuestTimer("second_spawn", 4000, npc, null); // timer to delay timer "2"
startQuestTimer("third_spawn", 8000, npc, null); // timer to delay timer "3"
startQuestTimer("fourth_spawn", 10000, npc, null); // timer to delay timer "4"
startQuestTimer("fafurion_poison", 3000, npc, null, true); // Every three seconds reduces Fafurions hp like it is poisoned
startQuestTimer("fafurion_despawn", 120000, npc, null); // Fafurion Kindred disappears after two minutes
}
// Spawn 4 Detractors on spawn of Fafurion
final int x = npc.getX();
final int y = npc.getY();
addSpawn(DETRACTOR2, x + 100, y + 100, npc.getZ(), 0, false, 40000);
addSpawn(DETRACTOR1, x + 100, y - 100, npc.getZ(), 0, false, 40000);
addSpawn(DETRACTOR2, x - 100, y + 100, npc.getZ(), 0, false, 40000);
addSpawn(DETRACTOR1, x - 100, y - 100, npc.getZ(), 0, false, 40000);
cancelQuestTimer("first_spawn", npc, null);
cancelQuestTimer("second_spawn", npc, null);
cancelQuestTimer("third_spawn", npc, null);
cancelQuestTimer("fourth_spawn", npc, null);
cancelQuestTimer("fafurion_poison", npc, null);
cancelQuestTimer("fafurion_despawn", npc, null);
startQuestTimer("first_spawn", 2000, npc, null); // timer to delay timer "1"
startQuestTimer("second_spawn", 4000, npc, null); // timer to delay timer "2"
startQuestTimer("third_spawn", 8000, npc, null); // timer to delay timer "3"
startQuestTimer("fourth_spawn", 10000, npc, null); // timer to delay timer "4"
startQuestTimer("fafurion_poison", 3000, npc, null, true); // Every three seconds reduces Fafurions hp like it is poisoned
startQuestTimer("fafurion_despawn", 120000, npc, null); // Fafurion Kindred disappears after two minutes
}
return super.onSpawn(npc);
}

View File

@@ -67,10 +67,7 @@ public class Rignos extends AbstractNpcAI
{
TIMER.getSkill().applyEffects(pet, pet);
}
player.getServitors().values().forEach(s ->
{
TIMER.getSkill().applyEffects(s, s);
});
player.getServitors().values().forEach(s -> TIMER.getSkill().applyEffects(s, s));
if (hasQuestItems(player, STAMP))
{

View File

@@ -235,7 +235,7 @@ public class KetraOrcSupport extends AbstractNpcAI
return htmltext;
}
public static void main(String args[])
public static void main(String[] args)
{
new KetraOrcSupport();
}

View File

@@ -49,10 +49,6 @@ public class LindviorScene extends AbstractNpcAI
private static boolean ALT_MODE = false;
private static int ALT_MODE_MIN = 120; // schedule delay in minutes if ALT_MODE enabled
private Npc _lindviorCamera = null;
private Npc _tomaris = null;
private Npc _artius = null;
public LindviorScene()
{
scheduleNextLindviorVisit();
@@ -88,14 +84,14 @@ public class LindviorScene extends AbstractNpcAI
}
case "start":
{
_lindviorCamera = SpawnTable.getInstance().getAnySpawn(LINDVIOR_CAMERA).getLastSpawn();
_tomaris = SpawnTable.getInstance().getAnySpawn(TOMARIS).getLastSpawn();
_artius = SpawnTable.getInstance().getAnySpawn(ARTIUS).getLastSpawn();
final Npc lindviorCamera = SpawnTable.getInstance().getAnySpawn(LINDVIOR_CAMERA).getLastSpawn();
final Npc tomaris = SpawnTable.getInstance().getAnySpawn(TOMARIS).getLastSpawn();
final Npc artius = SpawnTable.getInstance().getAnySpawn(ARTIUS).getLastSpawn();
startQuestTimer("tomaris_shout1", 1000, _tomaris, null);
startQuestTimer("artius_shout", 60000, _artius, null);
startQuestTimer("tomaris_shout2", 90000, _tomaris, null);
startQuestTimer("lindvior_scene", 120000, _lindviorCamera, null);
startQuestTimer("tomaris_shout1", 1000, tomaris, null);
startQuestTimer("artius_shout", 60000, artius, null);
startQuestTimer("tomaris_shout2", 90000, tomaris, null);
startQuestTimer("lindvior_scene", 120000, lindviorCamera, null);
scheduleNextLindviorVisit();
break;
}

View File

@@ -113,10 +113,7 @@ public class EntrancePortalToCrystalCaverns extends AbstractNpcAI
{
final int currentTemplateId = getCurrentInstanceTemplateId();
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 500, p ->
{
updateTriggersForPlayer(player, currentTemplateId);
});
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 500, p -> updateTriggersForPlayer(player, currentTemplateId));
}
}

View File

@@ -33,7 +33,7 @@ import ai.AbstractNpcAI;
*/
public class PlainsOfDion extends AbstractNpcAI
{
private static final int DELU_LIZARDMEN[] =
private static final int[] DELU_LIZARDMEN =
{
21104, // Delu Lizardman Supplier
21105, // Delu Lizardman Special Agent

View File

@@ -283,13 +283,10 @@ public class PrimevalIsle extends AbstractNpcAI
npc.doCast(physicalSpecial1.getSkill());
}
}
else if (getRandom(100) <= (probPhysicalSpecial2 * npc.getVariables().getInt("SKILL_MULTIPLER")))
else if ((getRandom(100) <= (probPhysicalSpecial2 * npc.getVariables().getInt("SKILL_MULTIPLER"))) && !npc.isSkillDisabled(physicalSpecial2.getSkill()))
{
if (!npc.isSkillDisabled(physicalSpecial2.getSkill()))
{
npc.setTarget(creature);
npc.doCast(physicalSpecial2.getSkill());
}
npc.setTarget(creature);
npc.doCast(physicalSpecial2.getSkill());
}
}
}
@@ -349,20 +346,14 @@ public class PrimevalIsle extends AbstractNpcAI
npc.doCast(SELFBUFF1.getSkill());
}
}
else if (npc.isScriptValue(1))
else if (npc.isScriptValue(1) && !npc.isSkillDisabled(SELFBUFF2.getSkill()))
{
if (!npc.isSkillDisabled(SELFBUFF2.getSkill()))
{
npc.doCast(SELFBUFF2.getSkill());
}
npc.doCast(SELFBUFF2.getSkill());
}
}
else if ((((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 60) && (npc.isScriptValue(3)))
else if ((((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 60) && (npc.isScriptValue(3)) && !npc.isSkillDisabled(SELFBUFF1.getSkill()))
{
if (!npc.isSkillDisabled(SELFBUFF1.getSkill()))
{
npc.doCast(SELFBUFF1.getSkill());
}
npc.doCast(SELFBUFF1.getSkill());
}
if (Util.calculateDistance(npc, attacker, true, false) > 100)
@@ -431,21 +422,15 @@ public class PrimevalIsle extends AbstractNpcAI
if (target != null)
{
if (getRandom(100) <= (probPhysicalSpecial1 * npc.getVariables().getInt("SKILL_MULTIPLER")))
if ((getRandom(100) <= (probPhysicalSpecial1 * npc.getVariables().getInt("SKILL_MULTIPLER"))) && !npc.isSkillDisabled(physicalSpecial1.getSkill()))
{
if (!npc.isSkillDisabled(physicalSpecial1.getSkill()))
{
npc.setTarget(target);
npc.doCast(physicalSpecial1.getSkill());
}
npc.setTarget(target);
npc.doCast(physicalSpecial1.getSkill());
}
if (getRandom(100) <= (probPhysicalSpecial2 * npc.getVariables().getInt("SKILL_MULTIPLER")))
if ((getRandom(100) <= (probPhysicalSpecial2 * npc.getVariables().getInt("SKILL_MULTIPLER"))) && !npc.isSkillDisabled(physicalSpecial2.getSkill()))
{
if (!npc.isSkillDisabled(physicalSpecial2.getSkill()))
{
npc.setTarget(target);
npc.doCast(physicalSpecial2.getSkill());
}
npc.setTarget(target);
npc.doCast(physicalSpecial2.getSkill());
}
}
}

View File

@@ -245,7 +245,7 @@ public class Venom extends AbstractNpcAI
{
teleportTarget(player);
((Attackable) npc).stopHating(player);
if ((_targets != null) && (_targets.size() > 0))
if ((_targets != null) && !_targets.isEmpty())
{
for (PlayerInstance target : _targets)
{

View File

@@ -169,13 +169,13 @@ public class Maguen extends AbstractNpcAI
@Override
public String onSpellFinished(Npc npc, PlayerInstance player, Skill skill)
{
final BuffInfo b_info = player.getEffectList().getFirstBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType());
final BuffInfo c_info = player.getEffectList().getFirstBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType());
final BuffInfo r_info = player.getEffectList().getFirstBuffInfoByAbnormalType(R_PLASMA1.getSkill().getAbnormalType());
final BuffInfo bInfo = player.getEffectList().getFirstBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType());
final BuffInfo cInfo = player.getEffectList().getFirstBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType());
final BuffInfo rInfo = player.getEffectList().getFirstBuffInfoByAbnormalType(R_PLASMA1.getSkill().getAbnormalType());
final int b = b_info == null ? 0 : b_info.getSkill().getAbnormalLvl();
final int c = c_info == null ? 0 : c_info.getSkill().getAbnormalLvl();
final int r = r_info == null ? 0 : r_info.getSkill().getAbnormalLvl();
final int b = bInfo == null ? 0 : bInfo.getSkill().getAbnormalLvl();
final int c = cInfo == null ? 0 : cInfo.getSkill().getAbnormalLvl();
final int r = rInfo == null ? 0 : rInfo.getSkill().getAbnormalLvl();
if ((b == 3) && (c == 0) && (r == 0))
{
@@ -259,103 +259,100 @@ public class Maguen extends AbstractNpcAI
@Override
public String onSkillSee(Npc npc, PlayerInstance caster, Skill skill, WorldObject[] targets, boolean isSummon)
{
if ((skill == MACHINE.getSkill()) && (caster == npc.getVariables().getObject("SUMMON_PLAYER", PlayerInstance.class)))
if ((skill == MACHINE.getSkill()) && (caster == npc.getVariables().getObject("SUMMON_PLAYER", PlayerInstance.class)) && (npc.getVariables().getInt("NPC_EFFECT") != 0) && (npc.getVariables().getInt("BLOCKED_SKILLSEE") == 0))
{
if ((npc.getVariables().getInt("NPC_EFFECT") != 0) && (npc.getVariables().getInt("BLOCKED_SKILLSEE") == 0))
final BuffInfo i1Info = caster.getEffectList().getFirstBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType());
final BuffInfo i2Info = caster.getEffectList().getFirstBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType());
final BuffInfo i3Info = caster.getEffectList().getFirstBuffInfoByAbnormalType(R_PLASMA1.getSkill().getAbnormalType());
final int i1 = i1Info == null ? 0 : i1Info.getSkill().getAbnormalLvl();
final int i2 = i2Info == null ? 0 : i2Info.getSkill().getAbnormalLvl();
final int i3 = i3Info == null ? 0 : i3Info.getSkill().getAbnormalLvl();
caster.getEffectList().stopEffects(B_PLASMA1.getSkill().getAbnormalType());
caster.getEffectList().stopEffects(C_PLASMA1.getSkill().getAbnormalType());
caster.getEffectList().stopEffects(R_PLASMA1.getSkill().getAbnormalType());
cancelQuestTimer("FIRST_TIMER", npc, caster);
cancelQuestTimer("SECOND_TIMER", npc, caster);
cancelQuestTimer("THIRD_TIMER", npc, caster);
cancelQuestTimer("FORTH_TIMER", npc, caster);
npc.getVariables().set("BLOCKED_SKILLSEE", 1);
SkillHolder skillToCast = null;
switch (npc.getVariables().getInt("NPC_EFFECT"))
{
final BuffInfo i1_info = caster.getEffectList().getFirstBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType());
final BuffInfo i2_info = caster.getEffectList().getFirstBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType());
final BuffInfo i3_info = caster.getEffectList().getFirstBuffInfoByAbnormalType(R_PLASMA1.getSkill().getAbnormalType());
final int i1 = i1_info == null ? 0 : i1_info.getSkill().getAbnormalLvl();
final int i2 = i2_info == null ? 0 : i2_info.getSkill().getAbnormalLvl();
final int i3 = i3_info == null ? 0 : i3_info.getSkill().getAbnormalLvl();
caster.getEffectList().stopEffects(B_PLASMA1.getSkill().getAbnormalType());
caster.getEffectList().stopEffects(C_PLASMA1.getSkill().getAbnormalType());
caster.getEffectList().stopEffects(R_PLASMA1.getSkill().getAbnormalType());
cancelQuestTimer("FIRST_TIMER", npc, caster);
cancelQuestTimer("SECOND_TIMER", npc, caster);
cancelQuestTimer("THIRD_TIMER", npc, caster);
cancelQuestTimer("FORTH_TIMER", npc, caster);
npc.getVariables().set("BLOCKED_SKILLSEE", 1);
SkillHolder skillToCast = null;
switch (npc.getVariables().getInt("NPC_EFFECT"))
case 1:
{
case 1:
switch (i1)
{
switch (i1)
case 0:
{
case 0:
{
skillToCast = B_PLASMA1;
break;
}
case 1:
{
skillToCast = B_PLASMA2;
break;
}
case 2:
{
skillToCast = B_PLASMA3;
break;
}
skillToCast = B_PLASMA1;
break;
}
break;
}
case 2:
{
switch (i2)
case 1:
{
case 0:
{
skillToCast = C_PLASMA1;
break;
}
case 1:
{
skillToCast = C_PLASMA2;
break;
}
case 2:
{
skillToCast = C_PLASMA3;
break;
}
skillToCast = B_PLASMA2;
break;
}
break;
}
case 3:
{
switch (i3)
case 2:
{
case 0:
{
skillToCast = R_PLASMA1;
break;
}
case 1:
{
skillToCast = R_PLASMA2;
break;
}
case 2:
{
skillToCast = R_PLASMA3;
break;
}
skillToCast = B_PLASMA3;
break;
}
break;
}
break;
}
if (skillToCast != null)
case 2:
{
npc.setTarget(caster);
npc.doCast(skillToCast.getSkill());
switch (i2)
{
case 0:
{
skillToCast = C_PLASMA1;
break;
}
case 1:
{
skillToCast = C_PLASMA2;
break;
}
case 2:
{
skillToCast = C_PLASMA3;
break;
}
}
break;
}
case 3:
{
switch (i3)
{
case 0:
{
skillToCast = R_PLASMA1;
break;
}
case 1:
{
skillToCast = R_PLASMA2;
break;
}
case 2:
{
skillToCast = R_PLASMA3;
break;
}
}
break;
}
}
if (skillToCast != null)
{
npc.setTarget(caster);
npc.doCast(skillToCast.getSkill());
}
}
return super.onSkillSee(npc, caster, skill, targets, isSummon);
@@ -385,7 +382,7 @@ public class Maguen extends AbstractNpcAI
{
giveItems(player, MAGUEN_PET, 1);
}
else if ((chance1 == 0) && (chance2 == 0))
else if (chance1 == 0)
{
giveItems(player, ELITE_MAGUEN_PET, 1);
}

View File

@@ -346,13 +346,10 @@ public class SeedOfAnnihilation extends AbstractNpcAI
// Conditions for Quest 454
World.getInstance().forEachVisibleObjectInRange(creature, Npc.class, 500, npc ->
{
if ((npc.getId() == 32738) && (npc.getTarget() != null))
if ((npc.getId() == 32738) && (npc.getTarget() != null) && (npc.getTarget().getObjectId() == creature.getObjectId()))
{
if (npc.getTarget().getObjectId() == creature.getObjectId())
{
npc.teleToLocation(teleLoc, false);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, creature, 150);
}
npc.teleToLocation(teleLoc, false);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, creature, 150);
}
});
creature.teleToLocation(teleLoc, false);

View File

@@ -92,24 +92,22 @@ public class StakatoNest extends AbstractNpcAI
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon)
{
final MonsterInstance mob = (MonsterInstance) npc;
if ((mob.getId() == STAKATO_LEADER) && (getRandom(1000) < 100) && (mob.getCurrentHp() < (mob.getMaxHp() * 0.3)))
{
final MonsterInstance _follower = checkMinion(npc);
if (_follower != null)
final MonsterInstance follower = checkMinion(npc);
if (follower != null)
{
final double _hp = _follower.getCurrentHp();
final double _hp = follower.getCurrentHp();
if (_hp > (_follower.getMaxHp() * 0.3))
if (_hp > (follower.getMaxHp() * 0.3))
{
mob.abortAttack();
mob.abortCast();
mob.setHeading(Util.calculateHeadingFrom(mob, _follower));
mob.setHeading(Util.calculateHeadingFrom(mob, follower));
mob.doCast(DEVOUR_SUBORDINATE.getSkill());
mob.setCurrentHp(mob.getCurrentHp() + _hp);
_follower.doDie(_follower);
_follower.deleteMe();
follower.doDie(follower);
follower.deleteMe();
}
}
}

View File

@@ -16,7 +16,7 @@
*/
package ai.areas.TalkingIsland.AwakeningMaster;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Map;
import java.util.Map.Entry;
@@ -66,7 +66,7 @@ public class AwakeningMaster extends AbstractNpcAI
private static final int SCROLL_OF_AFTERLIFE = 17600;
private static final int CHAOS_POMANDER = 37374;
private static final int CHAOS_POMANDER_DUAL_CLASS = 37375;
private static final Map<CategoryType, Integer> AWAKE_POWER = new HashMap<>();
private static final Map<CategoryType, Integer> AWAKE_POWER = new EnumMap<>(CategoryType.class);
static
{
AWAKE_POWER.put(CategoryType.SIXTH_SIGEL_GROUP, 32264);
@@ -347,10 +347,7 @@ public class AwakeningMaster extends AbstractNpcAI
}
player.sendSkillList();
ThreadPool.schedule(() ->
{
player.sendPacket(ExShowUsm.AWAKENING_END);
}, 10000);
ThreadPool.schedule(() -> player.sendPacket(ExShowUsm.AWAKENING_END), 10000);
}
public static void main(String[] args)

View File

@@ -92,8 +92,8 @@ public class Hardin extends AbstractNpcAI
}
if (Config.HARDIN_SAME_AWAKEN_GROUP)
{
final String original = c.toString().contains("_") ? c.toString().substring(0, c.toString().indexOf("_") - 1) : c.toString();
final String search = player.getClassId().toString().contains("_") ? player.getClassId().toString().substring(0, player.getClassId().toString().indexOf("_") - 1) : player.getClassId().toString();
final String original = c.toString().contains("_") ? c.toString().substring(0, c.toString().indexOf('_') - 1) : c.toString();
final String search = player.getClassId().toString().contains("_") ? player.getClassId().toString().substring(0, player.getClassId().toString().indexOf('_') - 1) : player.getClassId().toString();
if (!original.equals(search))
{
continue;

View File

@@ -79,10 +79,6 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
private int currentMonitorizedDamage = 0;
private int zoneStage = 0;
public zoneInfo()
{
}
void setZoneStage(int a)
{
zoneStage = a;
@@ -211,7 +207,6 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

View File

@@ -93,7 +93,7 @@ public class MonkOfChaos extends AbstractNpcAI
if (player.isDualClassActive())
{
final List<SkillLearn> skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.DUALCLASS);
if (skills.size() > 0)
if (!skills.isEmpty())
{
player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION_DUALCLASS));
}
@@ -105,7 +105,7 @@ public class MonkOfChaos extends AbstractNpcAI
else
{
final List<SkillLearn> skills = SkillTreesData.getInstance().getAvailableRevelationSkills(player, SubclassType.BASECLASS);
if (skills.size() > 0)
if (!skills.isEmpty())
{
player.sendPacket(new ExAcquirableSkillListByClass(skills, AcquireSkillType.REVELATION));
}

View File

@@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -99,7 +98,7 @@ public class Raina extends AbstractNpcAI
subclassSetMap.put(ClassId.SPELLHOWLER, subclasseSet5);
}
private static final Map<CategoryType, Integer> classCloak = new HashMap<>();
private static final Map<CategoryType, Integer> classCloak = new EnumMap<>(CategoryType.class);
static
{
classCloak.put(CategoryType.SIXTH_SIGEL_GROUP, 30310); // Abelius Cloak
@@ -112,7 +111,7 @@ public class Raina extends AbstractNpcAI
classCloak.put(CategoryType.SIXTH_EOLH_GROUP, 30317); // Laksis Cloak Grade
}
private static final Map<CategoryType, Integer> powerItem = new HashMap<>();
private static final Map<CategoryType, Integer> powerItem = new EnumMap<>(CategoryType.class);
static
{
powerItem.put(CategoryType.SIXTH_SIGEL_GROUP, 32264); // Abelius Power
@@ -260,7 +259,7 @@ public class Raina extends AbstractNpcAI
}
break;
}
case "changeSubclass": // TODO: Finish me
case "changeSubclass":
{
if (player.isTransformed())
{

View File

@@ -30,7 +30,7 @@ import ai.AbstractNpcAI;
public class YeSagiraGuards extends AbstractNpcAI
{
// NPCs
private static final int GUARDS[] =
private static final int[] GUARDS =
{
19152,
19153

View File

@@ -104,10 +104,10 @@ public class YeSegiraTeleportDevice extends AbstractNpcAI
final QuestState qs = player.getQuestState(Q10365_ForTheSearchdogKing.class.getSimpleName());
if ((qs != null) && qs.isStarted() && qs.isCond(1))
{
final Quest quest_10365 = QuestManager.getInstance().getQuest(Q10365_ForTheSearchdogKing.class.getSimpleName());
if (quest_10365 != null)
final Quest quest10365 = QuestManager.getInstance().getQuest(Q10365_ForTheSearchdogKing.class.getSimpleName());
if (quest10365 != null)
{
quest_10365.notifyEvent("TELEPORT_TO_NEXT_STAGE", null, player);
quest10365.notifyEvent("TELEPORT_TO_NEXT_STAGE", null, player);
}
}
}

View File

@@ -235,7 +235,7 @@ public class VarkaSilenosSupport extends AbstractNpcAI
return htmltext;
}
public static void main(String args[])
public static void main(String[] args)
{
new VarkaSilenosSupport();
}

View File

@@ -97,10 +97,7 @@ public class Wastelands extends AbstractNpcAI
npc.broadcastSocialAction(4);
npc.broadcastSay(ChatType.NPC_GENERAL, GUARD_SHOUT[getRandom(2)], 1000);
World.getInstance().getVisibleObjectsInRange(npc, Npc.class, 500).stream().filter(n -> n.getId() == GUARD).forEach(guard ->
{
startQuestTimer("SOCIAL_ACTION", getRandom(2500, 3500), guard, null);
});
World.getInstance().getVisibleObjectsInRange(npc, Npc.class, 500).stream().filter(n -> n.getId() == GUARD).forEach(guard -> startQuestTimer("SOCIAL_ACTION", getRandom(2500, 3500), guard, null));
break;
}
case "SOCIAL_ACTION":

View File

@@ -595,15 +595,9 @@ public class Anakim extends AbstractNpcAI
}
}
}
if (npc.getId() == REMNANT)
if ((npc.getId() == REMNANT) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.30)) && !npc.isCastingNow() && (Rnd.get(100) > 95))
{
if (npc.getCurrentHp() < (npc.getMaxHp() * 0.30))
{
if (!npc.isCastingNow() && (Rnd.get(100) > 95))
{
npc.doCast(REMANT_TELE);
}
}
npc.doCast(REMANT_TELE);
}
return super.onAttack(npc, attacker, damage, isPet);
@@ -640,12 +634,9 @@ public class Anakim extends AbstractNpcAI
@Override
public String onSpellFinished(Npc npc, PlayerInstance player, Skill skill)
{
if ((npc.getId() == REMNANT) && PRE_ANAKIM_ZONE.isInsideZone(npc))
if ((npc.getId() == REMNANT) && PRE_ANAKIM_ZONE.isInsideZone(npc) && (skill == REMANT_TELE))
{
if (skill == REMANT_TELE)
{
notifyEvent("spawn_remant", npc, null);
}
notifyEvent("spawn_remant", npc, null);
}
return super.onSpellFinished(npc, player, skill);
}
@@ -653,18 +644,12 @@ public class Anakim extends AbstractNpcAI
@Override
public String onSkillSee(Npc npc, PlayerInstance caster, Skill skill, WorldObject[] targets, boolean isPet)
{
if (CommonUtil.contains(ANAKIM_MINIONS, npc.getId()) && Rnd.nextBoolean())
if (CommonUtil.contains(ANAKIM_MINIONS, npc.getId()) && Rnd.nextBoolean() && (skill.getAbnormalType() == AbnormalType.HP_RECOVER) && !npc.isCastingNow() && (npc.getTarget() != npc) && (npc.getTarget() != caster) && (npc.getTarget() != _anakimBoss))
{
if (skill.getAbnormalType() == AbnormalType.HP_RECOVER)
{
if (!npc.isCastingNow() && (npc.getTarget() != npc) && (npc.getTarget() != caster) && (npc.getTarget() != _anakimBoss)) // Don't call minions if are healing Anakim
{
((Attackable) npc).clearAggroList();
npc.setTarget(caster);
((Attackable) npc).addDamageHate(caster, 500, 99999);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, caster);
}
}
((Attackable) npc).clearAggroList();
npc.setTarget(caster);
((Attackable) npc).addDamageHate(caster, 500, 99999);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, caster);
}
return super.onSkillSee(npc, caster, skill, targets, isPet);
}

View File

@@ -119,6 +119,7 @@ public class Baium extends AbstractNpcAI
case WAITING:
{
setStatus(ALIVE);
// fallthrough
}
case ALIVE:
{
@@ -301,11 +302,11 @@ public class Baium extends AbstractNpcAI
}
else
{
for (Creature creature : World.getInstance().getVisibleObjectsInRange(npc, PlayerInstance.class, 2000))
for (PlayerInstance creature : World.getInstance().getVisibleObjectsInRange(npc, PlayerInstance.class, 2000))
{
if (zone.isInsideZone(creature) && !creature.isDead())
{
addAttackPlayerDesire(npc, (Playable) creature);
addAttackPlayerDesire(npc, creature);
break;
}
}
@@ -487,13 +488,10 @@ public class Baium extends AbstractNpcAI
if (npc.getId() == BAIUM)
{
if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTI_STRIDER.getSkillId()))
if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTI_STRIDER.getSkillId()) && !npc.isSkillDisabled(ANTI_STRIDER.getSkill()))
{
if (!npc.isSkillDisabled(ANTI_STRIDER.getSkill()))
{
npc.setTarget(attacker);
npc.doCast(ANTI_STRIDER.getSkill());
}
npc.setTarget(attacker);
npc.doCast(ANTI_STRIDER.getSkill());
}
if (skill == null)

View File

@@ -89,9 +89,9 @@ public class BalokWarzone extends AbstractInstance
{153608, 140371, -12712}
};
//@formatter:on
private final List<Npc> minionList = new ArrayList<>();
private Npc currentMinion;
private Npc balok;
private final List<Npc> _minionList = new ArrayList<>();
private Npc _currentMinion;
private Npc _balok;
public BalokWarzone()
{
@@ -143,19 +143,19 @@ public class BalokWarzone extends AbstractInstance
}
case "stage_1_spawn_balok":
{
balok = addSpawn(BALOK, 153573, 142071, -12738, 16565, false, 0, false, world.getId());
_balok = addSpawn(BALOK, 153573, 142071, -12738, 16565, false, 0, false, world.getId());
world.setStatus(1);
break;
}
case "stage_last_send_minions":
{
Npc minion = minionList.get(Rnd.get(minionList.size()));
Npc minion = _minionList.get(Rnd.get(_minionList.size()));
if (minion != null)
{
minion.setRunning();
((Attackable) minion).setCanReturnToSpawnPoint(false);
currentMinion = minion;
_currentMinion = minion;
getTimers().addTimer("stage_last_minion_walk", 2000, minion, player);
}
@@ -165,16 +165,16 @@ public class BalokWarzone extends AbstractInstance
{
if (npc.getId() == MINION)
{
if (npc.calculateDistanceSq2D(balok) > 113125)
if (npc.calculateDistanceSq2D(_balok) > 113125)
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(balok.getX() + 100, balok.getY() + 50, balok.getZ(), balok.getHeading()));
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(_balok.getX() + 100, _balok.getY() + 50, _balok.getZ(), _balok.getHeading()));
getTimers().addTimer("stage_last_minion_walk", 2000, npc, player);
}
else
{
npc.stopSkillEffects(INVINCIBILITY_ACTIVATION.getSkill());
balok.setTarget(npc);
balok.doCast(DARKNESS_DRAIN.getSkill());
_balok.setTarget(npc);
_balok.doCast(DARKNESS_DRAIN.getSkill());
}
}
break;
@@ -203,46 +203,43 @@ public class BalokWarzone extends AbstractInstance
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon)
{
final Instance world = npc.getInstanceWorld();
if (isInInstance(world))
if (isInInstance(world) && (npc.getId() == BALOK))
{
if (npc.getId() == BALOK)
if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.85)) && (world.getStatus() == 1))
{
if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.85)) && (world.getStatus() == 1))
for (int[] a : MINION_SPAWN)
{
for (int[] a : MINION_SPAWN)
Npc minion = addSpawn(MINION, a[0], a[1], a[2], a[3], false, 0, false, world.getId());
_minionList.add(minion);
INVINCIBILITY_ACTIVATION.getSkill().applyEffects(minion, minion);
world.setStatus(2);
}
}
if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.50)) && (world.getStatus() == 2))
{
if (npc.isScriptValue(0))
{
INVINCIBILITY_ACTIVATION.getSkill().applyEffects(npc, npc);
npc.setScriptValue(1);
}
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 300, instPlayer ->
{
if ((instPlayer == null) || (Rnd.get(100) > 2))
{
Npc minion = addSpawn(MINION, a[0], a[1], a[2], a[3], false, 0, false, world.getId());
minionList.add(minion);
INVINCIBILITY_ACTIVATION.getSkill().applyEffects(minion, minion);
world.setStatus(2);
return;
}
}
if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.50)) && (world.getStatus() == 2))
{
if (npc.isScriptValue(0))
{
INVINCIBILITY_ACTIVATION.getSkill().applyEffects(npc, npc);
npc.setScriptValue(1);
}
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 300, instPlayer ->
{
if ((instPlayer == null) || (Rnd.get(100) > 2))
{
return;
}
npc.setTarget(instPlayer);
npc.doCast(IMPRISION.getSkill());
getTimers().addTimer("imprission_minions", 4000, npc, instPlayer);
});
getTimers().addTimer("stage_last_send_minions", 2000, npc, null);
}
if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) && npc.isScriptValue(1))
{
npc.setScriptValue(2);
npc.doCast(EARTH_DEMOLITION.getSkill());
addSpawn(HELLS_GATE, npc.getX() + 100, npc.getY() + 50, npc.getZ(), npc.getHeading(), false, 0, false, world.getId());
getTimers().addTimer("stage_spawn_apostols", 2000, npc, attacker);
}
npc.setTarget(instPlayer);
npc.doCast(IMPRISION.getSkill());
getTimers().addTimer("imprission_minions", 4000, npc, instPlayer);
});
getTimers().addTimer("stage_last_send_minions", 2000, npc, null);
}
if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) && npc.isScriptValue(1))
{
npc.setScriptValue(2);
npc.doCast(EARTH_DEMOLITION.getSkill());
addSpawn(HELLS_GATE, npc.getX() + 100, npc.getY() + 50, npc.getZ(), npc.getHeading(), false, 0, false, world.getId());
getTimers().addTimer("stage_spawn_apostols", 2000, npc, attacker);
}
}
return super.onAttack(npc, attacker, damage, isSummon);
@@ -252,18 +249,9 @@ public class BalokWarzone extends AbstractInstance
public String onSpellFinished(Npc npc, PlayerInstance player, Skill skill)
{
final Instance world = npc.getInstanceWorld();
if (isInInstance(world))
if (isInInstance(world) && (world != null) && (skill.getId() == DARKNESS_DRAIN.getSkillId()) && !_currentMinion.isDead())
{
if (world != null)
{
if (skill.getId() == DARKNESS_DRAIN.getSkillId())
{
if (!currentMinion.isDead())
{
balok.setCurrentHp(balok.getCurrentHp() + currentMinion.getMaxHp());
}
}
}
_balok.setCurrentHp(_balok.getCurrentHp() + _currentMinion.getMaxHp());
}
return super.onSpellFinished(npc, player, skill);
}
@@ -273,7 +261,7 @@ public class BalokWarzone extends AbstractInstance
{
final Instance world = npc.getInstanceWorld();
if (npc == balok)
if (npc == _balok)
{
if (world.getAliveNpcs(BALOK).isEmpty())
{
@@ -287,21 +275,21 @@ public class BalokWarzone extends AbstractInstance
world.setReenterTime();
}
}
else if (npc == currentMinion)
else if (npc == _currentMinion)
{
synchronized (minionList)
synchronized (_minionList)
{
if (minionList.contains(npc))
if (_minionList.contains(npc))
{
minionList.remove(npc);
_minionList.remove(npc);
if (minionList.size() > 0)
if (!_minionList.isEmpty())
{
startQuestTimer("stage_last_send_minions", 2000, npc, null);
}
else
{
balok.stopSkillEffects(INVINCIBILITY_ACTIVATION.getSkill());
_balok.stopSkillEffects(INVINCIBILITY_ACTIVATION.getSkill());
}
}
}

View File

@@ -336,10 +336,7 @@ public class BaylorWarzone extends AbstractInstance
private void broadcastSocialAction(Creature creature, int actionId)
{
final SocialAction action = new SocialAction(creature.getObjectId(), actionId);
World.getInstance().forEachVisibleObject(creature, PlayerInstance.class, player ->
{
player.sendPacket(action);
});
World.getInstance().forEachVisibleObject(creature, PlayerInstance.class, player -> player.sendPacket(action));
}
public static void main(String[] args)

View File

@@ -609,15 +609,11 @@ public class Beleth extends AbstractNpcAI
@Override
public String onAggroRangeEnter(Npc npc, PlayerInstance player, boolean isSummon)
{
if (!npc.isDead() && !npc.isCastingNow())
if (!npc.isDead() && !npc.isCastingNow() && (getRandom(100) < 40) && !World.getInstance().getVisibleObjectsInRange(npc, PlayerInstance.class, 200).isEmpty())
{
if ((getRandom(100) < 40) && !World.getInstance().getVisibleObjectsInRange(npc, PlayerInstance.class, 200).isEmpty())
{
npc.setTarget(player);
npc.doCast(FIREBALL.getSkill());
}
npc.setTarget(player);
npc.doCast(FIREBALL.getSkill());
}
return null;
}

View File

@@ -622,10 +622,7 @@ public class IceQueensCastleBattle extends AbstractInstance
final Attackable mob = (Attackable) npc;
mob.clearAggroList();
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, characters ->
{
mob.addDamageHate(characters, 0, getRandom(10000, 20000));
});
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, characters -> mob.addDamageHate(characters, 0, getRandom(10000, 20000)));
startQuestTimer("LEADER_RANDOMIZE", 25000, npc, null);
break;
}
@@ -762,13 +759,10 @@ public class IceQueensCastleBattle extends AbstractInstance
}
else
{
if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTI_STRIDER.getSkillId()) && !npc.isCastingNow(SkillCaster::isAnyNormalType))
if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTI_STRIDER.getSkillId()) && !npc.isCastingNow(SkillCaster::isAnyNormalType) && !npc.isSkillDisabled(ANTI_STRIDER.getSkill()))
{
if (!npc.isSkillDisabled(ANTI_STRIDER.getSkill()))
{
npc.setTarget(attacker);
npc.doCast(ANTI_STRIDER.getSkill());
}
npc.setTarget(attacker);
npc.doCast(ANTI_STRIDER.getSkill());
}
final Creature mostHated = ((Attackable) npc).getMostHated();
@@ -846,13 +840,10 @@ public class IceQueensCastleBattle extends AbstractInstance
startQuestTimer("SPAWN_SUPPORT", 27000, controller, null);
}
if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTI_STRIDER.getSkillId()) && !npc.isCastingNow(SkillCaster::isAnyNormalType))
if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTI_STRIDER.getSkillId()) && !npc.isCastingNow(SkillCaster::isAnyNormalType) && !npc.isSkillDisabled(ANTI_STRIDER.getSkill()))
{
if (!npc.isSkillDisabled(ANTI_STRIDER.getSkill()))
{
npc.setTarget(attacker);
npc.doCast(ANTI_STRIDER.getSkill());
}
npc.setTarget(attacker);
npc.doCast(ANTI_STRIDER.getSkill());
}
final Creature mostHated = ((Attackable) npc).getMostHated();

View File

@@ -50,12 +50,6 @@ public class Jinia extends AbstractNpcAI
String htmltext = event;
switch (event)
{
case "32781-10.html":
case "32781-11.html":
{
htmltext = event;
break;
}
case "check":
{
if (hasAtLeastOneQuestItem(player, FROZEN_CORE, BLACK_FROZEN_CORE))

View File

@@ -707,13 +707,10 @@ public class LastImperialTomb extends AbstractInstance
startQuestTimer("SCARLET_SECOND_MORPH", 1000, npc, null, false);
}
}
if (skill != null)
// When Dewdrop of Destruction is used on Portraits they suicide.
if ((skill != null) && CommonUtil.contains(PORTRAITS, npc.getId()) && (skill.getId() == DEWDROP_OF_DESTRUCTION_SKILL_ID))
{
// When Dewdrop of Destruction is used on Portraits they suicide.
if (CommonUtil.contains(PORTRAITS, npc.getId()) && (skill.getId() == DEWDROP_OF_DESTRUCTION_SKILL_ID))
{
npc.doDie(attacker);
}
npc.doDie(attacker);
}
return null;
}

View File

@@ -24,10 +24,8 @@ import java.util.ArrayList;
import org.l2jmobius.gameserver.data.xml.impl.SkillData;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.DecoyInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.skills.Skill;
import org.l2jmobius.gameserver.util.Util;
@@ -49,10 +47,10 @@ public class ScarletVanHalisha extends AbstractNpcAI
private static final int FRINTEZZA_DAEMON_MORPH = 5018;
private static final int FRINTEZZA_DAEMON_FIELD = 5019;
// Misc
private static final int RANGED_SKILL_MIN_COOLTIME = 60000; // 1 minute
private Creature _target;
private Skill _skill;
private long _lastRangedSkillTime;
private final int _rangedSkillMinCoolTime = 60000; // 1 minute
public ScarletVanHalisha()
{
@@ -144,11 +142,11 @@ public class ScarletVanHalisha extends AbstractNpcAI
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_CHARGE, 2);
}
else if (((_lastRangedSkillTime + _rangedSkillMinCoolTime) < System.currentTimeMillis()) && (getRandom(100) < 10))
else if (((_lastRangedSkillTime + RANGED_SKILL_MIN_COOLTIME) < System.currentTimeMillis()) && (getRandom(100) < 10))
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_FIELD, 1);
}
else if (((_lastRangedSkillTime + _rangedSkillMinCoolTime) < System.currentTimeMillis()) && (getRandom(100) < 10))
else if (((_lastRangedSkillTime + RANGED_SKILL_MIN_COOLTIME) < System.currentTimeMillis()) && (getRandom(100) < 10))
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_MORPH, 1);
}
@@ -215,54 +213,50 @@ public class ScarletVanHalisha extends AbstractNpcAI
{
final ArrayList<Creature> result = new ArrayList<>();
{
for (WorldObject obj : npc.getInstanceWorld().getPlayers())
for (PlayerInstance obj : npc.getInstanceWorld().getPlayers())
{
if (obj.isPlayable() || (obj instanceof DecoyInstance))
if (obj.isPlayer() && obj.getActingPlayer().isInvisible())
{
if (obj.isPlayer() && obj.getActingPlayer().isInvisible())
{
continue;
}
if (((((Creature) obj).getZ() < (npc.getZ() - 100)) && (((Creature) obj).getZ() > (npc.getZ() + 100))) || !GeoEngine.getInstance().canSeeTarget(obj, npc))
{
continue;
}
continue;
}
if (obj.isPlayable() || (obj instanceof DecoyInstance))
if (((obj.getZ() < (npc.getZ() - 100)) && (obj.getZ() > (npc.getZ() + 100))) || !GeoEngine.getInstance().canSeeTarget(obj, npc))
{
int skillRange = 150;
if (skill != null)
continue;
}
int skillRange = 150;
if (skill != null)
{
switch (skill.getId())
{
switch (skill.getId())
case FRINTEZZA_DAEMON_ATTACK:
{
case FRINTEZZA_DAEMON_ATTACK:
{
skillRange = 150;
break;
}
case FRINTEZZA_DAEMON_CHARGE:
{
skillRange = 400;
break;
}
case YOKE_OF_SCARLET:
{
skillRange = 200;
break;
}
case FRINTEZZA_DAEMON_MORPH:
case FRINTEZZA_DAEMON_FIELD:
{
_lastRangedSkillTime = System.currentTimeMillis();
skillRange = 550;
break;
}
skillRange = 150;
break;
}
case FRINTEZZA_DAEMON_CHARGE:
{
skillRange = 400;
break;
}
case YOKE_OF_SCARLET:
{
skillRange = 200;
break;
}
case FRINTEZZA_DAEMON_MORPH:
case FRINTEZZA_DAEMON_FIELD:
{
_lastRangedSkillTime = System.currentTimeMillis();
skillRange = 550;
break;
}
}
if (Util.checkIfInRange(skillRange, npc, obj, true) && !((Creature) obj).isDead())
{
result.add((Creature) obj);
result.add(obj);
}
}
}

View File

@@ -121,6 +121,7 @@ public class IstinaCavern extends AbstractInstance
{
htmltext = "33293-07.html";
}
break;
}
case "giveReward":
{
@@ -221,7 +222,7 @@ public class IstinaCavern extends AbstractInstance
case "LOW_ERUPTION_TIMER":
{
final Attackable istina = (Attackable) npc;
if ((istina.getHateList() != null) && (istina.getHateList().size() > 0))
if ((istina.getHateList() != null) && !istina.getHateList().isEmpty())
{
final Creature target = istina.getHateList().stream().sorted((o1, o2) -> (int) o1.calculateDistance3D(o2)).findFirst().orElse(null);
if (target != null)

View File

@@ -221,7 +221,7 @@ public class Kelbim extends AbstractNpcAI
if (_kelbimBoss.isInCombat())
{
Skill randomAttackSkill = AREA_SKILLS[Rnd.get(AREA_SKILLS.length)];
ArrayList<Npc> _skillNpcs = new ArrayList<>();
List<Npc> skillNpcs = new ArrayList<>();
for (PlayerInstance pl : ZONE.getPlayersInside())
{
if (pl == null)
@@ -231,11 +231,11 @@ public class Kelbim extends AbstractNpcAI
if (Rnd.get(100) > 40)
{
Npc skillMob = addSpawn(KELBIM_SHOUT, pl.getX(), pl.getY(), pl.getZ() + 10, 0, true, 60000, false, 0);
_skillNpcs.add(skillMob);
skillNpcs.add(skillMob);
_minions.add(skillMob);
}
}
for (Npc skillNpc : _skillNpcs)
for (Npc skillNpc : skillNpcs)
{
if (skillNpc == null)
{

View File

@@ -206,35 +206,29 @@ public class KimerianCommon extends AbstractInstance
public String onAttack(Npc npc, PlayerInstance player, int damage, boolean isSummon)
{
final Instance instance = npc.getInstanceWorld();
if (isInInstance(instance))
if (isInInstance(instance) && (npc.getId() == KIMERIAN) && (npc.getCurrentHpPercent() <= 50) && npc.getVariables().getBoolean("CAN_ACTIVATE_INVUL", true))
{
if (npc.getId() == KIMERIAN)
npc.getVariables().set("CAN_ACTIVATE_INVUL", false);
npc.setTargetable(false);
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.PHANTOM_IMAGE);
getTimers().addRepeatingTimer("KIMERIAN_INVUL_END", 60000, npc, player);
for (int i = 0; i < 5; i++)
{
if ((npc.getCurrentHpPercent() <= 50) && npc.getVariables().getBoolean("CAN_ACTIVATE_INVUL", true))
{
npc.getVariables().set("CAN_ACTIVATE_INVUL", false);
npc.setTargetable(false);
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.PHANTOM_IMAGE);
getTimers().addRepeatingTimer("KIMERIAN_INVUL_END", 60000, npc, player);
for (int i = 0; i < 5; i++)
{
final Npc ghost = addSpawn(KIMERIAN_GHOST, npc.getX(), npc.getY(), npc.getZ(), Util.calculateHeadingFrom(npc, player), false, 0, false, instance.getId());
addAttackPlayerDesire(ghost, player, 23);
}
npc.disableCoreAI(true);
npc.breakAttack();
npc.breakCast();
((Attackable) npc).clearAggroList();
getTimers().addTimer("KIMERIAN_INVUL_START", 6000, n ->
{
addSkillCastDesire(npc, npc, INVUL_SKILL, 23);
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOOLISH_INSIGNIFICANT_CREATURES_HOW_DARE_YOU_CHALLENGE_ME);
});
}
final Npc ghost = addSpawn(KIMERIAN_GHOST, npc.getX(), npc.getY(), npc.getZ(), Util.calculateHeadingFrom(npc, player), false, 0, false, instance.getId());
addAttackPlayerDesire(ghost, player, 23);
}
npc.disableCoreAI(true);
npc.breakAttack();
npc.breakCast();
((Attackable) npc).clearAggroList();
getTimers().addTimer("KIMERIAN_INVUL_START", 6000, n ->
{
addSkillCastDesire(npc, npc, INVUL_SKILL, 23);
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.FOOLISH_INSIGNIFICANT_CREATURES_HOW_DARE_YOU_CHALLENGE_ME);
});
}
return super.onAttack(npc, player, damage, isSummon);
}

View File

@@ -611,15 +611,9 @@ public class Lilith extends AbstractNpcAI
}
}
}
if (npc.getId() == REMNANT)
if ((npc.getId() == REMNANT) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.30)) && !npc.isCastingNow() && (Rnd.get(100) > 95))
{
if (npc.getCurrentHp() < (npc.getMaxHp() * 0.30))
{
if (!npc.isCastingNow() && (Rnd.get(100) > 95))
{
npc.doCast(REMANT_TELE);
}
}
npc.doCast(REMANT_TELE);
}
return super.onAttack(npc, attacker, damage, isPet);
@@ -656,12 +650,9 @@ public class Lilith extends AbstractNpcAI
@Override
public String onSpellFinished(Npc npc, PlayerInstance player, Skill skill)
{
if ((npc.getId() == REMNANT) && PRE_LILITH_ZONE.isInsideZone(npc))
if ((npc.getId() == REMNANT) && PRE_LILITH_ZONE.isInsideZone(npc) && (skill == REMANT_TELE))
{
if (skill == REMANT_TELE)
{
notifyEvent("spawn_remant", npc, null);
}
notifyEvent("spawn_remant", npc, null);
}
return super.onSpellFinished(npc, player, skill);
}
@@ -669,18 +660,12 @@ public class Lilith extends AbstractNpcAI
@Override
public String onSkillSee(Npc npc, PlayerInstance caster, Skill skill, WorldObject[] targets, boolean isPet)
{
if (CommonUtil.contains(LILITH_MINIONS, npc.getId()) && Rnd.nextBoolean())
if (CommonUtil.contains(LILITH_MINIONS, npc.getId()) && Rnd.nextBoolean() && (skill.getAbnormalType() == AbnormalType.HP_RECOVER) && !npc.isCastingNow() && (npc.getTarget() != npc) && (npc.getTarget() != caster) && (npc.getTarget() != _lilithBoss))
{
if (skill.getAbnormalType() == AbnormalType.HP_RECOVER)
{
if (!npc.isCastingNow() && (npc.getTarget() != npc) && (npc.getTarget() != caster) && (npc.getTarget() != _lilithBoss))
{
((Attackable) npc).clearAggroList();
npc.setTarget(caster);
((Attackable) npc).addDamageHate(caster, 500, 99999);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, caster);
}
}
((Attackable) npc).clearAggroList();
npc.setTarget(caster);
((Attackable) npc).addDamageHate(caster, 500, 99999);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, caster);
}
return super.onSkillSee(npc, caster, skill, targets, isPet);
}

View File

@@ -217,7 +217,7 @@ public class Lindvior extends AbstractNpcAI
{21170106, 21170107},
{21170108, 21170109}
};
protected final int _chargedValues[] = new int[] {0, 0, 0, 0};
protected final int[] _chargedValues = new int[] {0, 0, 0, 0};
private static final int[] LINDVIOR_SERVITOR = {25895, 25896, 25897, 29242, 29241, 29243};
// @formatter:on
private static final NpcStringId[] GUARD_MSG =
@@ -336,13 +336,10 @@ public class Lindvior extends AbstractNpcAI
_lindvior = (GrandBossInstance) addSpawn(LINDVIOR_FLY, _lindvior.getLocation(), false, 0, false);
_lindvior.setCurrentHp(_lindvior.getMaxHp() * 0.4);
if (SpawnTable.getInstance().getSpawns(NPC_ATTACKER_BIG_VORTEX) != null)
if ((SpawnTable.getInstance().getSpawns(NPC_ATTACKER_BIG_VORTEX) != null) && (_vortex != null) && (_vortex.getId() == NPC_ATTACKER_SMALL_VORTEX))
{
if ((_vortex != null) && (_vortex.getId() == NPC_ATTACKER_SMALL_VORTEX))
{
_vortex.getSpawn().stopRespawn();
_vortex.deleteMe();
}
_vortex.getSpawn().stopRespawn();
_vortex.deleteMe();
}
_status = 4;
}
@@ -554,9 +551,9 @@ public class Lindvior extends AbstractNpcAI
return super.onSeeCreature(npc, creature, isSummon);
}
private void nextStage(int _taskId)
private void nextStage(int taskId)
{
switch (_taskId)
switch (taskId)
{
case 1: // Spawn Generators
{
@@ -616,10 +613,7 @@ public class Lindvior extends AbstractNpcAI
{
player.sendPacket(new OnEventTrigger(FIRST_STAGE_EVENT_TRIGGER, false));
cancelQuestTimers("NPC_SHOUT");
_guardSpawn.stream().forEach(guard ->
{
guard.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ALL_4_GENERATORS_MUST_BE_ACTIVATED);
});
_guardSpawn.stream().forEach(guard -> guard.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ALL_4_GENERATORS_MUST_BE_ACTIVATED));
_announceProtect = ThreadPool.scheduleAtFixedRate(() -> _zoneLair.getPlayersInside().forEach(p -> player.sendPacket(new ExShowScreenMessage(NpcStringId.PROTECT_THE_GENERATOR, ExShowScreenMessage.TOP_CENTER, 7000, true))), 10000, 18000);
_zoneLair.broadcastPacket(new SpecialCamera(_dummyLindvior, 3300, 200, 20, 11000, 10500, 0, 8, 1, 0, 0));
_generatorSpawn.forEach(npc -> npc.sendInfo(player));
@@ -729,22 +723,13 @@ public class Lindvior extends AbstractNpcAI
}
case "show_shield_animation": // zone broadcast shield event triger
{
_zoneLair.getPlayersInside().forEach(p ->
{
p.sendPacket(new OnEventTrigger(SECOND_STAGE_EVENT_TRIGGER, true));
});
_guardSpawn.stream().forEach(guard ->
{
guard.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_GENERATOR_IS_CONNECTED_TO_THE_CANNON);
});
_zoneLair.getPlayersInside().forEach(p -> p.sendPacket(new OnEventTrigger(SECOND_STAGE_EVENT_TRIGGER, true)));
_guardSpawn.stream().forEach(guard -> guard.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_GENERATOR_IS_CONNECTED_TO_THE_CANNON));
break;
}
case "show_movie": // zone broadcast Lindvior scene movie
{
_zoneLair.getPlayersInside().forEach(p ->
{
playMovie(p, Movie.SC_LIND_OPENING);
});
_zoneLair.getPlayersInside().forEach(p -> playMovie(p, Movie.SC_LIND_OPENING));
_dummyLindvior.deleteMe();
_lindvior2 = addSpawn(LINDVIOR_FAKE, CENTER_LOCATION, false, 0, false);
_lindvior2.setTargetable(false);
@@ -828,8 +813,8 @@ public class Lindvior extends AbstractNpcAI
_mobsSpawnTask.cancel(true);
_mobsSpawnTask = null;
}
_zoneLair.getCharactersInside().stream().filter(Creature::isNpc).forEach(mob -> mob.deleteMe());
ThreadPool.schedule(() -> npc.decayMe(), 10000);
_zoneLair.getCharactersInside().stream().filter(Creature::isNpc).forEach(Creature::deleteMe);
ThreadPool.schedule(npc::decayMe, 10000);
_zoneLair.broadcastPacket(new OnEventTrigger(SECOND_STAGE_EVENT_TRIGGER, false));
_zoneLair.broadcastPacket(new OnEventTrigger(FIRST_STAGE_EVENT_TRIGGER, true));
_lionel.deleteMe();
@@ -863,13 +848,10 @@ public class Lindvior extends AbstractNpcAI
@Override
public String onEnterZone(Creature creature, ZoneType zone)
{
if (zone.getId() == ZONE_ID)
if ((zone.getId() == ZONE_ID) && (_collapseTask != null))
{
if (_collapseTask != null)
{
_collapseTask.cancel(true);
_collapseTask = null;
}
_collapseTask.cancel(true);
_collapseTask = null;
}
return super.onEnterZone(creature, zone);
}
@@ -877,12 +859,9 @@ public class Lindvior extends AbstractNpcAI
@Override
public String onExitZone(Creature creature, ZoneType zone)
{
if (zone.getId() == ZONE_ID)
if ((zone.getId() == ZONE_ID) && zone.getPlayersInside().isEmpty())
{
if (zone.getPlayersInside().isEmpty())
{
_collapseTask = ThreadPool.schedule(() -> Fail(true), 900000);
}
_collapseTask = ThreadPool.schedule(() -> Fail(true), 900000);
}
return super.onExitZone(creature, zone);
}
@@ -890,13 +869,10 @@ public class Lindvior extends AbstractNpcAI
@Override
public void onTimerEvent(String event, StatsSet params, Npc npc, PlayerInstance player)
{
if (event.equals("NPC_SHOUT"))
if (event.equals("NPC_SHOUT") && (npc != null) && !npc.isDead())
{
if ((npc != null) && !npc.isDead())
{
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(GUARD_MSG));
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
}
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(GUARD_MSG));
getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null);
}
}

View File

@@ -162,7 +162,7 @@ public class Vortex extends AbstractNpcAI
{
return;
}
if (players.size() > 0)
if (!players.isEmpty())
{
addAttackPlayerDesire(npc, players.stream().findAny().get());
}

View File

@@ -309,10 +309,7 @@ public class OctavisWarzone extends AbstractInstance
final PlayerInstance mostHated = ((Attackable) npc).getMostHated().getActingPlayer();
if ((mostHated != null) && (mostHated.calculateDistance3D(npc) < 5000))
{
World.getInstance().getVisibleObjectsInRange(npc, Attackable.class, 4000, obj -> CommonUtil.contains(BEASTS_MINIONS, obj.getId()) || CommonUtil.contains(GLADIATORS, obj.getId())).forEach(minion ->
{
addAttackPlayerDesire(minion, mostHated, 23);
});
World.getInstance().getVisibleObjectsInRange(npc, Attackable.class, 4000, obj -> CommonUtil.contains(BEASTS_MINIONS, obj.getId()) || CommonUtil.contains(GLADIATORS, obj.getId())).forEach(minion -> addAttackPlayerDesire(minion, mostHated, 23));
}
getTimers().addTimer("MINION_CALL", 5000 + (getRandom(5) * 1000), npc, null);
break;
@@ -523,12 +520,9 @@ public class OctavisWarzone extends AbstractInstance
public String onEnterZone(Creature creature, ZoneType zone)
{
final Instance world = creature.getInstanceWorld();
if (creature.isPlayer() && isInInstance(world))
if (creature.isPlayer() && isInInstance(world) && world.getParameters().getBoolean("TELEPORT_ACTIVE", false))
{
if (world.getParameters().getBoolean("TELEPORT_ACTIVE", false))
{
creature.teleToLocation(BATTLE_LOC);
}
creature.teleToLocation(BATTLE_LOC);
}
return super.onEnterZone(creature, zone);
}

View File

@@ -113,19 +113,19 @@ public class QueenAnt extends AbstractNpcAI
}
else
{
int loc_x = info.getInt("loc_x");
int loc_y = info.getInt("loc_y");
int loc_z = info.getInt("loc_z");
int locX = info.getInt("loc_x");
int locY = info.getInt("loc_y");
int locZ = info.getInt("loc_z");
final int heading = info.getInt("heading");
final double hp = info.getDouble("currentHP");
final double mp = info.getDouble("currentMP");
if (!_zone.isInsideZone(loc_x, loc_y, loc_z))
if (!_zone.isInsideZone(locX, locY, locZ))
{
loc_x = QUEEN_X;
loc_y = QUEEN_Y;
loc_z = QUEEN_Z;
locX = QUEEN_X;
locY = QUEEN_Y;
locZ = QUEEN_Z;
}
final GrandBossInstance queen = (GrandBossInstance) addSpawn(QUEEN, loc_x, loc_y, loc_z, heading, false, 0);
final GrandBossInstance queen = (GrandBossInstance) addSpawn(QUEEN, locX, locY, locZ, heading, false, 0);
queen.setCurrentHpMp(hp, mp);
spawnBoss(queen);
}
@@ -291,13 +291,10 @@ public class QueenAnt extends AbstractNpcAI
return super.onFactionCall(npc, caller, attacker, isSummon);
}
if (!npc.isCastingNow(SkillCaster::isAnyNormalType) && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST))
if (!npc.isCastingNow(SkillCaster::isAnyNormalType) && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST) && (caller.getCurrentHp() < caller.getMaxHp()))
{
if (caller.getCurrentHp() < caller.getMaxHp())
{
npc.setTarget(caller);
((Attackable) npc).useMagic(HEAL1.getSkill());
}
npc.setTarget(caller);
((Attackable) npc).useMagic(HEAL1.getSkill());
}
return null;
}

View File

@@ -49,7 +49,7 @@ import ai.AbstractNpcAI;
public class Ramona extends AbstractNpcAI
{
// Status
private static enum Status
private enum Status
{
ALIVE,
IN_FIGHT,

View File

@@ -46,7 +46,6 @@ import org.l2jmobius.gameserver.model.actor.instance.DoorInstance;
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.instance.TrapInstance;
import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.instancezone.Instance;
import org.l2jmobius.gameserver.model.skills.Skill;
import org.l2jmobius.gameserver.model.zone.ZoneType;
@@ -68,14 +67,10 @@ import instances.AbstractInstance;
*/
public class Stage1 extends AbstractInstance implements IXmlReader
{
Logger LOGGER = Logger.getLogger(Stage1.class.getName());
private static final Logger LOGGER = Logger.getLogger(Stage1.class.getName());
private static class SODSpawn
{
public SODSpawn()
{
}
boolean isZone = false;
boolean isNeededNextFlag = false;
int npcId;
@@ -94,10 +89,6 @@ public class Stage1 extends AbstractInstance implements IXmlReader
private static final Location ENTER_TELEPORT_2 = new Location(-245800, 220488, -12112);
private static final Location CENTER_TELEPORT = new Location(-245802, 220528, -12104);
// Traps/Skills
private static final SkillHolder TRAP_HOLD = new SkillHolder(4186, 9); // 18720-18728
private static final SkillHolder TRAP_STUN = new SkillHolder(4072, 10); // 18729-18736
private static final SkillHolder TRAP_DAMAGE = new SkillHolder(5340, 4); // 18737-18770
private static final SkillHolder TRAP_SPAWN = new SkillHolder(10002, 1); // 18771-18774 : handled in this script
private static final int[] TRAP_18771_NPCS =
{
22541,
@@ -427,24 +418,7 @@ public class Stage1 extends AbstractInstance implements IXmlReader
// traps
if ((npcId >= 18720) && (npcId <= 18774))
{
Skill skill = null;
if (npcId <= 18728)
{
skill = TRAP_HOLD.getSkill();
}
else if (npcId <= 18736)
{
skill = TRAP_STUN.getSkill();
}
else if (npcId <= 18770)
{
skill = TRAP_DAMAGE.getSkill();
}
else
{
skill = TRAP_SPAWN.getSkill();
}
addTrap(npcId, x, y, z, h, skill, world.getId());
addTrap(npcId, x, y, z, h, world.getId());
return;
}
final Npc npc = addSpawn(npcId, x, y, z, h, false, 0, false, world.getId());

View File

@@ -72,7 +72,7 @@ public class Trasken extends AbstractNpcAI
// Zone
private static final int ZONE_ID = 12108;
private static final int ZONE_ID_HEART = 12109;
private final int[] eventTriggers = new int[]
private static final int[] EVENT_TRIGGERS = new int[]
{
22120840,
22120842,
@@ -101,20 +101,20 @@ public class Trasken extends AbstractNpcAI
private static final int ALIVE = 0;
private static final int DEAD = 3;
// Others
protected double hp_tail;
protected double hp_trasken;
private static Npc tie_trasken;
private static Npc trasken;
protected double _hpTail;
protected double _hpTrasken;
private static Npc _tieTrasken;
private static Npc _trasken;
private static NoSummonFriendZone _zoneLair;
private static NoSummonFriendZone _zoneLair2;
private int playersToEnter;
private int _playersToEnter;
protected int _statusZone = 0;
protected ScheduledFuture<?> _collapseTask;
protected AtomicInteger _killsTie = new AtomicInteger(0);
protected AtomicInteger _killsTradjan = new AtomicInteger(0);
// Spawns
private static final Location Spawn_Heart = new Location(88292, -173758, -15965);
private static final Location[] Spawn_Tie = new Location[]
private static final Location HEART_SPAWN = new Location(88292, -173758, -15965);
private static final Location[] TIE_SPAWN = new Location[]
{
new Location(79075, -180963, -9897, 4527),
new Location(81047, -182282, -9897, 33582),
@@ -139,7 +139,7 @@ public class Trasken extends AbstractNpcAI
new Location(83150, -183279, -9897, 62418),
new Location(79795, -182271, -9897, 5870)
};
private static final Location[] Spawn_Big_Tie = new Location[]
private static final Location[] BIG_TIE_SPAWN = new Location[]
{
new Location(83235, -182070, -9897, 31663),
new Location(83913, -183256, -9897, 4038),
@@ -161,7 +161,7 @@ public class Trasken extends AbstractNpcAI
new Location(83222, -184038, -9897, 13689),
new Location(82093, -184188, -9897, 61993)
};
private static final Location[] Spawn_Larva_1 = new Location[]
private static final Location[] LARVA_SPAWN_1 = new Location[]
{
new Location(81869, -181917, -9897, 59394),
new Location(82831, -182837, -9897, 19463),
@@ -172,7 +172,7 @@ public class Trasken extends AbstractNpcAI
new Location(78883, -183839, -9897, 5843),
new Location(80014, -182944, -9897, 6195)
};
private static final Location[] Spawn_Larva_2 = new Location[]
private static final Location[] LARVA_SPAWN_2 = new Location[]
{
new Location(81869, -181917, -9897, 20701),
new Location(82831, -182837, -9897, 6257),
@@ -183,7 +183,7 @@ public class Trasken extends AbstractNpcAI
new Location(78883, -183839, -9897, 23282),
new Location(80014, -182944, -9897, 9306)
};
private static final Location[] Spawn_Larva_3 = new Location[]
private static final Location[] LARVA_SPAWN_3 = new Location[]
{
new Location(79785, -181954, -9897, 65516),
new Location(81727, -184036, -9897, 63858),
@@ -215,26 +215,26 @@ public class Trasken extends AbstractNpcAI
new Location(81255, -182176, -9897, 53943),
new Location(78796, -184218, -9897, 40593)
};
private static final Location[] Spawn_Victim_1 = new Location[]
private static final Location[] VICTIM_SPAWN_1 = new Location[]
{
new Location(87891, -173888, 0, 14559),
new Location(87777, -172808, 0, 54130),
new Location(88896, -174206, 0, 4641)
};
private static final Location[] Spawn_Victim_2 = new Location[]
private static final Location[] VICTIM_SPAWN_2 = new Location[]
{
new Location(88085, -174105, 0, 39106),
new Location(88949, -174227, 0, 58094),
new Location(89000, -172909, 0, 55350),
new Location(87941, -173185, 0, 22119)
};
private static final Location[] Spawn_Victim_3 = new Location[]
private static final Location[] VICTIM_SPAWN_3 = new Location[]
{
new Location(88247, -174298, 0, 4884),
new Location(88924, -173858, 0, 44289),
new Location(88204, -172812, 0, 24052)
};
private static final Location[] Spawn_Tradjan = new Location[]
private static final Location[] TRADJAN_SPAWN = new Location[]
{
new Location(79785, -181954, -9897, 65516),
new Location(81727, -184036, -9897, 63858),
@@ -266,7 +266,7 @@ public class Trasken extends AbstractNpcAI
new Location(81255, -182176, -9897, 53943),
new Location(78796, -184218, -9897, 40593)
};
private static final Location[] Spawn_Digestive = new Location[]
private static final Location[] DIGESTIVE_SPAWN = new Location[]
{
new Location(88114, -173387, -15980),
new Location(88640, -173491, -15980),
@@ -274,14 +274,14 @@ public class Trasken extends AbstractNpcAI
new Location(87913, -173950, -15981)
};
// @formatter:off
private static final int[][] Rnd_Spawn_Tail = new int[][]
private static final int[][] TAIL_RANDOM_SPAWN = new int[][]
{
{80966, -183780, -9896},
{82949, -181947, -9899},
{81688, -181059, -9895},
{81208, -182095, -9895}
};
private static final int[][] Rnd_Spawn_Trasken = new int[][]
private static final int[][] TRASKEN_RANDOM_SPAWN = new int[][]
{
{82564, -180742, -9896},
{82379, -183532, -9896},
@@ -347,19 +347,19 @@ public class Trasken extends AbstractNpcAI
int size = _zoneLair.getPlayersInside().size();
if ((size >= 14) && (size <= 28))
{
playersToEnter = 7;
_playersToEnter = 7;
}
else if ((size >= 28) && (size <= 56))
{
playersToEnter = 14;
_playersToEnter = 14;
}
else if ((size >= 56) && (size <= 102))
{
playersToEnter = 21;
_playersToEnter = 21;
}
else
{
playersToEnter = 1;
_playersToEnter = 1;
}
}
@@ -407,7 +407,7 @@ public class Trasken extends AbstractNpcAI
{
case TAIL_TRASKEN:
{
hp_tail = npc.getCurrentHp();
_hpTail = npc.getCurrentHp();
break;
}
case TRASKEN:
@@ -429,7 +429,7 @@ public class Trasken extends AbstractNpcAI
doom.setTarget(doom);
doom.isCastingNow();
doom.doCast(SKILL_1.getSkill());
ThreadPool.schedule(() -> doom.deleteMe(), 15000);
ThreadPool.schedule(doom::deleteMe, 15000);
}
final double percent = ((npc.getCurrentHp() - damage) / npc.getMaxHp()) * 100.0;
if ((percent <= 30) && (_statusZone == 4))
@@ -461,7 +461,7 @@ public class Trasken extends AbstractNpcAI
{
npc.doCast(SKILL_5.getSkill());
}
hp_trasken = npc.getCurrentHp();
_hpTrasken = npc.getCurrentHp();
break;
}
}
@@ -490,10 +490,7 @@ public class Trasken extends AbstractNpcAI
case TIE:
case BIG_TIE:
{
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 600, cha ->
{
npc.setTarget(cha);
});
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 600, npc::setTarget);
npc.setIsOverloaded(true);
npc.setRandomWalking(true);
npc.getSpawn().setRespawnDelay(60);
@@ -502,10 +499,7 @@ public class Trasken extends AbstractNpcAI
case TRADJAN:
{
npc.getSpawn().setRespawnDelay(120);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 3500, cha ->
{
npc.setTarget(cha);
});
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 3500, npc::setTarget);
break;
}
case LAVRA_1:
@@ -513,10 +507,7 @@ public class Trasken extends AbstractNpcAI
case LAVRA_3:
{
npc.getSpawn().setRespawnDelay(200);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 3500, cha ->
{
npc.setTarget(cha);
});
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 3500, npc::setTarget);
break;
}
case VICTIM_EARTWORMS_1:
@@ -524,10 +515,7 @@ public class Trasken extends AbstractNpcAI
case VICTIM_EARTWORMS_3:
{
npc.getSpawn().setRespawnDelay(30);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, cha ->
{
npc.setTarget(cha);
});
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, npc::setTarget);
break;
}
case DIGISTIVE:
@@ -535,10 +523,7 @@ public class Trasken extends AbstractNpcAI
npc.setIsOverloaded(true);
npc.setRandomWalking(true);
npc.getSpawn().setRespawnDelay(60);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, cha ->
{
npc.setTarget(cha);
});
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, npc::setTarget);
break;
}
case HEART_ERTHWYRM:
@@ -600,23 +585,20 @@ public class Trasken extends AbstractNpcAI
}
case "finish":
{
trasken.doDie(player);
trasken.setIsDead(true);
_trasken.doDie(player);
_trasken.setIsDead(true);
_zoneLair2.getPlayersInside().forEach(players -> players.teleToLocation(CENTER_LOCATION));
_zoneLair2.getPlayersInside().forEach(p ->
{
playMovie(p, Movie.SC_EARTHWORM_ENDING);
});
_zoneLair2.getPlayersInside().forEach(p -> playMovie(p, Movie.SC_EARTHWORM_ENDING));
if (_collapseTask != null)
{
_collapseTask.cancel(true);
_collapseTask = null;
}
_zoneLair.getCharactersInside().stream().filter(Creature::isNpc).forEach(mob -> mob.deleteMe());
_zoneLair.getCharactersInside().stream().filter(Creature::isNpc).forEach(Creature::deleteMe);
_zoneLair.getCharactersInside().stream().filter(WorldObject::isMonster).forEach(cha -> ((MonsterInstance) cha).getSpawn().stopRespawn());
_zoneLair2.getCharactersInside().stream().filter(Creature::isNpc).forEach(mob -> mob.deleteMe());
_zoneLair2.getCharactersInside().stream().filter(Creature::isNpc).forEach(Creature::deleteMe);
_zoneLair2.getCharactersInside().stream().filter(WorldObject::isMonster).forEach(cha -> ((MonsterInstance) cha).getSpawn().stopRespawn());
ThreadPool.schedule(() -> npc.decayMe(), 10000);
ThreadPool.schedule(npc::decayMe, 10000);
cancelQuestTimer("finish", npc, null);
GrandBossManager.getInstance().setBossStatus(TRASKEN, DEAD);
@@ -635,20 +617,20 @@ public class Trasken extends AbstractNpcAI
{
if (_statusZone == 2)
{
tie_trasken.doCast(SKILL_TAIL_2.getSkill());
tie_trasken.getSpawn().stopRespawn();
tie_trasken.decayMe();
_tieTrasken.doCast(SKILL_TAIL_2.getSkill());
_tieTrasken.getSpawn().stopRespawn();
_tieTrasken.decayMe();
final int[] spawn = Rnd_Spawn_Tail[Rnd.get(Rnd_Spawn_Tail.length)];
final int[] spawn = TAIL_RANDOM_SPAWN[Rnd.get(TAIL_RANDOM_SPAWN.length)];
if (SpawnTable.getInstance().getSpawns(TAIL_TRASKEN) == null)
{
ThreadPool.schedule(() ->
{
tie_trasken = addSpawn(TAIL_TRASKEN, spawn[0], spawn[1], spawn[2], 0, false, 0, true);
tie_trasken.setCurrentHp(hp_tail);
_tieTrasken = addSpawn(TAIL_TRASKEN, spawn[0], spawn[1], spawn[2], 0, false, 0, true);
_tieTrasken.setCurrentHp(_hpTail);
}, 5000);
}
startQuestTimer("spawn_rnd", 30000, tie_trasken, null);
startQuestTimer("spawn_rnd", 30000, _tieTrasken, null);
}
break;
}
@@ -656,21 +638,21 @@ public class Trasken extends AbstractNpcAI
{
if (_statusZone == 3)
{
trasken.doCast(SKILL_TRASKEN_FIRST.getSkill());
trasken.getSpawn().stopRespawn();
trasken.decayMe();
_trasken.doCast(SKILL_TRASKEN_FIRST.getSkill());
_trasken.getSpawn().stopRespawn();
_trasken.decayMe();
final int[] spawn1 = Rnd_Spawn_Trasken[Rnd.get(Rnd_Spawn_Trasken.length)];
final int[] spawn1 = TRASKEN_RANDOM_SPAWN[Rnd.get(TRASKEN_RANDOM_SPAWN.length)];
if (SpawnTable.getInstance().getSpawns(TRASKEN) == null)
{
ThreadPool.schedule(() ->
{
trasken = addSpawn(TRASKEN, spawn1[0], spawn1[1], spawn1[2], 0, false, 0, true);
trasken.doCast(SKILL_TRASKEN_UP.getSkill());
trasken.setCurrentHp(hp_trasken);
_trasken = addSpawn(TRASKEN, spawn1[0], spawn1[1], spawn1[2], 0, false, 0, true);
_trasken.doCast(SKILL_TRASKEN_UP.getSkill());
_trasken.setCurrentHp(_hpTrasken);
}, 10000);
}
startQuestTimer("spawn_rnd", 70000, trasken, null);
startQuestTimer("spawn_rnd", 70000, _trasken, null);
}
break;
}
@@ -718,7 +700,7 @@ public class Trasken extends AbstractNpcAI
{
_zoneLair.getPlayersInside().forEach(p -> p.broadcastPacket(new ExShowScreenMessage(NpcStringId.HEART_OF_EARTH_WYRM_HAS_BEEN_DESTROYED, 5, 4000, true)));
_zoneLair2.getPlayersInside().forEach(p -> p.broadcastPacket(new ExShowScreenMessage(NpcStringId.HEART_OF_EARTH_WYRM_HAS_BEEN_DESTROYED, 5, 4000, true)));
cancelQuestTimer("spawn_rnd", trasken, null);
cancelQuestTimer("spawn_rnd", _trasken, null);
startQuestTimer("finish", 5000, npc, killer);
break;
}
@@ -750,7 +732,7 @@ public class Trasken extends AbstractNpcAI
{
if ((zone.getId() == ZONE_ID) && creature.isPlayer())
{
for (int info : eventTriggers)
for (int info : EVENT_TRIGGERS)
{
creature.broadcastPacket(new OnEventTrigger(info, true));
}
@@ -787,7 +769,7 @@ public class Trasken extends AbstractNpcAI
_collapseTask = ThreadPool.schedule(() ->
{
Fail(true);
for (int info : eventTriggers)
for (int info : EVENT_TRIGGERS)
{
creature.broadcastPacket(new OnEventTrigger(info, false));
}
@@ -802,34 +784,34 @@ public class Trasken extends AbstractNpcAI
{
case 0:
{
for (Location loc : Spawn_Tie)
for (Location loc : TIE_SPAWN)
{
addSpawn(TIE, loc, false, 0, true);
}
for (Location loc : Spawn_Big_Tie)
for (Location loc : BIG_TIE_SPAWN)
{
addSpawn(BIG_TIE, loc, false, 0, true);
}
addSpawn(HEART_ERTHWYRM, Spawn_Heart, false, 0, true);
addSpawn(HEART_ERTHWYRM, HEART_SPAWN, false, 0, true);
for (Location loc : Spawn_Victim_1)
for (Location loc : VICTIM_SPAWN_1)
{
addSpawn(VICTIM_EARTWORMS_1, loc, false, 0, true);
}
for (Location loc : Spawn_Victim_2)
for (Location loc : VICTIM_SPAWN_2)
{
addSpawn(VICTIM_EARTWORMS_2, loc, false, 0, true);
}
for (Location loc : Spawn_Victim_3)
for (Location loc : VICTIM_SPAWN_3)
{
addSpawn(VICTIM_EARTWORMS_3, loc, false, 0, true);
}
for (Location loc : Spawn_Digestive)
for (Location loc : DIGESTIVE_SPAWN)
{
addSpawn(DIGISTIVE, loc, false, 0, true);
}
@@ -837,7 +819,7 @@ public class Trasken extends AbstractNpcAI
}
case 1:
{
for (Location loc : Spawn_Tradjan)
for (Location loc : TRADJAN_SPAWN)
{
addSpawn(TRADJAN, loc, false, 0, true);
}
@@ -845,31 +827,31 @@ public class Trasken extends AbstractNpcAI
}
case 2:
{
tie_trasken = addSpawn(TAIL_TRASKEN, CENTER_LOCATION, false, 0, true);
hp_tail = tie_trasken.getCurrentHp();
startQuestTimer("spawn_rnd", 3000000, tie_trasken, null);
_tieTrasken = addSpawn(TAIL_TRASKEN, CENTER_LOCATION, false, 0, true);
_hpTail = _tieTrasken.getCurrentHp();
startQuestTimer("spawn_rnd", 3000000, _tieTrasken, null);
break;
}
case 3:
{
cancelQuestTimer("spawn_rnd", tie_trasken, null);
cancelQuestTimer("spawn_rnd", _tieTrasken, null);
trasken = addSpawn(TRASKEN, CENTER_LOCATION, false, 0, true);
trasken.doCast(SKILL_TRASKEN_UP.getSkill());
hp_trasken = trasken.getCurrentHp();
_trasken = addSpawn(TRASKEN, CENTER_LOCATION, false, 0, true);
_trasken.doCast(SKILL_TRASKEN_UP.getSkill());
_hpTrasken = _trasken.getCurrentHp();
startQuestTimer("spawn_rnd", 9000000, trasken, null);
for (Location loc : Spawn_Larva_1)
startQuestTimer("spawn_rnd", 9000000, _trasken, null);
for (Location loc : LARVA_SPAWN_1)
{
addSpawn(LAVRA_1, loc, false, 0, true);
}
for (Location loc : Spawn_Larva_2)
for (Location loc : LARVA_SPAWN_2)
{
addSpawn(LAVRA_2, loc, false, 0, true);
}
for (Location loc : Spawn_Larva_3)
for (Location loc : LARVA_SPAWN_3)
{
addSpawn(LAVRA_3, loc, false, 0, true);
}
@@ -882,7 +864,7 @@ public class Trasken extends AbstractNpcAI
{
creature.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_EARTH_WYRM_HAS_LOST_CONSCIOUSNESS, 5, 4600, true));
creature.doCast(SKILL_TRASKEN_BUFF.getSkill()); // 12 sec combo
if (playersToEnter == _zoneLair2.getPlayersInside().size())
if (_playersToEnter == _zoneLair2.getPlayersInside().size())
{
final BuffInfo traskenBuff = creature.getEffectList().getBuffInfoBySkillId(SKILL_TRASKEN_BUFF.getSkillId());
if (traskenBuff != null)

View File

@@ -86,7 +86,7 @@ public class Valakas extends AbstractNpcAI
};
// Locations
private static final Location TELEPORT_CUBE_LOCATIONS[] =
private static final Location[] TELEPORT_CUBE_LOCATIONS =
{
new Location(214880, -116144, -1644),
new Location(213696, -116592, -1644),

View File

@@ -16,8 +16,9 @@
*/
package ai.others.AdventureGuildsman;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Map;
import java.util.Map.Entry;
import org.l2jmobius.commons.util.CommonUtil;
import org.l2jmobius.gameserver.data.xml.impl.MultisellData;
@@ -73,7 +74,7 @@ public class AdventureGuildsman extends AbstractNpcAI
};
// Misc
//@formatter:off
private static final Map<CategoryType, Integer> R_CLASS_TALISMAN = new HashMap<>();
private static final Map<CategoryType, Integer> R_CLASS_TALISMAN = new EnumMap<>(CategoryType.class);
static
{
R_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 735);
@@ -87,7 +88,7 @@ public class AdventureGuildsman extends AbstractNpcAI
R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 736);
R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 741);
}
private static final Map<CategoryType, Integer> R90_CLASS_TALISMAN = new HashMap<>();
private static final Map<CategoryType, Integer> R90_CLASS_TALISMAN = new EnumMap<>(CategoryType.class);
static
{
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 743);
@@ -101,7 +102,7 @@ public class AdventureGuildsman extends AbstractNpcAI
R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 744);
R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 749);
}
private static final Map<CategoryType, Integer> R95_CLASS_TALISMAN = new HashMap<>();
private static final Map<CategoryType, Integer> R95_CLASS_TALISMAN = new EnumMap<>(CategoryType.class);
static
{
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 751);
@@ -115,7 +116,7 @@ public class AdventureGuildsman extends AbstractNpcAI
R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 752);
R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 757);
}
private static final Map<CategoryType, Integer> R99_CLASS_TALISMAN = new HashMap<>();
private static final Map<CategoryType, Integer> R99_CLASS_TALISMAN = new EnumMap<>(CategoryType.class);
static
{
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 759);
@@ -204,7 +205,7 @@ public class AdventureGuildsman extends AbstractNpcAI
}
case "buff_group":
{
htmltext = player.getPcCafePoints() >= 120 ? applyBuffsGroup(npc, player, GROUP_MELODY.length) : "pccafe_buff_1001.htm";
htmltext = player.getPcCafePoints() >= 120 ? applyBuffsGroup(npc, player) : "pccafe_buff_1001.htm";
break;
}
case "knight":
@@ -348,11 +349,11 @@ public class AdventureGuildsman extends AbstractNpcAI
{
int multisellId = -1;
for (CategoryType type : R_CLASS_TALISMAN.keySet())
for (Entry<CategoryType, Integer> entry : R_CLASS_TALISMAN.entrySet())
{
if (player.isInCategory(type))
if (player.isInCategory(entry.getKey()))
{
multisellId = R_CLASS_TALISMAN.get(type);
multisellId = entry.getValue();
break;
}
}
@@ -367,11 +368,11 @@ public class AdventureGuildsman extends AbstractNpcAI
{
int multisellId = -1;
for (CategoryType type : R90_CLASS_TALISMAN.keySet())
for (Entry<CategoryType, Integer> entry : R90_CLASS_TALISMAN.entrySet())
{
if (player.isInCategory(type))
if (player.isInCategory(entry.getKey()))
{
multisellId = R90_CLASS_TALISMAN.get(type);
multisellId = entry.getValue();
break;
}
}
@@ -385,11 +386,11 @@ public class AdventureGuildsman extends AbstractNpcAI
case "give_talismanR95_by_class":
{
int multisellId = -1;
for (CategoryType type : R95_CLASS_TALISMAN.keySet())
for (Entry<CategoryType, Integer> entry : R95_CLASS_TALISMAN.entrySet())
{
if (player.isInCategory(type))
if (player.isInCategory(entry.getKey()))
{
multisellId = R95_CLASS_TALISMAN.get(type);
multisellId = entry.getValue();
break;
}
}
@@ -405,11 +406,11 @@ public class AdventureGuildsman extends AbstractNpcAI
{
int multisellId = -1;
for (CategoryType type : R99_CLASS_TALISMAN.keySet())
for (Entry<CategoryType, Integer> entry : R99_CLASS_TALISMAN.entrySet())
{
if (player.isInCategory(type))
if (player.isInCategory(entry.getKey()))
{
multisellId = R99_CLASS_TALISMAN.get(type);
multisellId = entry.getValue();
break;
}
}
@@ -423,7 +424,7 @@ public class AdventureGuildsman extends AbstractNpcAI
}
if (event.startsWith("melody"))
{
final int buffOffset = CommonUtil.constrain(Integer.parseInt(event.substring(event.indexOf(" ") + 1)), 0, GROUP_MELODY.length);
final int buffOffset = CommonUtil.constrain(Integer.parseInt(event.substring(event.indexOf(' ') + 1)), 0, GROUP_MELODY.length);
if (player.getPcCafePoints() >= 20)
{
npc.setTarget(player);
@@ -455,7 +456,7 @@ public class AdventureGuildsman extends AbstractNpcAI
return null;
}
private String applyBuffsGroup(Npc npc, PlayerInstance player, int length)
private String applyBuffsGroup(Npc npc, PlayerInstance player)
{
for (SkillHolder holder : GROUP_MELODY)
{

View File

@@ -37,7 +37,7 @@ import ai.AbstractNpcAI;
public class AlchemistManager extends AbstractNpcAI
{
// NPCs
private static final int ALCHEMISTS[] =
private static final int[] ALCHEMISTS =
{
33978, // Zephyra
33977, // Veruti

View File

@@ -73,13 +73,10 @@ public class Ballista extends AbstractNpcAI
{
if ((skill != null) && (caster.getTarget() == npc) && (getRandom(100) < 40) && (skill == BOMB.getSkill()))
{
if (npc.getFort().getSiege().isInProgress())
if (npc.getFort().getSiege().isInProgress() && (caster.getClan() != null) && (caster.getClan().getLevel() >= MIN_CLAN_LV))
{
if ((caster.getClan() != null) && (caster.getClan().getLevel() >= MIN_CLAN_LV))
{
caster.getClan().addReputationScore(Config.BALLISTA_POINTS, true);
caster.sendPacket(SystemMessageId.THE_BALLISTA_HAS_BEEN_SUCCESSFULLY_DESTROYED_THE_CLAN_REPUTATION_WILL_BE_INCREASED);
}
caster.getClan().addReputationScore(Config.BALLISTA_POINTS, true);
caster.sendPacket(SystemMessageId.THE_BALLISTA_HAS_BEEN_SUCCESSFULLY_DESTROYED_THE_CLAN_REPUTATION_WILL_BE_INCREASED);
}
npc.doDie(caster);
}

View File

@@ -52,7 +52,7 @@ public class CastleBlacksmith extends AbstractNpcAI
private boolean hasRights(PlayerInstance player, Npc npc)
{
final boolean isMyLord = player.isClanLeader() ? (player.getClan().getCastleId() == (npc.getCastle() != null ? npc.getCastle().getResidenceId() : -1)) : false;
final boolean isMyLord = player.isClanLeader() && (player.getClan().getCastleId() == (npc.getCastle() != null ? npc.getCastle().getResidenceId() : -1));
return player.canOverrideCond(PlayerCondOverride.CASTLE_CONDITIONS) || isMyLord || ((player.getClanId() == npc.getCastle().getOwnerId()) && player.hasClanPrivilege(ClanPrivilege.CS_MANOR_ADMIN));
}

View File

@@ -398,7 +398,7 @@ public class CastleChamberlain extends AbstractNpcAI
final Castle castle = npc.getCastle();
final StringTokenizer st = new StringTokenizer(event, " ");
String htmltext = null;
final boolean isMyLord = player.isClanLeader() ? (player.getClan().getCastleId() == (npc.getCastle() != null ? npc.getCastle().getResidenceId() : -1)) : false;
final boolean isMyLord = player.isClanLeader() && (player.getClan().getCastleId() == (npc.getCastle() != null ? npc.getCastle().getResidenceId() : -1));
switch (st.nextToken())
{
@@ -959,13 +959,13 @@ public class CastleChamberlain extends AbstractNpcAI
{
if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS))
{
final CastleFunction HP = castle.getCastleFunction(Castle.FUNC_RESTORE_HP);
final CastleFunction MP = castle.getCastleFunction(Castle.FUNC_RESTORE_MP);
final CastleFunction XP = castle.getCastleFunction(Castle.FUNC_RESTORE_EXP);
final CastleFunction hp = castle.getCastleFunction(Castle.FUNC_RESTORE_HP);
final CastleFunction mp = castle.getCastleFunction(Castle.FUNC_RESTORE_MP);
final CastleFunction xp = castle.getCastleFunction(Castle.FUNC_RESTORE_EXP);
final NpcHtmlMessage html = getHtmlPacket(player, npc, "castledecofunction.html");
html.replace("%HPDepth%", (HP == null) ? "0" : Integer.toString(HP.getLvl()));
html.replace("%MPDepth%", (MP == null) ? "0" : Integer.toString(MP.getLvl()));
html.replace("%XPDepth%", (XP == null) ? "0" : Integer.toString(XP.getLvl()));
html.replace("%HPDepth%", (hp == null) ? "0" : Integer.toString(hp.getLvl()));
html.replace("%MPDepth%", (mp == null) ? "0" : Integer.toString(mp.getLvl()));
html.replace("%XPDepth%", (xp == null) ? "0" : Integer.toString(xp.getLvl()));
player.sendPacket(html);
}
else

View File

@@ -55,7 +55,7 @@ public class CastleWarehouse extends AbstractNpcAI
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
String htmltext = event;
final boolean isMyLord = player.isClanLeader() ? (player.getClan().getCastleId() == (npc.getCastle() != null ? npc.getCastle().getResidenceId() : -1)) : false;
final boolean isMyLord = player.isClanLeader() && (player.getClan().getCastleId() == (npc.getCastle() != null ? npc.getCastle().getResidenceId() : -1));
switch (event)
{
case "warehouse-01.html":

View File

@@ -107,8 +107,8 @@ public class ClanHallAuctioneer extends AbstractNpcAI
// THE_CLAN_DOES_NOT_OWN_A_CLAN_HALL
htmltext = getHtm(player, "ClanHallAuctioneer-cancelBid.html");
htmltext = htmltext.replaceAll("%myBid%", String.valueOf(clanHallAuction.getClanBid(clan)));
htmltext = htmltext.replaceAll("%myBidRemain%", String.valueOf(clanHallAuction.getClanBid(clan) * 9));
htmltext = htmltext.replace("%myBid%", String.valueOf(clanHallAuction.getClanBid(clan)));
htmltext = htmltext.replace("%myBidRemain%", String.valueOf(clanHallAuction.getClanBid(clan) * 9));
break;
}
case "cancel":
@@ -151,9 +151,9 @@ public class ClanHallAuctioneer extends AbstractNpcAI
final DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
htmltext = getHtm(player, "ClanHallAuctioneer-bid2.html");
htmltext = htmltext.replaceAll("%id%", String.valueOf(clanHallAuction.getClanHallId()));
htmltext = htmltext.replaceAll("%minBid%", String.valueOf(clanHallAuction.getHighestBid()));
htmltext = htmltext.replaceAll("%myBid%", String.valueOf(clanHallAuction.getClanBid(clan)));
htmltext = htmltext.replace("%id%", String.valueOf(clanHallAuction.getClanHallId()));
htmltext = htmltext.replace("%minBid%", String.valueOf(clanHallAuction.getHighestBid()));
htmltext = htmltext.replace("%myBid%", String.valueOf(clanHallAuction.getClanBid(clan)));
htmltext = htmltext.replace("%auctionEnd%", builder.appendPattern("dd/MM/yyyy HH").appendLiteral(" hour ").appendPattern("mm").appendLiteral(" minutes").toFormatter().format(Instant.ofEpochMilli(System.currentTimeMillis() + clanHallAuction.getRemaingTime()).atZone(ZoneId.systemDefault())));
}
}
@@ -194,7 +194,7 @@ public class ClanHallAuctioneer extends AbstractNpcAI
final DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
htmltext = getHtm(player, "ClanHallAuctioneer-bidInfo.html");
htmltext = htmltext.replaceAll("%id%", String.valueOf(clanHall.getResidenceId()));
htmltext = htmltext.replace("%id%", String.valueOf(clanHall.getResidenceId()));
htmltext = htmltext.replace("%owner%", owner != null ? owner.getName() : "");
htmltext = htmltext.replace("%clanLeader%", owner != null ? owner.getLeaderName() : "");
htmltext = htmltext.replace("%rent%", String.valueOf(clanHall.getLease()));
@@ -287,7 +287,7 @@ public class ClanHallAuctioneer extends AbstractNpcAI
final ClanHallAuction auction = ClanHallAuctionManager.getInstance().getClanHallAuctionById(clanHall.getResidenceId());
if(auction == null)
{
System.out.println(clanHall.getResidenceId());
// System.out.println(clanHall.getResidenceId());
return;
}
sb.append("<tr><td width=50><font color=\"aaaaff\">&^");

View File

@@ -171,9 +171,9 @@ public class ClanHallManager extends AbstractNpcAI
final ResidenceFunction mpFunc = clanHall.getFunction(ResidenceFunctionType.MP_REGEN);
final ResidenceFunction xpFunc = clanHall.getFunction(ResidenceFunctionType.EXP_RESTORE);
htmltext = getHtm(player, "ClanHallManager-09.html");
htmltext = htmltext.replaceAll("%hpFunction%", hpFunc != null ? String.valueOf((int) hpFunc.getValue()) : "0");
htmltext = htmltext.replaceAll("%mpFunction%", mpFunc != null ? String.valueOf((int) mpFunc.getValue()) : "0");
htmltext = htmltext.replaceAll("%resFunction%", xpFunc != null ? String.valueOf((int) xpFunc.getValue()) : "0");
htmltext = htmltext.replace("%hpFunction%", hpFunc != null ? String.valueOf((int) hpFunc.getValue()) : "0");
htmltext = htmltext.replace("%mpFunction%", mpFunc != null ? String.valueOf((int) mpFunc.getValue()) : "0");
htmltext = htmltext.replace("%resFunction%", xpFunc != null ? String.valueOf((int) xpFunc.getValue()) : "0");
}
else
{
@@ -216,7 +216,7 @@ public class ClanHallManager extends AbstractNpcAI
if (!st.hasMoreTokens())
{
htmltext = getHtm(player, "ClanHallManager-funcBuffs_" + buffLevel + ".html");
htmltext = htmltext.replaceAll("%manaLeft%", Integer.toString((int) npc.getCurrentMp()));
htmltext = htmltext.replace("%manaLeft%", Integer.toString((int) npc.getCurrentMp()));
}
else
{
@@ -237,7 +237,7 @@ public class ClanHallManager extends AbstractNpcAI
castSkill(npc, player, skill);
htmltext = getHtm(player, "ClanHallManager-funcBuffsDone.html");
}
htmltext = htmltext.replaceAll("%manaLeft%", Integer.toString((int) npc.getCurrentMp()));
htmltext = htmltext.replace("%manaLeft%", Integer.toString((int) npc.getCurrentMp()));
}
}
}
@@ -278,8 +278,8 @@ public class ClanHallManager extends AbstractNpcAI
case "warehouse":
{
htmltext = getHtm(player, "ClanHallManager-10.html");
htmltext = htmltext.replaceAll("%lease%", String.valueOf(clanHall.getLease()));
htmltext = htmltext.replaceAll("%payDate%", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(clanHall.getNextPayment())));
htmltext = htmltext.replace("%lease%", String.valueOf(clanHall.getLease()));
htmltext = htmltext.replace("%payDate%", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(clanHall.getNextPayment())));
break;
}
case "manageFunctions":
@@ -329,7 +329,7 @@ public class ClanHallManager extends AbstractNpcAI
{
final int funcVal = (int) oldFunc.getTemplate().getValue();
htmltext = getHtm(player, "ClanHallManager-manageFuncAlreadySet.html");
htmltext = htmltext.replaceAll("%funcEffect%", "<fstring p1=\"" + (funcVal > 0 ? funcVal : oldFunc.getLevel()) + "\">" + (funcVal > 0 ? NpcStringId.S1.getId() : NpcStringId.STAGE_S1.getId()) + "</fstring>");
htmltext = htmltext.replace("%funcEffect%", "<fstring p1=\"" + (funcVal > 0 ? funcVal : oldFunc.getLevel()) + "\">" + (funcVal > 0 ? NpcStringId.S1.getId() : NpcStringId.STAGE_S1.getId()) + "</fstring>");
}
else if ((funcId >= 1) && (funcId <= 8))
{
@@ -337,9 +337,9 @@ public class ClanHallManager extends AbstractNpcAI
if (template != null)
{
htmltext = getHtm(player, "ClanHallManager-funcConfirm" + funcId + ".html");
htmltext = htmltext.replaceAll("%funcId%", String.valueOf(funcId));
htmltext = htmltext.replaceAll("%funcLv%", String.valueOf(funcLv));
htmltext = htmltext.replaceAll("%funcCost%", "<fstring p1=\"" + template.getCost().getCount() + "\" p2=\"" + template.getDurationAsDays() + "\">" + NpcStringId.FONT_COLOR_FFAABB_S1_FONT_ADENA_S2_DAY_S.getId() + "</fstring>");
htmltext = htmltext.replace("%funcId%", String.valueOf(funcId));
htmltext = htmltext.replace("%funcLv%", String.valueOf(funcLv));
htmltext = htmltext.replace("%funcCost%", "<fstring p1=\"" + template.getCost().getCount() + "\" p2=\"" + template.getDurationAsDays() + "\">" + NpcStringId.FONT_COLOR_FFAABB_S1_FONT_ADENA_S2_DAY_S.getId() + "</fstring>");
}
}
}
@@ -383,7 +383,7 @@ public class ClanHallManager extends AbstractNpcAI
if (act.equals("confirm"))
{
htmltext = getHtm(player, "ClanHallManager-removeFunctionConfirm.html");
htmltext = htmltext.replaceAll("%FUNC_TYPE%", funcType.toString());
htmltext = htmltext.replace("%FUNC_TYPE%", funcType.toString());
}
else if (act.equals("remove"))
{
@@ -444,7 +444,7 @@ public class ClanHallManager extends AbstractNpcAI
else
{
htmltext = getHtm(player, "ClanHallManager-02.html");
htmltext = htmltext.replaceAll("%costFailDayLeft%", Integer.toString((8 - clanHall.getCostFailDay())));
htmltext = htmltext.replace("%costFailDayLeft%", Integer.toString((8 - clanHall.getCostFailDay())));
}
}
else

View File

@@ -65,8 +65,10 @@ import ai.AbstractNpcAI;
*/
public class ClassMaster extends AbstractNpcAI implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(ClassMaster.class.getName());
// NPCs
private static final List<Integer> CLASS_MASTERS = new ArrayList<>();
private static final List<Integer> CLASS_MASTERS = new ArrayList<>();
static
{
CLASS_MASTERS.add(31756); // Mr. Cat
@@ -76,7 +78,6 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
private boolean _isEnabled;
private boolean _spawnClassMasters;
private boolean _showPopupWindow;
private static final Logger LOGGER = Logger.getLogger(ClassMaster.class.getName());
private final List<ClassChangeData> _classChangeData = new LinkedList<>();
public ClassMaster()
@@ -364,15 +365,12 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
classDataIndex = Integer.parseInt(st.nextToken());
}
if (checkIfClassChangeHasOptions(player))
if (checkIfClassChangeHasOptions(player) && (classDataIndex == -1))
{
if (classDataIndex == -1)
{
htmltext = getHtm(player, "cc_options.html");
htmltext = htmltext.replace("%name%", ClassListData.getInstance().getClass(classId).getClassName()); // getEscapedClientCode());
htmltext = htmltext.replace("%options%", getClassChangeOptions(player, classId));
return htmltext;
}
htmltext = getHtm(player, "cc_options.html");
htmltext = htmltext.replace("%name%", ClassListData.getInstance().getClass(classId).getClassName()); // getEscapedClientCode());
htmltext = htmltext.replace("%options%", getClassChangeOptions(player, classId));
return htmltext;
}
final ClassChangeData data = getClassChangeData(classDataIndex);
@@ -967,7 +965,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
for (int i = 0; i < _classChangeData.size(); i++)
{
final ClassChangeData option = getClassChangeData(i);
if ((option == null) || !option.getCategories().stream().anyMatch(ct -> player.isInCategory(ct)))
if ((option == null) || option.getCategories().stream().noneMatch(player::isInCategory))
{
continue;
}
@@ -983,10 +981,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
}
else
{
option.getItemsRequired().forEach(ih ->
{
sb.append("<tr><td><font color=\"LEVEL\">" + ih.getCount() + "</font></td><td>" + ItemTable.getInstance().getTemplate(ih.getId()).getName() + "</td><td width=30></td></tr>");
});
option.getItemsRequired().forEach(ih -> sb.append("<tr><td><font color=\"LEVEL\">" + ih.getCount() + "</font></td><td>" + ItemTable.getInstance().getTemplate(ih.getId()).getName() + "</td><td width=30></td></tr>"));
}
sb.append("<tr><td>Rewards:</td></tr>");
if (option.getItemsRewarded().isEmpty())
@@ -1008,10 +1003,7 @@ public class ClassMaster extends AbstractNpcAI implements IXmlReader
}
else
{
option.getItemsRewarded().forEach(ih ->
{
sb.append("<tr><td><font color=\"LEVEL\">" + ih.getCount() + "</font></td><td>" + ItemTable.getInstance().getTemplate(ih.getId()).getName() + "</td><td width=30></td></tr>");
});
option.getItemsRewarded().forEach(ih -> sb.append("<tr><td><font color=\"LEVEL\">" + ih.getCount() + "</font></td><td>" + ItemTable.getInstance().getTemplate(ih.getId()).getName() + "</td><td width=30></td></tr>"));
if (option.isRewardNoblesse())
{

View File

@@ -18,6 +18,7 @@ package ai.others;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.commons.concurrent.ThreadPool;
@@ -305,11 +306,11 @@ public class EnergySeeds extends AbstractNpcAI
public void stopAI(GraciaSeeds type)
{
for (Npc seed : _spawnedNpcs.keySet())
for (Entry<Npc, Integer> entry : _spawnedNpcs.entrySet())
{
if (type == _spawns.get(_spawnedNpcs.get(seed))._seedId)
if (type == _spawns.get(entry.getValue())._seedId)
{
seed.deleteMe();
entry.getKey().deleteMe();
}
}
}

View File

@@ -80,7 +80,7 @@ public class FortressSiegeManager extends AbstractNpcAI
case "FortressSiegeManager-15.html":
case "FortressSiegeManager-16.html":
{
return htmltext = event;
return event;
}
case "register":
{

View File

@@ -37,10 +37,6 @@ import ai.AbstractNpcAI;
*/
public class Incarnation extends AbstractNpcAI
{
public Incarnation()
{
}
@RegisterEvent(EventType.ON_NPC_SPAWN)
@RegisterType(ListenerRegisterType.NPC)
@Id(13302)

View File

@@ -38,7 +38,7 @@ import ai.AbstractNpcAI;
public class Mammons extends AbstractNpcAI
{
// NPCs
private static final int MAMMONS[] =
private static final int[] MAMMONS =
{
31126, // Blacksmith of Mammon
33739, // Priest of Mammon

View File

@@ -19,9 +19,10 @@ package ai.others.OlyManager;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.temporal.WeekFields;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -52,10 +53,12 @@ import ai.AbstractNpcAI;
*/
public class OlyManager extends AbstractNpcAI implements IBypassHandler
{
private static final Logger LOGGER = Logger.getLogger(OlyManager.class.getName());
// NPC
private static final int MANAGER = 31688;
// Misc
private static final Map<CategoryType, Integer> EQUIPMENT_MULTISELL = new HashMap<>();
private static final Map<CategoryType, Integer> EQUIPMENT_MULTISELL = new EnumMap<>(CategoryType.class);
static
{
EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_SIGEL_GROUP, 917);
@@ -73,7 +76,6 @@ public class OlyManager extends AbstractNpcAI implements IBypassHandler
"watchmatch",
"arenachange"
};
private static final Logger LOGGER = Logger.getLogger(OlyManager.class.getName());
private OlyManager()
{
@@ -212,11 +214,11 @@ public class OlyManager extends AbstractNpcAI implements IBypassHandler
}
else
{
for (CategoryType type : EQUIPMENT_MULTISELL.keySet())
for (Entry<CategoryType, Integer> entry : EQUIPMENT_MULTISELL.entrySet())
{
if (player.isInCategory(type))
if (player.isInCategory(entry.getKey()))
{
multisellId = EQUIPMENT_MULTISELL.get(type);
multisellId = entry.getValue();
break;
}
}

View File

@@ -90,23 +90,20 @@ public class PolymorphingOnAttack extends AbstractNpcAI
if (npc.isSpawned() && !npc.isDead())
{
final List<Integer> tmp = MOBSPAWNS.get(npc.getId());
if (tmp != null)
if ((tmp != null) && (npc.getCurrentHp() <= ((npc.getMaxHp() * tmp.get(1)) / 100.0)) && (getRandom(100) < tmp.get(2)))
{
if ((npc.getCurrentHp() <= ((npc.getMaxHp() * tmp.get(1)) / 100.0)) && (getRandom(100) < tmp.get(2)))
if (tmp.get(3) >= 0)
{
if (tmp.get(3) >= 0)
{
final NpcStringId npcString = MOBTEXTS[tmp.get(3)][getRandom(MOBTEXTS[tmp.get(3)].length)];
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), npcString));
}
npc.deleteMe();
final Attackable newNpc = (Attackable) addSpawn(tmp.get(0), npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true);
final Creature originalAttacker = isSummon ? attacker.getServitors().values().stream().findFirst().orElse(attacker.getPet()) : attacker;
newNpc.setRunning();
newNpc.addDamageHate(originalAttacker, 0, 500);
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalAttacker);
final NpcStringId npcString = MOBTEXTS[tmp.get(3)][getRandom(MOBTEXTS[tmp.get(3)].length)];
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getName(), npcString));
}
npc.deleteMe();
final Attackable newNpc = (Attackable) addSpawn(tmp.get(0), npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), false, 0, true);
final Creature originalAttacker = isSummon ? attacker.getServitors().values().stream().findFirst().orElse(attacker.getPet()) : attacker;
newNpc.setRunning();
newNpc.addDamageHate(originalAttacker, 0, 500);
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, originalAttacker);
}
}
return super.onAttack(npc, attacker, damage, isSummon);

View File

@@ -77,14 +77,11 @@ public class PrisonGuards extends AbstractNpcAI
{
if (player.isAffectedBySkill(TIMER))
{
if ((getRandom(100) < 10) && (npc.calculateDistance3D(player) < 100))
if ((getRandom(100) < 10) && (npc.calculateDistance3D(player) < 100) && (getQuestItemsCount(player, STAMP) <= 3) && npc.isScriptValue(0))
{
if ((getQuestItemsCount(player, STAMP) <= 3) && npc.isScriptValue(0))
{
giveItems(player, STAMP, 1);
npc.setScriptValue(1);
startQuestTimer("CLEAR_STATUS", 600000, npc, null);
}
giveItems(player, STAMP, 1);
npc.setScriptValue(1);
startQuestTimer("CLEAR_STATUS", 600000, npc, null);
}
}
else

View File

@@ -69,17 +69,11 @@ public class SummonPc extends AbstractNpcAI
else if ((npc.calculateDistance3D(attacker) > 100) && !attacked)
{
final Attackable monster = (Attackable) npc;
if (monster.getMostHated() != null)
if ((monster.getMostHated() != null) && (((monster.getMostHated() == attacker) && (chance < 50)) || (chance < 10)) && (SUMMON_PC.getSkill().getMpConsume() < npc.getCurrentMp()) && (SUMMON_PC.getSkill().getHpConsume() < npc.getCurrentHp()) && !npc.isSkillDisabled(SUMMON_PC.getSkill()))
{
if (((monster.getMostHated() == attacker) && (chance < 50)) || (chance < 10))
{
if ((SUMMON_PC.getSkill().getMpConsume() < npc.getCurrentMp()) && (SUMMON_PC.getSkill().getHpConsume() < npc.getCurrentHp()) && !npc.isSkillDisabled(SUMMON_PC.getSkill()))
{
npc.setTarget(attacker);
npc.doCast(SUMMON_PC.getSkill());
npc.getVariables().set("attacked", true);
}
}
npc.setTarget(attacker);
npc.doCast(SUMMON_PC.getSkill());
npc.getVariables().set("attacked", true);
}
}
return super.onAttack(npc, attacker, damage, isSummon);

View File

@@ -51,16 +51,13 @@ public class TimakOrcTroopLeader extends AbstractNpcAI
if (npc.isMonster())
{
final MonsterInstance monster = (MonsterInstance) npc;
if (!monster.isTeleporting())
if (!monster.isTeleporting() && (getRandom(1, 100) <= npc.getParameters().getInt("SummonPrivateRate", 0)))
{
if (getRandom(1, 100) <= npc.getParameters().getInt("SummonPrivateRate", 0))
for (MinionHolder is : npc.getParameters().getMinionList("Privates"))
{
for (MinionHolder is : npc.getParameters().getMinionList("Privates"))
{
addMinion((MonsterInstance) npc, is.getId());
}
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG));
addMinion((MonsterInstance) npc, is.getId());
}
npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(ON_ATTACK_MSG));
}
}
return super.onAttack(npc, attacker, damage, isSummon);

View File

@@ -73,7 +73,7 @@ public class SellBuff implements IVoicedCommandHandler, IBypassHandler
public boolean useBypass(String command, PlayerInstance player, Creature target)
{
String cmd = "";
String params = "";
StringBuilder params = new StringBuilder();
final StringTokenizer st = new StringTokenizer(command, " ");
if (st.hasMoreTokens())
@@ -83,14 +83,14 @@ public class SellBuff implements IVoicedCommandHandler, IBypassHandler
while (st.hasMoreTokens())
{
params += st.nextToken() + (st.hasMoreTokens() ? " " : "");
params.append(st.nextToken() + (st.hasMoreTokens() ? " " : ""));
}
if (cmd.isEmpty())
{
return false;
}
return useBypass(cmd, player, params);
return useBypass(cmd, player, params.toString());
}
@Override
@@ -130,11 +130,12 @@ public class SellBuff implements IVoicedCommandHandler, IBypassHandler
}
else
{
String title = "BUFF SELL: ";
StringBuilder title = new StringBuilder();
title.append("BUFF SELL: ");
final StringTokenizer st = new StringTokenizer(params, " ");
while (st.hasMoreTokens())
{
title += st.nextToken() + " ";
title.append(st.nextToken() + " ");
}
if (title.length() > 40)
@@ -143,7 +144,7 @@ public class SellBuff implements IVoicedCommandHandler, IBypassHandler
return false;
}
SellBuffsManager.getInstance().startSellBuffs(player, title);
SellBuffsManager.getInstance().startSellBuffs(player, title.toString());
}
break;
}

View File

@@ -52,16 +52,16 @@ public class ShadowWeapons extends AbstractNpcAI
public String onTalk(Npc npc, PlayerInstance player)
{
String htmltext;
final boolean has_d = hasQuestItems(player, 8869); // Shadow Item Exchange Coupon (D-Grade)
final boolean has_c = hasQuestItems(player, 8870); // Shadow Item Exchange Coupon (C-Grade)
final boolean hasD = hasQuestItems(player, 8869); // Shadow Item Exchange Coupon (D-Grade)
final boolean hasC = hasQuestItems(player, 8870); // Shadow Item Exchange Coupon (C-Grade)
if (has_d || has_c)
if (hasD || hasC)
{
if (!has_d)
if (!hasD)
{
htmltext = "exchange_c.html";
}
else if (!has_c)
else if (!hasC)
{
htmltext = "exchange_d.html";
}
@@ -77,7 +77,7 @@ public class ShadowWeapons extends AbstractNpcAI
return htmltext;
}
public static void main(String args[])
public static void main(String[] args)
{
new ShadowWeapons();
}

View File

@@ -221,12 +221,9 @@ public class Rabbits extends Event
}
}
}
else if (skill.getId() == RABBIT_MAGIC_EYE.getSkillId())
else if ((skill.getId() == RABBIT_MAGIC_EYE.getSkillId()) && npc.isInvisible() && npc.isInsideRadius2D(caster, skill.getAffectRange()))
{
if (npc.isInvisible() && npc.isInsideRadius2D(caster, skill.getAffectRange()))
{
npc.setInvisible(false);
}
npc.setInvisible(false);
}
return super.onSkillSee(npc, caster, skill, targets, isSummon);
}

View File

@@ -41,6 +41,21 @@ import org.l2jmobius.gameserver.util.Broadcast;
*/
public class Race extends Event
{
// 5 min for register
private static final int REGISTER_TIME = 5;
// 5 min for race
private static final int RACE_TIME = 10;
// NPCs
private static final int START_NPC = 900103;
private static final int STOP_NPC = 900104;
// Locations
private static final String[] LOCATIONS =
{
"Heretic catacomb enterance",
"Dion castle bridge",
"Floran village enterance",
"Floran fort gate"
};
// Event NPCs list
private List<Npc> _npclist;
// Npc
@@ -53,28 +68,13 @@ public class Race extends Event
private static boolean _isactive = false;
// Race state
private static boolean _isRaceStarted = false;
// 5 min for register
private static final int _time_register = 5;
// 5 min for race
private static final int _time_race = 10;
// NPCs
private static final int _start_npc = 900103;
private static final int _stop_npc = 900104;
// Skills (Frog by default)
private static int _skill = 6201;
// We must keep second NPC spawn for radar
private static int[] _randspawn = null;
// Locations
private static final String[] _locations =
{
"Heretic catacomb enterance",
"Dion castle bridge",
"Floran village enterance",
"Floran fort gate"
};
// @formatter:off
private static final int[][] _coords =
private static final int[][] COORDS =
{
// x, y, z, heading
{ 39177, 144345, -3650, 0 },
@@ -82,7 +82,7 @@ public class Race extends Event
{ 16537, 169937, -3500, 0 },
{ 7644, 150898, -2890, 0 }
};
private static final int[][] _rewards =
private static final int[][] REWARDS =
{
{ 6622, 2 }, // Giant's Codex
{ 9625, 2 }, // Giant's Codex -
@@ -103,12 +103,12 @@ public class Race extends Event
private Race()
{
addStartNpc(_start_npc);
addFirstTalkId(_start_npc);
addTalkId(_start_npc);
addStartNpc(_stop_npc);
addFirstTalkId(_stop_npc);
addTalkId(_stop_npc);
addStartNpc(START_NPC);
addFirstTalkId(START_NPC);
addTalkId(START_NPC);
addStartNpc(STOP_NPC);
addFirstTalkId(STOP_NPC);
addTalkId(STOP_NPC);
}
@Override
@@ -132,14 +132,14 @@ public class Race extends Event
// Set Event active
_isactive = true;
// Spawn Manager
_npc = recordSpawn(_start_npc, 18429, 145861, -3090, 0, false, 0);
_npc = recordSpawn(START_NPC, 18429, 145861, -3090, 0, false, 0);
// Announce event start
Broadcast.toAllOnlinePlayers("* Race Event started! *");
Broadcast.toAllOnlinePlayers("Visit Event Manager in Dion village and signup, you have " + _time_register + " min before Race Start...");
Broadcast.toAllOnlinePlayers("Visit Event Manager in Dion village and signup, you have " + REGISTER_TIME + " min before Race Start...");
// Schedule Event end
_eventTask = ThreadPool.schedule(() -> StartRace(), _time_register * 60 * 1000);
_eventTask = ThreadPool.schedule(this::StartRace, REGISTER_TIME * 60 * 1000);
return true;
@@ -159,10 +159,10 @@ public class Race extends Event
// Announce
Broadcast.toAllOnlinePlayers("Race started!");
// Get random Finish
final int location = getRandom(0, _locations.length - 1);
_randspawn = _coords[location];
final int location = getRandom(0, LOCATIONS.length - 1);
_randspawn = COORDS[location];
// And spawn NPC
recordSpawn(_stop_npc, _randspawn[0], _randspawn[1], _randspawn[2], _randspawn[3], false, 0);
recordSpawn(STOP_NPC, _randspawn[0], _randspawn[1], _randspawn[2], _randspawn[3], false, 0);
// Transform players and send message
for (PlayerInstance player : _players)
{
@@ -170,7 +170,7 @@ public class Race extends Event
{
if (player.isInsideRadius2D(_npc, 500))
{
sendMessage(player, "Race started! Go find Finish NPC as fast as you can... He is located near " + _locations[location]);
sendMessage(player, "Race started! Go find Finish NPC as fast as you can... He is located near " + LOCATIONS[location]);
transformPlayer(player);
player.getRadar().addMarker(_randspawn[0], _randspawn[1], _randspawn[2]);
}
@@ -182,7 +182,7 @@ public class Race extends Event
}
}
// Schedule timeup for Race
_eventTask = ThreadPool.schedule(() -> timeUp(), _time_race * 60 * 1000);
_eventTask = ThreadPool.schedule(this::timeUp, RACE_TIME * 60 * 1000);
}
@Override
@@ -215,11 +215,11 @@ public class Race extends Event
}
}
// Despawn NPCs
for (Npc _npc : _npclist)
for (Npc npc : _npclist)
{
if (_npc != null)
if (npc != null)
{
_npc.deleteMe();
npc.deleteMe();
}
}
_npclist.clear();
@@ -241,13 +241,13 @@ public class Race extends Event
}
else
{
final int _number = Integer.parseInt(bypass.substring(5));
final Skill _sk = SkillData.getInstance().getSkill(_number, 1);
if (_sk != null)
final int number = Integer.parseInt(bypass.substring(5));
final Skill skill = SkillData.getInstance().getSkill(number, 1);
if (skill != null)
{
_skill = _number;
_skill = number;
player.sendMessage("Transform skill set to:");
player.sendMessage(_sk.getName());
player.sendMessage(skill.getName());
}
else
{
@@ -331,17 +331,17 @@ public class Race extends Event
{
getQuestState(player, true);
if (npc.getId() == _start_npc)
if (npc.getId() == START_NPC)
{
if (_isRaceStarted)
{
return _start_npc + "-started-" + isRacing(player) + ".htm";
return START_NPC + "-started-" + isRacing(player) + ".htm";
}
return _start_npc + "-" + isRacing(player) + ".htm";
return START_NPC + "-" + isRacing(player) + ".htm";
}
else if ((npc.getId() == _stop_npc) && _isRaceStarted)
else if ((npc.getId() == STOP_NPC) && _isRaceStarted)
{
return _stop_npc + "-" + isRacing(player) + ".htm";
return STOP_NPC + "-" + isRacing(player) + ".htm";
}
return npc.getId() + ".htm";
}
@@ -399,8 +399,8 @@ public class Race extends Event
private void winRace(PlayerInstance player)
{
final int[] _reward = _rewards[getRandom(_rewards.length - 1)];
player.addItem("eventModRace", _reward[0], _reward[1], _npc, true);
final int[] reward = REWARDS[getRandom(REWARDS.length - 1)];
player.addItem("eventModRace", reward[0], reward[1], _npc, true);
Broadcast.toAllOnlinePlayers(player.getName() + " is a winner!");
eventStop();
}

View File

@@ -574,8 +574,8 @@ public class TvT extends Event
}
// Start inactivity check.
if (creature.isPlayer() && //
((((zone == BLUE_PEACE_ZONE) && (creature.getTeam() == Team.BLUE)) || //
((zone == RED_PEACE_ZONE) && (creature.getTeam() == Team.RED)))))
(((zone == BLUE_PEACE_ZONE) && (creature.getTeam() == Team.BLUE)) || //
((zone == RED_PEACE_ZONE) && (creature.getTeam() == Team.RED))))
{
resetActivityTimers(creature.getActingPlayer());
}

View File

@@ -61,10 +61,7 @@ public class ListenerTest extends AbstractNpcAI
setAttackableAttackId(this::onAttackableAttack, ELPIES);
// Manual listener registration
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_DLG_ANSWER, (OnPlayerDlgAnswer event) ->
{
LOGGER.info(getClass().getSimpleName() + ": " + event.getPlayer() + " OnPlayerDlgAnswer: Answer: " + event.getAnswer() + " MessageId: " + event.getMessageId());
}, this));
Containers.Global().addListener(new ConsumerEventListener(Containers.Global(), EventType.ON_PLAYER_DLG_ANSWER, (OnPlayerDlgAnswer event) -> LOGGER.info(getClass().getSimpleName() + ": " + event.getPlayer() + " OnPlayerDlgAnswer: Answer: " + event.getAnswer() + " MessageId: " + event.getMessageId()), this));
}
/**

View File

@@ -114,24 +114,24 @@ public class HeavyMedal extends LongTimeEvent
public int checkLevel(PlayerInstance player)
{
int _lev = 0;
int level = 0;
if (hasQuestItems(player, 6402))
{
_lev = 4;
level = 4;
}
else if (hasQuestItems(player, 6401))
{
_lev = 3;
level = 3;
}
else if (hasQuestItems(player, 6400))
{
_lev = 2;
level = 2;
}
else if (hasQuestItems(player, 6399))
{
_lev = 1;
level = 1;
}
return _lev;
return level;
}
public static void main(String[] args)

View File

@@ -16,8 +16,6 @@
*/
package events.MasterOfEnchanting;
import java.util.Date;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
@@ -62,9 +60,6 @@ public class MasterOfEnchanting extends LongTimeEvent
9572
};
@SuppressWarnings("deprecation")
private static final Date EVENT_START = new Date(2011, 7, 1);
private MasterOfEnchanting()
{
addStartNpc(MASTER_YOGI);
@@ -93,8 +88,8 @@ public class MasterOfEnchanting extends LongTimeEvent
{
final long curTime = System.currentTimeMillis();
final String value = player.getVariables().getString("MasterOfEnchanting");
final long reuse = value == "" ? 0 : Long.parseLong(value);
if (player.getCreateDate().after(EVENT_START))
final long reuse = value.equals("") ? 0 : Long.parseLong(value);
if (player.getCreateDate().after(getEventPeriod().getStartDate()))
{
return "32599-bidth.htm";
}

View File

@@ -60,18 +60,15 @@ public class RudolphsBlessing extends LongTimeEvent
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
if (event.equals("rudolph_eat"))
if (event.equals("rudolph_eat") && (player != null) && player.isOnline())
{
if ((player != null) && player.isOnline())
if (takeItems(player, ITEM_REQUIREMENT.getId(), ITEM_REQUIREMENT.getCount()))
{
if (takeItems(player, ITEM_REQUIREMENT.getId(), ITEM_REQUIREMENT.getCount()))
{
SkillCaster.triggerCast(player, player, RUDOLPH_TRYUCK.getSkill());
Skill RudolphsBlessing = SkillData.getInstance().getSkill(23297, 1);
RudolphsBlessing.applyEffects(player, player);
}
startQuestTimer("rudolph_eat", 10 * 60 * 1000, null, player);
SkillCaster.triggerCast(player, player, RUDOLPH_TRYUCK.getSkill());
Skill rudolphsBlessing = SkillData.getInstance().getSkill(23297, 1);
rudolphsBlessing.applyEffects(player, player);
}
startQuestTimer("rudolph_eat", 10 * 60 * 1000, null, player);
}
if (player == null)
{

View File

@@ -307,12 +307,9 @@ public class SavingSanta extends LongTimeEvent
if (event.equalsIgnoreCase("ThomasQuest"))
{
startQuestTimer("ThomasQuest", 14400000, null, null);
Npc ThomasDTurkey = addSpawn(THOMAS_D_TURKEY_ID, THOMAS_SPAWN.getX(), THOMAS_SPAWN.getY(), THOMAS_SPAWN.getZ(), THOMAS_SPAWN.getHeading(), false, 1800000);
final Npc thomas = addSpawn(THOMAS_D_TURKEY_ID, THOMAS_SPAWN.getX(), THOMAS_SPAWN.getY(), THOMAS_SPAWN.getZ(), THOMAS_SPAWN.getHeading(), false, 1800000);
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.THOMAS_D_TURKEY_HAS_APPEARED_PLEASE_SAVE_SANTA));
startQuestTimer("ThomasCast1", 15000, ThomasDTurkey, null);
startQuestTimer("ThomasCast1", 15000, thomas, null);
_isSantaFree = false;
}
else if (event.equalsIgnoreCase("SantaSpawn"))

View File

@@ -136,7 +136,6 @@ import handlers.admincommandhandlers.AdminTargetSay;
import handlers.admincommandhandlers.AdminTeleport;
import handlers.admincommandhandlers.AdminTest;
import handlers.admincommandhandlers.AdminTransform;
import handlers.admincommandhandlers.AdminUnblockIp;
import handlers.admincommandhandlers.AdminVitality;
import handlers.admincommandhandlers.AdminZone;
import handlers.admincommandhandlers.AdminZones;
@@ -475,7 +474,6 @@ public class MasterHandler
AdminTeleport.class,
AdminTest.class,
AdminTransform.class,
AdminUnblockIp.class,
AdminVitality.class,
AdminZone.class,
},
@@ -711,12 +709,9 @@ public class MasterHandler
}
}
registerHandlerMethods.entrySet().stream().filter(e -> e.getValue() == null).forEach(e ->
{
LOGGER.warning("Failed loading handlers of: " + e.getKey().getClass().getSimpleName() + " seems registerHandler function does not exist.");
});
registerHandlerMethods.entrySet().stream().filter(e -> e.getValue() == null).forEach(e -> LOGGER.warning("Failed loading handlers of: " + e.getKey().getClass().getSimpleName() + " seems registerHandler function does not exist."));
for (Class<?> classes[] : HANDLERS)
for (Class<?>[] classes : HANDLERS)
{
for (Class<?> c : classes)
{

View File

@@ -33,15 +33,12 @@ public class ItemInstanceAction implements IActionHandler
public boolean action(PlayerInstance player, WorldObject target, boolean interact)
{
final Castle castle = CastleManager.getInstance().getCastle(target);
if ((castle != null) && (SiegeGuardManager.getInstance().getSiegeGuardByItem(castle.getResidenceId(), target.getId()) != null))
if ((castle != null) && (SiegeGuardManager.getInstance().getSiegeGuardByItem(castle.getResidenceId(), target.getId()) != null) && ((player.getClan() == null) || (castle.getOwnerId() != player.getClanId()) || !player.hasClanPrivilege(ClanPrivilege.CS_MERCENARIES)))
{
if ((player.getClan() == null) || (castle.getOwnerId() != player.getClanId()) || !player.hasClanPrivilege(ClanPrivilege.CS_MERCENARIES))
{
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_THE_AUTHORITY_TO_CANCEL_MERCENARY_POSITIONING);
player.setTarget(target);
player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
return false;
}
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_THE_AUTHORITY_TO_CANCEL_MERCENARY_POSITIONING);
player.setTarget(target);
player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
return false;
}
if (!player.isFlying())

View File

@@ -387,6 +387,7 @@ public class AdminAdmin implements IAdminCommandHandler
}
catch (Exception e)
{
// Not important.
}
switch (mode)
{

View File

@@ -207,13 +207,13 @@ public class AdminAnnouncements implements IAdminCommandHandler
announcementDelay = Long.toString(autoAnnounce.getDelay() / 1000);
announcementRepeat = Integer.toString(autoAnnounce.getRepeat());
}
content = content.replaceAll("%id%", announcementId);
content = content.replaceAll("%type%", announcementType);
content = content.replaceAll("%initial%", announcementInital);
content = content.replaceAll("%delay%", announcementDelay);
content = content.replaceAll("%repeat%", announcementRepeat);
content = content.replaceAll("%author%", announcementAuthor);
content = content.replaceAll("%content%", announcementContent);
content = content.replace("%id%", announcementId);
content = content.replace("%type%", announcementType);
content = content.replace("%initial%", announcementInital);
content = content.replace("%delay%", announcementDelay);
content = content.replace("%repeat%", announcementRepeat);
content = content.replace("%author%", announcementAuthor);
content = content.replace("%content%", announcementContent);
Util.sendCBHtml(activeChar, content);
break;
}
@@ -433,13 +433,13 @@ public class AdminAnnouncements implements IAdminCommandHandler
announcementDelay = Long.toString(autoAnnounce.getDelay() / 1000);
announcementRepeat = Integer.toString(autoAnnounce.getRepeat());
}
content = content.replaceAll("%id%", announcementId);
content = content.replaceAll("%type%", announcementType);
content = content.replaceAll("%initial%", announcementInital);
content = content.replaceAll("%delay%", announcementDelay);
content = content.replaceAll("%repeat%", announcementRepeat);
content = content.replaceAll("%author%", announcementAuthor);
content = content.replaceAll("%content%", announcementContent);
content = content.replace("%id%", announcementId);
content = content.replace("%type%", announcementType);
content = content.replace("%initial%", announcementInital);
content = content.replace("%delay%", announcementDelay);
content = content.replace("%repeat%", announcementRepeat);
content = content.replace("%author%", announcementAuthor);
content = content.replace("%content%", announcementContent);
Util.sendCBHtml(activeChar, content);
break;
}
@@ -489,8 +489,8 @@ public class AdminAnnouncements implements IAdminCommandHandler
sb.append("</tr>");
}).build();
content = content.replaceAll("%pages%", result.getPagerTemplate().toString());
content = content.replaceAll("%announcements%", result.getBodyTemplate().toString());
content = content.replace("%pages%", result.getPagerTemplate().toString());
content = content.replace("%announcements%", result.getBodyTemplate().toString());
Util.sendCBHtml(activeChar, content);
break;
}

View File

@@ -212,7 +212,7 @@ public class AdminBuffs implements IAdminCommandHandler
else if (command.startsWith("admin_removereuse"))
{
final StringTokenizer st = new StringTokenizer(command, " ");
command = st.nextToken();
st.nextToken();
PlayerInstance player = null;
if (st.hasMoreTokens())

View File

@@ -154,7 +154,7 @@ public class AdminClanHall implements IAdminCommandHandler
useAdminCommand("admin_clanhall id=" + clanHallId, player);
}
private void sendClanHallList(PlayerInstance player, int page, BypassParser parser)
private void sendClanHallList(PlayerInstance player, int page)
{
final NpcHtmlMessage html = new NpcHtmlMessage(0, 1);
html.setFile(player, "data/html/admin/clanhall_list.htm");
@@ -271,7 +271,7 @@ public class AdminClanHall implements IAdminCommandHandler
}
else
{
sendClanHallList(player, page, parser);
sendClanHallList(player, page);
}
}

View File

@@ -45,8 +45,6 @@ public class AdminCursedWeapons implements IAdminCommandHandler
"admin_cw_info_menu"
};
private int itemId;
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
{
@@ -94,7 +92,7 @@ public class AdminCursedWeapons implements IAdminCommandHandler
adminReply.setFile(activeChar, "data/html/admin/cwinfo.htm");
for (CursedWeapon cw : cwm.getCursedWeapons())
{
itemId = cw.getItemId();
final int itemId = cw.getItemId();
replyMSG.append("<table width=270><tr><td>Name:</td><td>");
replyMSG.append(cw.getName());

View File

@@ -17,6 +17,7 @@
package handlers.admincommandhandlers;
import java.awt.Color;
import java.util.logging.Logger;
import org.l2jmobius.gameserver.data.xml.impl.DoorData;
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
@@ -36,7 +37,10 @@ import org.l2jmobius.gameserver.util.BuilderUtil;
*/
public class AdminDoorControl implements IAdminCommandHandler
{
private static final Logger LOGGER = Logger.getLogger(AdminDoorControl.class.getName());
private static DoorData _doorTable = DoorData.getInstance();
private static final String[] ADMIN_COMMANDS =
{
"admin_open",
@@ -168,7 +172,7 @@ public class AdminDoorControl implements IAdminCommandHandler
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.warning("Problem with AdminDoorControl: " + e.getMessage());
}
return true;
}

View File

@@ -654,7 +654,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.warning(e.toString());
}
}
else if (command.startsWith("admin_find_dualbox"))
@@ -1255,9 +1255,9 @@ public class AdminEditChar implements IAdminCommandHandler
/**
* @param activeChar
* @param CharacterToFind
* @param characterToFind
*/
private void findCharacter(PlayerInstance activeChar, String CharacterToFind)
private void findCharacter(PlayerInstance activeChar, String characterToFind)
{
int CharactersFound = 0;
String name;
@@ -1271,7 +1271,7 @@ public class AdminEditChar implements IAdminCommandHandler
for (PlayerInstance player : players)
{ // Add player info into new Table row
name = player.getName();
if (name.toLowerCase().contains(CharacterToFind.toLowerCase()))
if (name.toLowerCase().contains(characterToFind.toLowerCase()))
{
CharactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
@@ -1318,23 +1318,22 @@ public class AdminEditChar implements IAdminCommandHandler
/**
* @param activeChar
* @param IpAdress
* @throws IllegalArgumentException
* @param ipAdress
*/
private void findCharactersPerIp(PlayerInstance activeChar, String IpAdress) throws IllegalArgumentException
private void findCharactersPerIp(PlayerInstance activeChar, String ipAdress)
{
boolean findDisconnected = false;
if (IpAdress.equals("disconnected"))
if (ipAdress.equals("disconnected"))
{
findDisconnected = true;
}
else if (!IpAdress.matches("^(?:(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))\\.){3}(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))$"))
else if (!ipAdress.matches("^(?:(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))\\.){3}(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))$"))
{
throw new IllegalArgumentException("Malformed IPv4 number");
}
int CharactersFound = 0;
int charactersFound = 0;
GameClient client;
String ip = "0.0.0.0";
final StringBuilder replyMSG = new StringBuilder(1000);
@@ -1366,14 +1365,14 @@ public class AdminEditChar implements IAdminCommandHandler
}
ip = client.getConnectionAddress().getHostAddress();
if (!ip.equals(IpAdress))
if (!ip.equals(ipAdress))
{
continue;
}
}
final String name = player.getName();
CharactersFound += 1;
charactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name);
replyMSG.append("\">");
@@ -1384,7 +1383,7 @@ public class AdminEditChar implements IAdminCommandHandler
replyMSG.append(player.getLevel());
replyMSG.append("</td></tr>");
if (CharactersFound > 20)
if (charactersFound > 20)
{
break;
}
@@ -1393,16 +1392,16 @@ public class AdminEditChar implements IAdminCommandHandler
final String replyMSG2;
if (CharactersFound == 0)
if (charactersFound == 0)
{
replyMSG2 = "s. Maybe they got d/c? :)";
}
else if (CharactersFound > 20)
else if (charactersFound > 20)
{
adminReply.replace("%number%", " more than " + CharactersFound);
adminReply.replace("%number%", " more than " + charactersFound);
replyMSG2 = "s.<br>In order to avoid you a client crash I won't <br1>display results beyond the 20th character.";
}
else if (CharactersFound == 1)
else if (charactersFound == 1)
{
replyMSG2 = ".";
}
@@ -1410,8 +1409,8 @@ public class AdminEditChar implements IAdminCommandHandler
{
replyMSG2 = "s.";
}
adminReply.replace("%ip%", IpAdress);
adminReply.replace("%number%", String.valueOf(CharactersFound));
adminReply.replace("%ip%", ipAdress);
adminReply.replace("%number%", String.valueOf(charactersFound));
adminReply.replace("%end%", replyMSG2);
activeChar.sendPacket(adminReply);
}
@@ -1419,9 +1418,8 @@ public class AdminEditChar implements IAdminCommandHandler
/**
* @param activeChar
* @param characterName
* @throws IllegalArgumentException
*/
private void findCharactersPerAccount(PlayerInstance activeChar, String characterName) throws IllegalArgumentException
private void findCharactersPerAccount(PlayerInstance activeChar, String characterName)
{
final PlayerInstance player = World.getInstance().getPlayer(characterName);
if (player == null)
@@ -1484,7 +1482,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
final List<String> keys = new ArrayList<>(dualboxIPs.keySet());
keys.sort(Comparator.comparing(s -> dualboxIPs.get(s)).reversed());
keys.sort(Comparator.comparing(dualboxIPs::get).reversed());
final StringBuilder results = new StringBuilder();
for (String dualboxIP : keys)
@@ -1538,7 +1536,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
final List<IpPack> keys = new ArrayList<>(dualboxIPs.keySet());
keys.sort(Comparator.comparing(s -> dualboxIPs.get(s)).reversed());
keys.sort(Comparator.comparing(dualboxIPs::get).reversed());
final StringBuilder results = new StringBuilder();
for (IpPack dualboxIP : keys)

View File

@@ -758,9 +758,9 @@ public class AdminEffects implements IAdminCommandHandler
private void playAdminSound(PlayerInstance activeChar, String sound)
{
final PlaySound _snd = new PlaySound(1, sound, 0, 0, 0, 0, 0);
activeChar.sendPacket(_snd);
activeChar.broadcastPacket(_snd);
final PlaySound snd = new PlaySound(1, sound, 0, 0, 0, 0, 0);
activeChar.sendPacket(snd);
activeChar.broadcastPacket(snd);
BuilderUtil.sendSysMessage(activeChar, "Playing " + sound + ".");
}

View File

@@ -44,7 +44,6 @@ import org.l2jmobius.gameserver.util.Broadcast;
*/
public class AdminEventEngine implements IAdminCommandHandler
{
private static final String[] ADMIN_COMMANDS =
{
"admin_event",
@@ -128,11 +127,8 @@ public class AdminEventEngine implements IAdminCommandHandler
}
catch (Exception e)
{
e.printStackTrace();
}
}
else if (actualCommand.startsWith("admin_event_del"))
{
@@ -214,9 +210,9 @@ public class AdminEventEngine implements IAdminCommandHandler
activeChar.sendMessage(GameEvent.startEventParticipation());
Broadcast.toAllOnlinePlayers(activeChar.getName() + " has started an event. You will find a participation NPC somewhere around you.");
final PlaySound _snd = new PlaySound(1, "B03_F", 0, 0, 0, 0, 0);
activeChar.sendPacket(_snd);
activeChar.broadcastPacket(_snd);
final PlaySound snd = new PlaySound(1, "B03_F", 0, 0, 0, 0, 0);
activeChar.sendPacket(snd);
activeChar.broadcastPacket(snd);
final NpcHtmlMessage adminReply = new NpcHtmlMessage(0, 1);
@@ -374,7 +370,6 @@ public class AdminEventEngine implements IAdminCommandHandler
}
catch (Exception e)
{
e.printStackTrace();
AdminData.getInstance().broadcastMessageToGMs("EventEngine: Error! Possible blank boxes while executing a command which requires a value in the box?");
}
return true;

View File

@@ -52,17 +52,17 @@ public class AdminEvents implements IAdminCommandHandler
return false;
}
String event_name = "";
String _event_bypass = "";
String eventName = "";
String eventBypass = "";
final StringTokenizer st = new StringTokenizer(command, " ");
st.nextToken();
if (st.hasMoreTokens())
{
event_name = st.nextToken();
eventName = st.nextToken();
}
if (st.hasMoreTokens())
{
_event_bypass = st.nextToken();
eventBypass = st.nextToken();
}
if (command.contains("_menu"))
@@ -74,18 +74,18 @@ public class AdminEvents implements IAdminCommandHandler
{
try
{
if (event_name != null)
if (eventName != null)
{
final Event event = (Event) QuestManager.getInstance().getQuest(event_name);
final Event event = (Event) QuestManager.getInstance().getQuest(eventName);
if (event != null)
{
if (event.eventStart(activeChar))
{
BuilderUtil.sendSysMessage(activeChar, "Event " + event_name + " started.");
BuilderUtil.sendSysMessage(activeChar, "Event " + eventName + " started.");
return true;
}
BuilderUtil.sendSysMessage(activeChar, "There is problem starting " + event_name + " event.");
BuilderUtil.sendSysMessage(activeChar, "There is problem starting " + eventName + " event.");
return true;
}
}
@@ -93,7 +93,6 @@ public class AdminEvents implements IAdminCommandHandler
catch (Exception e)
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //event_start <eventname>");
e.printStackTrace();
return false;
}
}
@@ -101,18 +100,18 @@ public class AdminEvents implements IAdminCommandHandler
{
try
{
if (event_name != null)
if (eventName != null)
{
final Event event = (Event) QuestManager.getInstance().getQuest(event_name);
final Event event = (Event) QuestManager.getInstance().getQuest(eventName);
if (event != null)
{
if (event.eventStop())
{
BuilderUtil.sendSysMessage(activeChar, "Event " + event_name + " stopped.");
BuilderUtil.sendSysMessage(activeChar, "Event " + eventName + " stopped.");
return true;
}
BuilderUtil.sendSysMessage(activeChar, "There is problem with stoping " + event_name + " event.");
BuilderUtil.sendSysMessage(activeChar, "There is problem with stoping " + eventName + " event.");
return true;
}
}
@@ -120,7 +119,6 @@ public class AdminEvents implements IAdminCommandHandler
catch (Exception e)
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //event_start <eventname>");
e.printStackTrace();
return false;
}
}
@@ -128,19 +126,18 @@ public class AdminEvents implements IAdminCommandHandler
{
try
{
if (event_name != null)
if (eventName != null)
{
final Event event = (Event) QuestManager.getInstance().getQuest(event_name);
final Event event = (Event) QuestManager.getInstance().getQuest(eventName);
if (event != null)
{
event.eventBypass(activeChar, _event_bypass);
event.eventBypass(activeChar, eventBypass);
}
}
}
catch (Exception e)
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //event_bypass <eventname> <bypass>");
e.printStackTrace();
return false;
}
}

View File

@@ -108,7 +108,7 @@ public class AdminExpSp implements IAdminCommandHandler
activeChar.sendPacket(adminReply);
}
private boolean adminAddExpSp(PlayerInstance activeChar, String ExpSp)
private boolean adminAddExpSp(PlayerInstance activeChar, String expSp)
{
final WorldObject target = activeChar.getTarget();
PlayerInstance player = null;
@@ -121,7 +121,7 @@ public class AdminExpSp implements IAdminCommandHandler
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
final StringTokenizer st = new StringTokenizer(ExpSp);
final StringTokenizer st = new StringTokenizer(expSp);
if (st.countTokens() != 2)
{
return false;
@@ -151,7 +151,7 @@ public class AdminExpSp implements IAdminCommandHandler
return true;
}
private boolean adminRemoveExpSP(PlayerInstance activeChar, String ExpSp)
private boolean adminRemoveExpSP(PlayerInstance activeChar, String expSp)
{
final WorldObject target = activeChar.getTarget();
PlayerInstance player = null;
@@ -164,7 +164,7 @@ public class AdminExpSp implements IAdminCommandHandler
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
final StringTokenizer st = new StringTokenizer(ExpSp);
final StringTokenizer st = new StringTokenizer(expSp);
if (st.countTokens() != 2)
{
return false;

View File

@@ -43,7 +43,6 @@ public class AdminFightCalculator implements IAdminCommandHandler
"admin_fcs",
};
// TODO: remove from gm list etc etc
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
{
@@ -64,6 +63,7 @@ public class AdminFightCalculator implements IAdminCommandHandler
}
catch (StringIndexOutOfBoundsException e)
{
// Do nothing.
}
return true;
}
@@ -212,66 +212,66 @@ public class AdminFightCalculator implements IAdminCommandHandler
for (int i = 0; i < 10000; i++)
{
final boolean _miss1 = Formulas.calcHitMiss(npc1, npc2);
if (_miss1)
final boolean calcMiss1 = Formulas.calcHitMiss(npc1, npc2);
if (calcMiss1)
{
miss1++;
}
final byte _shld1 = Formulas.calcShldUse(npc1, npc2, false);
if (_shld1 > 0)
final byte calcShld1 = Formulas.calcShldUse(npc1, npc2, false);
if (calcShld1 > 0)
{
shld1++;
}
final boolean _crit1 = Formulas.calcCrit(npc1.getCriticalHit(), npc1, npc2, null);
if (_crit1)
final boolean calcCrit1 = Formulas.calcCrit(npc1.getCriticalHit(), npc1, npc2, null);
if (calcCrit1)
{
crit1++;
}
double _patk1 = npc1.getPAtk();
_patk1 += npc1.getRandomDamageMultiplier();
patk1 += _patk1;
double npcPatk1 = npc1.getPAtk();
npcPatk1 += npc1.getRandomDamageMultiplier();
patk1 += npcPatk1;
final double _pdef1 = npc1.getPDef();
pdef1 += _pdef1;
final double npcPdef1 = npc1.getPDef();
pdef1 += npcPdef1;
if (!_miss1)
if (!calcMiss1)
{
final double _dmg1 = Formulas.calcAutoAttackDamage(npc1, npc2, _shld1, _crit1, false);
dmg1 += _dmg1;
final double calcDmg1 = Formulas.calcAutoAttackDamage(npc1, npc2, calcShld1, calcCrit1, false);
dmg1 += calcDmg1;
npc1.abortAttack();
}
}
for (int i = 0; i < 10000; i++)
{
final boolean _miss2 = Formulas.calcHitMiss(npc2, npc1);
if (_miss2)
final boolean calcMiss2 = Formulas.calcHitMiss(npc2, npc1);
if (calcMiss2)
{
miss2++;
}
final byte _shld2 = Formulas.calcShldUse(npc2, npc1, false);
if (_shld2 > 0)
final byte calcShld2 = Formulas.calcShldUse(npc2, npc1, false);
if (calcShld2 > 0)
{
shld2++;
}
final boolean _crit2 = Formulas.calcCrit(npc2.getCriticalHit(), npc2, npc1, null);
if (_crit2)
final boolean calcCrit2 = Formulas.calcCrit(npc2.getCriticalHit(), npc2, npc1, null);
if (calcCrit2)
{
crit2++;
}
double _patk2 = npc2.getPAtk();
_patk2 *= npc2.getRandomDamageMultiplier();
patk2 += _patk2;
double npcPatk2 = npc2.getPAtk();
npcPatk2 *= npc2.getRandomDamageMultiplier();
patk2 += npcPatk2;
final double _pdef2 = npc2.getPDef();
pdef2 += _pdef2;
final double npcPdef2 = npc2.getPDef();
pdef2 += npcPdef2;
if (!_miss2)
if (!calcMiss2)
{
final double _dmg2 = Formulas.calcAutoAttackDamage(npc2, npc1, _shld2, _crit2, false);
dmg2 += _dmg2;
final double calcDmg2 = Formulas.calcAutoAttackDamage(npc2, npc1, calcShld2, calcCrit2, false);
dmg2 += calcDmg2;
npc2.abortAttack();
}
}

View File

@@ -33,7 +33,7 @@ import org.l2jmobius.gameserver.util.BuilderUtil;
*/
public class AdminHeal implements IAdminCommandHandler
{
private static final Logger LOGGER = Logger.getLogger(AdminRes.class.getName());
private static final Logger LOGGER = Logger.getLogger(AdminHeal.class.getName());
private static final String[] ADMIN_COMMANDS =
{
"admin_heal"

View File

@@ -243,7 +243,7 @@ public class AdminInstance implements IAdminCommandHandler
}
}
private void sendTemplateList(PlayerInstance player, int page, BypassParser parser)
private void sendTemplateList(PlayerInstance player, int page)
{
final NpcHtmlMessage html = new NpcHtmlMessage(0, 1);
html.setFile(player, "data/html/admin/instances_list.htm");
@@ -299,7 +299,7 @@ public class AdminInstance implements IAdminCommandHandler
}
else
{
sendTemplateList(player, page, parser);
sendTemplateList(player, page);
}
}

View File

@@ -17,6 +17,7 @@
package handlers.admincommandhandlers;
import java.util.Map;
import java.util.Map.Entry;
import java.util.StringTokenizer;
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
@@ -67,7 +68,7 @@ public class AdminInstanceZone implements IAdminCommandHandler
else if (command.startsWith("admin_instancezone"))
{
final StringTokenizer st = new StringTokenizer(command, " ");
command = st.nextToken();
st.nextToken();
if (st.hasMoreTokens())
{
@@ -108,12 +109,6 @@ public class AdminInstanceZone implements IAdminCommandHandler
return true;
}
@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
private void display(PlayerInstance player, PlayerInstance activeChar)
{
final Map<Integer, Long> instanceTimes = InstanceManager.getInstance().getAllInstanceTimes(player);
@@ -121,11 +116,12 @@ public class AdminInstanceZone implements IAdminCommandHandler
final StringBuilder html = new StringBuilder(500 + (instanceTimes.size() * 200));
html.append("<html><center><table width=260><tr><td width=40><button value=\"Main\" action=\"bypass -h admin_admin\" width=40 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td width=180><center>Character Instances</center></td><td width=40><button value=\"Back\" action=\"bypass -h admin_current_player\" width=40 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><br><font color=\"LEVEL\">Instances for " + player.getName() + "</font><center><br><table><tr><td width=150>Name</td><td width=50>Time</td><td width=70>Action</td></tr>");
for (int id : instanceTimes.keySet())
for (Entry<Integer, Long> entry : instanceTimes.entrySet())
{
int hours = 0;
int minutes = 0;
final long remainingTime = (instanceTimes.get(id) - System.currentTimeMillis()) / 1000;
int id = entry.getKey();
final long remainingTime = (entry.getValue() - System.currentTimeMillis()) / 1000;
if (remainingTime > 0)
{
hours = (int) (remainingTime / 3600);
@@ -141,4 +137,10 @@ public class AdminInstanceZone implements IAdminCommandHandler
ms.setHtml(html.toString());
activeChar.sendPacket(ms);
}
@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
}

View File

@@ -233,18 +233,12 @@ public class AdminLogin implements IAdminCommandHandler
return nameType;
}
/**
*
*/
private void allowToAll()
{
LoginServerThread.getInstance().setServerStatus(ServerStatus.STATUS_AUTO);
Config.SERVER_GMONLY = false;
}
/**
*
*/
private void gmOnly()
{
LoginServerThread.getInstance().setServerStatus(ServerStatus.STATUS_GM_ONLY);

View File

@@ -86,6 +86,7 @@ public class AdminMenu implements IAdminCommandHandler
}
catch (StringIndexOutOfBoundsException e)
{
// Not important.
}
}
else if (command.startsWith("admin_recall_party_menu"))
@@ -153,6 +154,7 @@ public class AdminMenu implements IAdminCommandHandler
}
catch (StringIndexOutOfBoundsException e)
{
// Not important.
}
}
else if (command.equals("admin_kill_menu"))

View File

@@ -82,9 +82,9 @@ public class AdminMessages implements IAdminCommandHandler
}
else if (val.startsWith("zone:"))
{
final int x = Integer.parseInt(val.substring(5, val.indexOf(",")));
final int y = Integer.parseInt(val.substring(val.indexOf(",") + 1, val.lastIndexOf(",")));
final int z = Integer.parseInt(val.substring(val.lastIndexOf(",") + 1, val.length()));
final int x = Integer.parseInt(val.substring(5, val.indexOf(',')));
final int y = Integer.parseInt(val.substring(val.indexOf(',') + 1, val.lastIndexOf(',')));
final int z = Integer.parseInt(val.substring(val.lastIndexOf(',') + 1, val.length()));
sm.addZoneName(x, y, z);
}
else if (val.startsWith("castle:"))
@@ -101,7 +101,6 @@ public class AdminMessages implements IAdminCommandHandler
catch (Exception e)
{
BuilderUtil.sendSysMessage(activeChar, "Exception: " + e.getMessage());
continue;
}
}
activeChar.sendPacket(sm);

View File

@@ -77,7 +77,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
final Npc npc = (Npc) obj;
if ((npc.getLocation().getX() > topLeftX) && (npc.getLocation().getX() < bottomRightX) && (npc.getLocation().getY() > topLeftY) && (npc.getLocation().getY() < bottomRightY) && npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK))
{
if ((npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm") //
if ((npc.getHtmlPath(npc.getId(), 0, null).equals("data/html/npcdefault.htm"))//
|| ((obj instanceof FishermanInstance) && (HtmCache.getInstance().getHtm(null, "data/html/fisherman/" + npc.getId() + ".htm") == null)) //
|| ((obj instanceof WarehouseInstance) && (HtmCache.getInstance().getHtm(null, "data/html/warehouse/" + npc.getId() + ".htm") == null)) //
|| (((obj instanceof MerchantInstance) && !(obj instanceof FishermanInstance)) && (HtmCache.getInstance().getHtm(null, "data/html/merchant/" + npc.getId() + ".htm") == null)) //
@@ -112,7 +112,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
final Npc npc = (Npc) obj;
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK))
{
if ((npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm") //
if ((npc.getHtmlPath(npc.getId(), 0, null).equals("data/html/npcdefault.htm")) //
|| ((obj instanceof FishermanInstance) && (HtmCache.getInstance().getHtm(null, "data/html/fisherman/" + npc.getId() + ".htm") == null)) //
|| ((obj instanceof WarehouseInstance) && (HtmCache.getInstance().getHtm(null, "data/html/warehouse/" + npc.getId() + ".htm") == null)) //
|| (((obj instanceof MerchantInstance) && !(obj instanceof FishermanInstance)) && (HtmCache.getInstance().getHtm(null, "data/html/merchant/" + npc.getId() + ".htm") == null)) //
@@ -144,7 +144,7 @@ public class AdminMissingHtmls implements IAdminCommandHandler
final Npc npc = (Npc) obj;
if (npc.isTalkable() && !npc.hasListener(EventType.ON_NPC_FIRST_TALK))
{
if ((npc.getHtmlPath(npc.getId(), 0, null) == "data/html/npcdefault.htm") //
if ((npc.getHtmlPath(npc.getId(), 0, null).equals("data/html/npcdefault.htm")) //
|| ((obj instanceof FishermanInstance) && (HtmCache.getInstance().getHtm(null, "data/html/fisherman/" + npc.getId() + ".htm") == null)) //
|| ((obj instanceof WarehouseInstance) && (HtmCache.getInstance().getHtm(null, "data/html/warehouse/" + npc.getId() + ".htm") == null)) //
|| (((obj instanceof MerchantInstance) && !(obj instanceof FishermanInstance)) && (HtmCache.getInstance().getHtm(null, "data/html/merchant/" + npc.getId() + ".htm") == null)) //

View File

@@ -61,7 +61,7 @@ public class AdminMobGroup implements IAdminCommandHandler
{
if (command.equals("admin_mobmenu"))
{
showMainPage(activeChar, command);
showMainPage(activeChar);
return true;
}
else if (command.equals("admin_mobgroup_list"))
@@ -132,15 +132,11 @@ public class AdminMobGroup implements IAdminCommandHandler
{
teleportGroup(command, activeChar);
}
showMainPage(activeChar, command);
showMainPage(activeChar);
return true;
}
/**
* @param activeChar
* @param command
*/
private void showMainPage(PlayerInstance activeChar, String command)
private void showMainPage(PlayerInstance activeChar)
{
final String filename = "mobgroup.htm";
AdminHtml.showAdminHtml(activeChar, filename);

View File

@@ -97,12 +97,12 @@ public class AdminMonsterRace implements IAdminCommandHandler
final SystemMessage sm = new SystemMessage(SystemMessageId.THEY_RE_OFF);
sm.addInt(0);
activeChar.sendPacket(sm);
final PlaySound SRace = new PlaySound(1, "S_Race", 0, 0, 0, 0, 0);
activeChar.sendPacket(SRace);
activeChar.broadcastPacket(SRace);
final PlaySound SRace2 = new PlaySound(0, "ItemSound2.race_start", 1, 121209259, 12125, 182487, -3559);
activeChar.sendPacket(SRace2);
activeChar.broadcastPacket(SRace2);
final PlaySound sRace = new PlaySound(1, "S_Race", 0, 0, 0, 0, 0);
activeChar.sendPacket(sRace);
activeChar.broadcastPacket(sRace);
final PlaySound sRace2 = new PlaySound(0, "ItemSound2.race_start", 1, 121209259, 12125, 182487, -3559);
activeChar.sendPacket(sRace2);
activeChar.broadcastPacket(sRace2);
final MonRaceInfo spk = new MonRaceInfo(codes[state][0], codes[state][1], race.getMonsters(), race.getSpeeds());
activeChar.sendPacket(spk);
activeChar.broadcastPacket(spk);

View File

@@ -105,8 +105,8 @@ public class AdminOlympiad implements IAdminCommandHandler
final PlayerInstance player = target != null ? target.getActingPlayer() : null;
if (player != null)
{
final int val = parseInt(st, Integer.MIN_VALUE);
if (val == Integer.MIN_VALUE)
final int val = parseInt(st);
if (val == -1)
{
BuilderUtil.sendSysMessage(activeChar, "Syntax: //addolypoints <points>");
return false;
@@ -146,8 +146,8 @@ public class AdminOlympiad implements IAdminCommandHandler
final PlayerInstance player = target != null ? target.getActingPlayer() : null;
if (player != null)
{
final int val = parseInt(st, Integer.MIN_VALUE);
if (val == Integer.MIN_VALUE)
final int val = parseInt(st);
if (val == -1)
{
BuilderUtil.sendSysMessage(activeChar, "Syntax: //removeolypoints <points>");
return false;
@@ -188,8 +188,8 @@ public class AdminOlympiad implements IAdminCommandHandler
final PlayerInstance player = target != null ? target.getActingPlayer() : null;
if (player != null)
{
final int val = parseInt(st, Integer.MIN_VALUE);
if (val == Integer.MIN_VALUE)
final int val = parseInt(st);
if (val == -1)
{
BuilderUtil.sendSysMessage(activeChar, "Syntax: //setolypoints <points>");
return false;
@@ -227,7 +227,7 @@ public class AdminOlympiad implements IAdminCommandHandler
return false;
}
private int parseInt(StringTokenizer st, int defaultVal)
private int parseInt(StringTokenizer st)
{
final String token = st.nextToken();
if (!Util.isDigit(token))

Some files were not shown because too many files have changed in this diff Show More