Zone related changes.

This commit is contained in:
MobiusDev
2018-04-11 12:57:58 +00:00
parent f6ee0584bf
commit 994f80890c
32 changed files with 111 additions and 168 deletions

View File

@ -213,13 +213,7 @@ public final class MapRegionManager implements IGameXmlReader
public String getClosestTownName(L2Character activeChar)
{
final L2MapRegion region = getMapRegion(activeChar);
if (region == null)
{
return "Aden Castle Town";
}
return region.getTown();
return region == null ? "Aden Castle Town" : region.getTown();
}
/**
@ -419,7 +413,7 @@ public final class MapRegionManager implements IGameXmlReader
{
try
{
final L2PcInstance player = ((L2PcInstance) activeChar);
final L2PcInstance player = (L2PcInstance) activeChar;
final L2MapRegion region = _regions.get(point);
if (region.getBannedRace().containsKey(player.getRace()))

View File

@ -357,7 +357,7 @@ public final class ZoneManager implements IGameXmlReader
}
if (checkId(zoneId))
{
LOGGER.info(getClass().getSimpleName() + ": Caution: Zone (" + zoneId + ") from file: " + f.getName() + " overrides previos definition.");
LOGGER.config(getClass().getSimpleName() + ": Caution: Zone (" + zoneId + ") from file: " + f.getName() + " overrides previos definition.");
}
if ((zoneName != null) && !zoneName.isEmpty())
@ -669,7 +669,7 @@ public final class ZoneManager implements IGameXmlReader
{
if ((temp instanceof L2ArenaZone) && temp.isCharacterInZone(character))
{
return ((L2ArenaZone) temp);
return (L2ArenaZone) temp;
}
}
@ -692,7 +692,7 @@ public final class ZoneManager implements IGameXmlReader
{
if ((temp instanceof L2OlympiadStadiumZone) && temp.isCharacterInZone(character))
{
return ((L2OlympiadStadiumZone) temp);
return (L2OlympiadStadiumZone) temp;
}
}
return null;

View File

@ -38,14 +38,14 @@ public abstract class L2Tower extends L2Npc
public boolean canBeAttacked()
{
// Attackable during siege by attacker only
return ((getCastle() != null) && (getCastle().getResidenceId() > 0) && getCastle().getSiege().isInProgress());
return (getCastle() != null) && (getCastle().getResidenceId() > 0) && getCastle().getSiege().isInProgress();
}
@Override
public boolean isAutoAttackable(L2Character attacker)
{
// Attackable during siege by attacker only
return ((attacker != null) && attacker.isPlayer() && (getCastle() != null) && (getCastle().getResidenceId() > 0) && getCastle().getSiege().isInProgress() && getCastle().getSiege().checkIsAttacker(attacker.getClan()));
return (attacker != null) && attacker.isPlayer() && (getCastle() != null) && (getCastle().getResidenceId() > 0) && getCastle().getSiege().isInProgress() && getCastle().getSiege().checkIsAttacker(((L2PcInstance) attacker).getClan());
}
@Override
@ -61,13 +61,10 @@ public abstract class L2Tower extends L2Npc
// Set the target of the L2PcInstance player
player.setTarget(this);
}
else if (interact)
else if (interact && isAutoAttackable(player) && (Math.abs(player.getZ() - getZ()) < 100) && GeoEngine.getInstance().canSeeTarget(player, this))
{
if (isAutoAttackable(player) && (Math.abs(player.getZ() - getZ()) < 100) && GeoEngine.getInstance().canSeeTarget(player, this))
{
// Notify the L2PcInstance AI with AI_INTENTION_INTERACT
player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this);
}
// Notify the L2PcInstance AI with AI_INTENTION_INTERACT
player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this);
}
// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
player.sendPacket(ActionFailed.STATIC_PACKET);

View File

@ -416,12 +416,9 @@ public abstract class L2ZoneType extends ListenersContainer
if (isInsideZone(character))
{
// If the character can't be affected by this zone return
if (_checkAffected)
if (_checkAffected && !isAffected(character))
{
if (!isAffected(character))
{
return;
}
return;
}
if (_characterList.putIfAbsent(character.getObjectId(), character) == null)