Various unnecessary code changes.
This commit is contained in:
@@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
*/
|
||||
public class FortUpdater implements Runnable
|
||||
{
|
||||
protected static Logger LOGGER = Logger.getLogger(FortUpdater.class.getName());
|
||||
private static Logger LOGGER = Logger.getLogger(FortUpdater.class.getName());
|
||||
private final L2Clan _clan;
|
||||
private final Fort _fort;
|
||||
private int _runCount;
|
||||
|
@@ -488,7 +488,7 @@ public class GameServer
|
||||
INSTANCE = new GameServer();
|
||||
}
|
||||
|
||||
public static void printSection(String s)
|
||||
private static void printSection(String s)
|
||||
{
|
||||
s = "=[ " + s + " ]";
|
||||
while (s.length() < 61)
|
||||
|
@@ -39,9 +39,7 @@ public final class GameTimeController extends Thread
|
||||
public static final int IG_DAYS_PER_DAY = 6;
|
||||
public static final int MILLIS_PER_IG_DAY = (3600000 * 24) / IG_DAYS_PER_DAY;
|
||||
public static final int SECONDS_PER_IG_DAY = MILLIS_PER_IG_DAY / 1000;
|
||||
public static final int MINUTES_PER_IG_DAY = SECONDS_PER_IG_DAY / 60;
|
||||
public static final int TICKS_PER_IG_DAY = SECONDS_PER_IG_DAY * TICKS_PER_SECOND;
|
||||
public static final int TICKS_SUN_STATE_CHANGE = TICKS_PER_IG_DAY / 4;
|
||||
|
||||
private static GameTimeController _instance;
|
||||
|
||||
|
@@ -46,7 +46,7 @@ public final class ItemsAutoDestroy
|
||||
_items.add(item);
|
||||
}
|
||||
|
||||
public synchronized void removeItems()
|
||||
private synchronized void removeItems()
|
||||
{
|
||||
if (_items.isEmpty())
|
||||
{
|
||||
|
@@ -60,10 +60,10 @@ public class Shutdown extends Thread
|
||||
|
||||
private int _secondsShut;
|
||||
private int _shutdownMode;
|
||||
public static final int SIGTERM = 0;
|
||||
public static final int GM_SHUTDOWN = 1;
|
||||
public static final int GM_RESTART = 2;
|
||||
public static final int ABORT = 3;
|
||||
private static final int SIGTERM = 0;
|
||||
private static final int GM_SHUTDOWN = 1;
|
||||
private static final int GM_RESTART = 2;
|
||||
private static final int ABORT = 3;
|
||||
private static final String[] MODE_TEXT =
|
||||
{
|
||||
"SIGTERM",
|
||||
|
@@ -81,7 +81,7 @@ public abstract class AbstractAI implements Ctrl
|
||||
/** Flags about client's state, in order to know which messages to send */
|
||||
protected volatile boolean _clientMoving;
|
||||
/** Flags about client's state, in order to know which messages to send */
|
||||
protected volatile boolean _clientAutoAttacking;
|
||||
private volatile boolean _clientAutoAttacking;
|
||||
/** Flags about client's state, in order to know which messages to send */
|
||||
protected int _clientMovingToPawnOffset;
|
||||
|
||||
@@ -97,7 +97,7 @@ public abstract class AbstractAI implements Ctrl
|
||||
/** Different internal state flags */
|
||||
protected int _moveToPawnTimeout;
|
||||
|
||||
protected Future<?> _followTask = null;
|
||||
private Future<?> _followTask = null;
|
||||
private static final int FOLLOW_INTERVAL = 1000;
|
||||
private static final int ATTACK_FOLLOW_INTERVAL = 500;
|
||||
|
||||
@@ -630,7 +630,7 @@ public abstract class AbstractAI implements Ctrl
|
||||
* Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop <I>(broadcast)</I>.<br>
|
||||
* <FONT COLOR=#FF0000><B> <U>Caution</U> : Low level function, used by AI subclasses</B></FONT>
|
||||
*/
|
||||
public void clientStopAutoAttack()
|
||||
void clientStopAutoAttack()
|
||||
{
|
||||
if (_actor.isSummon())
|
||||
{
|
||||
|
@@ -36,14 +36,14 @@ public class L2PlayerAI extends L2PlayableAI
|
||||
{
|
||||
private boolean _thinking; // to prevent recursive thinking
|
||||
|
||||
IntentionCommand _nextIntention = null;
|
||||
private IntentionCommand _nextIntention = null;
|
||||
|
||||
public L2PlayerAI(L2PcInstance player)
|
||||
{
|
||||
super(player);
|
||||
}
|
||||
|
||||
void saveNextIntention(CtrlIntention intention, Object arg0, Object arg1)
|
||||
private void saveNextIntention(CtrlIntention intention, Object arg0, Object arg1)
|
||||
{
|
||||
_nextIntention = new IntentionCommand(intention, arg0, arg1);
|
||||
}
|
||||
|
@@ -28,8 +28,8 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
*/
|
||||
public class WarehouseCacheManager
|
||||
{
|
||||
protected final Map<L2PcInstance, Long> _cachedWh = new ConcurrentHashMap<>();
|
||||
protected final long _cacheTime = Config.WAREHOUSE_CACHE_TIME * 60000;
|
||||
final Map<L2PcInstance, Long> _cachedWh = new ConcurrentHashMap<>();
|
||||
final long _cacheTime = Config.WAREHOUSE_CACHE_TIME * 60000;
|
||||
|
||||
protected WarehouseCacheManager()
|
||||
{
|
||||
@@ -46,8 +46,12 @@ public class WarehouseCacheManager
|
||||
_cachedWh.remove(pc);
|
||||
}
|
||||
|
||||
public class CacheScheduler implements Runnable
|
||||
private class CacheScheduler implements Runnable
|
||||
{
|
||||
public CacheScheduler()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
|
@@ -70,7 +70,7 @@ public class Post
|
||||
insertindb(cp);
|
||||
}
|
||||
|
||||
public void insertindb(CPost cp)
|
||||
private void insertindb(CPost cp)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)"))
|
||||
|
@@ -69,7 +69,7 @@ public class Topic
|
||||
}
|
||||
}
|
||||
|
||||
public void insertindb()
|
||||
private void insertindb()
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO topic (topic_id,topic_forum_id,topic_name,topic_date,topic_ownername,topic_ownerid,topic_type,topic_reply) values (?,?,?,?,?,?,?,?)"))
|
||||
|
@@ -104,7 +104,7 @@ public final class AnnouncementsTable
|
||||
* @param player
|
||||
* @param type
|
||||
*/
|
||||
public void sendAnnouncements(L2PcInstance player, AnnouncementType type)
|
||||
private void sendAnnouncements(L2PcInstance player, AnnouncementType type)
|
||||
{
|
||||
for (IAnnouncement announce : _announcements.values())
|
||||
{
|
||||
|
@@ -60,8 +60,8 @@ public class SummonEffectsTable
|
||||
|
||||
public static class SummonEffect
|
||||
{
|
||||
Skill _skill;
|
||||
int _effectCurTime;
|
||||
private final Skill _skill;
|
||||
private final int _effectCurTime;
|
||||
|
||||
public SummonEffect(Skill skill, int effectCurTime)
|
||||
{
|
||||
|
@@ -35,8 +35,7 @@ import com.l2jmobius.gameserver.model.holders.LuckyGameDataHolder;
|
||||
public class LuckyGameData implements IGameXmlReader
|
||||
{
|
||||
private final Map<Integer, LuckyGameDataHolder> _luckyGame = new HashMap<>();
|
||||
|
||||
final AtomicInteger _serverPlay = new AtomicInteger();
|
||||
private final AtomicInteger _serverPlay = new AtomicInteger();
|
||||
|
||||
protected LuckyGameData()
|
||||
{
|
||||
|
@@ -1215,7 +1215,7 @@ public final class SkillTreesData implements IGameXmlReader
|
||||
* @param lvl the transformation skill level
|
||||
* @return the transform skill from the Transform Skill Tree for a given {@code id} and {@code lvl}
|
||||
*/
|
||||
public L2SkillLearn getTransformSkill(int id, int lvl)
|
||||
private L2SkillLearn getTransformSkill(int id, int lvl)
|
||||
{
|
||||
return _transformSkillTree.get(SkillData.getSkillHashCode(id, lvl));
|
||||
}
|
||||
@@ -1237,7 +1237,7 @@ public final class SkillTreesData implements IGameXmlReader
|
||||
* @param lvl the alchemy skill level
|
||||
* @return the alchemy skill from the Alchemy Skill Tree for a given {@code id} and {@code lvl}
|
||||
*/
|
||||
public L2SkillLearn getAlchemySkill(int id, int lvl)
|
||||
private L2SkillLearn getAlchemySkill(int id, int lvl)
|
||||
{
|
||||
return _alchemySkillTree.get(SkillData.getSkillHashCode(id, lvl));
|
||||
}
|
||||
@@ -1260,7 +1260,7 @@ public final class SkillTreesData implements IGameXmlReader
|
||||
* @param lvl the fishing skill level
|
||||
* @return Fishing skill from the Fishing Skill Tree for a given {@code id} and {@code lvl}
|
||||
*/
|
||||
public L2SkillLearn getFishingSkill(int id, int lvl)
|
||||
private L2SkillLearn getFishingSkill(int id, int lvl)
|
||||
{
|
||||
return _fishingSkillTree.get(SkillData.getSkillHashCode(id, lvl));
|
||||
}
|
||||
@@ -1271,7 +1271,7 @@ public final class SkillTreesData implements IGameXmlReader
|
||||
* @param lvl the pledge skill level
|
||||
* @return the pledge skill from the Pledge Skill Tree for a given {@code id} and {@code lvl}
|
||||
*/
|
||||
public L2SkillLearn getPledgeSkill(int id, int lvl)
|
||||
private L2SkillLearn getPledgeSkill(int id, int lvl)
|
||||
{
|
||||
return _pledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl));
|
||||
}
|
||||
@@ -1282,7 +1282,7 @@ public final class SkillTreesData implements IGameXmlReader
|
||||
* @param lvl the sub-pledge skill level
|
||||
* @return the sub-pledge skill from the Sub-Pledge Skill Tree for a given {@code id} and {@code lvl}
|
||||
*/
|
||||
public L2SkillLearn getSubPledgeSkill(int id, int lvl)
|
||||
private L2SkillLearn getSubPledgeSkill(int id, int lvl)
|
||||
{
|
||||
return _subPledgeSkillTree.get(SkillData.getSkillHashCode(id, lvl));
|
||||
}
|
||||
@@ -1294,7 +1294,7 @@ public final class SkillTreesData implements IGameXmlReader
|
||||
* @param classId the transfer skill tree Id
|
||||
* @return the transfer skill from the Transfer Skill Trees for a given {@code classId}, {@code id} and {@code lvl}
|
||||
*/
|
||||
public L2SkillLearn getTransferSkill(int id, int lvl, ClassId classId)
|
||||
private L2SkillLearn getTransferSkill(int id, int lvl, ClassId classId)
|
||||
{
|
||||
if (_transferSkillTrees.get(classId) != null)
|
||||
{
|
||||
@@ -1310,7 +1310,7 @@ public final class SkillTreesData implements IGameXmlReader
|
||||
* @param race the race skill tree Id
|
||||
* @return the transfer skill from the Race Skill Trees for a given {@code race}, {@code id} and {@code lvl}
|
||||
*/
|
||||
public L2SkillLearn getRaceSkill(int id, int lvl, Race race)
|
||||
private L2SkillLearn getRaceSkill(int id, int lvl, Race race)
|
||||
{
|
||||
for (L2SkillLearn skill : getRaceSkillTree(race))
|
||||
{
|
||||
@@ -1328,7 +1328,7 @@ public final class SkillTreesData implements IGameXmlReader
|
||||
* @param lvl the sub-class skill level
|
||||
* @return the sub-class skill from the Sub-Class Skill Tree for a given {@code id} and {@code lvl}
|
||||
*/
|
||||
public L2SkillLearn getSubClassSkill(int id, int lvl)
|
||||
private L2SkillLearn getSubClassSkill(int id, int lvl)
|
||||
{
|
||||
return _subClassSkillTree.get(SkillData.getSkillHashCode(id, lvl));
|
||||
}
|
||||
|
@@ -595,25 +595,28 @@ public final class BotReportTable
|
||||
}
|
||||
}
|
||||
|
||||
class PunishHolder
|
||||
private class PunishHolder
|
||||
{
|
||||
final Skill _punish;
|
||||
final int _systemMessageId;
|
||||
|
||||
PunishHolder(Skill sk, int sysMsg)
|
||||
public PunishHolder(Skill sk, int sysMsg)
|
||||
{
|
||||
_punish = sk;
|
||||
_systemMessageId = sysMsg;
|
||||
}
|
||||
}
|
||||
|
||||
class ResetPointTask implements Runnable
|
||||
private class ResetPointTask implements Runnable
|
||||
{
|
||||
public ResetPointTask()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
resetPointsAndSchedule();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -21,10 +21,10 @@ import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
|
||||
public class Item
|
||||
{
|
||||
public int id;
|
||||
public String type;
|
||||
public String name;
|
||||
public StatsSet set;
|
||||
public int currentLevel;
|
||||
public L2Item item;
|
||||
int id;
|
||||
String type;
|
||||
String name;
|
||||
StatsSet set;
|
||||
int currentLevel;
|
||||
L2Item item;
|
||||
}
|
||||
|
@@ -29,15 +29,12 @@ import com.l2jmobius.gameserver.data.xml.impl.DoorData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.FenceData;
|
||||
import com.l2jmobius.gameserver.geoengine.geodata.ABlock;
|
||||
import com.l2jmobius.gameserver.geoengine.geodata.BlockComplex;
|
||||
import com.l2jmobius.gameserver.geoengine.geodata.BlockComplexDynamic;
|
||||
import com.l2jmobius.gameserver.geoengine.geodata.BlockFlat;
|
||||
import com.l2jmobius.gameserver.geoengine.geodata.BlockMultilayer;
|
||||
import com.l2jmobius.gameserver.geoengine.geodata.BlockMultilayerDynamic;
|
||||
import com.l2jmobius.gameserver.geoengine.geodata.BlockNull;
|
||||
import com.l2jmobius.gameserver.geoengine.geodata.GeoFormat;
|
||||
import com.l2jmobius.gameserver.geoengine.geodata.GeoLocation;
|
||||
import com.l2jmobius.gameserver.geoengine.geodata.GeoStructure;
|
||||
import com.l2jmobius.gameserver.geoengine.geodata.IBlockDynamic;
|
||||
import com.l2jmobius.gameserver.geoengine.geodata.IGeoObject;
|
||||
import com.l2jmobius.gameserver.instancemanager.WarpedSpaceManager;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
@@ -276,7 +273,7 @@ public class GeoEngine
|
||||
* @param geoY : Geodata Y
|
||||
* @return {@link ABlock} : Block of geodata.
|
||||
*/
|
||||
public final ABlock getBlock(int geoX, int geoY)
|
||||
private final ABlock getBlock(int geoX, int geoY)
|
||||
{
|
||||
final int x = geoX / GeoStructure.BLOCK_CELLS_X;
|
||||
final int y = geoY / GeoStructure.BLOCK_CELLS_Y;
|
||||
@@ -328,7 +325,7 @@ public class GeoEngine
|
||||
* @param worldZ : Cell world Z coordinate.
|
||||
* @return short : Cell geodata Z coordinate, closest to given coordinates.
|
||||
*/
|
||||
public final short getHeightNearestOriginal(int geoX, int geoY, int worldZ)
|
||||
private final short getHeightNearestOriginal(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
final ABlock block = getBlock(geoX, geoY);
|
||||
return block != null ? block.getHeightNearestOriginal(geoX, geoY, worldZ) : (short) worldZ;
|
||||
@@ -355,7 +352,7 @@ public class GeoEngine
|
||||
* @param worldZ : Cell world Z coordinate.
|
||||
* @return short : Cell NSWE flag byte coordinate, closest to given coordinates.
|
||||
*/
|
||||
public final byte getNsweNearestOriginal(int geoX, int geoY, int worldZ)
|
||||
private final byte getNsweNearestOriginal(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
final ABlock block = getBlock(geoX, geoY);
|
||||
return block != null ? block.getNsweNearestOriginal(geoX, geoY, worldZ) : (byte) 0xFF;
|
||||
@@ -384,200 +381,6 @@ public class GeoEngine
|
||||
return getHeightNearest(getGeoX(worldX), getGeoY(worldY), worldZ);
|
||||
}
|
||||
|
||||
// GEODATA - DYNAMIC
|
||||
|
||||
/**
|
||||
* Returns calculated NSWE flag byte as a description of {@link IGeoObject}.<br>
|
||||
* The {@link IGeoObject} is defined by boolean 2D array, saying if the object is present on given cell or not.
|
||||
* @param inside : 2D description of {@link IGeoObject}
|
||||
* @return byte[][] : Returns NSWE flags of {@link IGeoObject}.
|
||||
*/
|
||||
public static byte[][] calculateGeoObject(boolean inside[][])
|
||||
{
|
||||
// get dimensions
|
||||
final int width = inside.length;
|
||||
final int height = inside[0].length;
|
||||
|
||||
// create object flags for geodata, according to the geo object 2D description
|
||||
final byte[][] result = new byte[width][height];
|
||||
|
||||
// loop over each cell of the geo object
|
||||
for (int ix = 0; ix < width; ix++)
|
||||
{
|
||||
for (int iy = 0; iy < height; iy++)
|
||||
{
|
||||
if (inside[ix][iy])
|
||||
{
|
||||
// cell is inside geo object, block whole movement (nswe = 0)
|
||||
result[ix][iy] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// cell is outside of geo object, block only movement leading inside geo object
|
||||
|
||||
// set initial value -> no geodata change
|
||||
byte nswe = (byte) 0xFF;
|
||||
|
||||
// perform axial and diagonal checks
|
||||
if (iy < (height - 1))
|
||||
{
|
||||
if (inside[ix][iy + 1])
|
||||
{
|
||||
nswe &= ~GeoStructure.CELL_FLAG_S;
|
||||
}
|
||||
}
|
||||
if (iy > 0)
|
||||
{
|
||||
if (inside[ix][iy - 1])
|
||||
{
|
||||
nswe &= ~GeoStructure.CELL_FLAG_N;
|
||||
}
|
||||
}
|
||||
if (ix < (width - 1))
|
||||
{
|
||||
if (inside[ix + 1][iy])
|
||||
{
|
||||
nswe &= ~GeoStructure.CELL_FLAG_E;
|
||||
}
|
||||
}
|
||||
if (ix > 0)
|
||||
{
|
||||
if (inside[ix - 1][iy])
|
||||
{
|
||||
nswe &= ~GeoStructure.CELL_FLAG_W;
|
||||
}
|
||||
}
|
||||
if ((ix < (width - 1)) && (iy < (height - 1)))
|
||||
{
|
||||
if (inside[ix + 1][iy + 1] || inside[ix][iy + 1] || inside[ix + 1][iy])
|
||||
{
|
||||
nswe &= ~GeoStructure.CELL_FLAG_SE;
|
||||
}
|
||||
}
|
||||
if ((ix < (width - 1)) && (iy > 0))
|
||||
{
|
||||
if (inside[ix + 1][iy - 1] || inside[ix][iy - 1] || inside[ix + 1][iy])
|
||||
{
|
||||
nswe &= ~GeoStructure.CELL_FLAG_NE;
|
||||
}
|
||||
}
|
||||
if ((ix > 0) && (iy < (height - 1)))
|
||||
{
|
||||
if (inside[ix - 1][iy + 1] || inside[ix][iy + 1] || inside[ix - 1][iy])
|
||||
{
|
||||
nswe &= ~GeoStructure.CELL_FLAG_SW;
|
||||
}
|
||||
}
|
||||
if ((ix > 0) && (iy > 0))
|
||||
{
|
||||
if (inside[ix - 1][iy - 1] || inside[ix][iy - 1] || inside[ix - 1][iy])
|
||||
{
|
||||
nswe &= ~GeoStructure.CELL_FLAG_NW;
|
||||
}
|
||||
}
|
||||
|
||||
result[ix][iy] = nswe;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add {@link IGeoObject} to the geodata.
|
||||
* @param object : An object using {@link IGeoObject} interface.
|
||||
*/
|
||||
public final void addGeoObject(IGeoObject object)
|
||||
{
|
||||
toggleGeoObject(object, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove {@link IGeoObject} from the geodata.
|
||||
* @param object : An object using {@link IGeoObject} interface.
|
||||
*/
|
||||
public final void removeGeoObject(IGeoObject object)
|
||||
{
|
||||
toggleGeoObject(object, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles an {@link IGeoObject} in the geodata.
|
||||
* @param object : An object using {@link IGeoObject} interface.
|
||||
* @param add : Add/remove object.
|
||||
*/
|
||||
private final void toggleGeoObject(IGeoObject object, boolean add)
|
||||
{
|
||||
// get object geo coordinates and data
|
||||
final int minGX = object.getGeoX();
|
||||
final int minGY = object.getGeoY();
|
||||
final byte[][] geoData = object.getObjectGeoData();
|
||||
|
||||
// get min/max block coordinates
|
||||
int minBX = minGX / GeoStructure.BLOCK_CELLS_X;
|
||||
int maxBX = ((minGX + geoData.length) - 1) / GeoStructure.BLOCK_CELLS_X;
|
||||
int minBY = minGY / GeoStructure.BLOCK_CELLS_Y;
|
||||
int maxBY = ((minGY + geoData[0].length) - 1) / GeoStructure.BLOCK_CELLS_Y;
|
||||
|
||||
// loop over affected blocks in X direction
|
||||
for (int bx = minBX; bx <= maxBX; bx++)
|
||||
{
|
||||
// loop over affected blocks in Y direction
|
||||
for (int by = minBY; by <= maxBY; by++)
|
||||
{
|
||||
ABlock block;
|
||||
|
||||
// conversion to dynamic block must be synchronized to prevent 2 independent threads converting same block
|
||||
synchronized (_blocks)
|
||||
{
|
||||
// get related block
|
||||
block = _blocks[bx][by];
|
||||
|
||||
// check for dynamic block
|
||||
if (!(block instanceof IBlockDynamic))
|
||||
{
|
||||
// null block means no geodata (particular region file is not loaded), no geodata means no geobjects
|
||||
if (block instanceof BlockNull)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// not a dynamic block, convert it
|
||||
if (block instanceof BlockFlat)
|
||||
{
|
||||
// convert flat block to the dynamic complex block
|
||||
block = new BlockComplexDynamic(bx, by, (BlockFlat) block);
|
||||
_blocks[bx][by] = block;
|
||||
}
|
||||
else if (block instanceof BlockComplex)
|
||||
{
|
||||
// convert complex block to the dynamic complex block
|
||||
block = new BlockComplexDynamic(bx, by, (BlockComplex) block);
|
||||
_blocks[bx][by] = block;
|
||||
}
|
||||
else if (block instanceof BlockMultilayer)
|
||||
{
|
||||
// convert multilayer block to the dynamic multilayer block
|
||||
block = new BlockMultilayerDynamic(bx, by, (BlockMultilayer) block);
|
||||
_blocks[bx][by] = block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add/remove geo object to/from dynamic block
|
||||
if (add)
|
||||
{
|
||||
((IBlockDynamic) block).addGeoObject(object);
|
||||
}
|
||||
else
|
||||
{
|
||||
((IBlockDynamic) block).removeGeoObject(object);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PATHFINDING
|
||||
|
||||
/**
|
||||
@@ -732,7 +535,7 @@ public class GeoEngine
|
||||
* @param instance
|
||||
* @return {@code boolean} : True, when target can be seen.
|
||||
*/
|
||||
protected final boolean checkSee(int gox, int goy, int goz, double oheight, int gtx, int gty, int gtz, double theight, Instance instance)
|
||||
private final boolean checkSee(int gox, int goy, int goz, double oheight, int gtx, int gty, int gtz, double theight, Instance instance)
|
||||
{
|
||||
// get line of sight Z coordinates
|
||||
double losoz = goz + ((oheight * Config.PART_OF_CHARACTER_HEIGHT) / 100);
|
||||
@@ -915,7 +718,7 @@ public class GeoEngine
|
||||
* @param instance
|
||||
* @return {@code boolean} : True, when target can be seen.
|
||||
*/
|
||||
protected final boolean checkSeeOriginal(int gox, int goy, int goz, double oheight, int gtx, int gty, int gtz, double theight, Instance instance)
|
||||
private final boolean checkSeeOriginal(int gox, int goy, int goz, double oheight, int gtx, int gty, int gtz, double theight, Instance instance)
|
||||
{
|
||||
// get line of sight Z coordinates
|
||||
double losoz = goz + ((oheight * Config.PART_OF_CHARACTER_HEIGHT) / 100);
|
||||
|
@@ -1,255 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.geoengine.geodata;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Hasha
|
||||
*/
|
||||
public final class BlockComplexDynamic extends BlockComplex implements IBlockDynamic
|
||||
{
|
||||
private final int _bx;
|
||||
private final int _by;
|
||||
private final byte[] _original;
|
||||
private final List<IGeoObject> _objects;
|
||||
|
||||
/**
|
||||
* Creates {@link BlockComplexDynamic}.
|
||||
* @param bx : Block X coordinate.
|
||||
* @param by : Block Y coordinate.
|
||||
* @param block : The original FlatBlock to create a dynamic version from.
|
||||
*/
|
||||
public BlockComplexDynamic(int bx, int by, BlockFlat block)
|
||||
{
|
||||
// load data
|
||||
final byte nswe = block._nswe;
|
||||
final byte heightLow = (byte) (block._height & 0x00FF);
|
||||
final byte heightHigh = (byte) (block._height >> 8);
|
||||
|
||||
// initialize buffer
|
||||
_buffer = new byte[GeoStructure.BLOCK_CELLS * 3];
|
||||
|
||||
// save data
|
||||
for (int i = 0; i < GeoStructure.BLOCK_CELLS; i++)
|
||||
{
|
||||
// set nswe
|
||||
_buffer[i * 3] = nswe;
|
||||
|
||||
// set height
|
||||
_buffer[(i * 3) + 1] = heightLow;
|
||||
_buffer[(i * 3) + 2] = heightHigh;
|
||||
}
|
||||
|
||||
// get block coordinates
|
||||
_bx = bx;
|
||||
_by = by;
|
||||
|
||||
// create copy for dynamic implementation
|
||||
_original = new byte[GeoStructure.BLOCK_CELLS * 3];
|
||||
System.arraycopy(_buffer, 0, _original, 0, GeoStructure.BLOCK_CELLS * 3);
|
||||
|
||||
// create list for geo objects
|
||||
_objects = new LinkedList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates {@link BlockComplexDynamic}.
|
||||
* @param bx : Block X coordinate.
|
||||
* @param by : Block Y coordinate.
|
||||
* @param block : The original ComplexBlock to create a dynamic version from.
|
||||
*/
|
||||
public BlockComplexDynamic(int bx, int by, BlockComplex block)
|
||||
{
|
||||
// move buffer from BlockComplex object to this object
|
||||
_buffer = block._buffer;
|
||||
block._buffer = null;
|
||||
|
||||
// get block coordinates
|
||||
_bx = bx;
|
||||
_by = by;
|
||||
|
||||
// create copy for dynamic implementation
|
||||
_original = new byte[GeoStructure.BLOCK_CELLS * 3];
|
||||
System.arraycopy(_buffer, 0, _original, 0, GeoStructure.BLOCK_CELLS * 3);
|
||||
|
||||
// create list for geo objects
|
||||
_objects = new LinkedList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final short getHeightNearestOriginal(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
// get cell index
|
||||
final int index = (((geoX % GeoStructure.BLOCK_CELLS_X) * GeoStructure.BLOCK_CELLS_Y) + (geoY % GeoStructure.BLOCK_CELLS_Y)) * 3;
|
||||
|
||||
// get height
|
||||
return (short) ((_original[index + 1] & 0x00FF) | (_original[index + 2] << 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final byte getNsweNearestOriginal(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
// get cell index
|
||||
final int index = (((geoX % GeoStructure.BLOCK_CELLS_X) * GeoStructure.BLOCK_CELLS_Y) + (geoY % GeoStructure.BLOCK_CELLS_Y)) * 3;
|
||||
|
||||
// get nswe
|
||||
return _original[index];
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getIndexAboveOriginal(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
// get cell index
|
||||
final int index = (((geoX % GeoStructure.BLOCK_CELLS_X) * GeoStructure.BLOCK_CELLS_Y) + (geoY % GeoStructure.BLOCK_CELLS_Y)) * 3;
|
||||
|
||||
// get height
|
||||
final int height = (_original[index + 1] & 0x00FF) | (_original[index + 2] << 8);
|
||||
|
||||
// check height and return nswe
|
||||
return height > worldZ ? index : -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getIndexBelowOriginal(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
// get cell index
|
||||
final int index = (((geoX % GeoStructure.BLOCK_CELLS_X) * GeoStructure.BLOCK_CELLS_Y) + (geoY % GeoStructure.BLOCK_CELLS_Y)) * 3;
|
||||
|
||||
// get height
|
||||
final int height = (_original[index + 1] & 0x00FF) | (_original[index + 2] << 8);
|
||||
|
||||
// check height and return nswe
|
||||
return height < worldZ ? index : -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final short getHeightOriginal(int index)
|
||||
{
|
||||
return (short) ((_original[index + 1] & 0x00FF) | (_original[index + 2] << 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final byte getNsweOriginal(int index)
|
||||
{
|
||||
return _original[index];
|
||||
}
|
||||
|
||||
@Override
|
||||
public final synchronized void addGeoObject(IGeoObject object)
|
||||
{
|
||||
// add geo object, update block geodata when added
|
||||
if (_objects.add(object))
|
||||
{
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final synchronized void removeGeoObject(IGeoObject object)
|
||||
{
|
||||
// remove geo object, update block geodata when removed
|
||||
if (_objects.remove(object))
|
||||
{
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
private final void update()
|
||||
{
|
||||
// copy original geodata, than apply changes
|
||||
System.arraycopy(_original, 0, _buffer, 0, GeoStructure.BLOCK_CELLS * 3);
|
||||
|
||||
// get block geo coordinates
|
||||
final int minBX = _bx * GeoStructure.BLOCK_CELLS_X;
|
||||
final int minBY = _by * GeoStructure.BLOCK_CELLS_Y;
|
||||
final int maxBX = minBX + GeoStructure.BLOCK_CELLS_X;
|
||||
final int maxBY = minBY + GeoStructure.BLOCK_CELLS_Y;
|
||||
|
||||
// for all objects
|
||||
for (IGeoObject object : _objects)
|
||||
{
|
||||
// get object geo coordinates and other object variables
|
||||
final int minOX = object.getGeoX();
|
||||
final int minOY = object.getGeoY();
|
||||
final int minOZ = object.getGeoZ();
|
||||
final int maxOZ = minOZ + object.getHeight();
|
||||
final byte[][] geoData = object.getObjectGeoData();
|
||||
|
||||
// calculate min/max geo coordinates for iteration (intersection of block and object)
|
||||
final int minGX = Math.max(minBX, minOX);
|
||||
final int minGY = Math.max(minBY, minOY);
|
||||
final int maxGX = Math.min(maxBX, minOX + geoData.length);
|
||||
final int maxGY = Math.min(maxBY, minOY + geoData[0].length);
|
||||
|
||||
// iterate over intersection of block and object
|
||||
for (int gx = minGX; gx < maxGX; gx++)
|
||||
{
|
||||
for (int gy = minGY; gy < maxGY; gy++)
|
||||
{
|
||||
// get object nswe
|
||||
final byte objNswe = geoData[gx - minOX][gy - minOY];
|
||||
|
||||
// object contains no change of data in this cell, continue to next cell
|
||||
if (objNswe == 0xFF)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// get block index of this cell
|
||||
final int ib = (((gx - minBX) * GeoStructure.BLOCK_CELLS_Y) + (gy - minBY)) * 3;
|
||||
|
||||
// compare block data and original data, when height differs -> height was affected by other geo object
|
||||
// -> cell is inside an object -> no need to check/change it anymore (Z is lifted, nswe is 0)
|
||||
// compare is done in raw format (2 bytes) instead of conversion to short
|
||||
if ((_buffer[ib + 1] != _original[ib + 1]) || (_buffer[ib + 2] != _original[ib + 2]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// so far cell is not inside of any object
|
||||
if (objNswe == 0)
|
||||
{
|
||||
// cell is inside of this object -> set nswe to 0 and lift Z up
|
||||
|
||||
// set block nswe
|
||||
_buffer[ib] = 0;
|
||||
|
||||
// set block Z to object height
|
||||
_buffer[ib + 1] = (byte) (maxOZ & 0x00FF);
|
||||
_buffer[ib + 2] = (byte) (maxOZ >> 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// cell is outside of this object -> update nswe
|
||||
|
||||
// height different is too high (trying to update another layer), skip
|
||||
short z = getHeight(ib);
|
||||
if (Math.abs(z - minOZ) > GeoStructure.CELL_IGNORE_HEIGHT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// adjust block nswe according to the object nswe
|
||||
_buffer[ib] &= objNswe;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,312 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.geoengine.geodata;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Hasha
|
||||
*/
|
||||
public final class BlockMultilayerDynamic extends BlockMultilayer implements IBlockDynamic
|
||||
{
|
||||
private final int _bx;
|
||||
private final int _by;
|
||||
private final byte[] _original;
|
||||
private final List<IGeoObject> _objects;
|
||||
|
||||
/**
|
||||
* Creates {@link BlockMultilayerDynamic}.
|
||||
* @param bx : Block X coordinate.
|
||||
* @param by : Block Y coordinate.
|
||||
* @param block : The original MultilayerBlock to create a dynamic version from.
|
||||
*/
|
||||
public BlockMultilayerDynamic(int bx, int by, BlockMultilayer block)
|
||||
{
|
||||
// move buffer from ComplexBlock object to this object
|
||||
_buffer = block._buffer;
|
||||
block._buffer = null;
|
||||
|
||||
// get block coordinates
|
||||
_bx = bx;
|
||||
_by = by;
|
||||
|
||||
// create copy for dynamic implementation
|
||||
_original = new byte[_buffer.length];
|
||||
System.arraycopy(_buffer, 0, _original, 0, _buffer.length);
|
||||
|
||||
// create list for geo objects
|
||||
_objects = new LinkedList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getHeightNearestOriginal(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
// get cell index
|
||||
final int index = getIndexNearestOriginal(geoX, geoY, worldZ);
|
||||
|
||||
// get height
|
||||
return (short) ((_original[index + 1] & 0x00FF) | (_original[index + 2] << 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getNsweNearestOriginal(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
// get cell index
|
||||
final int index = getIndexNearestOriginal(geoX, geoY, worldZ);
|
||||
|
||||
// get nswe
|
||||
return _original[index];
|
||||
}
|
||||
|
||||
private final int getIndexNearestOriginal(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
// move index to the cell given by coordinates
|
||||
int index = 0;
|
||||
for (int i = 0; i < (((geoX % GeoStructure.BLOCK_CELLS_X) * GeoStructure.BLOCK_CELLS_Y) + (geoY % GeoStructure.BLOCK_CELLS_Y)); i++)
|
||||
{
|
||||
// move index by amount of layers for this cell
|
||||
index += (_original[index] * 3) + 1;
|
||||
}
|
||||
|
||||
// get layers count and shift to first layer data (first from bottom)
|
||||
byte layers = _original[index++];
|
||||
|
||||
// loop though all cell layers, find closest layer
|
||||
int limit = Integer.MAX_VALUE;
|
||||
while (layers-- > 0)
|
||||
{
|
||||
// get layer height
|
||||
final int height = (_original[index + 1] & 0x00FF) | (_original[index + 2] << 8);
|
||||
|
||||
// get Z distance and compare with limit
|
||||
// note: When 2 layers have same distance to worldZ (worldZ is in the middle of them):
|
||||
// > returns bottom layer
|
||||
// >= returns upper layer
|
||||
final int distance = Math.abs(height - worldZ);
|
||||
if (distance > limit)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// update limit and move to next layer
|
||||
limit = distance;
|
||||
index += 3;
|
||||
}
|
||||
|
||||
// return layer index
|
||||
return index - 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getIndexAboveOriginal(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
// move index to the cell given by coordinates
|
||||
int index = 0;
|
||||
for (int i = 0; i < (((geoX % GeoStructure.BLOCK_CELLS_X) * GeoStructure.BLOCK_CELLS_Y) + (geoY % GeoStructure.BLOCK_CELLS_Y)); i++)
|
||||
{
|
||||
// move index by amount of layers for this cell
|
||||
index += (_original[index] * 3) + 1;
|
||||
}
|
||||
|
||||
// get layers count and shift to last layer data (first from bottom)
|
||||
byte layers = _original[index++];
|
||||
index += (layers - 1) * 3;
|
||||
|
||||
// loop though all layers, find first layer above worldZ
|
||||
while (layers-- > 0)
|
||||
{
|
||||
// get layer height
|
||||
final int height = (_original[index + 1] & 0x00FF) | (_original[index + 2] << 8);
|
||||
|
||||
// layer height is higher than worldZ, return layer index
|
||||
if (height > worldZ)
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
// move index to next layer
|
||||
index -= 3;
|
||||
}
|
||||
|
||||
// none layer found
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getIndexBelowOriginal(int geoX, int geoY, int worldZ)
|
||||
{
|
||||
// move index to the cell given by coordinates
|
||||
int index = 0;
|
||||
for (int i = 0; i < (((geoX % GeoStructure.BLOCK_CELLS_X) * GeoStructure.BLOCK_CELLS_Y) + (geoY % GeoStructure.BLOCK_CELLS_Y)); i++)
|
||||
{
|
||||
// move index by amount of layers for this cell
|
||||
index += (_original[index] * 3) + 1;
|
||||
}
|
||||
|
||||
// get layers count and shift to first layer data (first from top)
|
||||
byte layers = _original[index++];
|
||||
|
||||
// loop though all layers, find first layer below worldZ
|
||||
while (layers-- > 0)
|
||||
{
|
||||
// get layer height
|
||||
final int height = (_original[index + 1] & 0x00FF) | (_original[index + 2] << 8);
|
||||
|
||||
// layer height is lower than worldZ, return layer index
|
||||
if (height < worldZ)
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
// move index to next layer
|
||||
index += 3;
|
||||
}
|
||||
|
||||
// none layer found
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getHeightOriginal(int index)
|
||||
{
|
||||
// get height
|
||||
return (short) ((_original[index + 1] & 0x00FF) | (_original[index + 2] << 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getNsweOriginal(int index)
|
||||
{
|
||||
// get nswe
|
||||
return _original[index];
|
||||
}
|
||||
|
||||
@Override
|
||||
public final synchronized void addGeoObject(IGeoObject object)
|
||||
{
|
||||
// add geo object, update block geodata when added
|
||||
if (_objects.add(object))
|
||||
{
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final synchronized void removeGeoObject(IGeoObject object)
|
||||
{
|
||||
// remove geo object, update block geodata when removed
|
||||
if (_objects.remove(object))
|
||||
{
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
private final void update()
|
||||
{
|
||||
// copy original geodata, than apply changes
|
||||
System.arraycopy(_original, 0, _buffer, 0, _original.length);
|
||||
|
||||
// get block geo coordinates
|
||||
final int minBX = _bx * GeoStructure.BLOCK_CELLS_X;
|
||||
final int minBY = _by * GeoStructure.BLOCK_CELLS_Y;
|
||||
final int maxBX = minBX + GeoStructure.BLOCK_CELLS_X;
|
||||
final int maxBY = minBY + GeoStructure.BLOCK_CELLS_Y;
|
||||
|
||||
// for all objects
|
||||
for (IGeoObject object : _objects)
|
||||
{
|
||||
// get object geo coordinates and other object variables
|
||||
final int minOX = object.getGeoX();
|
||||
final int minOY = object.getGeoY();
|
||||
final int minOZ = object.getGeoZ();
|
||||
final int maxOZ = minOZ + object.getHeight();
|
||||
final byte[][] geoData = object.getObjectGeoData();
|
||||
|
||||
// calculate min/max geo coordinates for iteration (intersection of block and object)
|
||||
final int minGX = Math.max(minBX, minOX);
|
||||
final int minGY = Math.max(minBY, minOY);
|
||||
final int maxGX = Math.min(maxBX, minOX + geoData.length);
|
||||
final int maxGY = Math.min(maxBY, minOY + geoData[0].length);
|
||||
|
||||
// iterate over intersection of block and object
|
||||
for (int gx = minGX; gx < maxGX; gx++)
|
||||
{
|
||||
for (int gy = minGY; gy < maxGY; gy++)
|
||||
{
|
||||
// get object nswe
|
||||
final byte objNswe = geoData[gx - minOX][gy - minOY];
|
||||
|
||||
// object contains no change of data in this cell, continue to next cell
|
||||
if (objNswe == 0xFF)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// get block index of this cell
|
||||
int ib = getIndexNearest(gx, gy, minOZ);
|
||||
|
||||
// compare block data and original data, when height differs -> height was affected by other geo object
|
||||
// -> cell is inside an object -> no need to check/change it anymore (Z is lifted, nswe is 0)
|
||||
// compare is done in raw format (2 bytes) instead of conversion to short
|
||||
if ((_buffer[ib + 1] != _original[ib + 1]) || (_buffer[ib + 2] != _original[ib + 2]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// so far cell is not inside of any object
|
||||
if (objNswe == 0)
|
||||
{
|
||||
// cell is inside of this object -> set nswe to 0 and lift Z up
|
||||
|
||||
// set block nswe
|
||||
_buffer[ib] = 0;
|
||||
|
||||
// calculate object height, limit to next layer
|
||||
int z = maxOZ;
|
||||
int i = getIndexAbove(gx, gy, minOZ);
|
||||
if (i != -1)
|
||||
{
|
||||
int az = getHeight(i);
|
||||
if (az <= maxOZ)
|
||||
{
|
||||
z = az - GeoStructure.CELL_IGNORE_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
// set block Z to object height
|
||||
_buffer[ib + 1] = (byte) (z & 0x00FF);
|
||||
_buffer[ib + 2] = (byte) (z >> 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// cell is outside of this object -> update nswe
|
||||
|
||||
// height different is too high (trying to update another layer), skip
|
||||
short z = getHeight(ib);
|
||||
if (Math.abs(z - minOZ) > GeoStructure.CELL_IGNORE_HEIGHT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// adjust block nswe according to the object nswe
|
||||
_buffer[ib] &= objNswe;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -32,12 +32,7 @@ public final class GeoStructure
|
||||
public static final byte CELL_FLAG_SW = 1 << 5;
|
||||
public static final byte CELL_FLAG_NE = 1 << 6;
|
||||
public static final byte CELL_FLAG_NW = (byte) (1 << 7);
|
||||
public static final byte CELL_FLAG_S_AND_E = CELL_FLAG_S | CELL_FLAG_E;
|
||||
public static final byte CELL_FLAG_S_AND_W = CELL_FLAG_S | CELL_FLAG_W;
|
||||
public static final byte CELL_FLAG_N_AND_E = CELL_FLAG_N | CELL_FLAG_E;
|
||||
public static final byte CELL_FLAG_N_AND_W = CELL_FLAG_N | CELL_FLAG_W;
|
||||
|
||||
public static final int CELL_SIZE = 16;
|
||||
public static final int CELL_HEIGHT = 8;
|
||||
public static final int CELL_IGNORE_HEIGHT = CELL_HEIGHT * 6;
|
||||
|
||||
@@ -64,8 +59,8 @@ public final class GeoStructure
|
||||
public static final int REGION_CELLS_Y = REGION_BLOCKS_Y * BLOCK_CELLS_Y;
|
||||
|
||||
// global geodata
|
||||
public static final int GEO_REGIONS_X = ((L2World.TILE_X_MAX - L2World.TILE_X_MIN) + 1);
|
||||
public static final int GEO_REGIONS_Y = ((L2World.TILE_Y_MAX - L2World.TILE_Y_MIN) + 1);
|
||||
private static final int GEO_REGIONS_X = ((L2World.TILE_X_MAX - L2World.TILE_X_MIN) + 1);
|
||||
private static final int GEO_REGIONS_Y = ((L2World.TILE_Y_MAX - L2World.TILE_Y_MIN) + 1);
|
||||
|
||||
public static final int GEO_BLOCKS_X = GEO_REGIONS_X * REGION_BLOCKS_X;
|
||||
public static final int GEO_BLOCKS_Y = GEO_REGIONS_Y * REGION_BLOCKS_Y;
|
||||
|
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jmobius.gameserver.geoengine.geodata;
|
||||
|
||||
/**
|
||||
* @author Hasha
|
||||
*/
|
||||
public interface IBlockDynamic
|
||||
{
|
||||
/**
|
||||
* Adds {@link IGeoObject} to the {@link ABlock}. The block will update geodata according the object.
|
||||
* @param object : {@link IGeoObject} to be added.
|
||||
*/
|
||||
void addGeoObject(IGeoObject object);
|
||||
|
||||
/**
|
||||
* Removes {@link IGeoObject} from the {@link ABlock}. The block will update geodata according the object.
|
||||
* @param object : {@link IGeoObject} to be removed.
|
||||
*/
|
||||
void removeGeoObject(IGeoObject object);
|
||||
}
|
@@ -253,7 +253,7 @@ public class DailyTaskManager extends AbstractEventManager<AbstractEvent<?>>
|
||||
});
|
||||
}
|
||||
|
||||
public void resetTrainingCamp()
|
||||
private void resetTrainingCamp()
|
||||
{
|
||||
if (Config.TRAINING_CAMP_ENABLE)
|
||||
{
|
||||
|
@@ -33,7 +33,7 @@ import com.l2jmobius.gameserver.model.entity.Fort;
|
||||
|
||||
public final class FortManager implements InstanceListManager
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(FortManager.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(FortManager.class.getName());
|
||||
|
||||
private final Map<Integer, Fort> _forts = new ConcurrentSkipListMap<>();
|
||||
|
||||
|
@@ -32,7 +32,7 @@ import com.l2jmobius.gameserver.scripting.ScriptEngineManager;
|
||||
*/
|
||||
public final class QuestManager
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(QuestManager.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(QuestManager.class.getName());
|
||||
|
||||
/** Map containing all the quests. */
|
||||
private final Map<String, Quest> _quests = new ConcurrentHashMap<>();
|
||||
|
@@ -47,7 +47,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneRegion;
|
||||
import com.l2jmobius.gameserver.model.zone.form.ZoneCuboid;
|
||||
import com.l2jmobius.gameserver.model.zone.form.ZoneCylinder;
|
||||
import com.l2jmobius.gameserver.model.zone.form.ZoneNPoly;
|
||||
import com.l2jmobius.gameserver.model.zone.type.L2ArenaZone;
|
||||
import com.l2jmobius.gameserver.model.zone.type.L2OlympiadStadiumZone;
|
||||
import com.l2jmobius.gameserver.model.zone.type.L2RespawnZone;
|
||||
import com.l2jmobius.gameserver.model.zone.type.L2SpawnTerritory;
|
||||
@@ -62,9 +61,9 @@ public final class ZoneManager implements IGameXmlReader
|
||||
|
||||
private static final Map<String, AbstractZoneSettings> SETTINGS = new HashMap<>();
|
||||
|
||||
public static final int SHIFT_BY = 15;
|
||||
public static final int OFFSET_X = Math.abs(L2World.MAP_MIN_X >> SHIFT_BY);
|
||||
public static final int OFFSET_Y = Math.abs(L2World.MAP_MIN_Y >> SHIFT_BY);
|
||||
private static final int SHIFT_BY = 15;
|
||||
private static final int OFFSET_X = Math.abs(L2World.MAP_MIN_X >> SHIFT_BY);
|
||||
private static final int OFFSET_Y = Math.abs(L2World.MAP_MIN_Y >> SHIFT_BY);
|
||||
|
||||
private final Map<Class<? extends L2ZoneType>, Map<Integer, ? extends L2ZoneType>> _classZones = new HashMap<>();
|
||||
private final Map<String, L2SpawnTerritory> _spawnTerritories = new HashMap<>();
|
||||
@@ -424,7 +423,7 @@ public final class ZoneManager implements IGameXmlReader
|
||||
* @param id the id
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean checkId(int id)
|
||||
private boolean checkId(int id)
|
||||
{
|
||||
for (Map<Integer, ? extends L2ZoneType> map : _classZones.values())
|
||||
{
|
||||
@@ -443,7 +442,7 @@ public final class ZoneManager implements IGameXmlReader
|
||||
* @param zone the zone
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends L2ZoneType> void addZone(Integer id, T zone)
|
||||
private <T extends L2ZoneType> void addZone(Integer id, T zone)
|
||||
{
|
||||
Map<Integer, T> map = (Map<Integer, T>) _classZones.get(zone.getClass());
|
||||
if (map == null)
|
||||
@@ -612,7 +611,7 @@ public final class ZoneManager implements IGameXmlReader
|
||||
* @return zone from given coordinates
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends L2ZoneType> T getZone(int x, int y, int z, Class<T> type)
|
||||
private <T extends L2ZoneType> T getZone(int x, int y, int z, Class<T> type)
|
||||
{
|
||||
for (L2ZoneType zone : getRegion(x, y).getZones().values())
|
||||
{
|
||||
@@ -653,29 +652,6 @@ public final class ZoneManager implements IGameXmlReader
|
||||
return temp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the arena.
|
||||
* @param character the character
|
||||
* @return the arena
|
||||
*/
|
||||
public final L2ArenaZone getArena(L2Character character)
|
||||
{
|
||||
if (character == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
for (L2ZoneType temp : getInstance().getZones(character.getX(), character.getY(), character.getZ()))
|
||||
{
|
||||
if ((temp instanceof L2ArenaZone) && temp.isCharacterInZone(character))
|
||||
{
|
||||
return (L2ArenaZone) temp;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the olympiad stadium.
|
||||
* @param character the character
|
||||
@@ -698,33 +674,6 @@ public final class ZoneManager implements IGameXmlReader
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* For testing purposes only.
|
||||
* @param <T> the generic type
|
||||
* @param obj the obj
|
||||
* @param type the type
|
||||
* @return the closest zone
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends L2ZoneType> T getClosestZone(L2Object obj, Class<T> type)
|
||||
{
|
||||
T zone = getZone(obj, type);
|
||||
if (zone == null)
|
||||
{
|
||||
double closestdis = Double.MAX_VALUE;
|
||||
for (T temp : (Collection<T>) _classZones.get(type).values())
|
||||
{
|
||||
final double distance = temp.getDistanceToZone(obj);
|
||||
if (distance < closestdis)
|
||||
{
|
||||
closestdis = distance;
|
||||
zone = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return zone;
|
||||
}
|
||||
|
||||
/**
|
||||
* General storage for debug items used for visualizing zones.
|
||||
* @return list of items
|
||||
|
@@ -157,26 +157,6 @@ public class TradeList
|
||||
return new TradeItem(item, item.getCount(), item.getReferencePrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust ItemRequest by corresponding item in this list using its <b>ObjectId</b>
|
||||
* @param item : ItemRequest to be adjusted
|
||||
*/
|
||||
public void adjustItemRequest(ItemRequest item)
|
||||
{
|
||||
for (TradeItem filtItem : _items)
|
||||
{
|
||||
if (filtItem.getObjectId() == item.getObjectId())
|
||||
{
|
||||
if (filtItem.getCount() < item.getCount())
|
||||
{
|
||||
item.setCount(filtItem.getCount());
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
item.setCount(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add simplified item to TradeList
|
||||
* @param objectId : int
|
||||
@@ -312,7 +292,7 @@ public class TradeList
|
||||
* @param count : int
|
||||
* @return
|
||||
*/
|
||||
public synchronized TradeItem removeItem(int objectId, int itemId, long count)
|
||||
private synchronized TradeItem removeItem(int objectId, int itemId, long count)
|
||||
{
|
||||
if (_locked)
|
||||
{
|
||||
@@ -462,7 +442,7 @@ public class TradeList
|
||||
/**
|
||||
* Cancels TradeList confirmation
|
||||
*/
|
||||
public void invalidateConfirmation()
|
||||
private void invalidateConfirmation()
|
||||
{
|
||||
_confirmed = false;
|
||||
}
|
||||
@@ -548,7 +528,7 @@ public class TradeList
|
||||
* @param partner
|
||||
* @return items slots count
|
||||
*/
|
||||
public int countItemsSlots(L2PcInstance partner)
|
||||
private int countItemsSlots(L2PcInstance partner)
|
||||
{
|
||||
int slots = 0;
|
||||
|
||||
@@ -579,7 +559,7 @@ public class TradeList
|
||||
/**
|
||||
* @return the weight of items in tradeList
|
||||
*/
|
||||
public int calcItemsWeight()
|
||||
private int calcItemsWeight()
|
||||
{
|
||||
long weight = 0;
|
||||
|
||||
|
@@ -122,7 +122,7 @@ public final class Transform implements IIdentifiable
|
||||
return _title;
|
||||
}
|
||||
|
||||
public TransformTemplate getTemplate(L2Character creature)
|
||||
private TransformTemplate getTemplate(L2Character creature)
|
||||
{
|
||||
if (creature.isPlayer())
|
||||
{
|
||||
|
@@ -36,8 +36,8 @@ public final class SubClass
|
||||
private int _vitalityPoints = 0;
|
||||
private boolean _dualClass = false;
|
||||
|
||||
public static final int MAX_VITALITY_POINTS = 140000;
|
||||
public static final int MIN_VITALITY_POINTS = 0;
|
||||
private static final int MAX_VITALITY_POINTS = 140000;
|
||||
private static final int MIN_VITALITY_POINTS = 0;
|
||||
|
||||
public SubClass()
|
||||
{
|
||||
@@ -137,26 +137,4 @@ public final class SubClass
|
||||
|
||||
_level = levelValue;
|
||||
}
|
||||
|
||||
public void incLevel()
|
||||
{
|
||||
if (!_dualClass && (_level == _maxLevel))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_level++;
|
||||
setExp(ExperienceData.getInstance().getExpForLevel(getLevel()));
|
||||
}
|
||||
|
||||
public void decLevel()
|
||||
{
|
||||
if (_level == Config.BASE_SUBCLASS_LEVEL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_level--;
|
||||
setExp(ExperienceData.getInstance().getExpForLevel(getLevel()));
|
||||
}
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ public final class TimerExecutor<T>
|
||||
* @param holder
|
||||
* @return {@code true} if timer were successfully added, {@code false} in case it exists already
|
||||
*/
|
||||
public boolean addTimer(TimerHolder<T> holder)
|
||||
private boolean addTimer(TimerHolder<T> holder)
|
||||
{
|
||||
final Set<TimerHolder<T>> timers = _timers.computeIfAbsent(holder.getEvent(), key -> ConcurrentHashMap.newKeySet());
|
||||
removeAndCancelTimers(timers, holder::isEqual);
|
||||
@@ -123,25 +123,11 @@ public final class TimerExecutor<T>
|
||||
* @param eventTimer
|
||||
* @return {@code true} if timer were successfully added, {@code false} in case it exists already
|
||||
*/
|
||||
public boolean addRepeatingTimer(T event, StatsSet params, long time, L2Npc npc, L2PcInstance player, IEventTimerEvent<T> eventTimer)
|
||||
private boolean addRepeatingTimer(T event, StatsSet params, long time, L2Npc npc, L2PcInstance player, IEventTimerEvent<T> eventTimer)
|
||||
{
|
||||
return addTimer(new TimerHolder<>(event, params, time, npc, player, true, eventTimer, _cancelListener, this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds repeating timer
|
||||
* @param event
|
||||
* @param params
|
||||
* @param time
|
||||
* @param npc
|
||||
* @param player
|
||||
* @return {@code true} if timer were successfully added, {@code false} in case it exists already
|
||||
*/
|
||||
public boolean addRepeatingTimer(T event, StatsSet params, long time, L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
return addRepeatingTimer(event, params, time, npc, player, _eventListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds repeating timer
|
||||
* @param event
|
||||
@@ -181,22 +167,6 @@ public final class TimerExecutor<T>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param timer
|
||||
*/
|
||||
public void onTimerCancel(TimerHolder<T> timer)
|
||||
{
|
||||
final Set<TimerHolder<T>> timers = _timers.get(timer.getEvent());
|
||||
if ((timers != null) && timers.remove(timer))
|
||||
{
|
||||
_eventListener.onTimerEvent(timer);
|
||||
if (timers.isEmpty())
|
||||
{
|
||||
_timers.remove(timer.getEvent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels and removes all timers from the _timers map
|
||||
*/
|
||||
@@ -223,15 +193,6 @@ public final class TimerExecutor<T>
|
||||
return timers.stream().anyMatch(holder -> holder.isEqual(event, npc, player));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param event
|
||||
* @return {@code true} if there is at least one timer with the given event, {@code false} otherwise
|
||||
*/
|
||||
public boolean hasTimers(T event)
|
||||
{
|
||||
return _timers.containsKey(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param event
|
||||
* @return {@code true} if at least one timer for the given event were stopped, {@code false} otherwise
|
||||
@@ -305,32 +266,4 @@ public final class TimerExecutor<T>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param event
|
||||
* @param npc
|
||||
* @param player
|
||||
* @return the remaining time of the timer, or -1 in case it doesn't exists
|
||||
*/
|
||||
public long getRemainingTime(T event, L2Npc npc, L2PcInstance player)
|
||||
{
|
||||
final Set<TimerHolder<T>> timers = _timers.get(event);
|
||||
if ((timers == null) || timers.isEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
final Iterator<TimerHolder<T>> holders = timers.iterator();
|
||||
while (holders.hasNext())
|
||||
{
|
||||
final TimerHolder<T> holder = holders.next();
|
||||
if (holder.isEqual(event, npc, player))
|
||||
{
|
||||
holders.remove();
|
||||
return holder.getRemainingTime();
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@@ -93,11 +93,6 @@ public class TrainingHolder implements Serializable
|
||||
return TimeUnit.SECONDS.toMinutes(Config.TRAINING_CAMP_MAX_DURATION - getElapsedTime());
|
||||
}
|
||||
|
||||
public long getRemainingTime(long time)
|
||||
{
|
||||
return TimeUnit.SECONDS.toMinutes(Config.TRAINING_CAMP_MAX_DURATION - time);
|
||||
}
|
||||
|
||||
public long getTrainingTime(TimeUnit unit)
|
||||
{
|
||||
return Math.min(unit.convert(Config.TRAINING_CAMP_MAX_DURATION, TimeUnit.SECONDS), unit.convert(_endTime - _startTime, TimeUnit.MILLISECONDS));
|
||||
|
@@ -18,6 +18,7 @@ package com.l2jmobius.gameserver.model.stats.finalizers;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.stats.BaseStats;
|
||||
@@ -37,12 +38,12 @@ public class MCritRateFinalizer implements IStatsFunction
|
||||
double baseValue = calcWeaponPlusBaseValue(creature, stat);
|
||||
if (creature.isPlayer())
|
||||
{
|
||||
// Enchanted legs bonus
|
||||
baseValue += calcEnchantBodyPart(creature, L2Item.SLOT_LEGS);
|
||||
}
|
||||
|
||||
final double witBonus = creature.getWIT() > 0 ? BaseStats.WIT.calcBonus(creature) : 1.;
|
||||
baseValue *= witBonus * 10;
|
||||
return Stats.defaultValue(creature, stat, baseValue);
|
||||
return validateValue(creature, Stats.defaultValue(creature, stat, baseValue * witBonus * 10), 0, Config.MAX_MCRIT_RATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -18,6 +18,7 @@ package com.l2jmobius.gameserver.model.stats.finalizers;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.stats.BaseStats;
|
||||
@@ -39,7 +40,7 @@ public class RegenCPFinalizer implements IStatsFunction
|
||||
}
|
||||
|
||||
final L2PcInstance player = creature.getActingPlayer();
|
||||
double baseValue = player.getTemplate().getBaseCpRegen(creature.getLevel()) * creature.getLevelMod() * BaseStats.CON.calcBonus(creature);
|
||||
double baseValue = player.getTemplate().getBaseCpRegen(creature.getLevel()) * creature.getLevelMod() * BaseStats.CON.calcBonus(creature) * Config.CP_REGEN_MULTIPLIER;
|
||||
if (player.isSitting())
|
||||
{
|
||||
baseValue *= 1.5; // Sitting
|
||||
|
@@ -40,12 +40,11 @@ public abstract class VoteSystem implements Runnable
|
||||
|
||||
private static List<VoteSystem> voteSystems = new ArrayList<>();
|
||||
|
||||
protected int votesDiff;
|
||||
protected boolean allowReport;
|
||||
protected int boxes;
|
||||
protected Map<Integer, Integer> rewards;
|
||||
protected int checkMins;
|
||||
protected int lastVotes = 0;
|
||||
private final int votesDiff;
|
||||
private final boolean allowReport;
|
||||
private final int boxes;
|
||||
private final Map<Integer, Integer> rewards;
|
||||
private int lastVotes = 0;
|
||||
private final Map<String, Integer> playerIps = new HashMap<>();
|
||||
|
||||
public static void initialize()
|
||||
@@ -87,26 +86,12 @@ public abstract class VoteSystem implements Runnable
|
||||
}
|
||||
}
|
||||
|
||||
public static VoteSystem getVoteSystem(String name)
|
||||
{
|
||||
for (VoteSystem vs : voteSystems)
|
||||
{
|
||||
if (vs.getSiteName().equals(name))
|
||||
{
|
||||
return vs;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public VoteSystem(int votesDiff, boolean allowReport, int boxes, Map<Integer, Integer> rewards, int checkMins)
|
||||
{
|
||||
this.votesDiff = votesDiff;
|
||||
this.allowReport = allowReport;
|
||||
this.boxes = boxes;
|
||||
this.rewards = rewards;
|
||||
this.checkMins = checkMins;
|
||||
|
||||
ThreadPool.scheduleAtFixedRate(this, checkMins * 1000 * 60, checkMins * 1000 * 60);
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.zone.L2ZoneForm;
|
||||
public class ZoneCuboid extends L2ZoneForm
|
||||
{
|
||||
private final int _z1, _z2;
|
||||
Rectangle _r;
|
||||
private final Rectangle _r;
|
||||
|
||||
public ZoneCuboid(int x1, int x2, int y1, int y2, int z1, int z2)
|
||||
{
|
||||
|
@@ -16234,18 +16234,6 @@ public final class SystemMessageId
|
||||
return VALUES.get(id);
|
||||
}
|
||||
|
||||
public static SystemMessageId getSystemMessageId(String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
return (SystemMessageId) SystemMessageId.class.getField(name).get(null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private final int _id;
|
||||
private String _name;
|
||||
private byte _params;
|
||||
|
@@ -23,26 +23,21 @@ import com.l2jmobius.commons.network.BaseSendablePacket;
|
||||
*/
|
||||
public class TempBan extends BaseSendablePacket
|
||||
{
|
||||
public TempBan(String accountName, String ip, long time, String reason)
|
||||
public TempBan(String accountName, String ip, long time)
|
||||
{
|
||||
writeC(0x0A);
|
||||
writeS(accountName);
|
||||
writeS(ip);
|
||||
writeQ(System.currentTimeMillis() + (time * 60000));
|
||||
if (reason != null)
|
||||
{
|
||||
writeC(0x01);
|
||||
writeS(reason);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeC(0x00);
|
||||
}
|
||||
}
|
||||
|
||||
public TempBan(String accountName, String ip, long time)
|
||||
{
|
||||
this(accountName, ip, time, null);
|
||||
// if (reason != null)
|
||||
// {
|
||||
// writeC(0x01);
|
||||
// writeS(reason);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
writeC(0x00);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -38,18 +38,6 @@ public final class TutorialShowHtml extends AbstractHtmlPacket
|
||||
_type = NORMAL_WINDOW;
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor is just here to be able to show a tutorial html<br>
|
||||
* window bound to an npc.
|
||||
* @param npcObjId
|
||||
* @param html
|
||||
*/
|
||||
public TutorialShowHtml(int npcObjId, String html)
|
||||
{
|
||||
super(npcObjId, html);
|
||||
_type = NORMAL_WINDOW;
|
||||
}
|
||||
|
||||
public TutorialShowHtml(int npcObjId, String html, int type)
|
||||
{
|
||||
super(npcObjId, html);
|
||||
|
@@ -52,7 +52,7 @@ public class TelnetServer
|
||||
}
|
||||
}
|
||||
|
||||
public void init()
|
||||
private void init()
|
||||
{
|
||||
addHandler(new ITelnetCommand()
|
||||
{
|
||||
|
@@ -47,12 +47,12 @@ import com.l2jmobius.gameserver.taskmanager.tasks.TaskShutdown;
|
||||
*/
|
||||
public final class TaskManager
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(TaskManager.class.getName());
|
||||
static final Logger LOGGER = Logger.getLogger(TaskManager.class.getName());
|
||||
|
||||
private final Map<Integer, Task> _tasks = new ConcurrentHashMap<>();
|
||||
protected final List<ExecutedTask> _currentTasks = new CopyOnWriteArrayList<>();
|
||||
final List<ExecutedTask> _currentTasks = new CopyOnWriteArrayList<>();
|
||||
|
||||
protected static final String[] SQL_STATEMENTS =
|
||||
static final String[] SQL_STATEMENTS =
|
||||
{
|
||||
"SELECT id,task,type,last_activation,param1,param2,param3 FROM global_tasks",
|
||||
"UPDATE global_tasks SET last_activation=? WHERE id=?",
|
||||
@@ -70,13 +70,13 @@ public final class TaskManager
|
||||
public class ExecutedTask implements Runnable
|
||||
{
|
||||
int id;
|
||||
long lastActivation;
|
||||
Task task;
|
||||
TaskTypes type;
|
||||
String[] params;
|
||||
private long lastActivation;
|
||||
private final Task task;
|
||||
private final TaskTypes type;
|
||||
private final String[] params;
|
||||
ScheduledFuture<?> scheduled;
|
||||
|
||||
public ExecutedTask(Task ptask, TaskTypes ptype, ResultSet rset) throws SQLException
|
||||
ExecutedTask(Task ptask, TaskTypes ptype, ResultSet rset) throws SQLException
|
||||
{
|
||||
task = ptask;
|
||||
type = ptype;
|
||||
@@ -150,7 +150,7 @@ public final class TaskManager
|
||||
return lastActivation;
|
||||
}
|
||||
|
||||
public void stopTask()
|
||||
private void stopTask()
|
||||
{
|
||||
task.onDestroy();
|
||||
|
||||
@@ -171,7 +171,7 @@ public final class TaskManager
|
||||
registerTask(new TaskShutdown());
|
||||
}
|
||||
|
||||
public void registerTask(Task task)
|
||||
private void registerTask(Task task)
|
||||
{
|
||||
_tasks.computeIfAbsent(task.getName().hashCode(), k ->
|
||||
{
|
||||
@@ -312,7 +312,7 @@ public final class TaskManager
|
||||
return addUniqueTask(task, type, param1, param2, param3, 0);
|
||||
}
|
||||
|
||||
public static boolean addUniqueTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
|
||||
private static boolean addUniqueTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement(SQL_STATEMENTS[2]))
|
||||
@@ -348,7 +348,7 @@ public final class TaskManager
|
||||
return addTask(task, type, param1, param2, param3, 0);
|
||||
}
|
||||
|
||||
public static boolean addTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
|
||||
private static boolean addTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[3]))
|
||||
|
@@ -24,7 +24,7 @@ import com.l2jmobius.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
*/
|
||||
public final class TaskCleanUp extends Task
|
||||
{
|
||||
public static final String NAME = "clean_up";
|
||||
private static final String NAME = "clean_up";
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
|
@@ -25,7 +25,7 @@ import com.l2jmobius.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
*/
|
||||
public final class TaskRestart extends Task
|
||||
{
|
||||
public static final String NAME = "restart";
|
||||
private static final String NAME = "restart";
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
|
@@ -25,7 +25,7 @@ import com.l2jmobius.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
*/
|
||||
public class TaskShutdown extends Task
|
||||
{
|
||||
public static final String NAME = "shutdown";
|
||||
private static final String NAME = "shutdown";
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
|
@@ -39,8 +39,8 @@ import com.l2jmobius.Config;
|
||||
public class frmAbout
|
||||
{
|
||||
private JFrame frmAbout;
|
||||
static final String URL = "www.l2jmobius.com";
|
||||
URI uri;
|
||||
private static final String URL = "www.l2jmobius.com";
|
||||
final URI uri;
|
||||
|
||||
public frmAbout()
|
||||
{
|
||||
@@ -129,7 +129,7 @@ public class frmAbout
|
||||
frmAbout.setLocationRelativeTo(null);
|
||||
}
|
||||
|
||||
public static URI createURI(String str)
|
||||
private static URI createURI(String str)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@@ -13,7 +13,6 @@ package com.l2jmobius.gameserver.util;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.DAYS;
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
import static java.util.concurrent.TimeUnit.NANOSECONDS;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
@@ -32,16 +31,6 @@ public class TimeAmountInterpreter
|
||||
// utility class
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls {@link #consolidate(long, TimeUnit)} with {@link TimeUnit#NANOSECONDS}.
|
||||
* @param timeAmountInNanos amount of time in nanoseconds
|
||||
* @return an user-friendly description of the given time amount
|
||||
*/
|
||||
public static String consolidateNanos(long timeAmountInNanos)
|
||||
{
|
||||
return consolidate(timeAmountInNanos, NANOSECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls {@link #consolidate(long, TimeUnit)} with {@link TimeUnit#MILLISECONDS}.
|
||||
* @param timeAmountInMillis amount of time in milliseconds
|
||||
@@ -58,7 +47,7 @@ public class TimeAmountInterpreter
|
||||
* @param timeUnit unit of the given amount
|
||||
* @return an user-friendly description of the given time amount
|
||||
*/
|
||||
public static String consolidate(long timeAmount, TimeUnit timeUnit)
|
||||
private static String consolidate(long timeAmount, TimeUnit timeUnit)
|
||||
{
|
||||
return consolidate(timeAmount, timeUnit, timeUnit, DAYS, "0 " + timeUnit.name().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
@@ -92,7 +81,7 @@ public class TimeAmountInterpreter
|
||||
* @throws RuntimeException if {@code textBuilder} throws an {@link IOException}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends Appendable & CharSequence> T appendConsolidated(T textBuilder, long timeAmount, TimeUnit timeUnit, TimeUnit minConsolidationUnit, TimeUnit maxConsolidationUnit, String noTimeUsedIndicator) throws RuntimeException
|
||||
private static <T extends Appendable & CharSequence> T appendConsolidated(T textBuilder, long timeAmount, TimeUnit timeUnit, TimeUnit minConsolidationUnit, TimeUnit maxConsolidationUnit, String noTimeUsedIndicator) throws RuntimeException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@@ -40,7 +40,6 @@ import java.util.stream.Collectors;
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.commons.util.file.filter.ExtFilter;
|
||||
import com.l2jmobius.gameserver.enums.HtmlActionScope;
|
||||
import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
@@ -51,7 +50,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.tasks.player.IllegalPlayerActionTask;
|
||||
import com.l2jmobius.gameserver.model.interfaces.ILocational;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.AbstractHtmlPacket;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ShowBoard;
|
||||
|
||||
/**
|
||||
@@ -119,15 +117,6 @@ public final class Util
|
||||
return degree;
|
||||
}
|
||||
|
||||
public static int convertDegreeToClientHeading(double degree)
|
||||
{
|
||||
if (degree < 0)
|
||||
{
|
||||
degree = 360 + degree;
|
||||
}
|
||||
return (int) (degree * 182.044444444);
|
||||
}
|
||||
|
||||
public static int calculateHeadingFrom(ILocational from, ILocational to)
|
||||
{
|
||||
return calculateHeadingFrom(from.getX(), from.getY(), to.getX(), to.getY());
|
||||
@@ -447,16 +436,6 @@ public final class Util
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
|
||||
public static File[] getDatapackFiles(String dirname, String extention)
|
||||
{
|
||||
final File dir = new File(Config.DATAPACK_ROOT, "data/" + dirname);
|
||||
if (!dir.exists())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return dir.listFiles(new ExtFilter(extention));
|
||||
}
|
||||
|
||||
public static String getDateString(Date date)
|
||||
{
|
||||
final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
@@ -567,18 +546,6 @@ public final class Util
|
||||
buildHtmlLinkCache(player, scope, html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to send a NpcHtmlMessage to the specified player.
|
||||
* @param activeChar the player to send the html content to
|
||||
* @param html the html content
|
||||
*/
|
||||
public static void sendHtml(L2PcInstance activeChar, String html)
|
||||
{
|
||||
final NpcHtmlMessage npcHtml = new NpcHtmlMessage();
|
||||
npcHtml.setHtml(html);
|
||||
activeChar.sendPacket(npcHtml);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to send a community board html to the specified player.<br>
|
||||
* HtmlActionCache will be build with npc origin 0 which means the<br>
|
||||
|
@@ -257,7 +257,7 @@ public class TaskExecutor
|
||||
/**
|
||||
* Resumes the execution after it has been paused.
|
||||
*/
|
||||
public void resume()
|
||||
private void resume()
|
||||
{
|
||||
synchronized (lock)
|
||||
{
|
||||
|
@@ -28,7 +28,7 @@ public abstract class Token
|
||||
public static final short TOKEN_VARIABLE = 6;
|
||||
public static final short TOKEN_SEPARATOR = 7;
|
||||
|
||||
protected final int type;
|
||||
private final int type;
|
||||
|
||||
Token(int type)
|
||||
{
|
||||
@@ -39,5 +39,4 @@ public abstract class Token
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -312,12 +312,12 @@ public class Tokenizer
|
||||
return Character.isDigit(ch) || (ch == '.') || (ch == 'e') || (ch == 'E') || (lastCharE && ((ch == '-') || (ch == '+')));
|
||||
}
|
||||
|
||||
public static boolean isAlphabetic(int codePoint)
|
||||
private static boolean isAlphabetic(int codePoint)
|
||||
{
|
||||
return Character.isLetter(codePoint);
|
||||
}
|
||||
|
||||
public static boolean isVariableOrFunctionCharacter(int codePoint)
|
||||
private static boolean isVariableOrFunctionCharacter(int codePoint)
|
||||
{
|
||||
return isAlphabetic(codePoint) || Character.isDigit(codePoint) || (codePoint == '_') || (codePoint == '.');
|
||||
}
|
||||
|
Reference in New Issue
Block a user