Code improvements.
This commit is contained in:
@@ -137,14 +137,15 @@ public class AirShipManager
|
||||
|
||||
public void removeAirShip(L2AirShipInstance ship)
|
||||
{
|
||||
if (ship.getOwnerId() != 0)
|
||||
if (ship.getOwnerId() == 0)
|
||||
{
|
||||
storeInDb(ship.getOwnerId());
|
||||
final StatsSet info = _airShipsInfo.get(ship.getOwnerId());
|
||||
if (info != null)
|
||||
{
|
||||
info.set("fuel", ship.getFuel());
|
||||
}
|
||||
return;
|
||||
}
|
||||
storeInDb(ship.getOwnerId());
|
||||
final StatsSet info = _airShipsInfo.get(ship.getOwnerId());
|
||||
if (info != null)
|
||||
{
|
||||
info.set("fuel", ship.getFuel());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,40 +156,34 @@ public class AirShipManager
|
||||
|
||||
public void registerLicense(int ownerId)
|
||||
{
|
||||
if (!_airShipsInfo.containsKey(ownerId))
|
||||
if (_airShipsInfo.containsKey(ownerId))
|
||||
{
|
||||
final StatsSet info = new StatsSet();
|
||||
info.set("fuel", 600);
|
||||
|
||||
_airShipsInfo.put(ownerId, info);
|
||||
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(ADD_DB))
|
||||
{
|
||||
ps.setInt(1, ownerId);
|
||||
ps.setInt(2, info.getInt("fuel"));
|
||||
ps.executeUpdate();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Could not add new airship license: " + e.getMessage(), e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Error while initializing: " + e.getMessage(), e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
final StatsSet info = new StatsSet();
|
||||
info.set("fuel", 600);
|
||||
_airShipsInfo.put(ownerId, info);
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(ADD_DB))
|
||||
{
|
||||
ps.setInt(1, ownerId);
|
||||
ps.setInt(2, info.getInt("fuel"));
|
||||
ps.executeUpdate();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Could not add new airship license: " + e.getMessage(), e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Error while initializing: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasAirShip(int ownerId)
|
||||
{
|
||||
final L2AirShipInstance ship = _airShips.get(ownerId);
|
||||
if ((ship == null) || !(ship.isVisible() || ship.isTeleporting()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return (ship != null) && (ship.isVisible() || ship.isTeleporting());
|
||||
}
|
||||
|
||||
public void registerAirShipTeleportList(int dockId, int locationId, VehiclePathPoint[][] tp, int[] fuelConsumption)
|
||||
@@ -227,33 +222,13 @@ public class AirShipManager
|
||||
public VehiclePathPoint[] getTeleportDestination(int dockId, int index)
|
||||
{
|
||||
final AirShipTeleportList all = _teleports.get(dockId);
|
||||
if (all == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if ((index < -1) || (index >= all.getRoute().length))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return all.getRoute()[index + 1];
|
||||
return (all == null) || (index < -1) || (index >= all.getRoute().length) ? null : all.getRoute()[index + 1];
|
||||
}
|
||||
|
||||
public int getFuelConsumption(int dockId, int index)
|
||||
{
|
||||
final AirShipTeleportList all = _teleports.get(dockId);
|
||||
if (all == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((index < -1) || (index >= all.getFuel().length))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return all.getFuel()[index + 1];
|
||||
return (all == null) || (index < -1) || (index >= all.getFuel().length) ? 0 : all.getFuel()[index + 1];
|
||||
}
|
||||
|
||||
private void load()
|
||||
|
@@ -67,39 +67,24 @@ public final class AntiFeedManager
|
||||
}
|
||||
|
||||
final L2PcInstance targetPlayer = target.getActingPlayer();
|
||||
if (targetPlayer == null)
|
||||
if ((targetPlayer == null) || ((Config.ANTIFEED_INTERVAL > 0) && _lastDeathTimes.containsKey(targetPlayer.getObjectId()) && ((System.currentTimeMillis() - _lastDeathTimes.get(targetPlayer.getObjectId())) < Config.ANTIFEED_INTERVAL)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((Config.ANTIFEED_INTERVAL > 0) && _lastDeathTimes.containsKey(targetPlayer.getObjectId()))
|
||||
if (!Config.ANTIFEED_DUALBOX || (attacker == null))
|
||||
{
|
||||
if ((System.currentTimeMillis() - _lastDeathTimes.get(targetPlayer.getObjectId())) < Config.ANTIFEED_INTERVAL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Config.ANTIFEED_DUALBOX && (attacker != null))
|
||||
final L2PcInstance attackerPlayer = attacker.getActingPlayer();
|
||||
if (attackerPlayer == null)
|
||||
{
|
||||
final L2PcInstance attackerPlayer = attacker.getActingPlayer();
|
||||
if (attackerPlayer == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2GameClient targetClient = targetPlayer.getClient();
|
||||
final L2GameClient attackerClient = attackerPlayer.getClient();
|
||||
if ((targetClient == null) || (attackerClient == null) || targetClient.isDetached() || attackerClient.isDetached())
|
||||
{
|
||||
// unable to check ip address
|
||||
return !Config.ANTIFEED_DISCONNECTED_AS_DUALBOX;
|
||||
}
|
||||
|
||||
return !targetClient.getConnectionAddress().equals(attackerClient.getConnectionAddress());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
final L2GameClient targetClient = targetPlayer.getClient();
|
||||
final L2GameClient attackerClient = attackerPlayer.getClient();
|
||||
return (targetClient == null) || (attackerClient == null) || targetClient.isDetached() || attackerClient.isDetached() ? !Config.ANTIFEED_DISCONNECTED_AS_DUALBOX : !targetClient.getConnectionAddress().equals(attackerClient.getConnectionAddress());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,12 +140,12 @@ public final class AntiFeedManager
|
||||
|
||||
final AtomicInteger connectionCount = event.computeIfAbsent(addrHash, k -> new AtomicInteger());
|
||||
|
||||
if ((connectionCount.get() + 1) <= (max + Config.L2JMOD_DUALBOX_CHECK_WHITELIST.getOrDefault(addrHash, 0)))
|
||||
if ((connectionCount.get() + 1) > (max + Config.L2JMOD_DUALBOX_CHECK_WHITELIST.getOrDefault(addrHash, 0)))
|
||||
{
|
||||
connectionCount.incrementAndGet();
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
connectionCount.incrementAndGet();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,12 +243,7 @@ public final class AntiFeedManager
|
||||
}
|
||||
|
||||
final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode());
|
||||
int limit = max;
|
||||
if (Config.L2JMOD_DUALBOX_CHECK_WHITELIST.containsKey(addrHash))
|
||||
{
|
||||
limit += Config.L2JMOD_DUALBOX_CHECK_WHITELIST.get(addrHash);
|
||||
}
|
||||
return limit;
|
||||
return Config.L2JMOD_DUALBOX_CHECK_WHITELIST.containsKey(addrHash) ? max + Config.L2JMOD_DUALBOX_CHECK_WHITELIST.get(addrHash) : max;
|
||||
}
|
||||
|
||||
public static final AntiFeedManager getInstance()
|
||||
|
@@ -117,11 +117,7 @@ public final class CHSiegeManager
|
||||
public final ClanHallSiegeEngine getSiege(L2Character character)
|
||||
{
|
||||
final SiegableHall hall = getNearbyClanHall(character);
|
||||
if (hall == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return hall.getSiege();
|
||||
return hall == null ? null : hall.getSiege();
|
||||
}
|
||||
|
||||
public final void registerClan(L2Clan clan, SiegableHall hall, L2PcInstance player)
|
||||
|
@@ -200,12 +200,7 @@ public final class CastleManager implements InstanceListManager
|
||||
|
||||
public int getCircletByCastleId(int castleId)
|
||||
{
|
||||
if ((castleId > 0) && (castleId < 10))
|
||||
{
|
||||
return _castleCirclets[castleId];
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (castleId > 0) && (castleId < 10) ? _castleCirclets[castleId] : 0;
|
||||
}
|
||||
|
||||
// remove this castle's circlets from the clan
|
||||
@@ -223,45 +218,48 @@ public final class CastleManager implements InstanceListManager
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance player = member.getPlayerInstance();
|
||||
final int circletId = getCircletByCastleId(castleId);
|
||||
|
||||
if (circletId != 0)
|
||||
if (circletId == 0)
|
||||
{
|
||||
// online-player circlet removal
|
||||
if (player != null)
|
||||
return;
|
||||
}
|
||||
|
||||
// online-player circlet removal
|
||||
if (player != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
final L2ItemInstance circlet = player.getInventory().getItemByItemId(circletId);
|
||||
if (circlet != null)
|
||||
{
|
||||
final L2ItemInstance circlet = player.getInventory().getItemByItemId(circletId);
|
||||
if (circlet != null)
|
||||
if (circlet.isEquipped())
|
||||
{
|
||||
if (circlet.isEquipped())
|
||||
{
|
||||
player.getInventory().unEquipItemInSlot(circlet.getLocationSlot());
|
||||
}
|
||||
player.destroyItemByItemId("CastleCircletRemoval", circletId, 1, player, true);
|
||||
player.getInventory().unEquipItemInSlot(circlet.getLocationSlot());
|
||||
}
|
||||
return;
|
||||
}
|
||||
catch (NullPointerException e)
|
||||
{
|
||||
// continue removing offline
|
||||
player.destroyItemByItemId("CastleCircletRemoval", circletId, 1, player, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// else offline-player circlet removal
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE owner_id = ? and item_id = ?"))
|
||||
catch (NullPointerException e)
|
||||
{
|
||||
ps.setInt(1, member.getObjectId());
|
||||
ps.setInt(2, circletId);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "Failed to remove castle circlets offline for player " + member.getName() + ": " + e.getMessage(), e);
|
||||
// continue removing offline
|
||||
}
|
||||
}
|
||||
// else offline-player circlet removal
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE owner_id = ? and item_id = ?"))
|
||||
{
|
||||
ps.setInt(1, member.getObjectId());
|
||||
ps.setInt(2, circletId);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "Failed to remove castle circlets offline for player " + member.getName() + ": " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -185,26 +185,25 @@ public class ClanEntryManager
|
||||
|
||||
public boolean addPlayerApplicationToClan(int clanId, PledgeApplicantInfo info)
|
||||
{
|
||||
if (!_playerLocked.containsKey(info.getPlayerId()))
|
||||
if (_playerLocked.containsKey(info.getPlayerId()))
|
||||
{
|
||||
_applicantList.computeIfAbsent(clanId, k -> new ConcurrentHashMap<>()).put(info.getPlayerId(), info);
|
||||
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(INSERT_APPLICANT))
|
||||
{
|
||||
statement.setInt(1, info.getPlayerId());
|
||||
statement.setInt(2, info.getRequestClanId());
|
||||
statement.setInt(3, info.getKarma());
|
||||
statement.setString(4, info.getMessage());
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
_applicantList.computeIfAbsent(clanId, k -> new ConcurrentHashMap<>()).put(info.getPlayerId(), info);
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(INSERT_APPLICANT))
|
||||
{
|
||||
statement.setInt(1, info.getPlayerId());
|
||||
statement.setInt(2, info.getRequestClanId());
|
||||
statement.setInt(3, info.getKarma());
|
||||
statement.setString(4, info.getMessage());
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public OptionalInt getClanIdForPlayerApplication(int playerId)
|
||||
@@ -214,109 +213,108 @@ public class ClanEntryManager
|
||||
|
||||
public boolean addToWaitingList(int playerId, PledgeWaitingInfo info)
|
||||
{
|
||||
if (!_playerLocked.containsKey(playerId))
|
||||
if (_playerLocked.containsKey(playerId))
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(INSERT_WAITING_LIST))
|
||||
{
|
||||
statement.setInt(1, info.getPlayerId());
|
||||
statement.setInt(2, info.getKarma());
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
|
||||
return _waitingList.put(playerId, info) != null;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(INSERT_WAITING_LIST))
|
||||
{
|
||||
statement.setInt(1, info.getPlayerId());
|
||||
statement.setInt(2, info.getKarma());
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
return _waitingList.put(playerId, info) != null;
|
||||
}
|
||||
|
||||
public boolean removeFromWaitingList(int playerId)
|
||||
{
|
||||
if (_waitingList.containsKey(playerId))
|
||||
if (!_waitingList.containsKey(playerId))
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(DELETE_WAITING_LIST))
|
||||
{
|
||||
statement.setInt(1, playerId);
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
_waitingList.remove(playerId);
|
||||
lockPlayer(playerId);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(DELETE_WAITING_LIST))
|
||||
{
|
||||
statement.setInt(1, playerId);
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
_waitingList.remove(playerId);
|
||||
lockPlayer(playerId);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean addToClanList(int clanId, PledgeRecruitInfo info)
|
||||
{
|
||||
if (!_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
|
||||
if (_clanList.containsKey(clanId) || _clanLocked.containsKey(clanId))
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(INSERT_CLAN_RECRUIT))
|
||||
{
|
||||
statement.setInt(1, info.getClanId());
|
||||
statement.setInt(2, info.getKarma());
|
||||
statement.setString(3, info.getInformation());
|
||||
statement.setString(4, info.getDetailedInformation());
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
return _clanList.put(clanId, info) != null;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(INSERT_CLAN_RECRUIT))
|
||||
{
|
||||
statement.setInt(1, info.getClanId());
|
||||
statement.setInt(2, info.getKarma());
|
||||
statement.setString(3, info.getInformation());
|
||||
statement.setString(4, info.getDetailedInformation());
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
return _clanList.put(clanId, info) != null;
|
||||
}
|
||||
|
||||
public boolean updateClanList(int clanId, PledgeRecruitInfo info)
|
||||
{
|
||||
if (_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
|
||||
if (!_clanList.containsKey(clanId) || _clanLocked.containsKey(clanId))
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(UPDATE_CLAN_RECRUIT))
|
||||
{
|
||||
statement.setInt(1, info.getKarma());
|
||||
statement.setString(2, info.getInformation());
|
||||
statement.setString(3, info.getDetailedInformation());
|
||||
statement.setInt(4, info.getClanId());
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
return _clanList.replace(clanId, info) != null;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(UPDATE_CLAN_RECRUIT))
|
||||
{
|
||||
statement.setInt(1, info.getKarma());
|
||||
statement.setString(2, info.getInformation());
|
||||
statement.setString(3, info.getDetailedInformation());
|
||||
statement.setInt(4, info.getClanId());
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
return _clanList.replace(clanId, info) != null;
|
||||
}
|
||||
|
||||
public boolean removeFromClanList(int clanId)
|
||||
{
|
||||
if (_clanList.containsKey(clanId))
|
||||
if (!_clanList.containsKey(clanId))
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(DELETE_CLAN_RECRUIT))
|
||||
{
|
||||
statement.setInt(1, clanId);
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
_clanList.remove(clanId);
|
||||
lockClan(clanId);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(DELETE_CLAN_RECRUIT))
|
||||
{
|
||||
statement.setInt(1, clanId);
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, e.getMessage(), e);
|
||||
}
|
||||
_clanList.remove(clanId);
|
||||
lockClan(clanId);
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<PledgeWaitingInfo> getSortedWaitingList(int levelMin, int levelMax, int role, int sortBy, boolean descending)
|
||||
|
@@ -117,11 +117,7 @@ public final class ClanHallAuctionManager
|
||||
public final Auction getAuction(int auctionId)
|
||||
{
|
||||
final int index = getAuctionIndex(auctionId);
|
||||
if (index >= 0)
|
||||
{
|
||||
return _auctions.get(index);
|
||||
}
|
||||
return null;
|
||||
return index >= 0 ? _auctions.get(index) : null;
|
||||
}
|
||||
|
||||
public final int getAuctionIndex(int auctionId)
|
||||
|
@@ -30,7 +30,6 @@ import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.entity.Auction;
|
||||
import com.l2jmobius.gameserver.model.entity.ClanHall;
|
||||
import com.l2jmobius.gameserver.model.entity.clanhall.AuctionableHall;
|
||||
import com.l2jmobius.gameserver.model.entity.clanhall.SiegableHall;
|
||||
@@ -95,8 +94,7 @@ public final class ClanHallManager
|
||||
}
|
||||
_freeClanHall.put(id, ch);
|
||||
|
||||
final Auction auc = ClanHallAuctionManager.getInstance().getAuction(id);
|
||||
if ((auc == null) && (lease > 0))
|
||||
if ((ClanHallAuctionManager.getInstance().getAuction(id) == null) && (lease > 0))
|
||||
{
|
||||
ClanHallAuctionManager.getInstance().initNPC(id);
|
||||
}
|
||||
@@ -151,11 +149,7 @@ public final class ClanHallManager
|
||||
*/
|
||||
public final boolean isFree(int chId)
|
||||
{
|
||||
if (_freeClanHall.containsKey(chId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return _freeClanHall.containsKey(chId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -430,8 +430,7 @@ public final class CommissionManager
|
||||
{
|
||||
if ((_commissionItems.remove(commissionItem.getCommissionId()) != null) && deleteItemFromDB(commissionItem.getCommissionId()))
|
||||
{
|
||||
final Message mail = new Message(commissionItem.getItemInstance().getOwnerId(), commissionItem.getItemInstance(), MailType.COMMISSION_ITEM_RETURNED);
|
||||
MailManager.getInstance().sendMessage(mail);
|
||||
MailManager.getInstance().sendMessage(new Message(commissionItem.getItemInstance().getOwnerId(), commissionItem.getItemInstance(), MailType.COMMISSION_ITEM_RETURNED));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -70,55 +70,51 @@ public final class CoupleManager
|
||||
public final Couple getCouple(int coupleId)
|
||||
{
|
||||
final int index = getCoupleIndex(coupleId);
|
||||
if (index >= 0)
|
||||
{
|
||||
return getCouples().get(index);
|
||||
}
|
||||
return null;
|
||||
return index >= 0 ? getCouples().get(index) : null;
|
||||
}
|
||||
|
||||
public void createCouple(L2PcInstance player1, L2PcInstance player2)
|
||||
{
|
||||
if ((player1 != null) && (player2 != null))
|
||||
if ((player1 == null) || (player2 == null) || (player1.getPartnerId() != 0) || (player2.getPartnerId() != 0))
|
||||
{
|
||||
if ((player1.getPartnerId() == 0) && (player2.getPartnerId() == 0))
|
||||
{
|
||||
final int player1id = player1.getObjectId();
|
||||
final int player2id = player2.getObjectId();
|
||||
|
||||
final Couple couple = new Couple(player1, player2);
|
||||
getCouples().add(couple);
|
||||
player1.setPartnerId(player2id);
|
||||
player2.setPartnerId(player1id);
|
||||
player1.setCoupleId(couple.getId());
|
||||
player2.setCoupleId(couple.getId());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final int player1id = player1.getObjectId();
|
||||
final int player2id = player2.getObjectId();
|
||||
|
||||
final Couple couple = new Couple(player1, player2);
|
||||
getCouples().add(couple);
|
||||
player1.setPartnerId(player2id);
|
||||
player2.setPartnerId(player1id);
|
||||
player1.setCoupleId(couple.getId());
|
||||
player2.setCoupleId(couple.getId());
|
||||
}
|
||||
|
||||
public void deleteCouple(int coupleId)
|
||||
{
|
||||
final int index = getCoupleIndex(coupleId);
|
||||
final Couple couple = getCouples().get(index);
|
||||
if (couple != null)
|
||||
if (couple == null)
|
||||
{
|
||||
final L2PcInstance player1 = L2World.getInstance().getPlayer(couple.getPlayer1Id());
|
||||
final L2PcInstance player2 = L2World.getInstance().getPlayer(couple.getPlayer2Id());
|
||||
if (player1 != null)
|
||||
{
|
||||
player1.setPartnerId(0);
|
||||
player1.setMarried(false);
|
||||
player1.setCoupleId(0);
|
||||
}
|
||||
if (player2 != null)
|
||||
{
|
||||
player2.setPartnerId(0);
|
||||
player2.setMarried(false);
|
||||
player2.setCoupleId(0);
|
||||
}
|
||||
couple.divorce();
|
||||
getCouples().remove(index);
|
||||
return;
|
||||
}
|
||||
final L2PcInstance player1 = L2World.getInstance().getPlayer(couple.getPlayer1Id());
|
||||
final L2PcInstance player2 = L2World.getInstance().getPlayer(couple.getPlayer2Id());
|
||||
if (player1 != null)
|
||||
{
|
||||
player1.setPartnerId(0);
|
||||
player1.setMarried(false);
|
||||
player1.setCoupleId(0);
|
||||
}
|
||||
if (player2 != null)
|
||||
{
|
||||
player2.setPartnerId(0);
|
||||
player2.setMarried(false);
|
||||
player2.setCoupleId(0);
|
||||
}
|
||||
couple.divorce();
|
||||
getCouples().remove(index);
|
||||
}
|
||||
|
||||
public final int getCoupleIndex(int coupleId)
|
||||
|
@@ -31,7 +31,6 @@ import java.util.logging.Logger;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
@@ -101,9 +100,7 @@ public final class CursedWeaponsManager
|
||||
return;
|
||||
}
|
||||
|
||||
final Document doc = factory.newDocumentBuilder().parse(file);
|
||||
|
||||
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
|
||||
for (Node n = factory.newDocumentBuilder().parse(file).getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("list".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
@@ -306,23 +303,17 @@ public final class CursedWeaponsManager
|
||||
|
||||
public void drop(int itemId, L2Character killer)
|
||||
{
|
||||
final CursedWeapon cw = _cursedWeapons.get(itemId);
|
||||
|
||||
cw.dropIt(killer);
|
||||
_cursedWeapons.get(itemId).dropIt(killer);
|
||||
}
|
||||
|
||||
public void increaseKills(int itemId)
|
||||
{
|
||||
final CursedWeapon cw = _cursedWeapons.get(itemId);
|
||||
|
||||
cw.increaseKills();
|
||||
_cursedWeapons.get(itemId).increaseKills();
|
||||
}
|
||||
|
||||
public int getLevel(int itemId)
|
||||
{
|
||||
final CursedWeapon cw = _cursedWeapons.get(itemId);
|
||||
|
||||
return cw.getLevel();
|
||||
return _cursedWeapons.get(itemId).getLevel();
|
||||
}
|
||||
|
||||
public static void announce(SystemMessage sm)
|
||||
|
@@ -169,14 +169,7 @@ public final class DayNightSpawnManager
|
||||
{
|
||||
try
|
||||
{
|
||||
if (GameTimeController.getInstance().isNight())
|
||||
{
|
||||
changeMode(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
changeMode(0);
|
||||
}
|
||||
changeMode(GameTimeController.getInstance().isNight() ? 1 : 0);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@@ -112,8 +112,7 @@ public final class DuelManager
|
||||
{
|
||||
return;
|
||||
}
|
||||
final Duel duel = getDuel(player.getDuelId());
|
||||
duel.doSurrender(player);
|
||||
getDuel(player.getDuelId()).doSurrender(player);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -52,8 +52,7 @@ public class FactionManager
|
||||
{
|
||||
while (rs.next())
|
||||
{
|
||||
final int id = rs.getInt(1);
|
||||
_playerFactions.put(id, rs.getInt(2));
|
||||
_playerFactions.put(rs.getInt(1), rs.getInt(2));
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
@@ -101,15 +100,7 @@ public class FactionManager
|
||||
public final boolean isSameFaction(L2PcInstance player1, L2PcInstance player2)
|
||||
{
|
||||
// TODO: Maybe add support for multiple factions?
|
||||
// if (getFactionByCharId(player1.getId()) == getFactionByCharId(player2.getId()))
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
if ((player1.isGood() && player2.isGood()) || (player1.isEvil() && player2.isEvil()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return (player1.isGood() && player2.isGood()) || (player1.isEvil() && player2.isEvil());
|
||||
}
|
||||
|
||||
public static FactionManager getInstance()
|
||||
|
@@ -211,42 +211,22 @@ public class FishingChampionshipManager
|
||||
|
||||
public String getWinnerName(int par)
|
||||
{
|
||||
if (_winPlayersName.size() >= par)
|
||||
{
|
||||
return _winPlayersName.get(par - 1);
|
||||
}
|
||||
|
||||
return "None";
|
||||
return _winPlayersName.size() >= par ? _winPlayersName.get(par - 1) : "None";
|
||||
}
|
||||
|
||||
public String getCurrentName(int par)
|
||||
{
|
||||
if (_playersName.size() >= par)
|
||||
{
|
||||
return _playersName.get(par - 1);
|
||||
}
|
||||
|
||||
return "None";
|
||||
return _playersName.size() >= par ? _playersName.get(par - 1) : "None";
|
||||
}
|
||||
|
||||
public String getFishLength(int par)
|
||||
{
|
||||
if (_winFishLength.size() >= par)
|
||||
{
|
||||
return _winFishLength.get(par - 1);
|
||||
}
|
||||
|
||||
return "0";
|
||||
return _winFishLength.size() >= par ? _winFishLength.get(par - 1) : "0";
|
||||
}
|
||||
|
||||
public String getCurrentFishLength(int par)
|
||||
{
|
||||
if (_fishLength.size() >= par)
|
||||
{
|
||||
return _fishLength.get(par - 1);
|
||||
}
|
||||
|
||||
return "0";
|
||||
return _fishLength.size() >= par ? _fishLength.get(par - 1) : "0";
|
||||
}
|
||||
|
||||
public boolean isWinner(String playerName)
|
||||
@@ -265,54 +245,51 @@ public class FishingChampionshipManager
|
||||
{
|
||||
for (Fisher fisher : _winPlayers)
|
||||
{
|
||||
if (fisher.getName().equalsIgnoreCase(pl.getName()))
|
||||
if (fisher.getName().equalsIgnoreCase(pl.getName()) && (fisher.getRewardType() != 2))
|
||||
{
|
||||
if (fisher.getRewardType() != 2)
|
||||
int rewardCnt = 0;
|
||||
for (int x = 0; x < _winPlayersName.size(); x++)
|
||||
{
|
||||
int rewardCnt = 0;
|
||||
for (int x = 0; x < _winPlayersName.size(); x++)
|
||||
if (_winPlayersName.get(x).equalsIgnoreCase(pl.getName()))
|
||||
{
|
||||
if (_winPlayersName.get(x).equalsIgnoreCase(pl.getName()))
|
||||
switch (x)
|
||||
{
|
||||
switch (x)
|
||||
case 0:
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
rewardCnt = Config.ALT_FISH_CHAMPIONSHIP_REWARD_1;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
rewardCnt = Config.ALT_FISH_CHAMPIONSHIP_REWARD_2;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
rewardCnt = Config.ALT_FISH_CHAMPIONSHIP_REWARD_3;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
rewardCnt = Config.ALT_FISH_CHAMPIONSHIP_REWARD_4;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
rewardCnt = Config.ALT_FISH_CHAMPIONSHIP_REWARD_5;
|
||||
break;
|
||||
}
|
||||
rewardCnt = Config.ALT_FISH_CHAMPIONSHIP_REWARD_1;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
rewardCnt = Config.ALT_FISH_CHAMPIONSHIP_REWARD_2;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
rewardCnt = Config.ALT_FISH_CHAMPIONSHIP_REWARD_3;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
rewardCnt = Config.ALT_FISH_CHAMPIONSHIP_REWARD_4;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
rewardCnt = Config.ALT_FISH_CHAMPIONSHIP_REWARD_5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fisher.setRewardType(2);
|
||||
if (rewardCnt > 0)
|
||||
{
|
||||
pl.addItem("fishing_reward", Config.ALT_FISH_CHAMPIONSHIP_REWARD_ITEM, rewardCnt, null, true);
|
||||
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage();
|
||||
html.setFile(pl.getHtmlPrefix(), "html/fisherman/championship/fish_event_reward001.htm");
|
||||
pl.sendPacket(html);
|
||||
}
|
||||
}
|
||||
fisher.setRewardType(2);
|
||||
if (rewardCnt > 0)
|
||||
{
|
||||
pl.addItem("fishing_reward", Config.ALT_FISH_CHAMPIONSHIP_REWARD_ITEM, rewardCnt, null, true);
|
||||
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage();
|
||||
html.setFile(pl.getHtmlPrefix(), "html/fisherman/championship/fish_event_reward001.htm");
|
||||
pl.sendPacket(html);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -154,13 +154,7 @@ public final class FortSiegeManager
|
||||
|
||||
try
|
||||
{
|
||||
final int x = Integer.parseInt(st.nextToken());
|
||||
final int y = Integer.parseInt(st.nextToken());
|
||||
final int z = Integer.parseInt(st.nextToken());
|
||||
final int heading = Integer.parseInt(st.nextToken());
|
||||
final int npc_id = Integer.parseInt(st.nextToken());
|
||||
|
||||
commanderSpawns.add(new FortSiegeSpawn(fort.getResidenceId(), x, y, z, heading, npc_id, i));
|
||||
commanderSpawns.add(new FortSiegeSpawn(fort.getResidenceId(), Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()), i));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -181,12 +175,7 @@ public final class FortSiegeManager
|
||||
|
||||
try
|
||||
{
|
||||
final int x = Integer.parseInt(st.nextToken());
|
||||
final int y = Integer.parseInt(st.nextToken());
|
||||
final int z = Integer.parseInt(st.nextToken());
|
||||
final int flag_id = Integer.parseInt(st.nextToken());
|
||||
|
||||
flagSpawns.add(new CombatFlag(fort.getResidenceId(), x, y, z, 0, flag_id));
|
||||
flagSpawns.add(new CombatFlag(fort.getResidenceId(), Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()), 0, Integer.parseInt(st.nextToken())));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -308,30 +297,18 @@ public final class FortSiegeManager
|
||||
// here check if is siege is in progress
|
||||
// here check if is siege is attacker
|
||||
final Fort fort = FortManager.getInstance().getFort(player);
|
||||
|
||||
if ((fort == null) || (fort.getResidenceId() <= 0))
|
||||
if ((fort != null) && (fort.getResidenceId() > 0) && fort.getSiege().isInProgress() && (fort.getSiege().getAttackerClan(player.getClan()) != null))
|
||||
{
|
||||
player.sendPacket(sm);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
else if (!fort.getSiege().isInProgress())
|
||||
{
|
||||
player.sendPacket(sm);
|
||||
return false;
|
||||
}
|
||||
else if (fort.getSiege().getAttackerClan(player.getClan()) == null)
|
||||
{
|
||||
player.sendPacket(sm);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
player.sendPacket(sm);
|
||||
return false;
|
||||
}
|
||||
|
||||
public void dropCombatFlag(L2PcInstance player, int fortId)
|
||||
{
|
||||
final Fort fort = FortManager.getInstance().getFortById(fortId);
|
||||
final List<CombatFlag> fcf = _flagList.get(fort.getResidenceId());
|
||||
for (CombatFlag cf : fcf)
|
||||
for (CombatFlag cf : _flagList.get(fort.getResidenceId()))
|
||||
{
|
||||
if (cf.getPlayerObjectId() == player.getObjectId())
|
||||
{
|
||||
|
@@ -433,8 +433,7 @@ public final class FourSepulchersManager
|
||||
spawnDat.setHeading(rs.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(rs.getInt("respawn_delay"));
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
final int keyNpcId = rs.getInt("key_npc_id");
|
||||
_mysteriousBoxSpawns.put(keyNpcId, spawnDat);
|
||||
_mysteriousBoxSpawns.put(rs.getInt("key_npc_id"), spawnDat);
|
||||
}
|
||||
}
|
||||
LOG.info(getClass().getSimpleName() + ": loaded " + _mysteriousBoxSpawns.size() + " Mysterious-Box spawns.");
|
||||
@@ -1046,10 +1045,6 @@ public final class FourSepulchersManager
|
||||
mem.destroyItemByItemId("Quest", CHAPEL_KEY, hallsKey.getCount(), mem, true);
|
||||
}
|
||||
}
|
||||
|
||||
_challengers.put(npcId, player);
|
||||
|
||||
_hallInUse.put(npcId, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1062,17 +1057,14 @@ public final class FourSepulchersManager
|
||||
{
|
||||
player.addItem("Quest", USED_PASS, 1, player, true);
|
||||
}
|
||||
|
||||
final L2ItemInstance hallsKey = player.getInventory().getItemByItemId(CHAPEL_KEY);
|
||||
if (hallsKey != null)
|
||||
{
|
||||
player.destroyItemByItemId("Quest", CHAPEL_KEY, hallsKey.getCount(), player, true);
|
||||
}
|
||||
|
||||
_challengers.put(npcId, player);
|
||||
|
||||
_hallInUse.put(npcId, true);
|
||||
}
|
||||
_hallInUse.put(npcId, true);
|
||||
_challengers.put(npcId, player);
|
||||
}
|
||||
|
||||
public void spawnMysteriousBox(int npcId)
|
||||
@@ -1098,115 +1090,108 @@ public final class FourSepulchersManager
|
||||
}
|
||||
|
||||
final List<L2SepulcherMonsterInstance> mobs = new CopyOnWriteArrayList<>();
|
||||
final List<L2Spawn> monsterList;
|
||||
if (Rnd.get(2) == 0)
|
||||
final List<L2Spawn> monsterList = Rnd.get(2) == 0 ? _physicalMonsters.get(npcId) : _magicalMonsters.get(npcId);
|
||||
if (monsterList == null)
|
||||
{
|
||||
monsterList = _physicalMonsters.get(npcId);
|
||||
}
|
||||
else
|
||||
{
|
||||
monsterList = _magicalMonsters.get(npcId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (monsterList != null)
|
||||
boolean spawnKeyBoxMob = false;
|
||||
boolean spawnedKeyBoxMob = false;
|
||||
|
||||
for (L2Spawn spawnDat : monsterList)
|
||||
{
|
||||
boolean spawnKeyBoxMob = false;
|
||||
boolean spawnedKeyBoxMob = false;
|
||||
|
||||
for (L2Spawn spawnDat : monsterList)
|
||||
if (spawnedKeyBoxMob)
|
||||
{
|
||||
if (spawnedKeyBoxMob)
|
||||
spawnKeyBoxMob = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (npcId)
|
||||
{
|
||||
spawnKeyBoxMob = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (npcId)
|
||||
case 31469:
|
||||
case 31474:
|
||||
case 31479:
|
||||
case 31484:
|
||||
{
|
||||
case 31469:
|
||||
case 31474:
|
||||
case 31479:
|
||||
case 31484:
|
||||
if (Rnd.get(48) == 0)
|
||||
{
|
||||
if (Rnd.get(48) == 0)
|
||||
{
|
||||
spawnKeyBoxMob = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
spawnKeyBoxMob = false;
|
||||
spawnKeyBoxMob = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
L2SepulcherMonsterInstance mob = null;
|
||||
|
||||
if (spawnKeyBoxMob)
|
||||
{
|
||||
try
|
||||
default:
|
||||
{
|
||||
final L2Spawn keyBoxMobSpawn = new L2Spawn(18149);
|
||||
keyBoxMobSpawn.setAmount(1);
|
||||
keyBoxMobSpawn.setLocation(spawnDat.getLocation());
|
||||
keyBoxMobSpawn.setRespawnDelay(3600);
|
||||
SpawnTable.getInstance().addNewSpawn(keyBoxMobSpawn, false);
|
||||
mob = (L2SepulcherMonsterInstance) keyBoxMobSpawn.doSpawn();
|
||||
keyBoxMobSpawn.stopRespawn();
|
||||
spawnKeyBoxMob = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOG.log(Level.WARNING, "FourSepulchersManager.SpawnMonster: Spawn could not be initialized: " + e.getMessage(), e);
|
||||
}
|
||||
|
||||
spawnedKeyBoxMob = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mob = (L2SepulcherMonsterInstance) spawnDat.doSpawn();
|
||||
spawnDat.stopRespawn();
|
||||
}
|
||||
|
||||
if (mob != null)
|
||||
{
|
||||
mob.mysteriousBoxId = npcId;
|
||||
switch (npcId)
|
||||
{
|
||||
case 31469:
|
||||
case 31474:
|
||||
case 31479:
|
||||
case 31484:
|
||||
case 31472:
|
||||
case 31477:
|
||||
case 31482:
|
||||
case 31487:
|
||||
{
|
||||
mobs.add(mob);
|
||||
}
|
||||
}
|
||||
_allMobs.add(mob);
|
||||
}
|
||||
}
|
||||
|
||||
switch (npcId)
|
||||
L2SepulcherMonsterInstance mob = null;
|
||||
|
||||
if (spawnKeyBoxMob)
|
||||
{
|
||||
case 31469:
|
||||
case 31474:
|
||||
case 31479:
|
||||
case 31484:
|
||||
try
|
||||
{
|
||||
_viscountMobs.put(npcId, mobs);
|
||||
break;
|
||||
final L2Spawn keyBoxMobSpawn = new L2Spawn(18149);
|
||||
keyBoxMobSpawn.setAmount(1);
|
||||
keyBoxMobSpawn.setLocation(spawnDat.getLocation());
|
||||
keyBoxMobSpawn.setRespawnDelay(3600);
|
||||
SpawnTable.getInstance().addNewSpawn(keyBoxMobSpawn, false);
|
||||
mob = (L2SepulcherMonsterInstance) keyBoxMobSpawn.doSpawn();
|
||||
keyBoxMobSpawn.stopRespawn();
|
||||
}
|
||||
case 31472:
|
||||
case 31477:
|
||||
case 31482:
|
||||
case 31487:
|
||||
catch (Exception e)
|
||||
{
|
||||
_dukeMobs.put(npcId, mobs);
|
||||
break;
|
||||
LOG.log(Level.WARNING, "FourSepulchersManager.SpawnMonster: Spawn could not be initialized: " + e.getMessage(), e);
|
||||
}
|
||||
|
||||
spawnedKeyBoxMob = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mob = (L2SepulcherMonsterInstance) spawnDat.doSpawn();
|
||||
spawnDat.stopRespawn();
|
||||
}
|
||||
|
||||
if (mob != null)
|
||||
{
|
||||
mob.mysteriousBoxId = npcId;
|
||||
switch (npcId)
|
||||
{
|
||||
case 31469:
|
||||
case 31474:
|
||||
case 31479:
|
||||
case 31484:
|
||||
case 31472:
|
||||
case 31477:
|
||||
case 31482:
|
||||
case 31487:
|
||||
{
|
||||
mobs.add(mob);
|
||||
}
|
||||
}
|
||||
_allMobs.add(mob);
|
||||
}
|
||||
}
|
||||
|
||||
switch (npcId)
|
||||
{
|
||||
case 31469:
|
||||
case 31474:
|
||||
case 31479:
|
||||
case 31484:
|
||||
{
|
||||
_viscountMobs.put(npcId, mobs);
|
||||
break;
|
||||
}
|
||||
case 31472:
|
||||
case 31477:
|
||||
case 31482:
|
||||
case 31487:
|
||||
{
|
||||
_dukeMobs.put(npcId, mobs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1293,32 +1278,29 @@ public final class FourSepulchersManager
|
||||
|
||||
public void spawnArchonOfHalisha(int npcId)
|
||||
{
|
||||
if (!isAttackTime())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_archonSpawned.get(npcId))
|
||||
if (!isAttackTime() || _archonSpawned.get(npcId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final List<L2Spawn> monsterList = _dukeFinalMobs.get(npcId);
|
||||
if (monsterList != null)
|
||||
if (monsterList == null)
|
||||
{
|
||||
for (L2Spawn spawnDat : monsterList)
|
||||
{
|
||||
final L2SepulcherMonsterInstance mob = (L2SepulcherMonsterInstance) spawnDat.doSpawn();
|
||||
spawnDat.stopRespawn();
|
||||
|
||||
if (mob != null)
|
||||
{
|
||||
mob.mysteriousBoxId = npcId;
|
||||
_allMobs.add(mob);
|
||||
}
|
||||
}
|
||||
_archonSpawned.put(npcId, true);
|
||||
return;
|
||||
}
|
||||
|
||||
for (L2Spawn spawnDat : monsterList)
|
||||
{
|
||||
final L2SepulcherMonsterInstance mob = (L2SepulcherMonsterInstance) spawnDat.doSpawn();
|
||||
spawnDat.stopRespawn();
|
||||
|
||||
if (mob != null)
|
||||
{
|
||||
mob.mysteriousBoxId = npcId;
|
||||
_allMobs.add(mob);
|
||||
}
|
||||
}
|
||||
_archonSpawned.put(npcId, true);
|
||||
}
|
||||
|
||||
public void spawnEmperorsGraveNpc(int npcId)
|
||||
@@ -1537,13 +1519,6 @@ public final class FourSepulchersManager
|
||||
|
||||
min = minuteSelect(min);
|
||||
|
||||
NpcStringId msg = NpcStringId.MINUTE_S_HAVE_PASSED;
|
||||
|
||||
if (min == 90)
|
||||
{
|
||||
msg = NpcStringId.GAME_OVER_THE_TELEPORT_WILL_APPEAR_MOMENTARILY;
|
||||
}
|
||||
|
||||
for (L2Spawn temp : _managers)
|
||||
{
|
||||
if (temp == null)
|
||||
@@ -1562,29 +1537,20 @@ public final class FourSepulchersManager
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
((L2SepulcherNpcInstance) temp.getLastSpawn()).sayInShout(msg);
|
||||
((L2SepulcherNpcInstance) temp.getLastSpawn()).sayInShout((min == 90 ? NpcStringId.GAME_OVER_THE_TELEPORT_WILL_APPEAR_MOMENTARILY : NpcStringId.MINUTE_S_HAVE_PASSED));
|
||||
}
|
||||
}
|
||||
|
||||
else if (_inEntryTime)
|
||||
{
|
||||
final NpcStringId msg1 = NpcStringId.YOU_MAY_NOW_ENTER_THE_SEPULCHER;
|
||||
final NpcStringId msg2 = NpcStringId.IF_YOU_PLACE_YOUR_HAND_ON_THE_STONE_STATUE_IN_FRONT_OF_EACH_SEPULCHER_YOU_WILL_BE_ABLE_TO_ENTER;
|
||||
for (L2Spawn temp : _managers)
|
||||
{
|
||||
if (temp == null)
|
||||
if ((temp == null) || !(temp.getLastSpawn() instanceof L2SepulcherNpcInstance))
|
||||
{
|
||||
LOG.warning(getClass().getSimpleName() + ": Something goes wrong in managerSay()...");
|
||||
continue;
|
||||
}
|
||||
if (!(temp.getLastSpawn() instanceof L2SepulcherNpcInstance))
|
||||
{
|
||||
LOG.warning(getClass().getSimpleName() + ": Something goes wrong in managerSay()...");
|
||||
continue;
|
||||
}
|
||||
((L2SepulcherNpcInstance) temp.getLastSpawn()).sayInShout(msg1);
|
||||
((L2SepulcherNpcInstance) temp.getLastSpawn()).sayInShout(msg2);
|
||||
((L2SepulcherNpcInstance) temp.getLastSpawn()).sayInShout(NpcStringId.YOU_MAY_NOW_ENTER_THE_SEPULCHER);
|
||||
((L2SepulcherNpcInstance) temp.getLastSpawn()).sayInShout(NpcStringId.IF_YOU_PLACE_YOUR_HAND_ON_THE_STONE_STATUE_IN_FRONT_OF_EACH_SEPULCHER_YOU_WILL_BE_ABLE_TO_ENTER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -144,23 +144,24 @@ public final class GraciaSeedsManager
|
||||
|
||||
public void increaseSoDTiatKilled()
|
||||
{
|
||||
if (_SoDState == 1)
|
||||
if (_SoDState != 1)
|
||||
{
|
||||
_SoDTiatKilled++;
|
||||
if (_SoDTiatKilled >= Config.SOD_TIAT_KILL_COUNT)
|
||||
{
|
||||
setSoDState(2, false);
|
||||
}
|
||||
saveData(SODTYPE);
|
||||
final Quest esQuest = QuestManager.getInstance().getQuest(ENERGY_SEEDS);
|
||||
if (esQuest == null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": missing EnergySeeds Quest!");
|
||||
}
|
||||
else
|
||||
{
|
||||
esQuest.notifyEvent("StartSoDAi", null, null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
_SoDTiatKilled++;
|
||||
if (_SoDTiatKilled >= Config.SOD_TIAT_KILL_COUNT)
|
||||
{
|
||||
setSoDState(2, false);
|
||||
}
|
||||
saveData(SODTYPE);
|
||||
final Quest esQuest = QuestManager.getInstance().getQuest(ENERGY_SEEDS);
|
||||
if (esQuest == null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": missing EnergySeeds Quest!");
|
||||
}
|
||||
else
|
||||
{
|
||||
esQuest.notifyEvent("StartSoDAi", null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -133,9 +133,7 @@ public final class GrandBossManager implements IStorable
|
||||
{
|
||||
while (rs.next())
|
||||
{
|
||||
final int id = rs.getInt("player_id");
|
||||
final int zoneId = rs.getInt("zone");
|
||||
zones.get(zoneId).add(id);
|
||||
zones.get(rs.getInt("zone")).add(rs.getInt("player_id"));
|
||||
}
|
||||
_log.info(getClass().getSimpleName() + ": Initialized " + _zones.size() + " Grand Boss Zones");
|
||||
}
|
||||
|
@@ -225,7 +225,7 @@ public final class HandysBlockCheckerManager
|
||||
final ArenaParticipantsHolder holder = _arenaPlayers[arenaId];
|
||||
synchronized (holder)
|
||||
{
|
||||
final boolean isRed = team == 0 ? true : false;
|
||||
final boolean isRed = team == 0;
|
||||
|
||||
holder.removePlayer(player, team);
|
||||
holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed));
|
||||
@@ -255,29 +255,14 @@ public final class HandysBlockCheckerManager
|
||||
synchronized (holder)
|
||||
{
|
||||
final boolean isFromRed = holder.getRedPlayers().contains(player);
|
||||
|
||||
if (isFromRed && (holder.getBlueTeamSize() == 6))
|
||||
if ((isFromRed && (holder.getBlueTeamSize() == 6)) || (!isFromRed && (holder.getRedTeamSize() == 6)))
|
||||
{
|
||||
player.sendMessage("The team is full");
|
||||
return;
|
||||
}
|
||||
else if (!isFromRed && (holder.getRedTeamSize() == 6))
|
||||
{
|
||||
player.sendMessage("The team is full");
|
||||
return;
|
||||
}
|
||||
|
||||
final int futureTeam = isFromRed ? 1 : 0;
|
||||
holder.addPlayer(player, futureTeam);
|
||||
|
||||
if (isFromRed)
|
||||
{
|
||||
holder.removePlayer(player, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.removePlayer(player, 1);
|
||||
}
|
||||
holder.removePlayer(player, isFromRed ? 0 : 1);
|
||||
holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed));
|
||||
}
|
||||
}
|
||||
@@ -298,11 +283,7 @@ public final class HandysBlockCheckerManager
|
||||
*/
|
||||
public boolean arenaIsBeingUsed(int arenaId)
|
||||
{
|
||||
if ((arenaId < 0) || (arenaId > 3))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return _arenaStatus.get(arenaId);
|
||||
return (arenaId >= 0) && (arenaId <= 3) && _arenaStatus.get(arenaId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -332,29 +313,29 @@ public final class HandysBlockCheckerManager
|
||||
final int arena = player.getBlockCheckerArena();
|
||||
final int team = getHolder(arena).getPlayerTeam(player);
|
||||
HandysBlockCheckerManager.getInstance().removePlayer(player, arena, team);
|
||||
if (player.getTeam() != Team.NONE)
|
||||
if (player.getTeam() == Team.NONE)
|
||||
{
|
||||
player.stopAllEffects();
|
||||
// Remove team aura
|
||||
player.setTeam(Team.NONE);
|
||||
|
||||
// Remove the event items
|
||||
final PcInventory inv = player.getInventory();
|
||||
|
||||
if (inv.getItemByItemId(13787) != null)
|
||||
{
|
||||
final long count = inv.getInventoryItemCount(13787, 0);
|
||||
inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player);
|
||||
}
|
||||
if (inv.getItemByItemId(13788) != null)
|
||||
{
|
||||
final long count = inv.getInventoryItemCount(13788, 0);
|
||||
inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player);
|
||||
}
|
||||
player.setInsideZone(ZoneId.PVP, false);
|
||||
// Teleport Back
|
||||
player.teleToLocation(-57478, -60367, -2370);
|
||||
return;
|
||||
}
|
||||
|
||||
player.stopAllEffects();
|
||||
// Remove team aura
|
||||
player.setTeam(Team.NONE);
|
||||
|
||||
// Remove the event items
|
||||
final PcInventory inv = player.getInventory();
|
||||
|
||||
if (inv.getItemByItemId(13787) != null)
|
||||
{
|
||||
inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player);
|
||||
}
|
||||
if (inv.getItemByItemId(13788) != null)
|
||||
{
|
||||
inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player);
|
||||
}
|
||||
player.setInsideZone(ZoneId.PVP, false);
|
||||
// Teleport Back
|
||||
player.teleToLocation(-57478, -60367, -2370);
|
||||
}
|
||||
|
||||
public void removePenalty(int objectId)
|
||||
|
@@ -102,8 +102,7 @@ public final class ItemAuctionManager
|
||||
throw new Exception("Dublicated instanceId " + instanceId);
|
||||
}
|
||||
|
||||
final ItemAuctionInstance instance = new ItemAuctionInstance(instanceId, _auctionIds, nb);
|
||||
_managerInstances.put(instanceId, instance);
|
||||
_managerInstances.put(instanceId, (new ItemAuctionInstance(instanceId, _auctionIds, nb)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -125,15 +125,9 @@ public final class ItemsOnGroundManager implements Runnable
|
||||
_items.add(item);
|
||||
count++;
|
||||
// add to ItemsAutoDestroy only items not protected
|
||||
if (!Config.LIST_PROTECTED_ITEMS.contains(item.getId()))
|
||||
if (!Config.LIST_PROTECTED_ITEMS.contains(item.getId()) && (dropTime > -1) && (((Config.AUTODESTROY_ITEM_AFTER > 0) && !item.getItem().hasExImmediateEffect()) || ((Config.HERB_AUTO_DESTROY_TIME > 0) && item.getItem().hasExImmediateEffect())))
|
||||
{
|
||||
if (dropTime > -1)
|
||||
{
|
||||
if (((Config.AUTODESTROY_ITEM_AFTER > 0) && !item.getItem().hasExImmediateEffect()) || ((Config.HERB_AUTO_DESTROY_TIME > 0) && item.getItem().hasExImmediateEffect()))
|
||||
{
|
||||
ItemsAutoDestroy.getInstance().addItem(item);
|
||||
}
|
||||
}
|
||||
ItemsAutoDestroy.getInstance().addItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -210,12 +204,7 @@ public final class ItemsOnGroundManager implements Runnable
|
||||
{
|
||||
for (L2ItemInstance item : _items)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (CursedWeaponsManager.getInstance().isCursed(item.getId()))
|
||||
if ((item == null) || CursedWeaponsManager.getInstance().isCursed(item.getId()))
|
||||
{
|
||||
continue; // Cursed Items not saved to ground, prevent double save
|
||||
}
|
||||
|
@@ -120,8 +120,7 @@ public class JumpManager
|
||||
_log.log(Level.WARNING, "Could not parse JumpTrack.xml file: " + e.getMessage(), e);
|
||||
return;
|
||||
}
|
||||
final Node root = doc.getFirstChild();
|
||||
for (Node t = root.getFirstChild(); t != null; t = t.getNextSibling())
|
||||
for (Node t = doc.getFirstChild().getFirstChild(); t != null; t = t.getNextSibling())
|
||||
{
|
||||
if (t.getNodeName().equals("track"))
|
||||
{
|
||||
@@ -148,11 +147,7 @@ public class JumpManager
|
||||
if (j.getNodeName().equals("jumpLoc"))
|
||||
{
|
||||
final NamedNodeMap attrs = j.getAttributes();
|
||||
final int next = Integer.parseInt(attrs.getNamedItem("next").getNodeValue());
|
||||
final int x = Integer.parseInt(attrs.getNamedItem("x").getNodeValue());
|
||||
final int y = Integer.parseInt(attrs.getNamedItem("y").getNodeValue());
|
||||
final int z = Integer.parseInt(attrs.getNamedItem("z").getNodeValue());
|
||||
jw.add(new JumpNode(x, y, z, next));
|
||||
jw.add(new JumpNode(Integer.parseInt(attrs.getNamedItem("x").getNodeValue()), Integer.parseInt(attrs.getNamedItem("y").getNodeValue()), Integer.parseInt(attrs.getNamedItem("z").getNodeValue()), Integer.parseInt(attrs.getNamedItem("next").getNodeValue())));
|
||||
}
|
||||
}
|
||||
track.put(wayId, jw);
|
||||
@@ -185,11 +180,7 @@ public class JumpManager
|
||||
public JumpWay getJumpWay(int trackId, int wayId)
|
||||
{
|
||||
final Track t = _tracks.get(trackId);
|
||||
if (t != null)
|
||||
{
|
||||
return t.get(wayId);
|
||||
}
|
||||
return null;
|
||||
return t != null ? t.get(wayId) : null;
|
||||
}
|
||||
|
||||
public void StartJump(L2PcInstance player)
|
||||
|
@@ -98,19 +98,15 @@ public final class MapRegionManager implements IXmlReader
|
||||
final int spawnY = parseInteger(attrs, "Y");
|
||||
final int spawnZ = parseInteger(attrs, "Z");
|
||||
|
||||
final boolean other = parseBoolean(attrs, "isOther", false);
|
||||
final boolean chaotic = parseBoolean(attrs, "isChaotic", false);
|
||||
final boolean banish = parseBoolean(attrs, "isBanish", false);
|
||||
|
||||
if (other)
|
||||
if (parseBoolean(attrs, "isOther", false))
|
||||
{
|
||||
region.addOtherSpawn(spawnX, spawnY, spawnZ);
|
||||
}
|
||||
else if (chaotic)
|
||||
else if (parseBoolean(attrs, "isChaotic", false))
|
||||
{
|
||||
region.addChaoticSpawn(spawnX, spawnY, spawnZ);
|
||||
}
|
||||
else if (banish)
|
||||
else if (parseBoolean(attrs, "isBanish", false))
|
||||
{
|
||||
region.addBanishSpawn(spawnX, spawnY, spawnZ);
|
||||
}
|
||||
@@ -160,11 +156,7 @@ public final class MapRegionManager implements IXmlReader
|
||||
public final int getMapRegionLocId(int locX, int locY)
|
||||
{
|
||||
final L2MapRegion region = getMapRegion(locX, locY);
|
||||
if (region != null)
|
||||
{
|
||||
return region.getLocId();
|
||||
}
|
||||
return 0;
|
||||
return region != null ? region.getLocId() : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,13 +203,7 @@ public final class MapRegionManager implements IXmlReader
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,13 +213,7 @@ public final class MapRegionManager implements IXmlReader
|
||||
public int getAreaCastle(L2Character activeChar)
|
||||
{
|
||||
final L2MapRegion region = getMapRegion(activeChar);
|
||||
|
||||
if (region == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return region.getCastle();
|
||||
return region == null ? 0 : region.getCastle();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -264,11 +244,7 @@ public final class MapRegionManager implements IXmlReader
|
||||
final L2ClanHallZone zone = clanhall.getZone();
|
||||
if ((zone != null) && !player.isFlyingMounted())
|
||||
{
|
||||
if (player.getReputation() < 0)
|
||||
{
|
||||
return zone.getChaoticSpawnLoc();
|
||||
}
|
||||
return zone.getSpawnLoc();
|
||||
return player.getReputation() < 0 ? zone.getChaoticSpawnLoc() : zone.getSpawnLoc();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -290,11 +266,7 @@ public final class MapRegionManager implements IXmlReader
|
||||
|
||||
if ((castle != null) && (castle.getResidenceId() > 0))
|
||||
{
|
||||
if (player.getReputation() < 0)
|
||||
{
|
||||
return castle.getResidenceZone().getChaoticSpawnLoc();
|
||||
}
|
||||
return castle.getResidenceZone().getSpawnLoc();
|
||||
return player.getReputation() < 0 ? castle.getResidenceZone().getChaoticSpawnLoc() : castle.getResidenceZone().getSpawnLoc();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,11 +287,7 @@ public final class MapRegionManager implements IXmlReader
|
||||
|
||||
if ((fort != null) && (fort.getResidenceId() > 0))
|
||||
{
|
||||
if (player.getReputation() < 0)
|
||||
{
|
||||
return fort.getResidenceZone().getChaoticSpawnLoc();
|
||||
}
|
||||
return fort.getResidenceZone().getSpawnLoc();
|
||||
return player.getReputation() < 0 ? fort.getResidenceZone().getChaoticSpawnLoc() : fort.getResidenceZone().getSpawnLoc();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,34 +341,20 @@ public final class MapRegionManager implements IXmlReader
|
||||
try
|
||||
{
|
||||
final L2RespawnZone zone = ZoneManager.getInstance().getZone(player, L2RespawnZone.class);
|
||||
if (zone != null)
|
||||
{
|
||||
return getRestartRegion(activeChar, zone.getRespawnPoint((L2PcInstance) activeChar)).getChaoticSpawnLoc();
|
||||
}
|
||||
return getMapRegion(activeChar).getChaoticSpawnLoc();
|
||||
return zone != null ? getRestartRegion(activeChar, zone.getRespawnPoint((L2PcInstance) activeChar)).getChaoticSpawnLoc() : getMapRegion(activeChar).getChaoticSpawnLoc();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (player.isFlyingMounted())
|
||||
{
|
||||
return _regions.get("union_base_of_kserth").getChaoticSpawnLoc();
|
||||
}
|
||||
return _regions.get(defaultRespawn).getChaoticSpawnLoc();
|
||||
return player.isFlyingMounted() ? _regions.get("union_base_of_kserth").getChaoticSpawnLoc() : _regions.get(defaultRespawn).getChaoticSpawnLoc();
|
||||
}
|
||||
}
|
||||
|
||||
// Checking if needed to be respawned in "far" town from the castle;
|
||||
castle = CastleManager.getInstance().getCastle(player);
|
||||
if (castle != null)
|
||||
// Check if player's clan is participating
|
||||
if ((castle != null) && castle.getSiege().isInProgress() && (castle.getSiege().checkIsDefender(player.getClan()) || castle.getSiege().checkIsAttacker(player.getClan())))
|
||||
{
|
||||
if (castle.getSiege().isInProgress())
|
||||
{
|
||||
// Check if player's clan is participating
|
||||
if ((castle.getSiege().checkIsDefender(player.getClan()) || castle.getSiege().checkIsAttacker(player.getClan())))
|
||||
{
|
||||
return castle.getResidenceZone().getOtherSpawnLoc();
|
||||
}
|
||||
}
|
||||
return castle.getResidenceZone().getOtherSpawnLoc();
|
||||
}
|
||||
|
||||
// Checking if in an instance
|
||||
@@ -434,11 +388,7 @@ public final class MapRegionManager implements IXmlReader
|
||||
try
|
||||
{
|
||||
final L2RespawnZone zone = ZoneManager.getInstance().getZone(activeChar, L2RespawnZone.class);
|
||||
if (zone != null)
|
||||
{
|
||||
return getRestartRegion(activeChar, zone.getRespawnPoint((L2PcInstance) activeChar)).getSpawnLoc();
|
||||
}
|
||||
return getMapRegion(activeChar).getSpawnLoc();
|
||||
return zone != null ? getRestartRegion(activeChar, zone.getRespawnPoint((L2PcInstance) activeChar)).getSpawnLoc() : getMapRegion(activeChar).getSpawnLoc();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@@ -146,15 +146,13 @@ public class MentorManager
|
||||
public void setPenalty(int mentorId, long penalty)
|
||||
{
|
||||
final L2PcInstance player = L2World.getInstance().getPlayer(mentorId);
|
||||
final PlayerVariables vars = player != null ? player.getVariables() : new PlayerVariables(mentorId);
|
||||
vars.set("Mentor-Penalty-" + mentorId, String.valueOf(System.currentTimeMillis() + penalty));
|
||||
(player != null ? player.getVariables() : new PlayerVariables(mentorId)).set("Mentor-Penalty-" + mentorId, String.valueOf(System.currentTimeMillis() + penalty));
|
||||
}
|
||||
|
||||
public long getMentorPenalty(int mentorId)
|
||||
{
|
||||
final L2PcInstance player = L2World.getInstance().getPlayer(mentorId);
|
||||
final PlayerVariables vars = player != null ? player.getVariables() : new PlayerVariables(mentorId);
|
||||
return vars.getLong("Mentor-Penalty-" + mentorId, 0);
|
||||
return (player != null ? player.getVariables() : new PlayerVariables(mentorId)).getLong("Mentor-Penalty-" + mentorId, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,11 +211,7 @@ public class MentorManager
|
||||
|
||||
public Collection<L2Mentee> getMentees(int mentorId)
|
||||
{
|
||||
if (_menteeData.containsKey(mentorId))
|
||||
{
|
||||
return _menteeData.get(mentorId).values();
|
||||
}
|
||||
return Collections.emptyList();
|
||||
return _menteeData.containsKey(mentorId) ? _menteeData.get(mentorId).values() : Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,11 +221,7 @@ public class MentorManager
|
||||
*/
|
||||
public L2Mentee getMentee(int mentorId, int menteeId)
|
||||
{
|
||||
if (_menteeData.containsKey(mentorId))
|
||||
{
|
||||
return _menteeData.get(mentorId).get(menteeId);
|
||||
}
|
||||
return null;
|
||||
return _menteeData.containsKey(mentorId) ? _menteeData.get(mentorId).get(menteeId) : null;
|
||||
}
|
||||
|
||||
public boolean isAllMenteesOffline(int menteorId, int menteeId)
|
||||
@@ -239,13 +229,10 @@ public class MentorManager
|
||||
boolean isAllMenteesOffline = true;
|
||||
for (L2Mentee men : getMentees(menteorId))
|
||||
{
|
||||
if (men.isOnline() && (men.getObjectId() != menteeId))
|
||||
if (men.isOnline() && (men.getObjectId() != menteeId) && isAllMenteesOffline)
|
||||
{
|
||||
if (isAllMenteesOffline)
|
||||
{
|
||||
isAllMenteesOffline = false;
|
||||
break;
|
||||
}
|
||||
isAllMenteesOffline = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isAllMenteesOffline;
|
||||
|
@@ -239,11 +239,7 @@ public final class MercTicketManager
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count >= limit)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return count >= limit;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,11 +268,7 @@ public final class MercTicketManager
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count >= limit)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return count >= limit;
|
||||
}
|
||||
|
||||
public int getMaxAllowedMerc(int castleId)
|
||||
@@ -347,17 +339,17 @@ public final class MercTicketManager
|
||||
private void spawnMercenary(int npcId, int x, int y, int z, int despawnDelay)
|
||||
{
|
||||
final L2NpcTemplate template = NpcData.getInstance().getTemplate(npcId);
|
||||
if (template != null)
|
||||
if (template == null)
|
||||
{
|
||||
final L2DefenderInstance npc = new L2DefenderInstance(template);
|
||||
npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp());
|
||||
npc.setDecayed(false);
|
||||
npc.spawnMe(x, y, (z + 20));
|
||||
|
||||
if (despawnDelay > 0)
|
||||
{
|
||||
npc.scheduleDespawn(despawnDelay);
|
||||
}
|
||||
return;
|
||||
}
|
||||
final L2DefenderInstance npc = new L2DefenderInstance(template);
|
||||
npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp());
|
||||
npc.setDecayed(false);
|
||||
npc.spawnMe(x, y, (z + 20));
|
||||
if (despawnDelay > 0)
|
||||
{
|
||||
npc.scheduleDespawn(despawnDelay);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -32,12 +32,7 @@ public final class PcCafePointsManager
|
||||
|
||||
public void givePcCafePoint(L2PcInstance player, long exp)
|
||||
{
|
||||
if (!Config.PC_BANG_ENABLED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isInsideZone(ZoneId.PEACE) || player.isInsideZone(ZoneId.PVP) || player.isInsideZone(ZoneId.SIEGE) || (player.isOnlineInt() == 0) || player.isJailed())
|
||||
if (!Config.PC_BANG_ENABLED || player.isInsideZone(ZoneId.PEACE) || player.isInsideZone(ZoneId.PVP) || player.isInsideZone(ZoneId.SIEGE) || (player.isOnlineInt() == 0) || player.isJailed())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -61,27 +56,29 @@ public final class PcCafePointsManager
|
||||
points = 1; // minimum points
|
||||
}
|
||||
|
||||
SystemMessage message = null;
|
||||
if (points > 0)
|
||||
if (points <= 0)
|
||||
{
|
||||
if (Config.PC_BANG_ENABLE_DOUBLE_POINTS && (Rnd.get(100) < Config.PC_BANG_DOUBLE_POINTS_CHANCE))
|
||||
{
|
||||
points *= 2;
|
||||
message = SystemMessage.getSystemMessage(SystemMessageId.DOUBLE_POINTS_YOU_EARNED_S1_PC_POINT_S);
|
||||
}
|
||||
else
|
||||
{
|
||||
message = SystemMessage.getSystemMessage(SystemMessageId.YOU_EARNED_S1_PC_POINT_S);
|
||||
}
|
||||
if ((player.getPcBangPoints() + points) > Config.PC_BANG_MAX_POINTS)
|
||||
{
|
||||
points = Config.PC_BANG_MAX_POINTS - player.getPcBangPoints();
|
||||
}
|
||||
message.addLong(points);
|
||||
player.sendPacket(message);
|
||||
player.setPcBangPoints(player.getPcBangPoints() + points);
|
||||
player.sendPacket(new ExPCCafePointInfo(player.getPcBangPoints(), points, 1));
|
||||
return;
|
||||
}
|
||||
|
||||
SystemMessage message = null;
|
||||
if (Config.PC_BANG_ENABLE_DOUBLE_POINTS && (Rnd.get(100) < Config.PC_BANG_DOUBLE_POINTS_CHANCE))
|
||||
{
|
||||
points *= 2;
|
||||
message = SystemMessage.getSystemMessage(SystemMessageId.DOUBLE_POINTS_YOU_EARNED_S1_PC_POINT_S);
|
||||
}
|
||||
else
|
||||
{
|
||||
message = SystemMessage.getSystemMessage(SystemMessageId.YOU_EARNED_S1_PC_POINT_S);
|
||||
}
|
||||
if ((player.getPcBangPoints() + points) > Config.PC_BANG_MAX_POINTS)
|
||||
{
|
||||
points = Config.PC_BANG_MAX_POINTS - player.getPcBangPoints();
|
||||
}
|
||||
message.addLong(points);
|
||||
player.sendPacket(message);
|
||||
player.setPcBangPoints(player.getPcBangPoints() + points);
|
||||
player.sendPacket(new ExPCCafePointInfo(player.getPcBangPoints(), points, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -240,13 +240,7 @@ public final class PetitionManager
|
||||
|
||||
public boolean isPetitionInProcess(int petitionId)
|
||||
{
|
||||
if (!isValidPetition(petitionId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Petition currPetition = getPendingPetitions().get(petitionId);
|
||||
return (currPetition.getState() == PetitionState.IN_PROCESS);
|
||||
return isValidPetition(petitionId) && (getPendingPetitions().get(petitionId).getState() == PetitionState.IN_PROCESS);
|
||||
}
|
||||
|
||||
public boolean isPlayerInConsultation(L2PcInstance player)
|
||||
@@ -255,16 +249,10 @@ public final class PetitionManager
|
||||
{
|
||||
for (Petition currPetition : getPendingPetitions().values())
|
||||
{
|
||||
if (currPetition == null)
|
||||
if ((currPetition == null) || (currPetition.getState() != PetitionState.IN_PROCESS))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (currPetition.getState() != PetitionState.IN_PROCESS)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (((currPetition.getPetitioner() != null) && (currPetition.getPetitioner().getObjectId() == player.getObjectId())) || ((currPetition.getResponder() != null) && (currPetition.getResponder().getObjectId() == player.getObjectId())))
|
||||
{
|
||||
return true;
|
||||
@@ -430,12 +418,7 @@ public final class PetitionManager
|
||||
|
||||
public void viewPetition(L2PcInstance activeChar, int petitionId)
|
||||
{
|
||||
if (!activeChar.isGM())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isValidPetition(petitionId))
|
||||
if (!activeChar.isGM() || !isValidPetition(petitionId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -92,7 +92,7 @@ public class PremiumManager
|
||||
{
|
||||
if (player.getAccountNamePlayer().equalsIgnoreCase(accountName))
|
||||
{
|
||||
player.setPremiumStatus(getPremiumEndDate(accountName) > 0 ? true : false);
|
||||
player.setPremiumStatus(getPremiumEndDate(accountName) > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -67,8 +67,6 @@ public final class PunishmentManager
|
||||
final PunishmentAffect affect = PunishmentAffect.getByName(rset.getString("affect"));
|
||||
final PunishmentType type = PunishmentType.getByName(rset.getString("type"));
|
||||
final long expirationTime = rset.getLong("expiration");
|
||||
final String reason = rset.getString("reason");
|
||||
final String punishedBy = rset.getString("punishedBy");
|
||||
if ((type != null) && (affect != null))
|
||||
{
|
||||
if ((expirationTime > 0) && (System.currentTimeMillis() > expirationTime)) // expired task.
|
||||
@@ -78,7 +76,7 @@ public final class PunishmentManager
|
||||
else
|
||||
{
|
||||
initiated++;
|
||||
_tasks.get(affect).addPunishment(new PunishmentTask(id, key, affect, type, expirationTime, reason, punishedBy, true));
|
||||
_tasks.get(affect).addPunishment(new PunishmentTask(id, key, affect, type, expirationTime, rset.getString("reason"), rset.getString("punishedBy"), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,8 +105,7 @@ public final class PunishmentManager
|
||||
|
||||
public boolean hasPunishment(Object key, PunishmentAffect affect, PunishmentType type)
|
||||
{
|
||||
final PunishmentHolder holder = _tasks.get(affect);
|
||||
return holder.hasPunishment(String.valueOf(key), type);
|
||||
return _tasks.get(affect).hasPunishment(String.valueOf(key), type);
|
||||
}
|
||||
|
||||
public long getPunishmentExpiration(Object key, PunishmentAffect affect, PunishmentType type)
|
||||
|
@@ -50,11 +50,7 @@ public final class QuestManager extends ScriptManager<Quest>
|
||||
public boolean reload(String questFolder)
|
||||
{
|
||||
final Quest q = getQuest(questFolder);
|
||||
if (q == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return q.reload();
|
||||
return (q != null) && q.reload();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,11 +61,7 @@ public final class QuestManager extends ScriptManager<Quest>
|
||||
public boolean reload(int questId)
|
||||
{
|
||||
final Quest q = getQuest(questId);
|
||||
if (q == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return q.reload();
|
||||
return (q != null) && q.reload();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,11 +138,7 @@ public final class QuestManager extends ScriptManager<Quest>
|
||||
*/
|
||||
public Quest getQuest(String name)
|
||||
{
|
||||
if (_quests.containsKey(name))
|
||||
{
|
||||
return _quests.get(name);
|
||||
}
|
||||
return _scripts.get(name);
|
||||
return _quests.containsKey(name) ? _quests.get(name) : _scripts.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,8 +187,7 @@ public final class QuestManager extends ScriptManager<Quest>
|
||||
|
||||
if (Config.ALT_DEV_SHOW_QUESTS_LOAD_IN_LOGS)
|
||||
{
|
||||
final String questName = quest.getName().contains("_") ? quest.getName().substring(quest.getName().indexOf('_') + 1) : quest.getName();
|
||||
_log.info("Loaded quest " + Util.splitWords(questName) + ".");
|
||||
_log.info("Loaded quest " + Util.splitWords((quest.getName().contains("_") ? quest.getName().substring(quest.getName().indexOf('_') + 1) : quest.getName())) + ".");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +203,7 @@ public final class QuestManager extends ScriptManager<Quest>
|
||||
_quests.remove(script.getName());
|
||||
return true;
|
||||
}
|
||||
else if (_scripts.containsKey(script.getName()))
|
||||
if (_scripts.containsKey(script.getName()))
|
||||
{
|
||||
_scripts.remove(script.getName());
|
||||
return true;
|
||||
|
@@ -211,11 +211,7 @@ public class RaidBossSpawnManager
|
||||
*/
|
||||
public void addNewSpawn(L2Spawn spawnDat, long respawnTime, double currentHP, double currentMP, boolean storeInDb)
|
||||
{
|
||||
if (spawnDat == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_spawns.containsKey(spawnDat.getId()))
|
||||
if ((spawnDat == null) || _spawns.containsKey(spawnDat.getId()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -227,17 +223,7 @@ public class RaidBossSpawnManager
|
||||
|
||||
if ((respawnTime == 0L) || (time > respawnTime))
|
||||
{
|
||||
L2RaidBossInstance raidboss = null;
|
||||
|
||||
if (bossId == 25328)
|
||||
{
|
||||
raidboss = DayNightSpawnManager.getInstance().handleBoss(spawnDat);
|
||||
}
|
||||
else
|
||||
{
|
||||
raidboss = (L2RaidBossInstance) spawnDat.doSpawn();
|
||||
}
|
||||
|
||||
final L2RaidBossInstance raidboss = bossId == 25328 ? DayNightSpawnManager.getInstance().handleBoss(spawnDat) : (L2RaidBossInstance) spawnDat.doSpawn();
|
||||
if (raidboss != null)
|
||||
{
|
||||
raidboss.setCurrentHp(currentHP);
|
||||
@@ -256,8 +242,7 @@ public class RaidBossSpawnManager
|
||||
}
|
||||
else
|
||||
{
|
||||
final long spawnTime = respawnTime - Calendar.getInstance().getTimeInMillis();
|
||||
_schedules.put(bossId, ThreadPoolManager.getInstance().scheduleGeneral(new SpawnSchedule(bossId), spawnTime));
|
||||
_schedules.put(bossId, ThreadPoolManager.getInstance().scheduleGeneral(new SpawnSchedule(bossId), (respawnTime - Calendar.getInstance().getTimeInMillis())));
|
||||
}
|
||||
|
||||
_spawns.put(bossId, spawnDat);
|
||||
@@ -314,8 +299,7 @@ public class RaidBossSpawnManager
|
||||
|
||||
if (_schedules.containsKey(bossId))
|
||||
{
|
||||
final ScheduledFuture<?> f = _schedules.remove(bossId);
|
||||
f.cancel(true);
|
||||
_schedules.remove(bossId).cancel(true);
|
||||
}
|
||||
|
||||
if (_storedInfo.containsKey(bossId))
|
||||
@@ -432,8 +416,7 @@ public class RaidBossSpawnManager
|
||||
|
||||
if (_bosses == null)
|
||||
{
|
||||
msg += "None";
|
||||
return msg;
|
||||
return msg += "None";
|
||||
}
|
||||
|
||||
if (_bosses.containsKey(bossId))
|
||||
@@ -537,8 +520,7 @@ public class RaidBossSpawnManager
|
||||
{
|
||||
for (Integer bossId : _schedules.keySet())
|
||||
{
|
||||
final ScheduledFuture<?> f = _schedules.get(bossId);
|
||||
f.cancel(true);
|
||||
_schedules.get(bossId).cancel(true);
|
||||
}
|
||||
_schedules.clear();
|
||||
}
|
||||
|
@@ -145,7 +145,7 @@ public final class SiegeGuardManager
|
||||
{
|
||||
int hiredCount = 0;
|
||||
final int hiredMax = MercTicketManager.getInstance().getMaxAllowedMerc(_castle.getResidenceId());
|
||||
final boolean isHired = (getCastle().getOwnerId() > 0) ? true : false;
|
||||
final boolean isHired = getCastle().getOwnerId() > 0;
|
||||
loadSiegeGuard();
|
||||
for (L2Spawn spawn : _siegeGuardSpawn)
|
||||
{
|
||||
@@ -195,14 +195,7 @@ public final class SiegeGuardManager
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_siege_guards Where castleId = ? And isHired = ?"))
|
||||
{
|
||||
ps.setInt(1, getCastle().getResidenceId());
|
||||
if (getCastle().getOwnerId() > 0)
|
||||
{
|
||||
ps.setInt(2, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ps.setInt(2, 0);
|
||||
}
|
||||
ps.setInt(2, getCastle().getOwnerId() > 0 ? 1 : 0);
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
while (rs.next())
|
||||
|
@@ -81,8 +81,7 @@ public final class WalkingManager implements IXmlReader
|
||||
@Override
|
||||
public void parseDocument(Document doc)
|
||||
{
|
||||
final Node n = doc.getFirstChild();
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
for (Node d = doc.getFirstChild().getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
if (d.getNodeName().equals("route"))
|
||||
{
|
||||
@@ -199,31 +198,14 @@ public final class WalkingManager implements IXmlReader
|
||||
*/
|
||||
public boolean isOnWalk(L2Npc npc)
|
||||
{
|
||||
L2MonsterInstance monster = null;
|
||||
|
||||
if (npc.isMonster())
|
||||
{
|
||||
if (((L2MonsterInstance) npc).getLeader() == null)
|
||||
{
|
||||
monster = (L2MonsterInstance) npc;
|
||||
}
|
||||
else
|
||||
{
|
||||
monster = ((L2MonsterInstance) npc).getLeader();
|
||||
}
|
||||
}
|
||||
|
||||
final L2MonsterInstance monster = npc.isMonster() ? ((L2MonsterInstance) npc).getLeader() == null ? (L2MonsterInstance) npc : ((L2MonsterInstance) npc).getLeader() : null;
|
||||
if (((monster != null) && !isRegistered(monster)) || !isRegistered(npc))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final WalkInfo walk = monster != null ? _activeRoutes.get(monster.getObjectId()) : _activeRoutes.get(npc.getObjectId());
|
||||
if (walk.isStoppedByAttack() || walk.isSuspended())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !walk.isStoppedByAttack() && !walk.isSuspended();
|
||||
}
|
||||
|
||||
public L2WalkRoute getRoute(String route)
|
||||
@@ -344,11 +326,12 @@ public final class WalkingManager implements IXmlReader
|
||||
public synchronized void cancelMoving(L2Npc npc)
|
||||
{
|
||||
final WalkInfo walk = _activeRoutes.remove(npc.getObjectId());
|
||||
if (walk != null)
|
||||
if (walk == null)
|
||||
{
|
||||
walk.getWalkCheckTask().cancel(true);
|
||||
npc.getKnownList().stopTrackingTask();
|
||||
return;
|
||||
}
|
||||
walk.getWalkCheckTask().cancel(true);
|
||||
npc.getKnownList().stopTrackingTask();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -358,12 +341,13 @@ public final class WalkingManager implements IXmlReader
|
||||
public void resumeMoving(L2Npc npc)
|
||||
{
|
||||
final WalkInfo walk = _activeRoutes.get(npc.getObjectId());
|
||||
if (walk != null)
|
||||
if (walk == null)
|
||||
{
|
||||
walk.setSuspended(false);
|
||||
walk.setStoppedByAttack(false);
|
||||
startMoving(npc, walk.getRoute().getName());
|
||||
return;
|
||||
}
|
||||
walk.setSuspended(false);
|
||||
walk.setStoppedByAttack(false);
|
||||
startMoving(npc, walk.getRoute().getName());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -374,19 +358,7 @@ public final class WalkingManager implements IXmlReader
|
||||
*/
|
||||
public void stopMoving(L2Npc npc, boolean suspend, boolean stoppedByAttack)
|
||||
{
|
||||
L2MonsterInstance monster = null;
|
||||
|
||||
if (npc.isMonster())
|
||||
{
|
||||
if (((L2MonsterInstance) npc).getLeader() == null)
|
||||
{
|
||||
monster = (L2MonsterInstance) npc;
|
||||
}
|
||||
else
|
||||
{
|
||||
monster = ((L2MonsterInstance) npc).getLeader();
|
||||
}
|
||||
}
|
||||
final L2MonsterInstance monster = npc.isMonster() ? ((L2MonsterInstance) npc).getLeader() == null ? (L2MonsterInstance) npc : ((L2MonsterInstance) npc).getLeader() : null;
|
||||
|
||||
if (((monster != null) && !isRegistered(monster)) || !isRegistered(npc))
|
||||
{
|
||||
@@ -416,41 +388,46 @@ public final class WalkingManager implements IXmlReader
|
||||
*/
|
||||
public void onArrived(L2Npc npc)
|
||||
{
|
||||
if (_activeRoutes.containsKey(npc.getObjectId()))
|
||||
if (!_activeRoutes.containsKey(npc.getObjectId()))
|
||||
{
|
||||
// Notify quest
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcMoveNodeArrived(npc), npc);
|
||||
|
||||
final WalkInfo walk = _activeRoutes.get(npc.getObjectId());
|
||||
|
||||
// Opposite should not happen... but happens sometime
|
||||
if ((walk.getCurrentNodeId() >= 0) && (walk.getCurrentNodeId() < walk.getRoute().getNodesCount()))
|
||||
{
|
||||
final L2NpcWalkerNode node = walk.getRoute().getNodeList().get(walk.getCurrentNodeId());
|
||||
if (npc.isInsideRadius(node, 10, false, false))
|
||||
{
|
||||
npc.sendDebugMessage("Route '" + walk.getRoute().getName() + "', arrived to node " + walk.getCurrentNodeId());
|
||||
npc.sendDebugMessage("Done in " + ((System.currentTimeMillis() - walk.getLastAction()) / 1000) + " s");
|
||||
walk.calculateNextNode(npc);
|
||||
walk.setBlocked(true); // prevents to be ran from walk check task, if there is delay in this node.
|
||||
|
||||
if (node.getNpcString() != null)
|
||||
{
|
||||
Broadcast.toKnownPlayers(npc, new NpcSay(npc, ChatType.NPC_GENERAL, node.getNpcString()));
|
||||
}
|
||||
else if (!node.getChatText().isEmpty())
|
||||
{
|
||||
Broadcast.toKnownPlayers(npc, new NpcSay(npc, ChatType.NPC_GENERAL, node.getChatText()));
|
||||
}
|
||||
|
||||
if (npc.isDebug())
|
||||
{
|
||||
walk.setLastAction(System.currentTimeMillis());
|
||||
}
|
||||
ThreadPoolManager.getInstance().scheduleGeneral(new ArrivedTask(npc, walk), 100 + (node.getDelay() * 1000L));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Notify quest
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcMoveNodeArrived(npc), npc);
|
||||
|
||||
final WalkInfo walk = _activeRoutes.get(npc.getObjectId());
|
||||
// Opposite should not happen... but happens sometime
|
||||
if ((walk.getCurrentNodeId() < 0) || (walk.getCurrentNodeId() >= walk.getRoute().getNodesCount()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2NpcWalkerNode node = walk.getRoute().getNodeList().get(walk.getCurrentNodeId());
|
||||
if (!npc.isInsideRadius(node, 10, false, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
npc.sendDebugMessage("Route '" + walk.getRoute().getName() + "', arrived to node " + walk.getCurrentNodeId());
|
||||
npc.sendDebugMessage("Done in " + ((System.currentTimeMillis() - walk.getLastAction()) / 1000) + " s");
|
||||
walk.calculateNextNode(npc);
|
||||
walk.setBlocked(true); // prevents to be ran from walk check task, if there is delay in this node.
|
||||
|
||||
if (node.getNpcString() != null)
|
||||
{
|
||||
Broadcast.toKnownPlayers(npc, new NpcSay(npc, ChatType.NPC_GENERAL, node.getNpcString()));
|
||||
}
|
||||
else if (!node.getChatText().isEmpty())
|
||||
{
|
||||
Broadcast.toKnownPlayers(npc, new NpcSay(npc, ChatType.NPC_GENERAL, node.getChatText()));
|
||||
}
|
||||
|
||||
if (npc.isDebug())
|
||||
{
|
||||
walk.setLastAction(System.currentTimeMillis());
|
||||
}
|
||||
ThreadPoolManager.getInstance().scheduleGeneral(new ArrivedTask(npc, walk), 100 + (node.getDelay() * 1000L));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -408,7 +408,6 @@ public class Lottery
|
||||
sm.addInt(getId());
|
||||
sm.addLong(getPrize());
|
||||
sm.addLong(count1);
|
||||
Broadcast.toAllOnlinePlayers(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -416,8 +415,8 @@ public class Lottery
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_PRIZE_AMOUNT_FOR_LUCKY_LOTTERY_S1_IS_S2_ADENA_THERE_WAS_NO_FIRST_PRIZE_WINNER_IN_THIS_DRAWING_THEREFORE_THE_JACKPOT_WILL_BE_ADDED_TO_THE_NEXT_DRAWING);
|
||||
sm.addInt(getId());
|
||||
sm.addLong(getPrize());
|
||||
Broadcast.toAllOnlinePlayers(sm);
|
||||
}
|
||||
Broadcast.toAllOnlinePlayers(sm);
|
||||
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(UPDATE_LOTTERY))
|
||||
|
@@ -38,22 +38,7 @@ public final class FourSepulchersChangeEntryTimeTask implements Runnable
|
||||
manager.setIsAttackTime(false);
|
||||
manager.setIsCoolDownTime(false);
|
||||
|
||||
long interval = 0;
|
||||
// if this is first launch - search time whFourSepulchersManager_inEntryTime = true;naFourSepulchersManager_inEntryTime = true;maen entry time will be
|
||||
// ended:
|
||||
// counting difference between time when entry time ends and current
|
||||
// time
|
||||
// and then launching change time task
|
||||
if (manager.isFirstTimeRun())
|
||||
{
|
||||
interval = manager.getEntrytTimeEnd() - Calendar.getInstance().getTimeInMillis();
|
||||
}
|
||||
else
|
||||
{
|
||||
interval = Config.FS_TIME_ENTRY * 60000L; // else use stupid
|
||||
// method
|
||||
}
|
||||
|
||||
final long interval = manager.isFirstTimeRun() ? manager.getEntrytTimeEnd() - Calendar.getInstance().getTimeInMillis() : Config.FS_TIME_ENTRY * 60000L;
|
||||
// launching saying process...
|
||||
ThreadPoolManager.getInstance().scheduleGeneral(new FourSepulchersManagerSayTask(), 0);
|
||||
manager.setChangeWarmUpTimeTask(ThreadPoolManager.getInstance().scheduleEffect(new FourSepulchersChangeWarmUpTimeTask(), interval));
|
||||
|
@@ -38,20 +38,7 @@ public final class FourSepulchersChangeWarmUpTimeTask implements Runnable
|
||||
manager.setIsAttackTime(false);
|
||||
manager.setIsCoolDownTime(false);
|
||||
|
||||
long interval = 0;
|
||||
// searching time when warmup time will be ended:
|
||||
// counting difference between time when warmup time ends and
|
||||
// current time
|
||||
// and then launching change time task
|
||||
if (manager.isFirstTimeRun())
|
||||
{
|
||||
interval = manager.getWarmUpTimeEnd() - Calendar.getInstance().getTimeInMillis();
|
||||
}
|
||||
else
|
||||
{
|
||||
interval = Config.FS_TIME_WARMUP * 60000L;
|
||||
}
|
||||
|
||||
final long interval = manager.isFirstTimeRun() ? manager.getWarmUpTimeEnd() - Calendar.getInstance().getTimeInMillis() : Config.FS_TIME_WARMUP * 60000L;
|
||||
manager.setChangeAttackTimeTask(ThreadPoolManager.getInstance().scheduleGeneral(new FourSepulchersChangeAttackTimeTask(), interval));
|
||||
final ScheduledFuture<?> changeWarmUpTimeTask = manager.getChangeWarmUpTimeTask();
|
||||
|
||||
|
@@ -28,5 +28,4 @@ public class GrandBossManagerStoreTask implements Runnable
|
||||
{
|
||||
GrandBossManager.getInstance().storeMe();
|
||||
}
|
||||
|
||||
}
|
@@ -71,9 +71,7 @@ public final class MessageDeletionTask implements Runnable
|
||||
final L2PcInstance receiver = L2World.getInstance().getPlayer(msg.getReceiverId());
|
||||
if (receiver != null)
|
||||
{
|
||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME);
|
||||
// sm.addString(msg.getReceiverName());
|
||||
receiver.sendPacket(sm);
|
||||
receiver.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
Reference in New Issue
Block a user