Code review Part 1.

This commit is contained in:
MobiusDevelopment 2019-12-17 21:31:47 +00:00
parent d372391bef
commit b7fef9acf5
682 changed files with 6402 additions and 8133 deletions

View File

@ -592,9 +592,6 @@
<admin command="admin_tvt_remove" accessLevel="100" />
<admin command="admin_tvt_advance" accessLevel="100" />
<!-- ADMIN UNBLOCK IP -->
<admin command="admin_unblockip" accessLevel="100" />
<!-- ADMIN VITALITY -->
<admin command="admin_set_vitality" accessLevel="100" />
<admin command="admin_set_vitality_level" accessLevel="100" />

View File

@ -230,12 +230,9 @@ 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 (FEED_INFO.containsKey(npc.getObjectId()))
if (FEED_INFO.containsKey(npc.getObjectId()) && (FEED_INFO.get(npc.getObjectId()) == player.getObjectId()))
{
if (FEED_INFO.get(npc.getObjectId()) == player.getObjectId())
{
FEED_INFO.remove(npc.getObjectId());
}
FEED_INFO.remove(npc.getObjectId());
}
// despawn the old mob
// TODO: same code? FIXED?

View File

@ -145,9 +145,9 @@ public class FeedableBeasts extends AbstractNpcAI
_chance = chance;
}
public void addMobs(int spice, int[][] Mobs)
public void addMobs(int spice, int[][] mobs)
{
_spiceToMob.put(spice, Mobs);
_spiceToMob.put(spice, mobs);
}
public Integer getMob(int spice, int mobType, int classType)
@ -395,12 +395,9 @@ public class FeedableBeasts extends AbstractNpcAI
}
// remove the feedinfo of the mob that got despawned, if any
if (FEED_INFO.containsKey(npc.getObjectId()))
if (FEED_INFO.containsKey(npc.getObjectId()) && (FEED_INFO.get(npc.getObjectId()) == player.getObjectId()))
{
if (FEED_INFO.get(npc.getObjectId()) == player.getObjectId())
{
FEED_INFO.remove(npc.getObjectId());
}
FEED_INFO.remove(npc.getObjectId());
}
// despawn the old mob
// TODO: same code? FIXED?
@ -484,26 +481,23 @@ public class FeedableBeasts extends AbstractNpcAI
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
if (event.equalsIgnoreCase("polymorph Mad Cow") && (npc != null) && (player != null))
if (event.equalsIgnoreCase("polymorph Mad Cow") && (npc != null) && (player != null) && MAD_COW_POLYMORPH.containsKey(npc.getId()))
{
if (MAD_COW_POLYMORPH.containsKey(npc.getId()))
// remove the feed info from the previous mob
if (FEED_INFO.get(npc.getObjectId()) == player.getObjectId())
{
// remove the feed info from the previous mob
if (FEED_INFO.get(npc.getObjectId()) == player.getObjectId())
{
FEED_INFO.remove(npc.getObjectId());
}
// despawn the mad cow
npc.deleteMe();
// spawn the new mob
final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc);
// register the player in the feedinfo for the mob that just spawned
FEED_INFO.put(nextNpc.getObjectId(), player.getObjectId());
nextNpc.setRunning();
nextNpc.addDamageHate(player, 0, 99999);
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
FEED_INFO.remove(npc.getObjectId());
}
// despawn the mad cow
npc.deleteMe();
// spawn the new mob
final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc);
// register the player in the feedinfo for the mob that just spawned
FEED_INFO.put(nextNpc.getObjectId(), player.getObjectId());
nextNpc.setRunning();
nextNpc.addDamageHate(player, 0, 99999);
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
}
return super.onAdvEvent(event, npc, player);
}
@ -548,7 +542,7 @@ public class FeedableBeasts extends AbstractNpcAI
{
food = GOLDEN_SPICE;
}
else if (skillId == SKILL_CRYSTAL_SPICE)
else // if (skillId == SKILL_CRYSTAL_SPICE)
{
food = CRYSTAL_SPICE;
}

View File

@ -71,14 +71,12 @@ public class SummonPc extends AbstractNpcAI
final Attackable monster = (Attackable) npc;
if (monster.getMostHated() != null)
{
if (((monster.getMostHated() == attacker) && (chance < 50)) || (chance < 10))
if ((((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 ((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);
}
}
}

View File

@ -86,6 +86,7 @@ public class DragonValley extends AbstractNpcAI
private static final int MIN_LVL = 80;
private static final int CLASS_LVL = 3;
private static final EnumMap<ClassId, Double> CLASS_POINTS = new EnumMap<>(ClassId.class);
static
{
CLASS_POINTS.put(ClassId.ADVENTURER, 0.2);
CLASS_POINTS.put(ClassId.ARCANA_LORD, 1.5);

View File

@ -99,33 +99,33 @@ public class DragonVortex extends AbstractNpcAI
raid = EMERALD_HORN;
}
Location LOC = null;
Location loc = null;
switch (npc.getX())
{
case 92225:
{
LOC = SPOT_1;
loc = SPOT_1;
break;
}
case 110116:
{
LOC = SPOT_2;
loc = SPOT_2;
break;
}
case 121172:
{
LOC = SPOT_3;
loc = SPOT_3;
break;
}
case 108924:
{
LOC = SPOT_4;
loc = SPOT_4;
break;
}
}
npc.getVariables().set(I_QUEST0, true);
addSpawn(raid, LOC, false, 0, true);
addSpawn(raid, loc, false, 0, true);
startQuestTimer("CANSPAWN", 60000, npc, null);
}
else

View File

@ -216,7 +216,7 @@ public class Parade extends AbstractNpcAI
@Override
public void run()
{
if (spawns.size() <= 0)
if (spawns.isEmpty())
{
return;
}
@ -235,7 +235,7 @@ public class Parade extends AbstractNpcAI
}
}
}
if ((spawns.size() == 0) && (deleteTask != null))
if ((spawns.isEmpty()) && (deleteTask != null))
{
deleteTask.cancel(false);
}

View File

@ -56,7 +56,7 @@ public class TalentShow extends AbstractNpcAI
32424, 32425, 32426, 32427, 32428
};
// @formatter:on
private static boolean IS_STARTED = false;
private static boolean HAS_STARTED = false;
private static NpcStringId[] MESSAGES =
{
NpcStringId.HOW_COME_PEOPLE_ARE_NOT_HERE_WE_ARE_ABOUT_TO_START_THE_SHOW_HMM,
@ -173,7 +173,7 @@ public class TalentShow extends AbstractNpcAI
private void load()
{
// TODO put this stuff in Routes.xml
// TODO: Put this stuff in Routes.xml
TALKS.put("1", new ShoutInfo(MESSAGES[1], "2", 1000));
TALKS.put("2", new ShoutInfo(MESSAGES[2], "3", 6000));
TALKS.put("3", new ShoutInfo(MESSAGES[3], "4", 4000));
@ -310,7 +310,7 @@ public class TalentShow extends AbstractNpcAI
@Override
public String onSpawn(Npc npc)
{
if (IS_STARTED)
if (HAS_STARTED)
{
switch (npc.getId())
{
@ -369,11 +369,11 @@ public class TalentShow extends AbstractNpcAI
if (event.equalsIgnoreCase("Start"))
{
IS_STARTED = true;
HAS_STARTED = true;
addSpawn(MC, -56698, -56430, -2008, 32768, false, 0);
startQuestTimer("Start", 14400000L, null, null); // repeat
}
else if ((npc != null) && IS_STARTED)
else if ((npc != null) && HAS_STARTED)
{
// TODO switch on event
if (event.equalsIgnoreCase("6"))
@ -485,7 +485,7 @@ public class TalentShow extends AbstractNpcAI
}
else if (event.equalsIgnoreCase("clean_npc"))
{
IS_STARTED = false;
HAS_STARTED = false;
npc.deleteMe();
}
else if (TALKS.containsKey(event))

View File

@ -243,26 +243,23 @@ public class TarBeetleSpawn implements IXmlReader
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.warning("Problem with TarBeetleSpawn: " + e.getMessage());
}
}
public void refreshShots()
{
if (_spawn.size() > 0)
for (Npc npc : _spawn)
{
for (Npc npc : _spawn)
final int val = npc.getScriptValue();
if (val == 5)
{
final int val = npc.getScriptValue();
if (val == 5)
{
npc.deleteMe();
_spawn.remove(npc);
}
else
{
npc.setScriptValue(val + 1);
}
npc.deleteMe();
_spawn.remove(npc);
}
else
{
npc.setScriptValue(val + 1);
}
}
}

View File

@ -48,34 +48,24 @@ public class Jinia extends AbstractNpcAI
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
String htmltext = event;
switch (event)
if ("check".equals(event))
{
case "32781-10.html":
case "32781-11.html":
if (hasAtLeastOneQuestItem(player, FROZEN_CORE, BLACK_FROZEN_CORE))
{
htmltext = event;
break;
htmltext = "32781-03.html";
}
case "check":
else
{
if (hasAtLeastOneQuestItem(player, FROZEN_CORE, BLACK_FROZEN_CORE))
final QuestState qs = player.getQuestState(Q10286_ReunionWithSirra.class.getSimpleName());
if ((qs != null) && qs.isCompleted())
{
htmltext = "32781-03.html";
giveItems(player, FROZEN_CORE, 1);
}
else
{
final QuestState qs = player.getQuestState(Q10286_ReunionWithSirra.class.getSimpleName());
if ((qs != null) && qs.isCompleted())
{
giveItems(player, FROZEN_CORE, 1);
}
else
{
giveItems(player, BLACK_FROZEN_CORE, 1);
}
htmltext = "32781-04.html";
giveItems(player, BLACK_FROZEN_CORE, 1);
}
break;
htmltext = "32781-04.html";
}
}
return htmltext;

View File

@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
@ -510,11 +511,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

@ -47,10 +47,6 @@ public class Lindvior extends AbstractNpcAI
private static boolean ALT_MODE = false;
private static int ALT_MODE_MIN = 60; // schedule delay in minutes if ALT_MODE enabled
private Npc _lindviorCamera = null;
private Npc _tomaris = null;
private Npc _artius = null;
public Lindvior()
{
scheduleNextLindviorVisit();
@ -92,13 +88,13 @@ public class Lindvior extends AbstractNpcAI
}
case "start":
{
_lindviorCamera = SpawnTable.getInstance().getAnySpawn(LINDVIOR_CAMERA).getLastSpawn();
_tomaris = SpawnTable.getInstance().getAnySpawn(TOMARIS).getLastSpawn();
_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);
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);
scheduleNextLindviorVisit();
break;
}

View File

@ -171,13 +171,13 @@ public class Maguen extends AbstractNpcAI
@Override
public String onSpellFinished(Npc npc, PlayerInstance player, Skill skill)
{
final BuffInfo b_info = player.getEffectList().getBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType());
final BuffInfo c_info = player.getEffectList().getBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType());
final BuffInfo r_info = player.getEffectList().getBuffInfoByAbnormalType(R_PLASMA1.getSkill().getAbnormalType());
final BuffInfo infoB = player.getEffectList().getBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType());
final BuffInfo infoC = player.getEffectList().getBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType());
final BuffInfo infoR = player.getEffectList().getBuffInfoByAbnormalType(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 = infoB == null ? 0 : infoB.getSkill().getAbnormalLvl();
final int c = infoC == null ? 0 : infoC.getSkill().getAbnormalLvl();
final int r = infoR == null ? 0 : infoR.getSkill().getAbnormalLvl();
if ((b == 3) && (c == 0) && (r == 0))
{
@ -261,103 +261,101 @@ 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 info1 = caster.getEffectList().getBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType());
final BuffInfo info2 = caster.getEffectList().getBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType());
final BuffInfo info3 = caster.getEffectList().getBuffInfoByAbnormalType(R_PLASMA1.getSkill().getAbnormalType());
final int i1 = info1 == null ? 0 : info1.getSkill().getAbnormalLvl();
final int i2 = info2 == null ? 0 : info2.getSkill().getAbnormalLvl();
final int i3 = info3 == null ? 0 : info3.getSkill().getAbnormalLvl();
caster.getEffectList().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType());
caster.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType());
caster.getEffectList().stopSkillEffects(true, 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().getBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType());
final BuffInfo i2_info = caster.getEffectList().getBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType());
final BuffInfo i3_info = caster.getEffectList().getBuffInfoByAbnormalType(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().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType());
caster.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType());
caster.getEffectList().stopSkillEffects(true, 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);
@ -387,7 +385,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

@ -61,12 +61,9 @@ public class AbyssGaze extends AbstractNpcAI
htmltext = "32539-1.htm";
}
}
else if (event.equals("enter_seed"))
else if (event.equals("enter_seed") && (SoIManager.getCurrentStage() == 3))
{
if (SoIManager.getCurrentStage() == 3)
{
return null;
}
return null;
}
return htmltext;
}

View File

@ -43,7 +43,7 @@ public class FortuneTelling extends AbstractNpcAI
@Override
public String onTalk(Npc npc, PlayerInstance player)
{
String htmltext = getNoQuestMsg(player);
String htmltext;
if (player.getAdena() < COST)
{
htmltext = "lowadena.htm";

View File

@ -63,10 +63,6 @@ public class HallOfErosionAttack extends AbstractNpcAI
{
tumorCount += value;
}
public HEAWorld()
{
}
}
private static final int INSTANCEID = 119;

View File

@ -57,10 +57,6 @@ public class HallOfErosionDefence extends AbstractNpcAI
protected Npc deadTumor;
public long startTime = 0;
public ScheduledFuture<?> finishTask = null;
public HEDWorld()
{
}
}
private static final int INSTANCEID = 120;

View File

@ -56,10 +56,6 @@ public class HallOfSufferingAttack extends AbstractNpcAI
0,
0
}; // 0: instance start, 1: finish time
public HSAWorld()
{
}
}
private static final int INSTANCEID = 115;
@ -512,74 +508,72 @@ public class HallOfSufferingAttack extends AbstractNpcAI
runTwins(world);
}
}
else if ((world.getStatus() == 6) && ((npc.getId() == KLODEKUS) || (npc.getId() == KLANIKUS)))
else if (((world.getStatus() == 6) && ((npc.getId() == KLODEKUS) || (npc.getId() == KLANIKUS))) //
&& (world.klanikus.isDead() && world.klodekus.isDead()))
{
if (world.klanikus.isDead() && world.klodekus.isDead())
world.incStatus();
world.storeTime[1] = System.currentTimeMillis();
final Long finishDiff = world.storeTime[1] - world.storeTime[0];
if (finishDiff < 1260000)
{
world.incStatus();
world.storeTime[1] = System.currentTimeMillis();
final Long finishDiff = world.storeTime[1] - world.storeTime[0];
if (finishDiff < 1260000)
{
world.setParameter("tag", 13777);
}
else if (finishDiff < 1380000)
{
world.setParameter("tag", 13778);
}
else if (finishDiff < 1500000)
{
world.setParameter("tag", 13779);
}
else if (finishDiff < 1620000)
{
world.setParameter("tag", 13780);
}
else if (finishDiff < 1740000)
{
world.setParameter("tag", 13781);
}
else if (finishDiff < 1860000)
{
world.setParameter("tag", 13782);
}
else if (finishDiff < 1980000)
{
world.setParameter("tag", 13783);
}
else if (finishDiff < 2100000)
{
world.setParameter("tag", 13784);
}
else if (finishDiff < 2220000)
{
world.setParameter("tag", 13785);
}
else
{
world.setParameter("tag", 13786);
}
world.klanikus = null;
world.klodekus = null;
cancelQuestTimers("ressurectTwin");
cancelQuestTimers("spawnBossGuards");
cancelQuestTimers("isTwinSeparated");
addSpawn(TEPIOS, TEPIOS_SPAWN[0], TEPIOS_SPAWN[1], TEPIOS_SPAWN[2], 0, false, 0, false, world.getInstanceId());
for (PlayerInstance killer : world.getAllowed())
{
if (killer != null)
{
killer.sendPacket(new ExSendUIEvent(killer, true, true, 0, 0, ""));
}
}
final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
inst.setDuration(5 * 60000);
inst.setEmptyDestroyTime(0);
world.setParameter("tag", 13777);
}
else if (finishDiff < 1380000)
{
world.setParameter("tag", 13778);
}
else if (finishDiff < 1500000)
{
world.setParameter("tag", 13779);
}
else if (finishDiff < 1620000)
{
world.setParameter("tag", 13780);
}
else if (finishDiff < 1740000)
{
world.setParameter("tag", 13781);
}
else if (finishDiff < 1860000)
{
world.setParameter("tag", 13782);
}
else if (finishDiff < 1980000)
{
world.setParameter("tag", 13783);
}
else if (finishDiff < 2100000)
{
world.setParameter("tag", 13784);
}
else if (finishDiff < 2220000)
{
world.setParameter("tag", 13785);
}
else
{
world.setParameter("tag", 13786);
}
world.klanikus = null;
world.klodekus = null;
cancelQuestTimers("ressurectTwin");
cancelQuestTimers("spawnBossGuards");
cancelQuestTimers("isTwinSeparated");
addSpawn(TEPIOS, TEPIOS_SPAWN[0], TEPIOS_SPAWN[1], TEPIOS_SPAWN[2], 0, false, 0, false, world.getInstanceId());
for (PlayerInstance killer : world.getAllowed())
{
if (killer != null)
{
killer.sendPacket(new ExSendUIEvent(killer, true, true, 0, 0, ""));
}
}
final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
inst.setDuration(5 * 60000);
inst.setEmptyDestroyTime(0);
}
}
return "";

View File

@ -56,10 +56,6 @@ public class HallOfSufferingDefence extends AbstractNpcAI
0,
0
}; // 0: instance start, 1: finish time
public HSDWorld()
{
}
}
private static final int INSTANCEID = 116; // this is the client number
@ -512,74 +508,72 @@ public class HallOfSufferingDefence extends AbstractNpcAI
runTwins(world);
}
}
else if ((world.getStatus() == 6) && ((npc.getId() == KLODEKUS) || (npc.getId() == KLANIKUS)))
else if (((world.getStatus() == 6) && ((npc.getId() == KLODEKUS) || (npc.getId() == KLANIKUS))) //
&& (world.klanikus.isDead() && world.klodekus.isDead()))
{
if (world.klanikus.isDead() && world.klodekus.isDead())
world.incStatus();
world.storeTime[1] = System.currentTimeMillis();
final Long finishDiff = world.storeTime[1] - world.storeTime[0];
if (finishDiff < 1260000)
{
world.incStatus();
world.storeTime[1] = System.currentTimeMillis();
final Long finishDiff = world.storeTime[1] - world.storeTime[0];
if (finishDiff < 1260000)
{
world.setParameter("tag", 13777);
}
else if (finishDiff < 1380000)
{
world.setParameter("tag", 13778);
}
else if (finishDiff < 1500000)
{
world.setParameter("tag", 13779);
}
else if (finishDiff < 1620000)
{
world.setParameter("tag", 13780);
}
else if (finishDiff < 1740000)
{
world.setParameter("tag", 13781);
}
else if (finishDiff < 1860000)
{
world.setParameter("tag", 13782);
}
else if (finishDiff < 1980000)
{
world.setParameter("tag", 13783);
}
else if (finishDiff < 2100000)
{
world.setParameter("tag", 13784);
}
else if (finishDiff < 2220000)
{
world.setParameter("tag", 13785);
}
else
{
world.setParameter("tag", 13786);
}
world.klanikus = null;
world.klodekus = null;
cancelQuestTimers("ressurectTwin");
cancelQuestTimers("spawnBossGuards");
cancelQuestTimers("isTwinSeparated");
addSpawn(TEPIOS, TEPIOS_SPAWN[0], TEPIOS_SPAWN[1], TEPIOS_SPAWN[2], 0, false, 0, false, world.getInstanceId());
for (PlayerInstance killer : world.getAllowed())
{
if (killer != null)
{
killer.sendPacket(new ExSendUIEvent(killer, true, true, 0, 0, ""));
}
}
final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
inst.setDuration(5 * 60000);
inst.setEmptyDestroyTime(0);
world.setParameter("tag", 13777);
}
else if (finishDiff < 1380000)
{
world.setParameter("tag", 13778);
}
else if (finishDiff < 1500000)
{
world.setParameter("tag", 13779);
}
else if (finishDiff < 1620000)
{
world.setParameter("tag", 13780);
}
else if (finishDiff < 1740000)
{
world.setParameter("tag", 13781);
}
else if (finishDiff < 1860000)
{
world.setParameter("tag", 13782);
}
else if (finishDiff < 1980000)
{
world.setParameter("tag", 13783);
}
else if (finishDiff < 2100000)
{
world.setParameter("tag", 13784);
}
else if (finishDiff < 2220000)
{
world.setParameter("tag", 13785);
}
else
{
world.setParameter("tag", 13786);
}
world.klanikus = null;
world.klodekus = null;
cancelQuestTimers("ressurectTwin");
cancelQuestTimers("spawnBossGuards");
cancelQuestTimers("isTwinSeparated");
addSpawn(TEPIOS, TEPIOS_SPAWN[0], TEPIOS_SPAWN[1], TEPIOS_SPAWN[2], 0, false, 0, false, world.getInstanceId());
for (PlayerInstance killer : world.getAllowed())
{
if (killer != null)
{
killer.sendPacket(new ExSendUIEvent(killer, true, true, 0, 0, ""));
}
}
final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
inst.setDuration(5 * 60000);
inst.setEmptyDestroyTime(0);
}
}
return "";

View File

@ -69,10 +69,6 @@ public class HeartInfinityAttack extends AbstractNpcAI
{
tumorCount += value;
}
public HIAWorld()
{
}
}
private static final String qn = "HeartInfinityAttack";

View File

@ -60,10 +60,6 @@ public class HeartInfinityDefence extends AbstractNpcAI
protected ScheduledFuture<?> finishTask = null;
protected ScheduledFuture<?> timerTask = null;
protected ScheduledFuture<?> wagonSpawnTask = null;
public HIDWorld()
{
}
}
private static final String qn = "HeartInfinityDefence";
@ -406,16 +402,13 @@ public class HeartInfinityDefence extends AbstractNpcAI
ThreadPool.schedule(() ->
{
if (!conquestEnded)
if (!conquestEnded && !world.deadTumors.isEmpty())
{
if (!world.deadTumors.isEmpty())
for (Npc npc : world.deadTumors)
{
for (Npc npc : world.deadTumors)
if (npc != null)
{
if (npc != null)
{
spawnCoffin(npc, world);
}
spawnCoffin(npc, world);
}
}
}
@ -563,13 +556,10 @@ public class HeartInfinityDefence extends AbstractNpcAI
}
final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc);
if (tmpworld instanceof HIDWorld)
if ((tmpworld instanceof HIDWorld) && (npc.getId() == SOULWAGON))
{
if (npc.getId() == SOULWAGON)
{
// ((MonsterInstance) npc).setPassive(true);
((MonsterInstance) npc).getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
}
// ((MonsterInstance) npc).setPassive(true);
((MonsterInstance) npc).getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
}
return super.onSpawn(npc);
}

View File

@ -32,14 +32,12 @@ import org.l2jmobius.gameserver.instancemanager.InstanceManager;
import org.l2jmobius.gameserver.instancemanager.SoDManager;
import org.l2jmobius.gameserver.model.CommandChannel;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Summon;
import org.l2jmobius.gameserver.model.actor.instance.DoorInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.instancezone.Instance;
import org.l2jmobius.gameserver.model.instancezone.InstanceWorld;
import org.l2jmobius.gameserver.model.quest.QuestState;
@ -96,11 +94,6 @@ public class SeedOfDestruction extends AbstractNpcAI
private static final int[] MOB_IDS = {22536, 22537, 22538, 22539, 22540, 22541, 22542, 22543, 22544, 22547, 22550, 22551, 22552, 22596, 29162};
private static final Location MOVE_TO_TIAT = new Location(-250403, 207273, -11952, 16384);
// 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-18774
// Doors/Walls/Zones
private static final int[] ATTACKABLE_DOORS = {12240005, 12240006, 12240007, 12240008, 12240009, 12240010, 12240013, 12240014, 12240015, 12240016, 12240017, 12240018, 12240021, 12240022, 12240023, 12240024, 12240025, 12240026, 12240028, 12240029, 12240030};
private static final int[] ENTRANCE_ROOM_DOORS = {12240001, 12240002};
@ -971,7 +964,6 @@ public class SeedOfDestruction extends AbstractNpcAI
player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
player.setInstanceId(teleto.instanceId);
player.teleToLocation(teleto.x, teleto.y, teleto.z);
return;
}
private void teleportplayer(PlayerInstance player, teleCoord teleto, SODWorld world)
@ -1092,21 +1084,7 @@ public class SeedOfDestruction extends AbstractNpcAI
// traps
if ((mob[0] >= 18720) && (mob[0] <= 18774))
{
Skill skill = null;
if (mob[0] <= 18728)
{
skill = TRAP_HOLD.getSkill();
}
else if (mob[0] <= 18736)
{
skill = TRAP_STUN.getSkill();
}
else
// if (mob[0] <= 18774)
{
skill = TRAP_DAMAGE.getSkill();
}
addTrap(mob[0], mob[1], mob[2], mob[3], mob[4], skill, world.getInstanceId());
addTrap(mob[0], mob[1], mob[2], mob[3], mob[4], world.getInstanceId());
continue;
}
@ -1171,12 +1149,6 @@ public class SeedOfDestruction extends AbstractNpcAI
}
}
@Override
public String onSkillSee(Npc npc, PlayerInstance caster, Skill skill, WorldObject[] targets, boolean isPet)
{
return super.onSkillSee(npc, caster, skill, targets, isPet);
}
@Override
public String onSpawn(Npc npc)
{
@ -1203,18 +1175,15 @@ public class SeedOfDestruction extends AbstractNpcAI
}
else if ((world.getStatus() <= 8) && (npc.getId() == TIAT))
{
if (npc.getCurrentHp() < (npc.getMaxHp() / 2))
if ((npc.getCurrentHp() < (npc.getMaxHp() / 2)) && (_numAtk < 1))
{
if (_numAtk < 1)
{
final ExShowScreenMessage message4 = new ExShowScreenMessage(NpcStringId.COME_OUT_WARRIORS_PROTECT_SEED_OF_DESTRUCTION, 5, 5000);
sendScreenMessage(world, message4);
world._tiat.doCast(SkillData.getInstance().getSkill(5818, 1));
world._tiat.doCast(SkillData.getInstance().getSkill(181, 1));
world.deviceSpawnedMobCount = 0;
spawn(world, THRONE_PORTALS, false, true);
_numAtk++;
}
final ExShowScreenMessage message4 = new ExShowScreenMessage(NpcStringId.COME_OUT_WARRIORS_PROTECT_SEED_OF_DESTRUCTION, 5, 5000);
sendScreenMessage(world, message4);
world._tiat.doCast(SkillData.getInstance().getSkill(5818, 1));
world._tiat.doCast(SkillData.getInstance().getSkill(181, 1));
world.deviceSpawnedMobCount = 0;
spawn(world, THRONE_PORTALS, false, true);
_numAtk++;
}
}
}
@ -1228,60 +1197,64 @@ public class SeedOfDestruction extends AbstractNpcAI
if (tmpworld instanceof SODWorld)
{
final SODWorld world = (SODWorld) tmpworld;
if (event.equals("ThroneSpawn"))
switch (event)
{
world._tiat = addSpawn(TIAT, -250400, 207271, -11961, 16285, false, 0, false, world.getInstanceId());
world._tiat.setRandomWalking(false);
world._naezdTR1 = addSpawn(NAEZD, -250154, 207203, -11970, 33818, false, 0, false, world.getInstanceId());
world._naezdTR1.setRandomWalking(false);
world._naezdTR2 = addSpawn(NAEZD, -250209, 206941, -11966, 27379, false, 0, false, world.getInstanceId());
world._naezdTR2.setRandomWalking(false);
world._naezdTL1 = addSpawn(NAEZD, -250652, 207203, -11970, 0, false, 0, false, world.getInstanceId());
world._naezdTL1.setRandomWalking(false);
world._naezdTL2 = addSpawn(NAEZD, -250597, 206941, -11966, 6867, false, 0, false, world.getInstanceId());
world._naezdTL2.setRandomWalking(false);
for (int i = 0; i < 12; i++)
case "ThroneSpawn":
{
final Npc npc1 = addSpawn(22543, ONETR[i][0], ONETR[i][1], ONETR[i][2], 16285, false, 0, false, world.getInstanceId());
npc1.setRandomWalking(false);
world._mags.add(npc1);
final Npc npc2 = addSpawn(22541, TWOTR[i][0], TWOTR[i][1], TWOTR[i][2], 16285, false, 0, false, world.getInstanceId());
npc2.setRandomWalking(false);
}
for (int i = 0; i < 6; i++)
{
final Npc npc3 = addSpawn(FRETR[i][0], FRETR[i][1], FRETR[i][2], FRETR[i][3], 16285, false, 0, false, world.getInstanceId());
npc3.setRandomWalking(false);
final Npc npc4 = addSpawn(22536, FORTR[i][0], FORTR[i][1], FORTR[i][2], 16285, false, 0, false, world.getInstanceId());
npc4.setRandomWalking(false);
final Npc npc5 = addSpawn(22537, FIVETR[i][0], FIVETR[i][1], FIVETR[i][2], 16285, false, 0, false, world.getInstanceId());
npc5.setRandomWalking(false);
}
spawn(world, FORT_PORTALS, false, true);
}
else if (event.equals("KillTiatPart1"))
{
playMovie(world, Movie.SC_BOSS_TIAT_ENDING_SUCCES);
InstanceManager.getInstance().getInstance(world.getInstanceId()).getNpcs().forEach(Npc::deleteMe);
}
else if (event.equals("Spawn"))
{
if (world.getStatus() <= 7)
{
final PlayerInstance target = world.getAllowed().stream().findAny().get();
if ((world.deviceSpawnedMobCount < MAX_DEVICE_SPAWNED_MOB_COUNT) && (target != null) && ((npc != null) && (target.getInstanceId() == npc.getInstanceId())) && !target.isDead())
world._tiat = addSpawn(TIAT, -250400, 207271, -11961, 16285, false, 0, false, world.getInstanceId());
world._tiat.setRandomWalking(false);
world._naezdTR1 = addSpawn(NAEZD, -250154, 207203, -11970, 33818, false, 0, false, world.getInstanceId());
world._naezdTR1.setRandomWalking(false);
world._naezdTR2 = addSpawn(NAEZD, -250209, 206941, -11966, 27379, false, 0, false, world.getInstanceId());
world._naezdTR2.setRandomWalking(false);
world._naezdTL1 = addSpawn(NAEZD, -250652, 207203, -11970, 0, false, 0, false, world.getInstanceId());
world._naezdTL1.setRandomWalking(false);
world._naezdTL2 = addSpawn(NAEZD, -250597, 206941, -11966, 6867, false, 0, false, world.getInstanceId());
world._naezdTL2.setRandomWalking(false);
for (int i = 0; i < 12; i++)
{
final Attackable mob = (Attackable) addSpawn(SPAWN_MOB_IDS[Rnd.get(SPAWN_MOB_IDS.length)], npc.getSpawn().getX(), npc.getSpawn().getY(), npc.getSpawn().getZ(), npc.getSpawn().getHeading(), false, 0, false, world.getInstanceId());
world.deviceSpawnedMobCount++;
mob.setSeeThroughSilentMove(true);
mob.setRunning();
mob.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, MOVE_TO_TIAT);
final Npc npc1 = addSpawn(22543, ONETR[i][0], ONETR[i][1], ONETR[i][2], 16285, false, 0, false, world.getInstanceId());
npc1.setRandomWalking(false);
world._mags.add(npc1);
final Npc npc2 = addSpawn(22541, TWOTR[i][0], TWOTR[i][1], TWOTR[i][2], 16285, false, 0, false, world.getInstanceId());
npc2.setRandomWalking(false);
}
for (int i = 0; i < 6; i++)
{
final Npc npc3 = addSpawn(FRETR[i][0], FRETR[i][1], FRETR[i][2], FRETR[i][3], 16285, false, 0, false, world.getInstanceId());
npc3.setRandomWalking(false);
final Npc npc4 = addSpawn(22536, FORTR[i][0], FORTR[i][1], FORTR[i][2], 16285, false, 0, false, world.getInstanceId());
npc4.setRandomWalking(false);
final Npc npc5 = addSpawn(22537, FIVETR[i][0], FIVETR[i][1], FIVETR[i][2], 16285, false, 0, false, world.getInstanceId());
npc5.setRandomWalking(false);
}
spawn(world, FORT_PORTALS, false, true);
break;
}
case "KillTiatPart1":
{
playMovie(world, Movie.SC_BOSS_TIAT_ENDING_SUCCES);
InstanceManager.getInstance().getInstance(world.getInstanceId()).getNpcs().forEach(Npc::deleteMe);
break;
}
case "Spawn":
{
if (world.getStatus() <= 7)
{
final PlayerInstance target = world.getAllowed().stream().findAny().get();
if ((world.deviceSpawnedMobCount < MAX_DEVICE_SPAWNED_MOB_COUNT) && (target != null) && ((npc != null) && (target.getInstanceId() == npc.getInstanceId())) && !target.isDead())
{
final Attackable mob = (Attackable) addSpawn(SPAWN_MOB_IDS[Rnd.get(SPAWN_MOB_IDS.length)], npc.getSpawn().getX(), npc.getSpawn().getY(), npc.getSpawn().getZ(), npc.getSpawn().getHeading(), false, 0, false, world.getInstanceId());
world.deviceSpawnedMobCount++;
mob.setSeeThroughSilentMove(true);
mob.setRunning();
mob.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, MOVE_TO_TIAT);
}
}
break;
}
}
}

View File

@ -286,28 +286,25 @@ public abstract class AirShipController extends AbstractNpcAI
@Override
public String onEnterZone(Creature creature, ZoneType zone)
{
if (creature instanceof ControllableAirShipInstance)
if ((creature instanceof ControllableAirShipInstance) && (_dockedShip == null))
{
if (_dockedShip == null)
_dockedShip = (ControllableAirShipInstance) creature;
_dockedShip.setInDock(_dockZone);
_dockedShip.setOustLoc(_oustLoc);
// Ship is not empty - display movie to passengers and dock
if (!_dockedShip.isEmpty())
{
_dockedShip = (ControllableAirShipInstance) creature;
_dockedShip.setInDock(_dockZone);
_dockedShip.setOustLoc(_oustLoc);
if (_movie != null)
{
playMovie(_dockedShip.getPassengers(), _movie);
}
// Ship is not empty - display movie to passengers and dock
if (!_dockedShip.isEmpty())
{
if (_movie != null)
{
playMovie(_dockedShip.getPassengers(), _movie);
}
ThreadPool.schedule(_decayTask, 1000);
}
else
{
_departSchedule = ThreadPool.schedule(_departTask, DEPART_INTERVAL);
}
ThreadPool.schedule(_decayTask, 1000);
}
else
{
_departSchedule = ThreadPool.schedule(_departTask, DEPART_INTERVAL);
}
}
return null;
@ -316,20 +313,17 @@ public abstract class AirShipController extends AbstractNpcAI
@Override
public String onExitZone(Creature creature, ZoneType zone)
{
if (creature instanceof ControllableAirShipInstance)
if ((creature instanceof ControllableAirShipInstance) && creature.equals(_dockedShip))
{
if (creature.equals(_dockedShip))
if (_departSchedule != null)
{
if (_departSchedule != null)
{
_departSchedule.cancel(false);
_departSchedule = null;
}
_dockedShip.setInDock(0);
_dockedShip = null;
_isBusy = false;
_departSchedule.cancel(false);
_departSchedule = null;
}
_dockedShip.setInDock(0);
_dockedShip = null;
_isBusy = false;
}
return null;
}
@ -368,14 +362,11 @@ public abstract class AirShipController extends AbstractNpcAI
}
}
}
if (_arrivalPath == null)
if ((_arrivalPath == null) && !ZoneManager.getInstance().getZoneById(_dockZone, ScriptZone.class).isInsideZone(_shipSpawnX, _shipSpawnY, _shipSpawnZ))
{
if (!ZoneManager.getInstance().getZoneById(_dockZone, ScriptZone.class).isInsideZone(_shipSpawnX, _shipSpawnY, _shipSpawnZ))
{
LOGGER.log(Level.WARNING, getName() + ": Arrival path is null and spawn point not in zone " + _dockZone + ", controller disabled");
_isBusy = true;
return;
}
LOGGER.log(Level.WARNING, getName() + ": Arrival path is null and spawn point not in zone " + _dockZone + ", controller disabled");
_isBusy = true;
return;
}
if (_departPath != null)

View File

@ -303,7 +303,7 @@ public class AirShipGludioGracia extends AbstractNpcAI implements Runnable
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.warning(e.toString());
}
}

View File

@ -84,36 +84,32 @@ public class Chimeras extends AbstractNpcAI
@Override
public String onSkillSee(Npc npc, PlayerInstance caster, Skill skill, WorldObject[] targets, boolean isSummon)
{
if ((skill.getId() == BOTTLE) && !npc.isDead())
if (((skill.getId() == BOTTLE) && !npc.isDead()) //
&& ((targets.length > 0) && (targets[0] == npc)) //
&& (npc.getCurrentHp() < (npc.getMaxHp() * 0.1)))
{
if ((targets.length > 0) && (targets[0] == npc))
if (HellboundEngine.getInstance().getLevel() == 7)
{
if (npc.getCurrentHp() < (npc.getMaxHp() * 0.1))
HellboundEngine.getInstance().updateTrust(3, true);
}
npc.setIsDead(true);
if (npc.getId() == CELTUS)
{
npc.dropItem(caster, CONTAINED_LIFE_FORCE, CONTAINED_LIFE_FORCE_AMOUNT);
}
else
{
if (getRandom(100) < 80)
{
if (HellboundEngine.getInstance().getLevel() == 7)
{
HellboundEngine.getInstance().updateTrust(3, true);
}
npc.setIsDead(true);
if (npc.getId() == CELTUS)
{
npc.dropItem(caster, CONTAINED_LIFE_FORCE, CONTAINED_LIFE_FORCE_AMOUNT);
}
else
{
if (getRandom(100) < 80)
{
npc.dropItem(caster, DIM_LIFE_FORCE, 1);
}
else if (getRandom(100) < 80)
{
npc.dropItem(caster, LIFE_FORCE, 1);
}
}
npc.onDecay();
npc.dropItem(caster, DIM_LIFE_FORCE, 1);
}
else if (getRandom(100) < 80)
{
npc.dropItem(caster, LIFE_FORCE, 1);
}
}
npc.onDecay();
}
return super.onSkillSee(npc, caster, skill, targets, isSummon);
}

View File

@ -51,17 +51,16 @@ public class Bernarde extends AbstractNpcAI
{
case "HolyWater":
{
if (HellboundEngine.getInstance().getLevel() == 2)
if ((HellboundEngine.getInstance().getLevel() == 2) //
&& (player.getInventory().getInventoryItemCount(DARION_BADGE, -1, false) >= 5) //
&& player.exchangeItemsById("Quest", npc, DARION_BADGE, 5, HOLY_WATER, 1, true))
{
if (player.getInventory().getInventoryItemCount(DARION_BADGE, -1, false) >= 5)
{
if (player.exchangeItemsById("Quest", npc, DARION_BADGE, 5, HOLY_WATER, 1, true))
{
return "32300-02b.htm";
}
}
event = "32300-02b.htm";
}
else
{
event = "32300-02c.htm";
}
event = "32300-02c.htm";
break;
}
case "Treasure":

View File

@ -44,7 +44,7 @@ public class Buron extends AbstractNpcAI
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
String htmltext = event;
String htmltext;
if ("Rumor".equalsIgnoreCase(event))
{
htmltext = "32345-" + HellboundEngine.getInstance().getLevel() + "r.htm";

View File

@ -65,18 +65,15 @@ public class Falk extends AbstractNpcAI
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
if (event.equalsIgnoreCase("badges"))
if (event.equalsIgnoreCase("badges") && !hasAtLeastOneQuestItem(player, BASIC_CERT, STANDART_CERT, PREMIUM_CERT))
{
if (!hasAtLeastOneQuestItem(player, BASIC_CERT, STANDART_CERT, PREMIUM_CERT))
if (getQuestItemsCount(player, DARION_BADGE) >= 20)
{
if (getQuestItemsCount(player, DARION_BADGE) >= 20)
{
takeItems(player, DARION_BADGE, 20);
giveItems(player, BASIC_CERT, 1);
return "32297-02a.htm";
}
return "32297-02b.htm";
takeItems(player, DARION_BADGE, 20);
giveItems(player, BASIC_CERT, 1);
return "32297-02a.htm";
}
return "32297-02b.htm";
}
return super.onAdvEvent(event, npc, player);
}

View File

@ -55,32 +55,26 @@ public class Hude extends AbstractNpcAI
{
case "scertif":
{
if (HellboundEngine.getInstance().getLevel() > 3)
if ((HellboundEngine.getInstance().getLevel() > 3) && hasQuestItems(player, BASIC_CERT) && (getQuestItemsCount(player, MARK_OF_BETRAYAL) >= 30) && (getQuestItemsCount(player, STINGER) >= 60))
{
if (hasQuestItems(player, BASIC_CERT) && (getQuestItemsCount(player, MARK_OF_BETRAYAL) >= 30) && (getQuestItemsCount(player, STINGER) >= 60))
{
takeItems(player, MARK_OF_BETRAYAL, 30);
takeItems(player, STINGER, 60);
takeItems(player, BASIC_CERT, 1);
giveItems(player, STANDART_CERT, 1);
return "32298-04a.htm";
}
takeItems(player, MARK_OF_BETRAYAL, 30);
takeItems(player, STINGER, 60);
takeItems(player, BASIC_CERT, 1);
giveItems(player, STANDART_CERT, 1);
return "32298-04a.htm";
}
return "32298-04b.htm";
}
case "pcertif":
{
if (HellboundEngine.getInstance().getLevel() > 6)
if ((HellboundEngine.getInstance().getLevel() > 6) && hasQuestItems(player, STANDART_CERT) && (getQuestItemsCount(player, LIFE_FORCE) >= 56) && (getQuestItemsCount(player, CONTAINED_LIFE_FORCE) >= 14))
{
if (hasQuestItems(player, STANDART_CERT) && (getQuestItemsCount(player, LIFE_FORCE) >= 56) && (getQuestItemsCount(player, CONTAINED_LIFE_FORCE) >= 14))
{
takeItems(player, LIFE_FORCE, 56);
takeItems(player, CONTAINED_LIFE_FORCE, 14);
takeItems(player, STANDART_CERT, 1);
giveItems(player, PREMIUM_CERT, 1);
giveItems(player, MAP, 1);
return "32298-06a.htm";
}
takeItems(player, LIFE_FORCE, 56);
takeItems(player, CONTAINED_LIFE_FORCE, 14);
takeItems(player, STANDART_CERT, 1);
giveItems(player, PREMIUM_CERT, 1);
giveItems(player, MAP, 1);
return "32298-06a.htm";
}
return "32298-06b.htm";
}

View File

@ -45,14 +45,11 @@ public class Jude extends AbstractNpcAI
{
if ("TreasureSacks".equalsIgnoreCase(event))
{
if (HellboundEngine.getInstance().getLevel() == 3)
if ((HellboundEngine.getInstance().getLevel() == 3) && (getQuestItemsCount(player, NATIVE_TREASURE) >= 40))
{
if (getQuestItemsCount(player, NATIVE_TREASURE) >= 40)
{
takeItems(player, NATIVE_TREASURE, 40);
giveItems(player, RING_OF_WIND_MASTERY, 1);
return "32356-02.htm";
}
takeItems(player, NATIVE_TREASURE, 40);
giveItems(player, RING_OF_WIND_MASTERY, 1);
return "32356-02.htm";
}
return "32356-02a.htm";
}

View File

@ -164,23 +164,10 @@ public class Quarry extends AbstractNpcAI
if (creature.isAttackable())
{
final Attackable npc = (Attackable) creature;
if (npc.getId() == SLAVE)
if ((npc.getId() == SLAVE) && !npc.isDead() && !npc.isDecayed() && (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_FOLLOW) && (HellboundEngine.getInstance().getLevel() == 5))
{
if (!npc.isDead() && !npc.isDecayed() && (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_FOLLOW))
{
if (HellboundEngine.getInstance().getLevel() == 5)
{
startQuestTimer("DECAY", 1000, npc, null);
try
{
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THANK_YOU_FOR_THE_RESCUE_IT_S_A_SMALL_GIFT);
}
catch (Exception e)
{
//
}
}
}
startQuestTimer("DECAY", 1000, npc, null);
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THANK_YOU_FOR_THE_RESCUE_IT_S_A_SMALL_GIFT);
}
}
return super.onEnterZone(creature, zone);

View File

@ -120,9 +120,9 @@ public class Warpgate extends AbstractNpcAI
return true;
}
final QuestState path_to_hellbound_st = player.getQuestState(Q00130_PathToHellbound.class.getSimpleName());
final QuestState thats_bloody_hot_st = player.getQuestState(Q00133_ThatsBloodyHot.class.getSimpleName());
final QuestState qs1 = player.getQuestState(Q00130_PathToHellbound.class.getSimpleName());
final QuestState qs2 = player.getQuestState(Q00133_ThatsBloodyHot.class.getSimpleName());
return (((path_to_hellbound_st != null) && path_to_hellbound_st.isCompleted()) || ((thats_bloody_hot_st != null) && thats_bloody_hot_st.isCompleted()));
return (((qs1 != null) && qs1.isCompleted()) || ((qs2 != null) && qs2.isCompleted()));
}
}

View File

@ -60,8 +60,8 @@ public class AnomicFoundry extends AbstractNpcAI
//@formatter:on
private int respawnTime = 60000;
private final int respawnMin = 20000;
private final int respawnMax = 300000;
private final static int respawnMin = 20000;
private final static int respawnMax = 300000;
private final int[] _spawned =
{

View File

@ -21,6 +21,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
@ -391,17 +392,14 @@ public class TowerOfNaia extends AbstractNpcAI
}
return "18492-01.htm";
}
else if ((npcId >= ROOM_MANAGER_FIRST) && (npcId <= ROOM_MANAGER_LAST))
else if ((npcId >= ROOM_MANAGER_FIRST) && (npcId <= ROOM_MANAGER_LAST) && _activeRooms.containsKey(npcId) && !_activeRooms.get(npcId))
{
if (_activeRooms.containsKey(npcId) && !_activeRooms.get(npcId))
if (player.getParty() == null)
{
if (player.getParty() == null)
{
player.sendPacket(SystemMessageId.YOU_MUST_BE_IN_A_PARTY_IN_ORDER_TO_OPERATE_THE_MACHINE);
return null;
}
return "manager.htm";
player.sendPacket(SystemMessageId.YOU_MUST_BE_IN_A_PARTY_IN_ORDER_TO_OPERATE_THE_MACHINE);
return null;
}
return "manager.htm";
}
return super.onFirstTalk(npc, player);
}
@ -603,11 +601,11 @@ public class TowerOfNaia extends AbstractNpcAI
{
if (ZONES.containsValue(zone.getId()))
{
for (int i : ZONES.keySet())
for (Entry<Integer, Integer> entry : ZONES.entrySet())
{
if (ZONES.get(i) == zone.getId())
if (entry.getValue() == zone.getId())
{
managerId = i;
managerId = entry.getKey();
break;
}
}

View File

@ -923,7 +923,7 @@ public class TullyWorkshop extends AbstractNpcAI
}
else if (npcId == AGENT)
{
if (event.equalsIgnoreCase("tele_to_7th_floor") && (allowAgentSpawn == false))
if (event.equalsIgnoreCase("tele_to_7th_floor") && !allowAgentSpawn)
{
htmltext = null;
final Party party = player.getParty();
@ -969,7 +969,7 @@ public class TullyWorkshop extends AbstractNpcAI
}
}
}
else if (event.equalsIgnoreCase("buff") && (allowAgentSpawn_7th == false))
else if (event.equalsIgnoreCase("buff") && !allowAgentSpawn_7th)
{
htmltext = null;
final Party party = player.getParty();
@ -1003,7 +1003,7 @@ public class TullyWorkshop extends AbstractNpcAI
startQuestTimer("despawn_agent_7", 60000, npc, null);
}
}
else if (event.equalsIgnoreCase("refuse") && (allowAgentSpawn_7th == false))
else if (event.equalsIgnoreCase("refuse") && !allowAgentSpawn_7th)
{
allowAgentSpawn_7th = true;
npc.deleteMe();
@ -1124,22 +1124,16 @@ public class TullyWorkshop extends AbstractNpcAI
if ((actor != null) && !actor.isDead())
{
final double transferringHp = actor.getMaxHp() * 0.0001;
if ((getRandom(10000) > 1500) && (victim1 != null) && !victim1.isDead())
if ((getRandom(10000) > 1500) && (victim1 != null) && !victim1.isDead() && ((actor.getCurrentHp() - transferringHp) > 1))
{
if ((actor.getCurrentHp() - transferringHp) > 1)
{
actor.setCurrentHp(actor.getCurrentHp() - transferringHp);
victim1.setCurrentHp(victim1.getCurrentHp() + transferringHp);
}
actor.setCurrentHp(actor.getCurrentHp() - transferringHp);
victim1.setCurrentHp(victim1.getCurrentHp() + transferringHp);
}
if ((getRandom(10000) > 3000) && (victim2 != null) && !victim2.isDead())
if ((getRandom(10000) > 3000) && (victim2 != null) && !victim2.isDead() && ((actor.getCurrentHp() - transferringHp) > 1))
{
if ((actor.getCurrentHp() - transferringHp) > 1)
{
actor.setCurrentHp(actor.getCurrentHp() - transferringHp);
victim2.setCurrentHp(victim2.getCurrentHp() + transferringHp);
}
actor.setCurrentHp(actor.getCurrentHp() - transferringHp);
victim2.setCurrentHp(victim2.getCurrentHp() + transferringHp);
}
}
}
@ -1196,7 +1190,7 @@ public class TullyWorkshop extends AbstractNpcAI
if ((npcId == TULLY) && npc.isInsideRadius2D(-12557, 273901, -9000, 1000))
{
for (int i[] : POST_MORTEM_SPAWNLIST)
for (int[] i : POST_MORTEM_SPAWNLIST)
{
final Npc spawnedNpc = addSpawn(i[0], i[1], i[2], i[3], i[4], false, i[5], false);
postMortemSpawn.add(spawnedNpc);
@ -1209,19 +1203,16 @@ public class TullyWorkshop extends AbstractNpcAI
_countdown = ThreadPool.scheduleAtFixedRate(() ->
{
countdownTime -= 10000;
Npc _npc = null;
if ((postMortemSpawn != null) && (postMortemSpawn.size() > 0))
Npc npcSpawn = null;
if ((postMortemSpawn != null) && !postMortemSpawn.isEmpty())
{
_npc = postMortemSpawn.get(0);
npcSpawn = postMortemSpawn.get(0);
}
if (countdownTime > 60000)
{
if ((countdownTime % 60000) == 0)
if (((countdownTime % 60000) == 0) && (npcSpawn != null) && (npcSpawn.getId() == INGENIOUS_CONTRAPTION))
{
if ((_npc != null) && (_npc.getId() == INGENIOUS_CONTRAPTION))
{
_npc.broadcastSay(ChatType.NPC_SHOUT, NpcStringId.S1_MINUTE_S_ARE_REMAINING, Integer.toString((countdownTime / 60000)));
}
npcSpawn.broadcastSay(ChatType.NPC_SHOUT, NpcStringId.S1_MINUTE_S_ARE_REMAINING, Integer.toString((countdownTime / 60000)));
}
}
else if (countdownTime <= 0)
@ -1252,9 +1243,9 @@ public class TullyWorkshop extends AbstractNpcAI
}
else
{
if ((_npc != null) && (_npc.getId() == INGENIOUS_CONTRAPTION))
if ((npcSpawn != null) && (npcSpawn.getId() == INGENIOUS_CONTRAPTION))
{
_npc.broadcastSay(ChatType.NPC_SHOUT, NpcStringId.S1_SECOND_S_REMAINING, Integer.toString((countdownTime / 1000)));
npcSpawn.broadcastSay(ChatType.NPC_SHOUT, NpcStringId.S1_SECOND_S_REMAINING, Integer.toString((countdownTime / 1000)));
}
}
}, 60000, 10000);
@ -1268,7 +1259,7 @@ public class TullyWorkshop extends AbstractNpcAI
if (countdownTime > 180000)
{
countdownTime = Math.max(countdownTime - 180000, 60000);
if ((postMortemSpawn != null) && (postMortemSpawn.size() > 0) && (postMortemSpawn.get(0) != null) && (postMortemSpawn.get(0).getId() == INGENIOUS_CONTRAPTION))
if ((postMortemSpawn != null) && !postMortemSpawn.isEmpty() && (postMortemSpawn.get(0) != null) && (postMortemSpawn.get(0).getId() == INGENIOUS_CONTRAPTION))
{
postMortemSpawn.get(0).broadcastSay(ChatType.NPC_SHOUT, NpcStringId.ZZZZ_CITY_INTERFERENCE_ERROR_FORWARD_EFFECT_CREATED);
}
@ -1280,7 +1271,7 @@ public class TullyWorkshop extends AbstractNpcAI
if ((countdownTime > 0) && (countdownTime <= 420000))
{
countdownTime += 180000;
if ((postMortemSpawn != null) && (postMortemSpawn.size() > 0) && (postMortemSpawn.get(0) != null) && (postMortemSpawn.get(0).getId() == INGENIOUS_CONTRAPTION))
if ((postMortemSpawn != null) && !postMortemSpawn.isEmpty() && (postMortemSpawn.get(0) != null) && (postMortemSpawn.get(0).getId() == INGENIOUS_CONTRAPTION))
{
postMortemSpawn.get(0).broadcastSay(ChatType.NPC_SHOUT, NpcStringId.ZZZZ_CITY_INTERFERENCE_ERROR_RECURRENCE_EFFECT_CREATED);
}

View File

@ -173,44 +173,41 @@ public class UrbanArea extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
if (world != null)
if ((world != null) && (npc.getId() == DOWNTOWN_NATIVE))
{
if (npc.getId() == DOWNTOWN_NATIVE)
if (event.equalsIgnoreCase("rebuff") && !world.getParameters().getBoolean("isAmaskariDead", false))
{
if (event.equalsIgnoreCase("rebuff") && !world.getParameters().getBoolean("isAmaskariDead", false))
STONE.getSkill().applyEffects(npc, npc);
}
else if (event.equalsIgnoreCase("break_chains"))
{
if (!npc.isAffectedBySkill(STONE.getSkillId()) || world.getParameters().getBoolean("isAmaskariDead", false))
{
STONE.getSkill().applyEffects(npc, npc);
npc.broadcastSay(ChatType.NPC_GENERAL, NATIVES_NPCSTRING_ID[0]);
npc.broadcastSay(ChatType.NPC_GENERAL, NATIVES_NPCSTRING_ID[2]);
}
else if (event.equalsIgnoreCase("break_chains"))
else
{
if (!npc.isAffectedBySkill(STONE.getSkillId()) || world.getParameters().getBoolean("isAmaskariDead", false))
cancelQuestTimer("rebuff", npc, null);
if (npc.isAffectedBySkill(STONE.getSkillId()))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NATIVES_NPCSTRING_ID[0]);
npc.broadcastSay(ChatType.NPC_GENERAL, NATIVES_NPCSTRING_ID[2]);
npc.stopSkillEffects(false, STONE.getSkillId());
}
else
npc.broadcastSay(ChatType.NPC_GENERAL, NATIVES_NPCSTRING_ID[0]);
npc.broadcastSay(ChatType.NPC_GENERAL, NATIVES_NPCSTRING_ID[1]);
HellboundEngine.getInstance().updateTrust(10, true);
npc.scheduleDespawn(3000);
// Try to call Amaskari
final Npc spawnedAmaskari = world.getParameters().getObject("spawnedAmaskari", Npc.class);
if ((spawnedAmaskari != null) && !spawnedAmaskari.isDead() && (getRandom(1000) < 25) && Util.checkIfInRange(5000, npc, spawnedAmaskari, false))
{
cancelQuestTimer("rebuff", npc, null);
if (npc.isAffectedBySkill(STONE.getSkillId()))
final ScheduledFuture<?> activeAmaskariCall = world.getParameters().getObject("activeAmaskariCall", ScheduledFuture.class);
if (activeAmaskariCall != null)
{
npc.stopSkillEffects(false, STONE.getSkillId());
}
npc.broadcastSay(ChatType.NPC_GENERAL, NATIVES_NPCSTRING_ID[0]);
npc.broadcastSay(ChatType.NPC_GENERAL, NATIVES_NPCSTRING_ID[1]);
HellboundEngine.getInstance().updateTrust(10, true);
npc.scheduleDespawn(3000);
// Try to call Amaskari
final Npc spawnedAmaskari = world.getParameters().getObject("spawnedAmaskari", Npc.class);
if ((spawnedAmaskari != null) && !spawnedAmaskari.isDead() && (getRandom(1000) < 25) && Util.checkIfInRange(5000, npc, spawnedAmaskari, false))
{
final ScheduledFuture<?> activeAmaskariCall = world.getParameters().getObject("activeAmaskariCall", ScheduledFuture.class);
if (activeAmaskariCall != null)
{
activeAmaskariCall.cancel(true);
}
world.setParameter("activeAmaskariCall", ThreadPool.schedule(new CallAmaskari(npc), 25000));
activeAmaskariCall.cancel(true);
}
world.setParameter("activeAmaskariCall", ThreadPool.schedule(new CallAmaskari(npc), 25000));
}
}
}
@ -240,23 +237,20 @@ public class UrbanArea extends AbstractInstance
public String onAggroRangeEnter(Npc npc, PlayerInstance player, boolean isSummon)
{
final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
if (world != null)
if ((world != null) && !npc.isBusy())
{
if (!npc.isBusy())
npc.broadcastSay(ChatType.NPC_GENERAL, NPCSTRING_ID[0]);
npc.setBusy(true);
final Npc spawnedAmaskari = world.getParameters().getObject("spawnedAmaskari", Npc.class);
if ((spawnedAmaskari != null) && !spawnedAmaskari.isDead() && (getRandom(1000) < 25) && Util.checkIfInRange(1000, npc, spawnedAmaskari, false))
{
npc.broadcastSay(ChatType.NPC_GENERAL, NPCSTRING_ID[0]);
npc.setBusy(true);
final Npc spawnedAmaskari = world.getParameters().getObject("spawnedAmaskari", Npc.class);
if ((spawnedAmaskari != null) && !spawnedAmaskari.isDead() && (getRandom(1000) < 25) && Util.checkIfInRange(1000, npc, spawnedAmaskari, false))
final ScheduledFuture<?> activeAmaskariCall = world.getParameters().getObject("activeAmaskariCall", ScheduledFuture.class);
if (activeAmaskariCall != null)
{
final ScheduledFuture<?> activeAmaskariCall = world.getParameters().getObject("activeAmaskariCall", ScheduledFuture.class);
if (activeAmaskariCall != null)
{
activeAmaskariCall.cancel(true);
}
world.setParameter("activeAmaskariCall", ThreadPool.schedule(new CallAmaskari(npc), 25000));
activeAmaskariCall.cancel(true);
}
world.setParameter("activeAmaskariCall", ThreadPool.schedule(new CallAmaskari(npc), 25000));
}
}
return super.onAggroRangeEnter(npc, player, isSummon);
@ -266,50 +260,47 @@ public class UrbanArea extends AbstractInstance
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill)
{
final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
if (world != null)
if ((world != null) && !world.getParameters().getBoolean("isAmaskariDead", false) && !(npc.getBusyMessage().equalsIgnoreCase("atk") || npc.isBusy()))
{
if (!world.getParameters().getBoolean("isAmaskariDead", false) && !(npc.getBusyMessage().equalsIgnoreCase("atk") || npc.isBusy()))
int msgId;
int range;
switch (npc.getId())
{
int msgId;
int range;
switch (npc.getId())
case TOWN_GUARD:
{
case TOWN_GUARD:
{
msgId = 0;
range = 1000;
break;
}
case KEYMASTER:
{
msgId = 1;
range = 5000;
break;
}
default:
{
msgId = -1;
range = 0;
}
msgId = 0;
range = 1000;
break;
}
if (msgId >= 0)
case KEYMASTER:
{
npc.broadcastSay(ChatType.NPC_GENERAL, NPCSTRING_ID[msgId], range);
msgId = 1;
range = 5000;
break;
}
npc.setBusy(true);
npc.setBusyMessage("atk");
final Npc spawnedAmaskari = world.getParameters().getObject("spawnedAmaskari", Npc.class);
if ((spawnedAmaskari != null) && !spawnedAmaskari.isDead() && (getRandom(1000) < 25) && Util.checkIfInRange(range, npc, spawnedAmaskari, false))
default:
{
final ScheduledFuture<?> activeAmaskariCall = world.getParameters().getObject("activeAmaskariCall", ScheduledFuture.class);
if (activeAmaskariCall != null)
{
activeAmaskariCall.cancel(true);
}
world.setParameter("activeAmaskariCall", ThreadPool.schedule(new CallAmaskari(npc), 25000));
msgId = -1;
range = 0;
}
}
if (msgId >= 0)
{
npc.broadcastSay(ChatType.NPC_GENERAL, NPCSTRING_ID[msgId], range);
}
npc.setBusy(true);
npc.setBusyMessage("atk");
final Npc spawnedAmaskari = world.getParameters().getObject("spawnedAmaskari", Npc.class);
if ((spawnedAmaskari != null) && !spawnedAmaskari.isDead() && (getRandom(1000) < 25) && Util.checkIfInRange(range, npc, spawnedAmaskari, false))
{
final ScheduledFuture<?> activeAmaskariCall = world.getParameters().getObject("activeAmaskariCall", ScheduledFuture.class);
if (activeAmaskariCall != null)
{
activeAmaskariCall.cancel(true);
}
world.setParameter("activeAmaskariCall", ThreadPool.schedule(new CallAmaskari(npc), 25000));
}
}
return super.onAttack(npc, attacker, damage, isSummon, skill);
}

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

@ -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

@ -243,7 +243,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

@ -42,8 +42,8 @@ public class SelMahumSquad extends AbstractNpcAI
private static final int FIRE = 18927;
private static final int STOVE = 18933;
private static final int OHS_Weapon = 15280;
private static final int THS_Weapon = 15281;
private static final int OHS_WEAPON = 15280;
private static final int THS_WEAPON = 15281;
// Sel Mahum Squad Leaders
private static final int[] SQUAD_LEADERS =
@ -255,7 +255,7 @@ public class SelMahumSquad extends AbstractNpcAI
{
receiver.setRandomWalking(true);
receiver.getVariables().remove("BUSY_STATE");
receiver.setRHandId(THS_Weapon);
receiver.setRHandId(THS_WEAPON);
startQuestTimer("return_from_fire", 3000, receiver, null);
}
break;
@ -266,7 +266,7 @@ public class SelMahumSquad extends AbstractNpcAI
{
if (!receiver.isRandomWalkingEnabled()) // i_ai0 == 1
{
receiver.setRHandId(THS_Weapon);
receiver.setRHandId(THS_WEAPON);
}
receiver.setRandomWalking(false); // Moving to fire - i_ai0 = 1
receiver.getVariables().set("BUSY_STATE", 1); // Eating - i_ai3 = 1
@ -314,7 +314,7 @@ public class SelMahumSquad extends AbstractNpcAI
// NPC moves to fire
if (!npc.isRandomWalkingEnabled() && (npc.getX() == npc.getVariables().getInt("DESTINATION_X")) && (npc.getY() == npc.getVariables().getInt("DESTINATION_Y")))
{
npc.setRHandId(OHS_Weapon);
npc.setRHandId(OHS_WEAPON);
startQuestTimer("fire_arrived", 3000, npc, null);
}
}
@ -388,9 +388,9 @@ public class SelMahumSquad extends AbstractNpcAI
attacked.getVariables().remove("BUSY_STATE");
attacked.setRandomWalking(true);
attacked.setDisplayEffect(MAHUM_EFFECT_NONE);
if (attacked.getRightHandItem() == OHS_Weapon)
if (attacked.getRightHandItem() == OHS_WEAPON)
{
attacked.setRHandId(THS_Weapon);
attacked.setRHandId(THS_WEAPON);
}
// TODO: Check about i_quest0
}

View File

@ -89,25 +89,21 @@ public class StakatoNest extends AbstractNpcAI
@Override
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)))
if ((npc.getId() == STAKATO_LEADER) && (getRandom(1000) < 100) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.3)))
{
final MonsterInstance _follower = checkMinion(npc);
if (_follower != null)
final MonsterInstance follower = checkMinion(npc);
if (follower != null)
{
final double _hp = _follower.getCurrentHp();
if (_hp > (_follower.getMaxHp() * 0.3))
final double hp = follower.getCurrentHp();
if (hp > (follower.getMaxHp() * 0.3))
{
mob.abortAttack();
mob.abortCast();
mob.setHeading(Util.calculateHeadingFrom(mob, _follower));
mob.doCast(SkillData.getInstance().getSkill(4484, 1));
mob.setCurrentHp(mob.getCurrentHp() + _hp);
_follower.doDie(_follower);
_follower.deleteMe();
npc.abortAttack();
npc.abortCast();
npc.setHeading(Util.calculateHeadingFrom(npc, follower));
npc.doCast(SkillData.getInstance().getSkill(4484, 1));
npc.setCurrentHp(npc.getCurrentHp() + hp);
follower.doDie(follower);
follower.deleteMe();
}
}
}

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

@ -777,11 +777,11 @@ public class Baium extends AbstractNpcAI
private PlayerInstance getRandomPlayer(Npc npc)
{
for (Creature creature : World.getInstance().getVisibleObjectsInRange(npc, PlayerInstance.class, 2000))
for (PlayerInstance player : World.getInstance().getVisibleObjectsInRange(npc, PlayerInstance.class, 2000))
{
if ((creature != null) && zone.isInsideZone(creature) && !creature.isDead())
if ((player != null) && zone.isInsideZone(player) && !player.isDead())
{
return (PlayerInstance) creature;
return player;
}
}
return null;

View File

@ -162,7 +162,7 @@ public class Core extends AbstractNpcAI
}
else if (event.equalsIgnoreCase("despawn_minions"))
{
_minions.forEach(m -> m.decayMe());
_minions.forEach(Attackable::decayMe);
_minions.clear();
}
return super.onAdvEvent(event, npc, player);

View File

@ -95,14 +95,12 @@ public class DrChaos extends AbstractNpcAI
final GrandBossInstance golem = (GrandBossInstance) addSpawn(CHAOS_GOLEM, loc_x, loc_y, loc_z, heading, false, 0, false);
GrandBossManager.getInstance().addBoss(golem);
final Npc _golem = golem;
_golem.setCurrentHpMp(hp, mp);
_golem.setRunning();
golem.setCurrentHpMp(hp, mp);
golem.setRunning();
// start monitoring Dr. Chaos's inactivity
_lastAttackVsGolem = System.currentTimeMillis();
startQuestTimer("golem_despawn", 60000, _golem, null, true);
startQuestTimer("golem_despawn", 60000, golem, null, true);
}
// Spawn the regular NPC.
else
@ -122,17 +120,14 @@ public class DrChaos extends AbstractNpcAI
// despawn the live Dr. Chaos after 30 minutes of inactivity
else if (event.equalsIgnoreCase("golem_despawn") && (npc != null))
{
if (npc.getId() == CHAOS_GOLEM)
if ((npc.getId() == CHAOS_GOLEM) && ((_lastAttackVsGolem + 1800000) < System.currentTimeMillis()))
{
if ((_lastAttackVsGolem + 1800000) < System.currentTimeMillis())
{
// Despawn the war golem.
npc.deleteMe();
addSpawn(DOCTOR_CHAOS, 96320, -110912, -3328, 8191, false, 0, false); // spawn Dr. Chaos
GrandBossManager.getInstance().setBossStatus(CHAOS_GOLEM, NORMAL); // mark Dr. Chaos is not crazy any more
cancelQuestTimer("golem_despawn", npc, null);
}
// Despawn the war golem.
npc.deleteMe();
addSpawn(DOCTOR_CHAOS, 96320, -110912, -3328, 8191, false, 0, false); // spawn Dr. Chaos
GrandBossManager.getInstance().setBossStatus(CHAOS_GOLEM, NORMAL); // mark Dr. Chaos is not crazy any more
cancelQuestTimer("golem_despawn", npc, null);
}
}
else if (event.equalsIgnoreCase("1"))
@ -171,30 +166,27 @@ public class DrChaos extends AbstractNpcAI
startQuestTimer("golem_despawn", 60000, npc, null, true);
}
// Check every sec if someone is in range, if found, launch one task to decrease the timer.
else if (event.equalsIgnoreCase("paranoia_activity"))
else if (event.equalsIgnoreCase("paranoia_activity") && (GrandBossManager.getInstance().getBossStatus(CHAOS_GOLEM) == NORMAL))
{
if (GrandBossManager.getInstance().getBossStatus(CHAOS_GOLEM) == NORMAL)
for (PlayerInstance obj : World.getInstance().getVisibleObjectsInRange(npc, PlayerInstance.class, 500))
{
for (PlayerInstance obj : World.getInstance().getVisibleObjectsInRange(npc, PlayerInstance.class, 500))
if (obj.isDead())
{
if (obj.isDead())
{
continue;
}
_pissedOffTimer -= 1;
// Make him speak.
if (_pissedOffTimer == 15)
{
npc.broadcastSay(ChatType.NPC_GENERAL, "How dare you trespass into my territory! Have you no fear?");
}
// That was "too much" for that time.
if (_pissedOffTimer <= 0)
{
crazyMidgetBecomesAngry(npc);
}
continue;
}
_pissedOffTimer -= 1;
// Make him speak.
if (_pissedOffTimer == 15)
{
npc.broadcastSay(ChatType.NPC_GENERAL, "How dare you trespass into my territory! Have you no fear?");
}
// That was "too much" for that time.
if (_pissedOffTimer <= 0)
{
crazyMidgetBecomesAngry(npc);
}
}
}

View File

@ -69,7 +69,7 @@ public class Orfen extends AbstractNpcAI
// private static final int RIBA = 29017;
private static final int RIBA_IREN = 29018;
private static boolean _IsTeleported;
private static boolean _hasTeleported;
private static final Collection<Attackable> MINIONS = ConcurrentHashMap.newKeySet();
private static BossZone ZONE;
@ -85,7 +85,7 @@ public class Orfen extends AbstractNpcAI
RIBA_IREN
};
registerMobs(mobs);
_IsTeleported = false;
_hasTeleported = false;
ZONE = GrandBossManager.getInstance().getZone(POS[0]);
final StatsSet info = GrandBossManager.getInstance().getStatsSet(ORFEN);
if (GrandBossManager.getInstance().getBossStatus(ORFEN) == DEAD)
@ -192,12 +192,12 @@ public class Orfen extends AbstractNpcAI
}
else if (event.equalsIgnoreCase("check_orfen_pos"))
{
if ((_IsTeleported && (npc.getCurrentHp() > (npc.getMaxHp() * 0.95))) || (!ZONE.isInsideZone(npc) && !_IsTeleported))
if ((_hasTeleported && (npc.getCurrentHp() > (npc.getMaxHp() * 0.95))) || (!ZONE.isInsideZone(npc) && !_hasTeleported))
{
setSpawnPoint(npc, getRandom(3) + 1);
_IsTeleported = false;
_hasTeleported = false;
}
else if (_IsTeleported && !ZONE.isInsideZone(npc))
else if (_hasTeleported && !ZONE.isInsideZone(npc))
{
setSpawnPoint(npc, 0);
}
@ -290,9 +290,9 @@ public class Orfen extends AbstractNpcAI
final int npcId = npc.getId();
if (npcId == ORFEN)
{
if (!_IsTeleported && ((npc.getCurrentHp() - damage) < (npc.getMaxHp() / 2)))
if (!_hasTeleported && ((npc.getCurrentHp() - damage) < (npc.getMaxHp() / 2)))
{
_IsTeleported = true;
_hasTeleported = true;
setSpawnPoint(npc, 0);
}
else if (npc.isInsideRadius2D(attacker, 1000) && !npc.isInsideRadius2D(attacker, 300) && (getRandom(10) == 0))

View File

@ -85,7 +85,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

@ -77,12 +77,9 @@ public class BlackdaggerWing extends AbstractNpcAI
if (npc.getVariables().getBoolean(MID_HP_FLAG, false))
{
final Creature mostHated = ((Attackable) npc).getMostHated();
if ((mostHated != null) && mostHated.isPlayer() && (mostHated != creature))
if ((mostHated != null) && mostHated.isPlayer() && (mostHated != creature) && (getRandom(5) < 1))
{
if (getRandom(5) < 1)
{
addSkillCastDesire(npc, creature, RANGE_MAGIC_ATTACK, 99999);
}
addSkillCastDesire(npc, creature, RANGE_MAGIC_ATTACK, 99999);
}
}
return super.onSeeCreature(npc, creature, isSummon);

View File

@ -109,20 +109,17 @@ public class BleedingFly extends AbstractNpcAI
}
}
}
else if (TIMER_LOW_HP.equals(event))
else if (TIMER_LOW_HP.equals(event) && (npc.getVariables().getInt(LOW_HP_MINION_COUNT) > 0))
{
if (npc.getVariables().getInt(LOW_HP_MINION_COUNT) > 0)
npc.getVariables().set(LOW_HP_MINION_COUNT, npc.getVariables().getInt(LOW_HP_MINION_COUNT) - 1);
addSkillCastDesire(npc, npc, SUMMON_PARASITE_LEECH, 99999);
addSkillCastDesire(npc, npc, NPC_ACUMEN_LVL_3, 99999);
addSpawn(PARASITIC_LEECH, npc.getX() + getRandom(150), npc.getY() + getRandom(150), npc.getZ(), npc.getHeading(), false, 0);
addSpawn(PARASITIC_LEECH, npc.getX() + getRandom(150), npc.getY() + getRandom(150), npc.getZ(), npc.getHeading(), false, 0);
if (npc.getVariables().getBoolean(LOW_HP_FLAG, false))
{
npc.getVariables().set(LOW_HP_MINION_COUNT, npc.getVariables().getInt(LOW_HP_MINION_COUNT) - 1);
addSkillCastDesire(npc, npc, SUMMON_PARASITE_LEECH, 99999);
addSkillCastDesire(npc, npc, NPC_ACUMEN_LVL_3, 99999);
addSpawn(PARASITIC_LEECH, npc.getX() + getRandom(150), npc.getY() + getRandom(150), npc.getZ(), npc.getHeading(), false, 0);
addSpawn(PARASITIC_LEECH, npc.getX() + getRandom(150), npc.getY() + getRandom(150), npc.getZ(), npc.getHeading(), false, 0);
if (npc.getVariables().getBoolean(LOW_HP_FLAG, false))
{
startQuestTimer(TIMER_LOW_HP, 80000, npc, null);
}
startQuestTimer(TIMER_LOW_HP, 80000, npc, null);
}
}
return super.onAdvEvent(event, npc, player);

View File

@ -1095,13 +1095,13 @@ public class CastleChamberlain extends AbstractNpcAI
{
if (isOwner(player, npc) && player.hasClanPrivilege(ClanPrivilege.CS_USE_FUNCTIONS))
{
final CastleFunction HP = castle.getFunction(Castle.FUNC_RESTORE_HP);
final CastleFunction MP = castle.getFunction(Castle.FUNC_RESTORE_MP);
final CastleFunction XP = castle.getFunction(Castle.FUNC_RESTORE_EXP);
final CastleFunction hp = castle.getFunction(Castle.FUNC_RESTORE_HP);
final CastleFunction mp = castle.getFunction(Castle.FUNC_RESTORE_MP);
final CastleFunction xp = castle.getFunction(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
@ -1132,12 +1132,9 @@ public class CastleChamberlain extends AbstractNpcAI
{
final int locId = Integer.parseInt(st.nextToken());
final TeleportLocation list = TeleportLocationTable.getInstance().getTemplate(locId);
if (list != null)
if ((list != null) && takeItems(player, list.getItemId(), list.getPrice()))
{
if (takeItems(player, list.getItemId(), list.getPrice()))
{
player.teleToLocation(list.getLocX(), list.getLocY(), list.getLocZ());
}
player.teleToLocation(list.getLocX(), list.getLocY(), list.getLocZ());
}
}
else

View File

@ -62,12 +62,9 @@ public class EmeraldHorn extends AbstractNpcAI
npc.teleToLocation(npc.getSpawn().getX(), npc.getSpawn().getY(), npc.getSpawn().getZ());
}
if (npc.isAffectedBySkill(REFLECT_ATTACK.getSkillId()))
if (npc.isAffectedBySkill(REFLECT_ATTACK.getSkillId()) && npc.getVariables().getBoolean(CAST_FLAG, false))
{
if (npc.getVariables().getBoolean(CAST_FLAG, false))
{
npc.getVariables().set(TOTAL_DAMAGE_COUNT, npc.getVariables().getInt(TOTAL_DAMAGE_COUNT) + damage);
}
npc.getVariables().set(TOTAL_DAMAGE_COUNT, npc.getVariables().getInt(TOTAL_DAMAGE_COUNT) + damage);
}
if (npc.getVariables().getInt(TOTAL_DAMAGE_COUNT) > 5000)

View File

@ -54,12 +54,9 @@ public class Katenar extends AbstractNpcAI
{
case "CREATED_50":
{
if (npc0 != null)
if ((npc0 != null) && !npc.getVariables().getBoolean("SPAWNED", false))
{
if (!npc.getVariables().getBoolean("SPAWNED", false))
{
npc0.getVariables().set("SPAWNED", false);
}
npc0.getVariables().set("SPAWNED", false);
}
npc.deleteMe();
break;
@ -69,13 +66,10 @@ public class Katenar extends AbstractNpcAI
final QuestState qs = player.getQuestState(Q00065_CertifiedSoulBreaker.class.getSimpleName());
if (qs.isMemoState(14))
{
if (npc0 != null)
if ((npc0 != null) && !npc.getVariables().getBoolean("SPAWNED", false))
{
if (!npc.getVariables().getBoolean("SPAWNED", false))
{
npc0.getVariables().set("SPAWNED", false);
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.GOOD_LUCK);
}
npc0.getVariables().set("SPAWNED", false);
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.GOOD_LUCK);
}
npc.deleteMe();
}

View File

@ -43,24 +43,24 @@ public class Kier extends AbstractNpcAI
public String onFirstTalk(Npc npc, PlayerInstance player)
{
String htmltext = null;
final QuestState st_Q00115 = player.getQuestState(Q00115_TheOtherSideOfTruth.class.getSimpleName());
if (st_Q00115 == null)
final QuestState qs115 = player.getQuestState(Q00115_TheOtherSideOfTruth.class.getSimpleName());
if (qs115 == null)
{
htmltext = "32022-02.html";
}
else if (!st_Q00115.isCompleted())
else if (!qs115.isCompleted())
{
htmltext = "32022-01.html";
}
final QuestState st_Q10283 = player.getQuestState(Q10283_RequestOfIceMerchant.class.getSimpleName());
if (st_Q10283 != null)
final QuestState qs10283 = player.getQuestState(Q10283_RequestOfIceMerchant.class.getSimpleName());
if (qs10283 != null)
{
if (st_Q10283.isMemoState(2))
if (qs10283.isMemoState(2))
{
htmltext = "32022-03.html";
}
else if (st_Q10283.isCompleted())
else if (qs10283.isCompleted())
{
htmltext = "32022-04.html";
}

View File

@ -380,7 +380,7 @@ public class Minigame extends AbstractNpcAI
private boolean _started;
private int _attemptNumber;
private int _currentPot;
private final int _order[];
private final int[] _order;
private ConsumerEventListener _listener;
public MinigameRoom(Npc[] burners, Npc manager)

View File

@ -38,14 +38,14 @@ public class CabaleBuffer extends AbstractNpcAI
private static final int DISTANCE_TO_WATCH_OBJECT = 900;
// Messages
public static final NpcStringId[] ORATOR_MSG =
protected static final NpcStringId[] ORATOR_MSG =
{
NpcStringId.THE_DAY_OF_JUDGMENT_IS_NEAR,
NpcStringId.THE_PROPHECY_OF_DARKNESS_HAS_BEEN_FULFILLED,
NpcStringId.AS_FORETOLD_IN_THE_PROPHECY_OF_DARKNESS_THE_ERA_OF_CHAOS_HAS_BEGUN,
NpcStringId.THE_PROPHECY_OF_DARKNESS_HAS_COME_TO_PASS
};
public static final NpcStringId[] PREACHER_MSG =
protected static final NpcStringId[] PREACHER_MSG =
{
NpcStringId.THIS_WORLD_WILL_SOON_BE_ANNIHILATED,
NpcStringId.ALL_IS_LOST_PREPARE_TO_MEET_THE_GODDESS_OF_DEATH,

View File

@ -88,23 +88,19 @@ 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.getSummon() : 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.getSummon() : 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

@ -109,9 +109,9 @@ public class PriestOfBlessing extends AbstractNpcAI
if (player.getAdena() >= PRICE_VOICE)
{
final String value = player.getVariables().getString("PriestOfBlessing_voice", "");
final long _reuse_time = value.isEmpty() ? 0 : Long.parseLong(value);
final long reuseTime = value.isEmpty() ? 0 : Long.parseLong(value);
if (System.currentTimeMillis() > _reuse_time)
if (System.currentTimeMillis() > reuseTime)
{
takeItems(player, Inventory.ADENA_ID, PRICE_VOICE);
giveItems(player, NEVIT_VOICE, 1);
@ -119,7 +119,7 @@ public class PriestOfBlessing extends AbstractNpcAI
}
else
{
final long remainingTime = (_reuse_time - System.currentTimeMillis()) / 1000;
final long remainingTime = (reuseTime - System.currentTimeMillis()) / 1000;
final int hours = (int) (remainingTime / 3600);
final int minutes = (int) ((remainingTime % 3600) / 60);
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_WILL_BE_AVAILABLE_FOR_RE_USE_AFTER_S2_HOUR_S_S3_MINUTE_S);
@ -134,25 +134,25 @@ public class PriestOfBlessing extends AbstractNpcAI
}
else if (event.equalsIgnoreCase("buy_hourglass"))
{
final int _index = getHGIndex(player.getLevel());
final int _price_hourglass = PRICE_HOURGLASS[_index];
final int index = getHGIndex(player.getLevel());
final int priceHourglass = PRICE_HOURGLASS[index];
if (player.getAdena() >= _price_hourglass)
if (player.getAdena() >= priceHourglass)
{
final String value = player.getVariables().getString("PriestOfBlessing_hg_" + _index, "");
final long _reuse_time = value.isEmpty() ? 0 : Long.parseLong(value);
final String value = player.getVariables().getString("PriestOfBlessing_hg_" + index, "");
final long reuseTime = value.isEmpty() ? 0 : Long.parseLong(value);
if (System.currentTimeMillis() > _reuse_time)
if (System.currentTimeMillis() > reuseTime)
{
final int[] _hg = HOURGLASSES[_index];
final int _nevit_hourglass = _hg[getRandom(0, _hg.length - 1)];
takeItems(player, Inventory.ADENA_ID, _price_hourglass);
giveItems(player, _nevit_hourglass, 1);
player.getVariables().set("PriestOfBlessing_hg_" + _index, Long.toString(System.currentTimeMillis() + (20 * 3600000)));
final int[] hg = HOURGLASSES[index];
final int nevitHourglass = hg[getRandom(0, hg.length - 1)];
takeItems(player, Inventory.ADENA_ID, priceHourglass);
giveItems(player, nevitHourglass, 1);
player.getVariables().set("PriestOfBlessing_hg_" + index, Long.toString(System.currentTimeMillis() + (20 * 3600000)));
}
else
{
final long remainingTime = (_reuse_time - System.currentTimeMillis()) / 1000;
final long remainingTime = (reuseTime - System.currentTimeMillis()) / 1000;
final int hours = (int) (remainingTime / 3600);
final int minutes = (int) ((remainingTime % 3600) / 60);
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_WILL_BE_AVAILABLE_FOR_RE_USE_AFTER_S2_HOUR_S_S3_MINUTE_S);

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

@ -57,28 +57,19 @@ public class Remnants extends AbstractNpcAI
@Override
public String onSkillSee(Npc npc, PlayerInstance caster, Skill skill, WorldObject[] targets, boolean isSummon)
{
if (skill.getId() == SKILL_HOLY_WATER)
if ((skill.getId() == SKILL_HOLY_WATER) && !npc.isDead() && (targets.length > 0) && (targets[0] == npc) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.02)))
{
if (!npc.isDead())
npc.doDie(caster);
//@formatter:off
/*if (npc.getNpcId() == DEREK)
{
if ((targets.length > 0) && (targets[0] == npc))
{
if (npc.getCurrentHp() < (npc.getMaxHp() * 0.02)) // Lower, than 2%
{
npc.doDie(caster);
//@formatter:off
/*if (npc.getNpcId() == DEREK)
{
caster.sendMessage(MSG_DEREK);
}
else
{
caster.sendMessage(MSG);
}*/
//@formatter:on
}
}
caster.sendMessage(MSG_DEREK);
}
else
{
caster.sendMessage(MSG);
}*/
//@formatter:on
}
return super.onSkillSee(npc, caster, skill, targets, isSummon);
}

View File

@ -78,13 +78,10 @@ public class ShadowSummoner extends AbstractNpcAI
@Override
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
{
if (!creature.isPlayer())
if (!creature.isPlayer() && (creature.getId() == DEMONS_BANQUET_2))
{
if (creature.getId() == DEMONS_BANQUET_2)
{
((Attackable) npc).clearAggroList();
addAttackDesire(npc, creature, 99999);
}
((Attackable) npc).clearAggroList();
addAttackDesire(npc, creature, 99999);
}
return super.onSeeCreature(npc, creature, isSummon);
}

View File

@ -129,13 +129,10 @@ public class SiegeGuards extends AbstractNpcAI
{
final Summon summon = nearby.isSummon() ? (Summon) nearby : null;
final PlayerInstance pl = summon == null ? (PlayerInstance) nearby : summon.getOwner();
if (((pl.getSiegeState() != 2) || pl.isRegisteredOnThisSiegeField(guard.getScriptValue())) && ((pl.getSiegeState() != 0) || (guard.getAI().getIntention() != CtrlIntention.AI_INTENTION_IDLE)))
if (((pl.getSiegeState() != 2) || pl.isRegisteredOnThisSiegeField(guard.getScriptValue())) && ((pl.getSiegeState() != 0) || (guard.getAI().getIntention() != CtrlIntention.AI_INTENTION_IDLE)) && (!pl.isInvisible() && !pl.isInvul()))
{
if (!pl.isInvisible() && !pl.isInvul()) // skip invisible players
{
addAttackDesire(guard, pl);
break; // no need to search more
}
addAttackDesire(guard, pl);
break; // no need to search more
}
}
}

View File

@ -148,27 +148,27 @@ public class SubclassCertification extends AbstractNpcAI
}
case "lvl65Emergent":
{
htmltext = doCertification(player, qs, "EmergentAbility", CERTIFICATE_EMERGENT_ABILITY, 65);
htmltext = doCertification(player, "EmergentAbility", CERTIFICATE_EMERGENT_ABILITY, 65);
break;
}
case "lvl70Emergent":
{
htmltext = doCertification(player, qs, "EmergentAbility", CERTIFICATE_EMERGENT_ABILITY, 70);
htmltext = doCertification(player, "EmergentAbility", CERTIFICATE_EMERGENT_ABILITY, 70);
break;
}
case "lvl75Master":
{
htmltext = doCertification(player, qs, "ClassAbility", CERTIFICATE_MASTER_ABILITY, 75);
htmltext = doCertification(player, "ClassAbility", CERTIFICATE_MASTER_ABILITY, 75);
break;
}
case "lvl75Class":
{
htmltext = doCertification(player, qs, "ClassAbility", ABILITY_CERTIFICATES.get(getClassIndex(player)), 75);
htmltext = doCertification(player, "ClassAbility", ABILITY_CERTIFICATES.get(getClassIndex(player)), 75);
break;
}
case "lvl80Class":
{
htmltext = doCertification(player, qs, "ClassAbility", TRANSFORMATION_SEALBOOKS.get(getClassIndex(player)), 80);
htmltext = doCertification(player, "ClassAbility", TRANSFORMATION_SEALBOOKS.get(getClassIndex(player)), 80);
break;
}
case "Main.html":
@ -230,7 +230,7 @@ public class SubclassCertification extends AbstractNpcAI
return -1;
}
private String doCertification(PlayerInstance player, QuestState qs, String variable, Integer itemId, int level)
private String doCertification(PlayerInstance player, String variable, Integer itemId, int level)
{
if (itemId == null)
{

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.getTemplate().getParameters().getInt("SummonPrivateRate", 0)))
{
if (getRandom(1, 100) <= npc.getTemplate().getParameters().getInt("SummonPrivateRate", 0))
for (MinionHolder is : npc.getTemplate().getParameters().getMinionList("Privates"))
{
for (MinionHolder is : npc.getTemplate().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

@ -37,8 +37,8 @@ import org.l2jmobius.gameserver.util.Util;
*/
public class FortressOfResistance extends ClanHallSiegeEngine
{
private final int MESSENGER = 35382;
private final int BLOODY_LORD_NURKA = 35375;
private static final int MESSENGER = 35382;
private static final int BLOODY_LORD_NURKA = 35375;
private final Location[] NURKA_COORDS =
{
@ -84,8 +84,7 @@ public class FortressOfResistance extends ClanHallSiegeEngine
}
catch (Exception e)
{
LOGGER.warning(getName() + ": Couldnt set the Bloody Lord Nurka spawn");
e.printStackTrace();
LOGGER.warning(getName() + ": Couldnt set the Bloody Lord Nurka spawn " + e);
}
}

View File

@ -26,6 +26,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ScheduledFuture;
import org.l2jmobius.Config;
@ -88,16 +89,16 @@ public class RainbowSpringsChateau extends ClanHallSiegeEngine
{
long counter = 0;
Clan clan = null;
for (int clanId : _warDecreesCount.keySet())
for (Entry<Integer, Long> entry : _warDecreesCount.entrySet())
{
final Clan actingClan = ClanTable.getInstance().getClan(clanId);
final Clan actingClan = ClanTable.getInstance().getClan(entry.getKey());
if ((actingClan == null) || (actingClan.getDissolvingExpiryTime() > 0))
{
_warDecreesCount.remove(clanId);
_warDecreesCount.remove(entry.getKey());
continue;
}
final long count = _warDecreesCount.get(clanId);
final long count = entry.getValue();
if (count > counter)
{
counter = count;
@ -144,7 +145,7 @@ public class RainbowSpringsChateau extends ClanHallSiegeEngine
}
}
public static Clan _winner;
public static final Clan _winner = null;
@Override
public Clan getWinner()
@ -643,7 +644,7 @@ public class RainbowSpringsChateau extends ClanHallSiegeEngine
final WorldObject target = player.getTarget();
if ((target == null) || !(target instanceof Npc))
if (!(target instanceof Npc))
{
return null;
}
@ -724,7 +725,7 @@ public class RainbowSpringsChateau extends ClanHallSiegeEngine
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.warning("Problem at RainbowSpringsChateau: " + e.getMessage());
}
}
SpawnTable.getInstance().addNewSpawn(_gourds[i], false);
@ -884,7 +885,7 @@ public class RainbowSpringsChateau extends ClanHallSiegeEngine
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.warning("Problem at RainbowSpringsChateau: " + e.getMessage());
}
}

View File

@ -131,8 +131,8 @@ public abstract class FlagWar extends ClanHallSiegeEngine
{
final Clan clan = ClanTable.getInstance().getClan(_hall.getOwnerId());
String content = getHtm(player, "messenger_initial.htm");
content = content.replaceAll("%clanName%", (clan == null) ? "no owner" : clan.getName());
content = content.replaceAll("%objectId%", String.valueOf(npc.getObjectId()));
content = content.replace("%clanName%", (clan == null) ? "no owner" : clan.getName());
content = content.replace("%objectId%", String.valueOf(npc.getObjectId()));
html = content;
}
else
@ -360,11 +360,11 @@ public abstract class FlagWar extends ClanHallSiegeEngine
if (_hall.isInSiege())
{
final int npcId = npc.getId();
for (int keys : _data.keySet())
for (Entry<Integer, ClanData> entry : _data.entrySet())
{
if (_data.get(keys).npc == npcId)
if (entry.getValue().npc == npcId)
{
removeParticipant(keys, true);
removeParticipant(entry.getKey(), true);
}
}
@ -544,8 +544,7 @@ public abstract class FlagWar extends ClanHallSiegeEngine
catch (Exception e)
{
endSiege();
LOGGER.warning(getName() + ": Problems in siege initialization!");
e.printStackTrace();
LOGGER.warning(getName() + ": Problems in siege initialization! " + e);
}
}
}
@ -569,14 +568,7 @@ public abstract class FlagWar extends ClanHallSiegeEngine
{
for (int clanId : _data.keySet())
{
if (_hall.getOwnerId() == clanId)
{
removeParticipant(clanId, false);
}
else
{
removeParticipant(clanId, true);
}
removeParticipant(clanId, _hall.getOwnerId() != clanId);
}
}
clearTables();
@ -652,7 +644,6 @@ public abstract class FlagWar extends ClanHallSiegeEngine
catch (Exception e)
{
LOGGER.warning(getName() + ": Couldnt make clan spawns: " + e.getMessage());
e.printStackTrace();
}
}
@ -790,7 +781,6 @@ public abstract class FlagWar extends ClanHallSiegeEngine
catch (Exception e)
{
LOGGER.warning(getName() + ".loadAttackers()->" + e.getMessage());
e.printStackTrace();
}
}
@ -799,7 +789,6 @@ public abstract class FlagWar extends ClanHallSiegeEngine
try (Connection con = DatabaseFactory.getConnection())
{
final ArrayList<Integer> listInstance = _data.get(clanId).players;
if (listInstance == null)
{
LOGGER.warning(getName() + ": Tried to load unregistered clan with ID " + clanId);
@ -820,7 +809,6 @@ public abstract class FlagWar extends ClanHallSiegeEngine
catch (Exception e)
{
LOGGER.warning(getName() + ".loadAttackerMembers()->" + e.getMessage());
e.printStackTrace();
}
}
@ -839,7 +827,6 @@ public abstract class FlagWar extends ClanHallSiegeEngine
catch (Exception e)
{
LOGGER.warning(getName() + ".saveClan()->" + e.getMessage());
e.printStackTrace();
}
}
@ -856,7 +843,6 @@ public abstract class FlagWar extends ClanHallSiegeEngine
catch (Exception e)
{
LOGGER.warning(getName() + ".saveNpc()->" + e.getMessage());
e.printStackTrace();
}
}
@ -874,7 +860,6 @@ public abstract class FlagWar extends ClanHallSiegeEngine
catch (Exception e)
{
LOGGER.warning(getName() + ".saveMember()->" + e.getMessage());
e.printStackTrace();
}
}

View File

@ -154,7 +154,7 @@ public class NewbieCoupons extends AbstractNpcAI
return "30598.htm";
}
public static void main(String args[])
public static void main(String[] args)
{
new NewbieCoupons();
}

View File

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

View File

@ -96,7 +96,7 @@ public class RaidbossInfo extends AbstractNpcAI
return "info.htm";
}
public static void main(String args[])
public static void main(String[] args)
{
new RaidbossInfo();
}

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

@ -53,16 +53,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";
}
@ -78,7 +78,7 @@ public class ShadowWeapons extends AbstractNpcAI
return htmltext;
}
public static void main(String args[])
public static void main(String[] args)
{
new ShadowWeapons();
}

View File

@ -215,12 +215,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

@ -52,12 +52,12 @@ public class Race extends Event
// Race state
private static boolean _isRaceStarted = false;
// 5 min for register
private static final int _time_register = 5;
private static final int REGISTER_TIME = 5;
// 5 min for race
private static final int _time_race = 10;
private static final int RACE_TIME = 10;
// NPCs
private static final int _start_npc = 900103;
private static final int _stop_npc = 900104;
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
@ -101,12 +101,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
@ -129,14 +129,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,7 +159,7 @@ public class Race extends Event
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)
{
@ -179,7 +179,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
@ -213,9 +213,9 @@ public class Race extends Event
}
_players.clear();
// Despawn NPCs
for (Npc _npc : _npcs)
for (Npc npc : _npcs)
{
_npc.deleteMe();
npc.deleteMe();
}
_npcs.clear();
// Announce event end
@ -235,13 +235,13 @@ public class Race extends Event
}
else
{
final int _number = Integer.valueOf(bypass.substring(5));
final Skill _sk = SkillData.getInstance().getSkill(_number, 1);
if (_sk != null)
final int number = Integer.valueOf(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
{
@ -325,17 +325,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";
}

View File

@ -85,23 +85,23 @@ public class TvTManager extends AbstractNpcAI implements IVoicedCommandHandler
else if ((playerLevel < Config.TVT_EVENT_MIN_LVL) || (playerLevel > Config.TVT_EVENT_MAX_LVL))
{
htmltext = getHtm(player, "Level.html");
htmltext = htmltext.replaceAll("%min%", String.valueOf(Config.TVT_EVENT_MIN_LVL));
htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.TVT_EVENT_MAX_LVL));
htmltext = htmltext.replace("%min%", String.valueOf(Config.TVT_EVENT_MIN_LVL));
htmltext = htmltext.replace("%max%", String.valueOf(Config.TVT_EVENT_MAX_LVL));
}
else if ((team1Count == Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS) && (team2Count == Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS))
{
htmltext = getHtm(player, "TeamsFull.html");
htmltext = htmltext.replaceAll("%max%", String.valueOf(Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS));
htmltext = htmltext.replace("%max%", String.valueOf(Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS));
}
else if ((Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.TVT_ID, player, Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP))
{
htmltext = getHtm(player, "IPRestriction.html");
htmltext = htmltext.replaceAll("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP)));
htmltext = htmltext.replace("%max%", String.valueOf(AntiFeedManager.getInstance().getLimit(player, Config.TVT_EVENT_MAX_PARTICIPANTS_PER_IP)));
}
else if (TvTEvent.needParticipationFee() && !TvTEvent.hasParticipationFee(player))
{
htmltext = getHtm(player, "ParticipationFee.html");
htmltext = htmltext.replaceAll("%fee%", TvTEvent.getParticipationFee());
htmltext = htmltext.replace("%fee%", TvTEvent.getParticipationFee());
}
else if (TvTEvent.addParticipant(player))
{
@ -138,16 +138,16 @@ public class TvTManager extends AbstractNpcAI implements IVoicedCommandHandler
final boolean isParticipant = TvTEvent.isPlayerParticipant(player.getObjectId());
final int[] teamsPlayerCounts = TvTEvent.getTeamsPlayerCounts();
htmltext = getHtm(player, (!isParticipant ? "Participation.html" : "RemoveParticipation.html"));
htmltext = htmltext.replaceAll("%objectId%", String.valueOf(npc.getObjectId()));
htmltext = htmltext.replaceAll("%team1name%", Config.TVT_EVENT_TEAM_1_NAME);
htmltext = htmltext.replaceAll("%team1playercount%", String.valueOf(teamsPlayerCounts[0]));
htmltext = htmltext.replaceAll("%team2name%", Config.TVT_EVENT_TEAM_2_NAME);
htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1]));
htmltext = htmltext.replaceAll("%playercount%", String.valueOf(teamsPlayerCounts[0] + teamsPlayerCounts[1]));
htmltext = htmltext.replace("%objectId%", String.valueOf(npc.getObjectId()));
htmltext = htmltext.replace("%team1name%", Config.TVT_EVENT_TEAM_1_NAME);
htmltext = htmltext.replace("%team1playercount%", String.valueOf(teamsPlayerCounts[0]));
htmltext = htmltext.replace("%team2name%", Config.TVT_EVENT_TEAM_2_NAME);
htmltext = htmltext.replace("%team2playercount%", String.valueOf(teamsPlayerCounts[1]));
htmltext = htmltext.replace("%playercount%", String.valueOf(teamsPlayerCounts[0] + teamsPlayerCounts[1]));
if (!isParticipant)
{
htmltext = htmltext.replaceAll("%fee%", TvTEvent.getParticipationFee());
htmltext = htmltext.replace("%fee%", TvTEvent.getParticipationFee());
}
}
else if (TvTEvent.isStarting() || TvTEvent.isStarted())
@ -199,12 +199,12 @@ public class TvTManager extends AbstractNpcAI implements IVoicedCommandHandler
final int[] teamsPlayerCounts = TvTEvent.getTeamsPlayerCounts();
final int[] teamsPointsCounts = TvTEvent.getTeamsPoints();
String htmltext = getHtm(player, "Status.html");
htmltext = htmltext.replaceAll("%team1name%", Config.TVT_EVENT_TEAM_1_NAME);
htmltext = htmltext.replaceAll("%team1playercount%", String.valueOf(teamsPlayerCounts[0]));
htmltext = htmltext.replaceAll("%team1points%", String.valueOf(teamsPointsCounts[0]));
htmltext = htmltext.replaceAll("%team2name%", Config.TVT_EVENT_TEAM_2_NAME);
htmltext = htmltext.replaceAll("%team2playercount%", String.valueOf(teamsPlayerCounts[1]));
htmltext = htmltext.replaceAll("%team2points%", String.valueOf(teamsPointsCounts[1]));
htmltext = htmltext.replace("%team1name%", Config.TVT_EVENT_TEAM_1_NAME);
htmltext = htmltext.replace("%team1playercount%", String.valueOf(teamsPlayerCounts[0]));
htmltext = htmltext.replace("%team1points%", String.valueOf(teamsPointsCounts[0]));
htmltext = htmltext.replace("%team2name%", Config.TVT_EVENT_TEAM_2_NAME);
htmltext = htmltext.replace("%team2playercount%", String.valueOf(teamsPlayerCounts[1]));
htmltext = htmltext.replace("%team2points%", String.valueOf(teamsPointsCounts[1]));
return htmltext;
}

View File

@ -85,7 +85,7 @@ public class Wedding extends AbstractNpcAI
player.setMarryRequest(false);
partner.setMarryRequest(false);
htmltext = getHtm(player, "Ask.html");
htmltext = htmltext.replaceAll("%player%", partner.getName());
htmltext = htmltext.replace("%player%", partner.getName());
}
return htmltext;
}
@ -106,7 +106,7 @@ public class Wedding extends AbstractNpcAI
sendHtml(partner, "Ask.html", "%player%", player.getName());
htmltext = getHtm(player, "Requested.html");
htmltext = htmltext.replaceAll("%player%", partner.getName());
htmltext = htmltext.replace("%player%", partner.getName());
}
break;
}

View File

@ -78,11 +78,11 @@ public class FreyaCelebration extends LongTimeEvent
{
if (getQuestItemsCount(player, Inventory.ADENA_ID) > 1)
{
final long _curr_time = System.currentTimeMillis();
final long currTime = System.currentTimeMillis();
final String value = player.getVariables().getString("FreyaCelebration");
final long _reuse_time = value == "" ? 0 : Long.parseLong(value);
final long reuseTime = value.equals("") ? 0 : Long.parseLong(value);
if (_curr_time > _reuse_time)
if (currTime > reuseTime)
{
takeItems(player, Inventory.ADENA_ID, 1);
giveItems(player, FREYA_POTION, 1);
@ -90,7 +90,7 @@ public class FreyaCelebration extends LongTimeEvent
}
else
{
final long remainingTime = (_reuse_time - System.currentTimeMillis()) / 1000;
final long remainingTime = (reuseTime - System.currentTimeMillis()) / 1000;
final int hours = (int) (remainingTime / 3600);
final int minutes = (int) ((remainingTime % 3600) / 60);
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_WILL_BE_AVAILABLE_FOR_RE_USE_AFTER_S2_HOUR_S_S3_MINUTE_S);

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

@ -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

@ -132,7 +132,6 @@ import handlers.admincommandhandlers.AdminTerritoryWar;
import handlers.admincommandhandlers.AdminTest;
import handlers.admincommandhandlers.AdminTransform;
import handlers.admincommandhandlers.AdminTvTEvent;
import handlers.admincommandhandlers.AdminUnblockIp;
import handlers.admincommandhandlers.AdminVitality;
import handlers.admincommandhandlers.AdminZone;
import handlers.admincommandhandlers.AdminZones;
@ -434,7 +433,6 @@ public class MasterHandler
AdminTest.class,
AdminTransform.class,
AdminTvTEvent.class,
AdminUnblockIp.class,
AdminVitality.class,
AdminZone.class,
},
@ -629,12 +627,9 @@ public class MasterHandler
}
}
registerHandlerMethods.entrySet().stream().filter(e -> e.getValue() == null).forEach(e ->
{
LOGGER.log(Level.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.log(Level.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)
{
@ -657,7 +652,6 @@ public class MasterHandler
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Failed loading handler: " + c.getSimpleName(), e);
continue;
}
}
}

View File

@ -50,14 +50,10 @@ public class ArtefactInstanceAction implements IActionHandler
{
player.setTarget(target);
}
else if (interact)
else if (interact && !((Npc) target).canInteract(player)) // Calculate the distance between the PlayerInstance and the NpcInstance
{
// Calculate the distance between the PlayerInstance and the NpcInstance
if (!((Npc) target).canInteract(player))
{
// Notify the PlayerInstance AI with AI_INTENTION_INTERACT
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
// Notify the PlayerInstance AI with AI_INTENTION_INTERACT
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, target);
}
return true;
}

View File

@ -142,7 +142,7 @@ public class NpcActionShift implements IActionShiftHandler
}
final String spawnFile = SpawnTable.getInstance().getSpawnFile(((Npc) target).getSpawn().getNpcSpawnTemplateId());
html.replace("%spawnfile%", spawnFile.substring(spawnFile.lastIndexOf("\\") + 1));
html.replace("%spawnfile%", spawnFile.substring(spawnFile.lastIndexOf('\\') + 1));
}
else
{

View File

@ -308,6 +308,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;
}
@ -493,8 +493,8 @@ public class AdminAnnouncements implements IAdminCommandHandler
sb.append("</tr>");
return sb.toString();
});
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

@ -360,6 +360,7 @@ public class AdminBuffs implements IAdminCommandHandler
}
catch (Exception e)
{
// Checked bellow.
}
if ((target != null) && (skillId > 0))
@ -387,6 +388,7 @@ public class AdminBuffs implements IAdminCommandHandler
}
catch (Exception e)
{
// Checked bellow.
}
if (target != null)

View File

@ -17,6 +17,7 @@
package handlers.admincommandhandlers;
import java.util.Calendar;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.data.sql.impl.ClanTable;
@ -36,6 +37,8 @@ import org.l2jmobius.gameserver.util.BuilderUtil;
*/
public class AdminCHSiege implements IAdminCommandHandler
{
private static final Logger LOGGER = Logger.getLogger(AdminCHSiege.class.getName());
private static final String[] COMMANDS =
{
"admin_chsiege_siegablehall",
@ -355,7 +358,7 @@ public class AdminCHSiege implements IAdminCommandHandler
}
catch (NumberFormatException e)
{
e.printStackTrace();
LOGGER.warning("Problem with AdminCHSiege: " + e.getMessage());
}
return val;
}

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("Problem with AdminEditChar: " + e.getMessage());
}
}
else if (command.startsWith("admin_find_dualbox"))
@ -672,6 +672,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
catch (Exception e)
{
// Handled above.
}
findDualbox(activeChar, multibox);
}
@ -690,6 +691,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
catch (Exception e)
{
// Handled above.
}
findDualboxStrict(activeChar, multibox);
}
@ -794,6 +796,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
catch (Exception e)
{
LOGGER.warning("Problem with AdminEditChar: " + e.getMessage());
}
}
else
@ -1156,11 +1159,11 @@ 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;
int charactersFound = 0;
String name;
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
adminReply.setFile(activeChar, "data/html/admin/charfind.htm");
@ -1172,9 +1175,9 @@ 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;
charactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name);
replyMSG.append("\">");
@ -1185,7 +1188,7 @@ public class AdminEditChar implements IAdminCommandHandler
replyMSG.append(player.getLevel());
replyMSG.append("</td></tr>");
}
if (CharactersFound > 20)
if (charactersFound > 20)
{
break;
}
@ -1194,16 +1197,16 @@ public class AdminEditChar implements IAdminCommandHandler
final String replyMSG2;
if (CharactersFound == 0)
if (charactersFound == 0)
{
replyMSG2 = "s. Please try again.";
}
else if (CharactersFound > 20)
else if (charactersFound > 20)
{
adminReply.replace("%number%", " more than 20");
replyMSG2 = "s.<br>Please refine your search to see all of the results.";
}
else if (CharactersFound == 1)
else if (charactersFound == 1)
{
replyMSG2 = ".";
}
@ -1212,33 +1215,32 @@ public class AdminEditChar implements IAdminCommandHandler
replyMSG2 = "s.";
}
adminReply.replace("%number%", String.valueOf(CharactersFound));
adminReply.replace("%number%", String.valueOf(charactersFound));
adminReply.replace("%end%", replyMSG2);
activeChar.sendPacket(adminReply);
}
/**
* @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]))$"))
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 name;
String ip = "0.0.0.0";
@ -1271,14 +1273,14 @@ public class AdminEditChar implements IAdminCommandHandler
}
ip = client.getConnectionAddress().getHostAddress();
if (!ip.equals(IpAdress))
if (!ip.equals(ipAdress))
{
continue;
}
}
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("\">");
@ -1289,7 +1291,7 @@ public class AdminEditChar implements IAdminCommandHandler
replyMSG.append(player.getLevel());
replyMSG.append("</td></tr>");
if (CharactersFound > 20)
if (charactersFound > 20)
{
break;
}
@ -1298,16 +1300,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 = ".";
}
@ -1315,8 +1317,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);
}
@ -1324,9 +1326,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)
@ -1389,7 +1390,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)
@ -1443,7 +1444,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

@ -258,6 +258,7 @@ public class AdminEffects implements IAdminCommandHandler
}
catch (Exception e)
{
// Managed bellow.
}
try
{
@ -280,6 +281,7 @@ public class AdminEffects implements IAdminCommandHandler
}
catch (Exception e)
{
// Not important.
}
}
else if (command.startsWith("admin_unpara")) // || command.startsWith("admin_unpara_menu"))
@ -291,6 +293,7 @@ public class AdminEffects implements IAdminCommandHandler
}
catch (Exception e)
{
// Managed bellow.
}
try
{
@ -312,6 +315,7 @@ public class AdminEffects implements IAdminCommandHandler
}
catch (Exception e)
{
// Not important.
}
}
else if (command.startsWith("admin_bighead"))
@ -328,6 +332,7 @@ public class AdminEffects implements IAdminCommandHandler
}
catch (Exception e)
{
// Not important.
}
}
else if (command.startsWith("admin_shrinkhead"))
@ -344,6 +349,7 @@ public class AdminEffects implements IAdminCommandHandler
}
catch (Exception e)
{
// Not important.
}
}
else if (command.equals("admin_clearteams"))
@ -453,6 +459,7 @@ public class AdminEffects implements IAdminCommandHandler
}
catch (Exception e)
{
// Not important.
}
}
else if (command.startsWith("admin_ave_abnormal") || command.startsWith("admin_ave_special") || command.startsWith("admin_ave_event"))
@ -639,6 +646,7 @@ public class AdminEffects implements IAdminCommandHandler
}
catch (Exception e)
{
// Not important.
}
return true;
}
@ -698,9 +706,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

@ -25,6 +25,7 @@ import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.StringTokenizer;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.Rnd;
@ -45,6 +46,7 @@ import org.l2jmobius.gameserver.util.Broadcast;
*/
public class AdminEventEngine implements IAdminCommandHandler
{
private static final Logger LOGGER = Logger.getLogger(AdminEventEngine.class.getName());
private static final String[] ADMIN_COMMANDS =
{
@ -129,11 +131,8 @@ public class AdminEventEngine implements IAdminCommandHandler
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.warning("Problem with AdminEventEngine: " + e.getMessage());
}
}
else if (actualCommand.startsWith("admin_event_del"))
{
@ -167,7 +166,7 @@ public class AdminEventEngine implements IAdminCommandHandler
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.warning("Problem with AdminEventEngine: " + e.getMessage());
}
tempBuffer = "";
@ -379,7 +378,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;
@ -564,7 +562,7 @@ public class AdminEventEngine implements IAdminCommandHandler
player.addItem("Event", id, num, activeChar, true);
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
adminReply.setHtml("<html><body> CONGRATULATIONS! You should have been rewarded. </body></html>");
adminReply.setHtml("<html><body>CONGRATULATIONS! You should have been rewarded.</body></html>");
player.sendPacket(adminReply);
}
}

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

@ -109,7 +109,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;
@ -122,7 +122,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;
@ -152,7 +152,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;
@ -165,7 +165,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

@ -63,6 +63,7 @@ public class AdminFightCalculator implements IAdminCommandHandler
}
catch (StringIndexOutOfBoundsException e)
{
// Do nothing.
}
return true;
}
@ -211,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 isMiss1 = Formulas.calcHitMiss(npc1, npc2);
if (isMiss1)
{
miss1++;
}
final byte _shld1 = Formulas.calcShldUse(npc1, npc2, null, false);
if (_shld1 > 0)
final byte calcShld1 = Formulas.calcShldUse(npc1, npc2, null, false);
if (calcShld1 > 0)
{
shld1++;
}
final boolean _crit1 = Formulas.calcCrit(npc1, npc2);
if (_crit1)
final boolean calcCrit1 = Formulas.calcCrit(npc1, npc2);
if (calcCrit1)
{
crit1++;
}
double _patk1 = npc1.getPAtk(npc2);
_patk1 += npc1.getRandomDamageMultiplier();
patk1 += _patk1;
double npc1Patk1 = npc1.getPAtk(npc2);
npc1Patk1 += npc1.getRandomDamageMultiplier();
patk1 += npc1Patk1;
final double _pdef1 = npc1.getPDef(npc2);
pdef1 += _pdef1;
final double npc1Pdef1 = npc1.getPDef(npc2);
pdef1 += npc1Pdef1;
if (!_miss1)
if (!isMiss1)
{
final double _dmg1 = Formulas.calcPhysDam(npc1, npc2, null, _shld1, _crit1, false);
dmg1 += _dmg1;
final double calcDmg1 = Formulas.calcPhysDam(npc1, npc2, null, 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, null, false);
if (_shld2 > 0)
final byte calcShld2 = Formulas.calcShldUse(npc2, npc1, null, false);
if (calcShld2 > 0)
{
shld2++;
}
final boolean _crit2 = Formulas.calcCrit(npc2, npc1);
if (_crit2)
final boolean calcCrit2 = Formulas.calcCrit(npc2, npc1);
if (calcCrit2)
{
crit2++;
}
double _patk2 = npc2.getPAtk(npc1);
_patk2 *= npc2.getRandomDamageMultiplier();
patk2 += _patk2;
double npc2Patk2 = npc2.getPAtk(npc1);
npc2Patk2 *= npc2.getRandomDamageMultiplier();
patk2 += npc2Patk2;
final double _pdef2 = npc2.getPDef(npc1);
pdef2 += _pdef2;
final double npcPdef2 = npc2.getPDef(npc1);
pdef2 += npcPdef2;
if (!_miss2)
if (!calcMiss2)
{
final double _dmg2 = Formulas.calcPhysDam(npc2, npc1, null, _shld2, _crit2, false);
dmg2 += _dmg2;
final double calcDmg2 = Formulas.calcPhysDam(npc2, npc1, null, calcShld2, calcCrit2, false);
dmg2 += calcDmg2;
npc2.abortAttack();
}
}

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;
@ -80,6 +81,7 @@ public class AdminInstanceZone implements IAdminCommandHandler
}
catch (Exception e)
{
// Handled bellow.
}
if (player != null)
@ -121,18 +123,19 @@ 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 (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;
final long remainingTime = (entry.getValue() - System.currentTimeMillis()) / 1000;
if (remainingTime > 0)
{
hours = (int) (remainingTime / 3600);
minutes = (int) ((remainingTime % 3600) / 60);
}
html.append("<tr><td>" + InstanceManager.getInstance().getInstanceIdName(id) + "</td><td>" + hours + ":" + minutes + "</td><td><button value=\"Clear\" action=\"bypass -h admin_instancezone_clear " + player.getName() + " " + id + "\" width=60 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>");
html.append("<tr><td>" + InstanceManager.getInstance().getInstanceIdName(entry.getKey()) + "</td><td>" + hours + ":" + minutes + "</td><td><button value=\"Clear\" action=\"bypass -h admin_instancezone_clear " + player.getName() + " " + entry.getKey() + "\" width=60 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>");
}
html.append("</table></html>");

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

@ -55,7 +55,7 @@ public class AdminMammon implements IAdminCommandHandler
teleportIndex = Integer.parseInt(command.substring(18));
}
}
catch (Exception NumberFormatException)
catch (Exception e)
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //mammon_find [teleportIndex] (where 1 = Blacksmith, 2 = Merchant)");
return false;

View File

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

View File

@ -101,7 +101,6 @@ public class AdminMessages implements IAdminCommandHandler
catch (Exception e)
{
BuilderUtil.sendSysMessage(activeChar, "Exception: " + e.getMessage());
continue;
}
}
activeChar.sendPacket(sm);

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