Code style changes.

This commit is contained in:
MobiusDev
2016-04-26 19:21:19 +00:00
parent 6a13705766
commit fc070c9238
768 changed files with 3338 additions and 4252 deletions

View File

@@ -74,7 +74,7 @@ final class AdenReconstructorManager extends AbstractNpcAI
@Override
public String onSpawn(L2Npc npc)
{
startQuestTimer("SPAM_TEXT", (5 * 60 * 1000), npc, null, true);
startQuestTimer("SPAM_TEXT", 5 * 60 * 1000, npc, null, true);
return super.onSpawn(npc);
}

View File

@@ -40,7 +40,6 @@ final class ArcanRitual extends Quest
private static final int BLUE_TRIGGER = 262001;
private static final int RED_TRIGGER = 262003;
private static final int ARCAN_RITUAL_INTERVAL = 30 * 60000; // 30 minutes
private static final boolean ENABLED = true; // In case we want to disable spawning NPCs
private static final Location ARCAN_TOWN_LOC = new Location(207096, 88696, -1129);
// @formatter:off
static final int[][] RITUAL_NPCS =
@@ -155,10 +154,7 @@ final class ArcanRitual extends Quest
}
addEnterZoneId(arcanZone.getId());
ritualStage = BLUE_TRIGGER;
if (ENABLED)
{
ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new ChangeStage(), ARCAN_RITUAL_INTERVAL, ARCAN_RITUAL_INTERVAL);
}
ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new ChangeStage(), ARCAN_RITUAL_INTERVAL, ARCAN_RITUAL_INTERVAL);
}
@Override

View File

@@ -93,8 +93,6 @@ final class DenOfEvil extends AbstractNpcAI
new Location(62905, -106109, -2384, 51288)
};
private final static boolean DEBUG = false;
private DenOfEvil()
{
super(DenOfEvil.class.getSimpleName(), "ai/group_template");
@@ -119,10 +117,6 @@ final class DenOfEvil extends AbstractNpcAI
final L2EffectZone zone = ZoneManager.getInstance().getZone(npc, L2EffectZone.class);
if (zone == null)
{
if (DEBUG)
{
_log.warning("NPC " + npc + " spawned outside of L2EffectZone, check your zone coords! X:" + npc.getX() + " Y:" + npc.getY() + " Z:" + npc.getZ());
}
return null;
}
final int skillId = getSkillIdByNpcId(npc.getId());
@@ -147,10 +141,6 @@ final class DenOfEvil extends AbstractNpcAI
final L2EffectZone zone = ZoneManager.getInstance().getZone(npc, L2EffectZone.class);
if (zone == null)
{
if (DEBUG)
{
_log.warning("NPC " + npc + " killed outside of L2EffectZone, check your zone coords! X:" + npc.getX() + " Y:" + npc.getY() + " Z:" + npc.getZ());
}
return null;
}
final int skillId = getSkillIdByNpcId(npc.getId());
@@ -210,12 +200,9 @@ final class DenOfEvil extends AbstractNpcAI
{
SkillData.getInstance().getSkill(6149, 1).applyEffects(character, character);
}
else
else if (character.doDie(null) && character.isNpc() && Util.contains(EYE_IDS, ((L2Npc) character).getId())) // mobs die
{
if (character.doDie(null) && character.isNpc() && Util.contains(EYE_IDS, ((L2Npc) character).getId())) // mobs die
{
ThreadPoolManager.getInstance().scheduleAi(new RespawnNewEye(((L2Npc) character).getLocation()), 15000);
}
ThreadPoolManager.getInstance().scheduleAi(new RespawnNewEye(((L2Npc) character).getLocation()), 15000);
}
}
for (int i = SKILL_ID; i <= (SKILL_ID + 4); i = i + 2)

View File

@@ -164,18 +164,15 @@ final class DragonValley extends AbstractNpcAI
{
spawnGhost(npc, attacker, isSummon, 1);
}
else
else if ((npc.getCurrentHp() < (npc.getMaxHp() / 2)) && (getRandom(100) < 5) && npc.isScriptValue(0))
{
if ((npc.getCurrentHp() < (npc.getMaxHp() / 2)) && (getRandom(100) < 5) && npc.isScriptValue(0))
npc.setScriptValue(1);
final int rnd = getRandom(3, 5);
for (int i = 0; i < rnd; i++)
{
npc.setScriptValue(1);
final int rnd = getRandom(3, 5);
for (int i = 0; i < rnd; i++)
{
final L2Playable playable = isSummon ? attacker.getServitors().values().stream().findFirst().orElse(attacker.getPet()) : attacker;
final L2Npc minion = addSpawn(DRAKOS_ASSASSIN, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), true, 0, true);
addAttackDesire(minion, playable);
}
final L2Playable playable = isSummon ? attacker.getServitors().values().stream().findFirst().orElse(attacker.getPet()) : attacker;
final L2Npc minion = addSpawn(DRAKOS_ASSASSIN, npc.getX(), npc.getY(), npc.getZ() + 10, npc.getHeading(), true, 0, true);
addAttackDesire(minion, playable);
}
}
return super.onAttack(npc, attacker, damage, isSummon);
@@ -285,7 +282,7 @@ final class DragonValley extends AbstractNpcAI
ghost1.getVariables().set("playable", attacker);
addAttackDesire(ghost1, attacker);
val++;
if ((val < 2) && (getRandomBoolean()))
if ((val < 2) && getRandomBoolean())
{
final L2Npc ghost2 = addSpawn(WRATHFUL_ORC_GHOST, npc.getX(), npc.getY(), npc.getZ() + 20, npc.getHeading(), false, 0, false);
addAttackDesire(ghost2, attacker);

View File

@@ -368,18 +368,15 @@ final class FeedableBeasts extends AbstractNpcAI
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 1, 0);
}
}
else // if not tamed, there is a small chance that have "mad cow" disease.
// that is a stronger-than-normal animal that attacks its feeder
if (getRandom(5) == 0)
{
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 1);
}
else
{
// if not tamed, there is a small chance that have "mad cow" disease.
// that is a stronger-than-normal animal that attacks its feeder
if (getRandom(5) == 0)
{
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 1);
}
else
{
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 0);
}
nextNpcId = GROWTH_CAPABLE_MONSTERS.get(npcId).getMob(food, 0, 0);
}
}
else
@@ -464,7 +461,7 @@ final class FeedableBeasts extends AbstractNpcAI
if (MAD_COW_POLYMORPH.containsKey(nextNpcId))
{
this.startQuestTimer("polymorph Mad Cow", 10000, nextNpc, player);
startQuestTimer("polymorph Mad Cow", 10000, nextNpc, player);
}
// register the player in the feedinfo for the mob that just spawned
@@ -573,7 +570,7 @@ final class FeedableBeasts extends AbstractNpcAI
}
else if (Util.contains(TAMED_BEASTS, npcId) && (npc instanceof L2TamedBeastInstance))
{
final L2TamedBeastInstance beast = ((L2TamedBeastInstance) npc);
final L2TamedBeastInstance beast = (L2TamedBeastInstance) npc;
if (skillId == beast.getFoodType())
{
beast.onReceiveFood();

View File

@@ -60,7 +60,7 @@ final class GiantsCave extends AbstractNpcAI
for (L2Character characters : npc.getKnownList().getKnownCharactersInRadius(450))
{
if ((characters != null) && (characters.isAttackable()) && (getRandomBoolean()))
if ((characters != null) && characters.isAttackable() && getRandomBoolean())
{
addAttackDesire((L2Npc) characters, player);
}

View File

@@ -32,17 +32,17 @@ import ai.npc.AbstractNpcAI;
final class LairOfAntharas extends AbstractNpcAI
{
// NPC
final private static int KNORIKS = 22857;
final private static int DRAGON_KNIGHT = 22844;
final private static int DRAGON_KNIGHT2 = 22845;
final private static int ELITE_DRAGON_KNIGHT = 22846;
private static final int KNORIKS = 22857;
private static final int DRAGON_KNIGHT = 22844;
private static final int DRAGON_KNIGHT2 = 22845;
private static final int ELITE_DRAGON_KNIGHT = 22846;
final private static int DRAGON_GUARD = 22852;
final private static int DRAGON_MAGE = 22853;
private static final int DRAGON_GUARD = 22852;
private static final int DRAGON_MAGE = 22853;
// Misc
final private static int KNIGHT_CHANCE = 30;
final private static int KNORIKS_CHANCE = 60;
final private static int KNORIKS_CHANCE2 = 50;
private static final int KNIGHT_CHANCE = 30;
private static final int KNORIKS_CHANCE = 60;
private static final int KNORIKS_CHANCE2 = 50;
private LairOfAntharas()
{

View File

@@ -138,7 +138,7 @@ final class PrimevalIsle extends AbstractNpcAI
if (skill.getId() == SELFBUFF1.getSkillId())
{
npc.setScriptValue(3);
if ((target != null))
if (target != null)
{
npc.setTarget(target);
addAttackDesire(npc, player);
@@ -150,7 +150,7 @@ final class PrimevalIsle extends AbstractNpcAI
if (skill.getId() == SELFBUFF1.getSkillId())
{
npc.setScriptValue(1);
if ((target != null))
if (target != null)
{
npc.setTarget(target);
addAttackDesire(npc, player);
@@ -159,7 +159,7 @@ final class PrimevalIsle extends AbstractNpcAI
else if (skill.getId() == SELFBUFF2.getSkillId())
{
npc.setScriptValue(5);
if ((target != null))
if (target != null)
{
npc.setTarget(target);
addAttackDesire(npc, player);
@@ -179,7 +179,7 @@ final class PrimevalIsle extends AbstractNpcAI
{
if ((npc != null) && !npc.isDead())
{
npc.doCast((npc.getId() == SPRIGNANT[0] ? ANESTHESIA.getSkill() : DEADLY_POISON.getSkill()));
npc.doCast(npc.getId() == SPRIGNANT[0] ? ANESTHESIA.getSkill() : DEADLY_POISON.getSkill());
startQuestTimer("USE_SKILL", 15000, npc, null);
}
break;
@@ -320,9 +320,9 @@ final class PrimevalIsle extends AbstractNpcAI
final L2Playable playable = isSummon ? attacker.getServitors().values().stream().findFirst().orElse(attacker.getPet()) : attacker;
for (L2Character characters : npc.getKnownList().getKnownCharactersInRadius(500))
{
if ((characters != null) && (characters.isAttackable()) && (getRandomBoolean()))
if ((characters != null) && characters.isAttackable() && getRandomBoolean())
{
addAttackDesire(((L2Attackable) characters), playable);
addAttackDesire((L2Attackable) characters, playable);
}
}
}
@@ -349,7 +349,7 @@ final class PrimevalIsle extends AbstractNpcAI
}
}
}
else if ((((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 60) && (npc.isScriptValue(3)))
else if ((((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 60) && npc.isScriptValue(3))
{
if (!npc.isSkillDisabled(SELFBUFF1.getSkill()))
{

View File

@@ -92,14 +92,11 @@ final class PrisonGuards extends AbstractNpcAI
broadcastNpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.IT_S_NOT_EASY_TO_OBTAIN);
}
}
else
else if (!player.isAffectedBySkill(TIMER) && (npc.calculateDistance(npc.getSpawn().getLocation(), false, false) < 2000))
{
if (!player.isAffectedBySkill(TIMER) && (npc.calculateDistance(npc.getSpawn().getLocation(), false, false) < 2000))
{
npc.setTarget(player);
npc.doCast(STONE.getSkill());
broadcastNpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.YOU_RE_OUT_OF_YOUR_MIND_COMING_HERE);
}
npc.setTarget(player);
npc.doCast(STONE.getSkill());
broadcastNpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.YOU_RE_OUT_OF_YOUR_MIND_COMING_HERE);
}
return super.onAttack(npc, player, damage, isSummon);
}

View File

@@ -206,12 +206,12 @@ final class SelMahumDrill extends AbstractNpcAI
// group hate
for (L2Character ch : npc.getKnownList().getKnownCharacters())
{
if (!ch.isInCombat() && ch.isMonster() && (((L2Npc) ch).getSpawn().getName().equals(npc.getSpawn().getName())))
if (!ch.isInCombat() && ch.isMonster() && ((L2Npc) ch).getSpawn().getName().equals(npc.getSpawn().getName()))
{
addAttackDesire((L2Npc) ch, attacker);
}
}
if ((getRandom(10) < 1) && (Util.contains(MAHUM_SOLDIERS, npc.getId())))
if ((getRandom(10) < 1) && Util.contains(MAHUM_SOLDIERS, npc.getId()))
{
npc.broadcastEvent("ATTACKED", 1000, null);
}
@@ -317,7 +317,7 @@ final class SelMahumDrill extends AbstractNpcAI
final int remainedCount = npc.getVariables().getInt("SOCIAL_ACTION_REMAINED_COUNT");
if (remainedCount > 0)
{
npc.getVariables().set("SOCIAL_ACTION_REMAINED_COUNT", (remainedCount - 1));
npc.getVariables().set("SOCIAL_ACTION_REMAINED_COUNT", remainedCount - 1);
startQuestTimer("do_social_action", action.getRepeatInterval(), npc, null);
}
}

View File

@@ -159,7 +159,7 @@ final class SilentValley extends AbstractNpcAI
{
if (creature.isPlayable())
{
final L2PcInstance player = (isSummon) ? ((L2Summon) creature).getOwner() : creature.getActingPlayer();
final L2PcInstance player = isSummon ? ((L2Summon) creature).getOwner() : creature.getActingPlayer();
if ((npc.getId() == GUARD1) || (npc.getId() == GUARD2))
{
npc.setTarget(player);

View File

@@ -245,7 +245,7 @@ final class StakatoNest extends AbstractNpcAI
private static void giveCocoon(L2PcInstance player, L2Npc npc)
{
player.addItem("StakatoCocoon", ((getRandom(100) > 80) ? LARGE_COCOON : SMALL_COCOON), 1, npc, true);
player.addItem("StakatoCocoon", (getRandom(100) > 80) ? LARGE_COCOON : SMALL_COCOON, 1, npc, true);
}
public static void main(String[] args)