Code improvements.

This commit is contained in:
MobiusDev
2016-04-24 16:30:15 +00:00
parent 8bd51aba1c
commit 2dd14bef9b
860 changed files with 8865 additions and 17041 deletions

View File

@@ -244,8 +244,7 @@ public final class CavernOfThePirateCaptain extends AbstractInstance
return false;
}
final Long reentertime = InstanceManager.getInstance().getInstanceTime(groupMembers.getObjectId(), (is83 ? TEMPLATE_ID_83 : TEMPLATE_ID_60));
if (System.currentTimeMillis() < reentertime)
if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(groupMembers.getObjectId(), (is83 ? TEMPLATE_ID_83 : TEMPLATE_ID_60)))
{
broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_MAY_NOT_RE_ENTER_YET, true);
return false;
@@ -391,12 +390,9 @@ public final class CavernOfThePirateCaptain extends AbstractInstance
giveItems(playersInside, VORPAL_EARRING, 1);
}
}
else if (time <= 900000) // 15 minutes
else if ((time <= 900000) && (getRandom(100) < 25)) // 15 minutes
{
if (getRandom(100) < 25)
{
giveItems(playersInside, VORPAL_RING, 1);
}
giveItems(playersInside, VORPAL_RING, 1);
}
}
}

View File

@@ -108,12 +108,9 @@ abstract class Chamber extends AbstractInstance
for (int objId : inst.getPlayers())
{
final L2PcInstance pl = L2World.getInstance().getPlayer(objId);
if ((pl != null) && pl.isOnline())
if ((pl != null) && pl.isOnline() && ((partyInside == null) || !pl.isInParty() || (partyInside != pl.getParty())))
{
if ((partyInside == null) || !pl.isInParty() || (partyInside != pl.getParty()))
{
exitInstance(pl);
}
exitInstance(pl);
}
}
}
@@ -241,17 +238,12 @@ abstract class Chamber extends AbstractInstance
return false;
}
if (isBigChamber())
if (isBigChamber() && (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), INSTANCEID)))
{
final long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), INSTANCEID);
if (System.currentTimeMillis() < reentertime)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET);
sm.addPcName(partyMember);
party.broadcastPacket(sm);
return false;
}
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET);
sm.addPcName(partyMember);
party.broadcastPacket(sm);
return false;
}
}
@@ -411,8 +403,7 @@ abstract class Chamber extends AbstractInstance
}
else
{
final CDWorld currentWorld = (CDWorld) world;
teleportPlayer(player, ROOM_ENTER_POINTS[currentWorld.currentRoom], world.getInstanceId());
teleportPlayer(player, ROOM_ENTER_POINTS[((CDWorld) world).currentRoom], world.getInstanceId());
}
}
@@ -432,10 +423,7 @@ abstract class Chamber extends AbstractInstance
{
try
{
final int x = Integer.parseInt(coords[0]);
final int y = Integer.parseInt(coords[1]);
final int z = Integer.parseInt(coords[2]);
ret.setLocation(new Location(x, y, z));
ret.setLocation(new Location(Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2])));
}
catch (Exception e)
{
@@ -511,12 +499,9 @@ abstract class Chamber extends AbstractInstance
inst.setEmptyDestroyTime(0);
}
}
else if (event.equals("look_party"))
else if (event.equals("look_party") && (player.getParty() != null) && (player.getParty() == world.getPartyInside()))
{
if ((player.getParty() != null) && (player.getParty() == world.getPartyInside()))
{
teleportPlayer(player, ROOM_ENTER_POINTS[world.currentRoom], world.getInstanceId(), false);
}
teleportPlayer(player, ROOM_ENTER_POINTS[world.currentRoom], world.getInstanceId(), false);
}
}
return htmltext;
@@ -622,19 +607,14 @@ abstract class Chamber extends AbstractInstance
{
final int npcId = npc.getId();
QuestState qs = getQuestState(player, false);
if (qs == null)
{
qs = newQuestState(player);
}
if (npcId == ENTRANCE_GATEKEEPER)
if ((npcId == ENTRANCE_GATEKEEPER) && checkConditions(player))
{
if (checkConditions(player))
{
final L2Party party = player.getParty();
enterInstance(player, new CDWorld(party), INSTANCE_TEMPLATE, INSTANCEID);
}
enterInstance(player, new CDWorld(player.getParty()), INSTANCE_TEMPLATE, INSTANCEID);
}
return "";
}

View File

@@ -552,8 +552,7 @@ public final class CrystalCaverns extends AbstractInstance
party.broadcastPacket(sm);
return false;
}
final Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID);
if (System.currentTimeMillis() < reentertime)
if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET);
sm.addPcName(partyMember);
@@ -880,13 +879,9 @@ public final class CrystalCaverns extends AbstractInstance
if (npc.getId() == ORACLE_GUIDE_1)
{
final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
if (tmpworld instanceof CCWorld)
if ((tmpworld instanceof CCWorld) && (((CCWorld) tmpworld).getStatus() == 0) && ((CCWorld) tmpworld).oracle.contains(npc))
{
final CCWorld world = (CCWorld) tmpworld;
if ((world.getStatus() == 0) && world.oracle.contains(npc))
{
return "32281.htm"; // TODO: Missing HTML.
}
return "32281.htm";
}
npc.showChatWindow(player);
return null;
@@ -1102,13 +1097,10 @@ public final class CrystalCaverns extends AbstractInstance
world.copys.add(copy);
}
}
else if ((nowHp < (maxHp * 0.15)) && !world.isUsedInvulSkill)
else if ((nowHp < (maxHp * 0.15)) && !world.isUsedInvulSkill && ((rand > 994) || (nowHp < (maxHp * 0.1))))
{
if ((rand > 994) || (nowHp < (maxHp * 0.1)))
{
world.isUsedInvulSkill = true;
npc.setIsInvul(true);
}
world.isUsedInvulSkill = true;
npc.setIsInvul(true);
}
}
}
@@ -1977,15 +1969,14 @@ public final class CrystalCaverns extends AbstractInstance
final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(trap.getInstanceId());
if (tmpworld instanceof CCWorld)
{
final CCWorld world = (CCWorld) tmpworld;
switch (action)
{
case TRAP_DISARMED:
{
if (trap.getId() == DOOR_OPENING_TRAP[0])
{
openDoor(24220001, world.getInstanceId());
runEmeraldRooms(world, ROOM1_SPAWNS, 1);
openDoor(24220001, ((CCWorld) tmpworld).getInstanceId());
runEmeraldRooms(((CCWorld) tmpworld), ROOM1_SPAWNS, 1);
}
break;
}

View File

@@ -302,9 +302,8 @@ public final class DarkCloudMansion extends AbstractInstance
{
world.setStatus(0);
final DMCRoom StartRoom = new DMCRoom();
DMCNpc thisnpc;
DMCNpc thisnpc = new DMCNpc();
thisnpc = new DMCNpc();
thisnpc.npc = addSpawn(BM[0], 146817, 180335, -6117, 0, false, 0, false, world.getInstanceId());
StartRoom.npcList.add(thisnpc);
if (noRndWalk)
@@ -405,9 +404,8 @@ public final class DarkCloudMansion extends AbstractInstance
private void runFirstRoom(DMCWorld world)
{
final DMCRoom FirstRoom = new DMCRoom();
DMCNpc thisnpc;
DMCNpc thisnpc = new DMCNpc();
thisnpc = new DMCNpc();
thisnpc.npc = addSpawn(HG[1], 147842, 179837, -6117, 0, false, 0, false, world.getInstanceId());
if (noRndWalk)
{
@@ -731,16 +729,13 @@ public final class DarkCloudMansion extends AbstractInstance
for (int i = 1; i < 7; i++)
{
// if there is a non zero value in the precedent step, the sequence is ok
if ((order[i] == 0) && (order[i - 1] != 0))
if ((order[i] == 0) && (order[i - 1] != 0) && (npcObj.order == i) && (npcObj.status == 0))
{
if ((npcObj.order == i) && (npcObj.status == 0))
{
order[i] = 1;
npcObj.status = 1;
npcObj.isDead = true;
npc.broadcastPacket(new MagicSkillUse(npc, npc, 5441, 1, 1, 0));
return;
}
order[i] = 1;
npcObj.status = 1;
npcObj.isDead = true;
npc.broadcastPacket(new MagicSkillUse(npc, npc, 5441, 1, 1, 0));
return;
}
}
@@ -855,9 +850,7 @@ public final class DarkCloudMansion extends AbstractInstance
private void removeMonoliths(DMCWorld world)
{
final DMCRoom SecondRoom = world.rooms.get("SecondRoom");
for (DMCNpc mob : SecondRoom.npcList)
for (DMCNpc mob : world.rooms.get("SecondRoom").npcList)
{
mob.npc.decayMe();
}
@@ -962,38 +955,25 @@ public final class DarkCloudMansion extends AbstractInstance
if (tmpworld instanceof DMCWorld)
{
world = (DMCWorld) tmpworld;
if (world.getStatus() == 0)
if ((world.getStatus() == 0) && checkKillProgress(npc, world.rooms.get("StartRoom")))
{
if (checkKillProgress(npc, world.rooms.get("StartRoom")))
{
runHall(world);
}
runHall(world);
}
if (world.getStatus() == 1)
if ((world.getStatus() == 1) && checkKillProgress(npc, world.rooms.get("Hall")))
{
if (checkKillProgress(npc, world.rooms.get("Hall")))
{
runFirstRoom(world);
}
runFirstRoom(world);
}
if (world.getStatus() == 2)
if ((world.getStatus() == 2) && checkKillProgress(npc, world.rooms.get("FirstRoom")))
{
if (checkKillProgress(npc, world.rooms.get("FirstRoom")))
{
runHall2(world);
}
runHall2(world);
}
if (world.getStatus() == 3)
if ((world.getStatus() == 3) && checkKillProgress(npc, world.rooms.get("Hall")))
{
if (checkKillProgress(npc, world.rooms.get("Hall")))
{
runSecondRoom(world);
}
runSecondRoom(world);
}
if (world.getStatus() == 4)
{
final DMCRoom SecondRoom = world.rooms.get("SecondRoom");
for (DMCNpc mob : SecondRoom.npcList)
for (DMCNpc mob : world.rooms.get("SecondRoom").npcList)
{
if (mob.golem == npc)
{
@@ -1001,30 +981,21 @@ public final class DarkCloudMansion extends AbstractInstance
}
}
}
if (world.getStatus() == 5)
if ((world.getStatus() == 5) && checkKillProgress(npc, world.rooms.get("Hall")))
{
if (checkKillProgress(npc, world.rooms.get("Hall")))
{
runThirdRoom(world);
}
runThirdRoom(world);
}
if (world.getStatus() == 6)
if ((world.getStatus() == 6) && checkKillProgress(npc, world.rooms.get("ThirdRoom")))
{
if (checkKillProgress(npc, world.rooms.get("ThirdRoom")))
{
runForthRoom(world);
}
runForthRoom(world);
}
if (world.getStatus() == 7)
{
chkShadowColumn(world, npc);
}
if (world.getStatus() == 8)
if ((world.getStatus() == 8) && checkKillProgress(npc, world.rooms.get("ThirdRoom2")))
{
if (checkKillProgress(npc, world.rooms.get("ThirdRoom2")))
{
runFifthRoom(world);
}
runFifthRoom(world);
}
if (world.getStatus() == 9)
{
@@ -1044,15 +1015,11 @@ public final class DarkCloudMansion extends AbstractInstance
world = (DMCWorld) tmpworld;
if (world.getStatus() == 7)
{
final DMCRoom ForthRoom = world.rooms.get("ForthRoom");
for (DMCNpc mob : ForthRoom.npcList)
for (DMCNpc mob : world.rooms.get("ForthRoom").npcList)
{
if (mob.npc == npc)
if ((mob.npc == npc) && mob.npc.isInvul() && (getRandom(100) < 12))
{
if (mob.npc.isInvul() && (getRandom(100) < 12))
{
addSpawn(BM[getRandom(BM.length)], attacker.getX(), attacker.getY(), attacker.getZ(), 0, false, 0, false, world.getInstanceId());
}
addSpawn(BM[getRandom(BM.length)], attacker.getX(), attacker.getY(), attacker.getZ(), 0, false, 0, false, world.getInstanceId());
}
}
}

View File

@@ -356,16 +356,13 @@ public final class DisciplesNecropolisPast extends AbstractInstance
final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
if (tmpworld instanceof DNPWorld)
{
if (npc.isScriptValue(0))
if (npc.isScriptValue(0) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.1)))
{
if (npc.getCurrentHp() < (npc.getMaxHp() * 0.1))
{
giveItems(player, SEAL_OF_BINDING, 1);
player.sendPacket(SystemMessageId.THE_SEALING_DEVICE_GLITTERS_AND_MOVES_ACTIVATION_COMPLETE_NORMALLY);
npc.setScriptValue(1);
startQuestTimer("FINISH", 1000, npc, player);
cancelQuestTimer("FIGHT", npc, player);
}
giveItems(player, SEAL_OF_BINDING, 1);
player.sendPacket(SystemMessageId.THE_SEALING_DEVICE_GLITTERS_AND_MOVES_ACTIVATION_COMPLETE_NORMALLY);
npc.setScriptValue(1);
startQuestTimer("FINISH", 1000, npc, player);
cancelQuestTimer("FIGHT", npc, player);
}
if (getRandom(100) < 50)
{
@@ -387,8 +384,7 @@ public final class DisciplesNecropolisPast extends AbstractInstance
final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
if (tmpworld instanceof DNPWorld)
{
final DNPWorld world = (DNPWorld) tmpworld;
checkDoors(npc, world);
checkDoors(npc, (DNPWorld) tmpworld);
}
switch (npc.getId())

View File

@@ -303,43 +303,30 @@ public final class FinalEmperialTomb extends AbstractInstance
attrs = cd.getAttributes();
final FETSpawn spw = new FETSpawn();
spw.npcId = npcId;
att = attrs.getNamedItem("x");
if (att != null)
{
spw.x = Integer.parseInt(att.getNodeValue());
}
else
if (att == null)
{
continue;
}
spw.x = Integer.parseInt(att.getNodeValue());
att = attrs.getNamedItem("y");
if (att != null)
{
spw.y = Integer.parseInt(att.getNodeValue());
}
else
if (att == null)
{
continue;
}
spw.y = Integer.parseInt(att.getNodeValue());
att = attrs.getNamedItem("z");
if (att != null)
{
spw.z = Integer.parseInt(att.getNodeValue());
}
else
if (att == null)
{
continue;
}
spw.z = Integer.parseInt(att.getNodeValue());
att = attrs.getNamedItem("heading");
if (att != null)
{
spw.h = Integer.parseInt(att.getNodeValue());
}
else
if (att == null)
{
continue;
}
spw.h = Integer.parseInt(att.getNodeValue());
att = attrs.getNamedItem("mustKill");
if (att != null)
{
@@ -358,25 +345,18 @@ public final class FinalEmperialTomb extends AbstractInstance
final FETSpawn spw = new FETSpawn();
spw.npcId = npcId;
spw.isZone = true;
att = attrs.getNamedItem("id");
if (att != null)
{
spw.zone = Integer.parseInt(att.getNodeValue());
}
else
if (att == null)
{
continue;
}
spw.zone = Integer.parseInt(att.getNodeValue());
att = attrs.getNamedItem("count");
if (att != null)
{
spw.count = Integer.parseInt(att.getNodeValue());
}
else
if (att == null)
{
continue;
}
spw.count = Integer.parseInt(att.getNodeValue());
att = attrs.getNamedItem("mustKill");
if (att != null)
{
@@ -430,24 +410,17 @@ public final class FinalEmperialTomb extends AbstractInstance
attrs = cd.getAttributes();
int x, y;
att = attrs.getNamedItem("x");
if (att != null)
{
x = Integer.parseInt(att.getNodeValue());
}
else
if (att == null)
{
continue;
}
x = Integer.parseInt(att.getNodeValue());
att = attrs.getNamedItem("y");
if (att != null)
{
y = Integer.parseInt(att.getNodeValue());
}
else
if (att == null)
{
continue;
}
y = Integer.parseInt(att.getNodeValue());
ter.add(x, y, minz, maxz, 0);
}
}
@@ -491,19 +464,19 @@ public final class FinalEmperialTomb extends AbstractInstance
player.sendPacket(SystemMessageId.YOU_CANNOT_ENTER_BECAUSE_YOU_ARE_NOT_ASSOCIATED_WITH_THE_CURRENT_COMMAND_CHANNEL);
return false;
}
else if (channel.getLeader() != player)
if (channel.getLeader() != player)
{
player.sendPacket(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER);
return false;
}
else if (player.getInventory().getItemByItemId(8073) == null)
if (player.getInventory().getItemByItemId(8073) == null)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED);
sm.addPcName(player);
player.sendPacket(sm);
return false;
}
else if ((channel.getMemberCount() < MIN_PLAYERS) || (channel.getMemberCount() > MAX_PLAYERS))
if ((channel.getMemberCount() < MIN_PLAYERS) || (channel.getMemberCount() > MAX_PLAYERS))
{
player.sendPacket(SystemMessageId.YOU_CANNOT_ENTER_DUE_TO_THE_PARTY_HAVING_EXCEEDED_THE_LIMIT);
return false;
@@ -520,8 +493,7 @@ public final class FinalEmperialTomb extends AbstractInstance
party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED).addPcName(channelMember));
return false;
}
final Long reentertime = InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID);
if (System.currentTimeMillis() < reentertime)
if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID))
{
party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET).addPcName(channelMember));
return false;
@@ -1531,12 +1503,9 @@ public final class FinalEmperialTomb extends AbstractInstance
}
else if (world.getStatus() <= 2)
{
if (npc.getId() == HALL_KEEPER_CAPTAIN)
if ((npc.getId() == HALL_KEEPER_CAPTAIN) && (getRandom(100) < 5))
{
if (getRandom(100) < 5)
{
npc.dropItem(player, DEWDROP_OF_DESTRUCTION_ITEM_ID, 1);
}
npc.dropItem(player, DEWDROP_OF_DESTRUCTION_ITEM_ID, 1);
}
if (checkKillProgress(npc, world))

View File

@@ -739,34 +739,31 @@ public final class HarnakUndergroundRuins extends AbstractInstance
}
}
}
else if (world.isStatus(3))
else if (world.isStatus(3) && (npc.getId() == HARNAKS_WRAITH))
{
if (npc.getId() == HARNAKS_WRAITH)
if (!world.harnakMessage1 && (((npc.getCurrentHp() / npc.getMaxHp()) * 100) > 80))
{
if (!world.harnakMessage1 && (((npc.getCurrentHp() / npc.getMaxHp()) * 100) > 80))
{
showOnScreenMsg(player, NpcStringId.FREE_ME_FROM_THIS_BINDING_OF_LIGHT, ExShowScreenMessage.TOP_CENTER, 5000);
world.harnakMessage1 = true;
}
else if (!world.harnakMessage2 && (((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 80))
{
showOnScreenMsg(player, NpcStringId.DESTROY_THE_GHOST_OF_HARNAK_THIS_CORRUPTED_CREATURE, ExShowScreenMessage.TOP_CENTER, 5000);
world.harnakMessage2 = true;
}
else if (!world.harnakMessage3 && (((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 60))
{
showOnScreenMsg(player, NpcStringId.FREE_ME_AND_I_PROMISE_YOU_THE_POWER_OF_GIANTS, ExShowScreenMessage.TOP_CENTER, 5000);
world.harnakMessage3 = true;
}
else if (((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 50)
{
world.incStatus();
player.sendPacket(new ExSendUIEvent(player, false, false, 60, 0, NpcStringId.REMAINING_TIME));
showOnScreenMsg(player, NpcStringId.NO_THE_SEAL_CONTROLS_HAVE_BEEN_EXPOSED_GUARDS_PROTECT_THE_SEAL_CONTROLS, ExShowScreenMessage.TOP_CENTER, 10000);
startQuestTimer("spawn_npc4", 1, npc, player);
cancelQuestTimer("fail_instance", null, player);
startQuestTimer("fail_instance", 60000, null, player);
}
showOnScreenMsg(player, NpcStringId.FREE_ME_FROM_THIS_BINDING_OF_LIGHT, ExShowScreenMessage.TOP_CENTER, 5000);
world.harnakMessage1 = true;
}
else if (!world.harnakMessage2 && (((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 80))
{
showOnScreenMsg(player, NpcStringId.DESTROY_THE_GHOST_OF_HARNAK_THIS_CORRUPTED_CREATURE, ExShowScreenMessage.TOP_CENTER, 5000);
world.harnakMessage2 = true;
}
else if (!world.harnakMessage3 && (((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 60))
{
showOnScreenMsg(player, NpcStringId.FREE_ME_AND_I_PROMISE_YOU_THE_POWER_OF_GIANTS, ExShowScreenMessage.TOP_CENTER, 5000);
world.harnakMessage3 = true;
}
else if (((npc.getCurrentHp() / npc.getMaxHp()) * 100) <= 50)
{
world.incStatus();
player.sendPacket(new ExSendUIEvent(player, false, false, 60, 0, NpcStringId.REMAINING_TIME));
showOnScreenMsg(player, NpcStringId.NO_THE_SEAL_CONTROLS_HAVE_BEEN_EXPOSED_GUARDS_PROTECT_THE_SEAL_CONTROLS, ExShowScreenMessage.TOP_CENTER, 10000);
startQuestTimer("spawn_npc4", 1, npc, player);
cancelQuestTimer("fail_instance", null, player);
startQuestTimer("fail_instance", 60000, null, player);
}
}
}

View File

@@ -165,15 +165,9 @@ public final class IceQueensCastle extends AbstractInstance
public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill)
{
final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
if ((tmpworld != null) && (tmpworld instanceof IQCWorld))
if ((tmpworld != null) && (tmpworld instanceof IQCWorld) && (skill == ETHERNAL_BLIZZARD.getSkill()) && (((IQCWorld) tmpworld).player != null))
{
final IQCWorld world = (IQCWorld) tmpworld;
if ((skill == ETHERNAL_BLIZZARD.getSkill()) && (world.player != null))
{
startQuestTimer("TIMER_SCENE_21", 1000, npc, world.player);
}
startQuestTimer("TIMER_SCENE_21", 1000, npc, ((IQCWorld) tmpworld).player);
}
return super.onSpellFinished(npc, player, skill);
}

View File

@@ -525,8 +525,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
knight.getSpawn().setLocation(loc);
world.spawnedMobs.add(knight);
final int time = (world.isHardCore ? getRandom(5, 10) : getRandom(15, 20)) * 1000;
startQuestTimer("ICE_RUPTURE", time, knight, null);
startQuestTimer("ICE_RUPTURE", ((world.isHardCore ? getRandom(5, 10) : getRandom(15, 20)) * 1000), knight, null);
}
break;
}
@@ -755,21 +754,19 @@ public final class IceQueensCastleBattle extends AbstractInstance
if (tmpworld instanceof IQCNBWorld)
{
final IQCNBWorld world = (IQCNBWorld) tmpworld;
if (npc.getId() == SUPP_JINIA)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
return null;
}
else if (npc.getId() == SUPP_KEGOR)
if (npc.getId() == SUPP_KEGOR)
{
if (world.isSupportActive)
if (!((IQCNBWorld) tmpworld).isSupportActive)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
return null;
return "18851.html";
}
return "18851.html";
player.sendPacket(ActionFailed.STATIC_PACKET);
return null;
}
}
player.sendPacket(ActionFailed.STATIC_PACKET);
@@ -803,13 +800,10 @@ public final class IceQueensCastleBattle extends AbstractInstance
}
else
{
if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTI_STRIDER.getSkillId()) && !npc.isCastingNow())
if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTI_STRIDER.getSkillId()) && !npc.isCastingNow() && !npc.isSkillDisabled(ANTI_STRIDER.getSkill()))
{
if (!npc.isSkillDisabled(ANTI_STRIDER.getSkill()))
{
npc.setTarget(attacker);
npc.doCast(ANTI_STRIDER.getSkill());
}
npc.setTarget(attacker);
npc.doCast(ANTI_STRIDER.getSkill());
}
final L2Character mostHated = ((L2Attackable) npc).getMostHated();
@@ -853,13 +847,10 @@ public final class IceQueensCastleBattle extends AbstractInstance
}
}
}
else if (getRandom(10000) < 1500)
else if ((getRandom(10000) < 1500) && !npc.isAffectedBySkill(SELF_NOVA.getSkillId()) && npc.checkDoCastConditions(SELF_NOVA.getSkill()) && !npc.isCastingNow())
{
if (!npc.isAffectedBySkill(SELF_NOVA.getSkillId()) && npc.checkDoCastConditions(SELF_NOVA.getSkill()) && !npc.isCastingNow())
{
npc.setTarget(npc);
npc.doCast(SELF_NOVA.getSkill());
}
npc.setTarget(npc);
npc.doCast(SELF_NOVA.getSkill());
}
}
break;
@@ -888,13 +879,10 @@ public final class IceQueensCastleBattle extends AbstractInstance
startQuestTimer("SPAWN_SUPPORT", 27000, world.controller, null);
}
if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTI_STRIDER.getSkillId()) && !npc.isCastingNow())
if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTI_STRIDER.getSkillId()) && !npc.isCastingNow() && !npc.isSkillDisabled(ANTI_STRIDER.getSkill()))
{
if (!npc.isSkillDisabled(ANTI_STRIDER.getSkill()))
{
npc.setTarget(attacker);
npc.doCast(ANTI_STRIDER.getSkill());
}
npc.setTarget(attacker);
npc.doCast(ANTI_STRIDER.getSkill());
}
final L2Character mostHated = ((L2Attackable) npc).getMostHated();
@@ -946,13 +934,10 @@ public final class IceQueensCastleBattle extends AbstractInstance
npc.doCast(SELF_NOVA.getSkill());
}
}
else if (getRandom(10000) < 1333)
else if ((getRandom(10000) < 1333) && !npc.isAffectedBySkill(REFLECT_MAGIC.getSkillId()) && npc.checkDoCastConditions(REFLECT_MAGIC.getSkill()) && !npc.isCastingNow())
{
if (!npc.isAffectedBySkill(REFLECT_MAGIC.getSkillId()) && npc.checkDoCastConditions(REFLECT_MAGIC.getSkill()) && !npc.isCastingNow())
{
npc.setTarget(npc);
npc.doCast(REFLECT_MAGIC.getSkill());
}
npc.setTarget(npc);
npc.doCast(REFLECT_MAGIC.getSkill());
}
break;
}
@@ -1083,8 +1068,6 @@ public final class IceQueensCastleBattle extends AbstractInstance
if (tmpworld instanceof IQCNBWorld)
{
final IQCNBWorld world = (IQCNBWorld) tmpworld;
switch (npc.getId())
{
case GLACIER:
@@ -1093,16 +1076,16 @@ public final class IceQueensCastleBattle extends AbstractInstance
{
if (getRandom(100) < 75)
{
final L2Attackable breath = (L2Attackable) addSpawn(BREATH, npc.getLocation(), false, 0, false, world.getInstanceId());
final L2Attackable breath = (L2Attackable) addSpawn(BREATH, npc.getLocation(), false, 0, false, ((IQCNBWorld) tmpworld).getInstanceId());
if (player != null)
{
addAttackDesire(breath, player);
}
else
{
manageRandomAttack(world, breath);
manageRandomAttack(((IQCNBWorld) tmpworld), breath);
}
world.spawnedMobs.add(breath);
((IQCNBWorld) tmpworld).spawnedMobs.add(breath);
startQuestTimer("BLIZZARD", 20000, breath, null);
}
notifyEvent("SUICIDE", npc, null);
@@ -1185,8 +1168,7 @@ public final class IceQueensCastleBattle extends AbstractInstance
if (spawnedBy != null)
{
final int time = (world.isHardCore ? getRandom(30, 60) : getRandom(50, 60)) * 1000;
startQuestTimer("SPAWN_KNIGHT", time, spawnedBy, null);
startQuestTimer("SPAWN_KNIGHT", ((world.isHardCore ? getRandom(30, 60) : getRandom(50, 60)) * 1000), spawnedBy, null);
}
world.spawnedMobs.remove(npc);
break;
@@ -1265,28 +1247,26 @@ public final class IceQueensCastleBattle extends AbstractInstance
{
final L2Party party = player.getParty();
final L2CommandChannel channel = party != null ? party.getCommandChannel() : null;
if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS))
{
return true;
}
if (party == null)
{
player.sendPacket(SystemMessageId.YOU_ARE_NOT_CURRENTLY_IN_A_PARTY_SO_YOU_CANNOT_ENTER);
return false;
}
else if (channel == null)
if (channel == null)
{
player.sendPacket(SystemMessageId.YOU_CANNOT_ENTER_BECAUSE_YOU_ARE_NOT_ASSOCIATED_WITH_THE_CURRENT_COMMAND_CHANNEL);
return false;
}
else if (player != channel.getLeader())
if (player != channel.getLeader())
{
player.sendPacket(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER);
return false;
}
else if ((channel.getMemberCount() < MIN_PLAYERS) || (channel.getMemberCount() > MAX_PLAYERS))
if ((channel.getMemberCount() < MIN_PLAYERS) || (channel.getMemberCount() > MAX_PLAYERS))
{
player.sendPacket(SystemMessageId.YOU_CANNOT_ENTER_DUE_TO_THE_PARTY_HAVING_EXCEEDED_THE_LIMIT);
return false;
@@ -1300,21 +1280,14 @@ public final class IceQueensCastleBattle extends AbstractInstance
party.broadcastPacket(sm);
return false;
}
else if (!Util.checkIfInRange(1000, player, channelMember, true))
if (!Util.checkIfInRange(1000, player, channelMember, true))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED);
sm.addPcName(channelMember);
party.broadcastPacket(sm);
return false;
}
else if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID_EASY))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET);
sm.addPcName(channelMember);
party.broadcastPacket(sm);
return false;
}
else if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID_HARD))
if ((System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID_EASY)) || (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID_HARD)))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET);
sm.addPcName(channelMember);

View File

@@ -1188,14 +1188,7 @@ public final class Kamaloka extends AbstractInstance
{
if (mob != null)
{
if (STEALTH_SHAMAN)
{
addKillId(mob[1]);
}
else
{
addKillId(mob[0]);
}
addKillId(STEALTH_SHAMAN ? mob[1] : mob[0]);
}
}
for (int[] mob : SECOND_ROOM)
@@ -1402,14 +1395,12 @@ public final class Kamaloka extends AbstractInstance
spawnKama((KamaWorld) world);
// and finally teleport party into instance
final L2Party party = player.getParty();
for (L2PcInstance partyMember : party.getMembers())
for (L2PcInstance partyMember : player.getParty().getMembers())
{
world.addAllowed(partyMember.getObjectId());
removeBuffs(partyMember);
teleportPlayer(partyMember, TELEPORTS[index], instanceId);
}
return;
}
/**
@@ -1595,15 +1586,7 @@ public final class Kamaloka extends AbstractInstance
@Override
public final String onFirstTalk(L2Npc npc, L2PcInstance player)
{
if (npc.getId() == TELEPORTER)
{
if (player.isInParty() && player.getParty().isLeader(player))
{
return "32496.htm";
}
return "32496-no.htm";
}
return "";
return player.isInParty() && player.getParty().isLeader(player) ? "32496.htm" : "32496-no.htm";
}
@Override
@@ -1616,39 +1599,31 @@ public final class Kamaloka extends AbstractInstance
final int objectId = npc.getObjectId();
// first room was spawned ?
if (world.firstRoom != null)
// is shaman killed ?
if ((world.firstRoom != null) && (world.shaman != 0) && (world.shaman == objectId))
{
// is shaman killed ?
if ((world.shaman != 0) && (world.shaman == objectId))
world.shaman = 0;
// stop respawn of the minions
for (L2Spawn spawn : world.firstRoom)
{
world.shaman = 0;
// stop respawn of the minions
for (L2Spawn spawn : world.firstRoom)
if (spawn != null)
{
if (spawn != null)
{
spawn.stopRespawn();
}
spawn.stopRespawn();
}
world.firstRoom.clear();
world.firstRoom = null;
if (world.boss != null)
{
final int skillId = FIRST_ROOM[world.index][2];
final int skillLvl = FIRST_ROOM[world.index][3];
if ((skillId != 0) && (skillLvl != 0))
{
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLvl);
if (skill != null)
{
skill.applyEffects(world.boss, world.boss);
}
}
}
return super.onKill(npc, player, isSummon);
}
world.firstRoom.clear();
world.firstRoom = null;
if ((world.boss != null) && (FIRST_ROOM[world.index][2] != 0) && (FIRST_ROOM[world.index][3] != 0))
{
final Skill skill = SkillData.getInstance().getSkill(FIRST_ROOM[world.index][2], FIRST_ROOM[world.index][3]);
if (skill != null)
{
skill.applyEffects(world.boss, world.boss);
}
}
return super.onKill(npc, player, isSummon);
}
// second room was spawned ?
@@ -1674,17 +1649,12 @@ public final class Kamaloka extends AbstractInstance
world.secondRoom.clear();
world.secondRoom = null;
if (world.boss != null)
if ((world.boss != null) && (SECOND_ROOM[world.index][1] != 0) && (SECOND_ROOM[world.index][2] != 0))
{
final int skillId = SECOND_ROOM[world.index][1];
final int skillLvl = SECOND_ROOM[world.index][2];
if ((skillId != 0) && (skillLvl != 0))
final Skill skill = SkillData.getInstance().getSkill(SECOND_ROOM[world.index][1], SECOND_ROOM[world.index][2]);
if (skill != null)
{
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLvl);
if (skill != null)
{
skill.applyEffects(world.boss, world.boss);
}
skill.applyEffects(world.boss, world.boss);
}
}
@@ -1697,17 +1667,12 @@ public final class Kamaloka extends AbstractInstance
{
world.miniBoss = 0;
if (world.boss != null)
if ((world.boss != null) && (MINIBOSS[world.index][4] != 0) && (MINIBOSS[world.index][5] != 0))
{
final int skillId = MINIBOSS[world.index][4];
final int skillLvl = MINIBOSS[world.index][5];
if ((skillId != 0) && (skillLvl != 0))
final Skill skill = SkillData.getInstance().getSkill(MINIBOSS[world.index][4], MINIBOSS[world.index][5]);
if (skill != null)
{
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLvl);
if (skill != null)
{
skill.applyEffects(world.boss, world.boss);
}
skill.applyEffects(world.boss, world.boss);
}
}

View File

@@ -136,7 +136,7 @@ public final class MithrilMine extends AbstractInstance
{
return npc.isScriptValue(0) ? "18846.html" : "18846-01.html";
}
else if (qs.isMemoState(3))
if (qs.isMemoState(3))
{
final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
world.removeAllowed(player.getObjectId());

View File

@@ -312,29 +312,23 @@ public class MonasteryOfSilence2 extends AbstractNpcAI
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.REMEMBER_THE_CONTENT_OF_THE_BOOKS_THAT_YOU_FOUND_YOU_CAN_T_TAKE_THEM_OUT_WITH_YOU));
}
}
if ((qs1 != null) && (qs1.getCond() == 3))
if ((qs1 != null) && (qs1.getCond() == 3) && (getRandom(8) < 1))
{
if (getRandom(8) < 1)
{
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOUR_WORK_HERE_IS_DONE_SO_RETURN_TO_THE_CENTRAL_GUARDIAN));
}
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOUR_WORK_HERE_IS_DONE_SO_RETURN_TO_THE_CENTRAL_GUARDIAN));
}
if ((qs2 != null) && (qs2.getCond() == 1))
if ((qs2 != null) && (qs2.getCond() == 1) && (getRandom(5) < 1))
{
if (getRandom(5) < 1)
if (getRandom(10) < 1)
{
if (getRandom(10) < 1)
{
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.TO_REMOVE_THE_BARRIER_YOU_MUST_FIND_THE_RELICS_THAT_FIT_THE_BARRIER_AND_ACTIVATE_THE_DEVICE));
}
else if (getRandom(15) < 1)
{
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THE_GUARDIAN_OF_THE_SEAL_DOESN_T_SEEM_TO_GET_INJURED_AT_ALL_UNTIL_THE_BARRIER_IS_DESTROYED));
}
else
{
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THE_DEVICE_LOCATED_IN_THE_ROOM_IN_FRONT_OF_THE_GUARDIAN_OF_THE_SEAL_IS_DEFINITELY_THE_BARRIER_THAT_CONTROLS_THE_GUARDIAN_S_POWER));
}
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.TO_REMOVE_THE_BARRIER_YOU_MUST_FIND_THE_RELICS_THAT_FIT_THE_BARRIER_AND_ACTIVATE_THE_DEVICE));
}
else if (getRandom(15) < 1)
{
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THE_GUARDIAN_OF_THE_SEAL_DOESN_T_SEEM_TO_GET_INJURED_AT_ALL_UNTIL_THE_BARRIER_IS_DESTROYED));
}
else
{
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THE_DEVICE_LOCATED_IN_THE_ROOM_IN_FRONT_OF_THE_GUARDIAN_OF_THE_SEAL_IS_DEFINITELY_THE_BARRIER_THAT_CONTROLS_THE_GUARDIAN_S_POWER));
}
}
if (player.getCurrentHp() < (player.getMaxHp() * 0.8D))

View File

@@ -152,8 +152,7 @@ public final class NightmareKamaloka extends AbstractInstance
party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED).addPcName(member));
return false;
}
final Long reenterTime = InstanceManager.getInstance().getInstanceTime(member.getObjectId(), TEMPLATE_ID);
if (System.currentTimeMillis() < reenterTime)
if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(member.getObjectId(), TEMPLATE_ID))
{
party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET));
return false;

View File

@@ -256,8 +256,7 @@ public class TalkingIsland extends AbstractInstance
final QuestState qs = player.getQuestState(Q10385_RedThreadOfFate.class.getSimpleName());
if ((qs != null) && qs.isCond(19))
{
final Skill npcDefault = NPC_TREE.getSkill();
castSkill(npc, player, npcDefault);
castSkill(npc, player, NPC_TREE.getSkill());
}
{
enterInstance(player, new TIWorld(), "TalkingIsland.xml", TEMPLATE_ID);