Timed zones separation.
This commit is contained in:
@@ -14167,17 +14167,31 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone()
|
||||
{
|
||||
return isInTimedHuntingZone(2); // Storm Isle
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int zoneId)
|
||||
{
|
||||
final int x = ((getX() - World.MAP_MIN_X) >> 15) + World.TILE_X_MIN;
|
||||
final int y = ((getY() - World.MAP_MIN_Y) >> 15) + World.TILE_Y_MIN;
|
||||
if ((x == 20) && (y == 15)) // Ancient Pirates' Tomb.
|
||||
|
||||
switch (zoneId)
|
||||
{
|
||||
return true;
|
||||
case 2: // Ancient Pirates' Tomb.
|
||||
{
|
||||
if ((x == 20) && (y == 15))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void startTimedHuntingZone(long delay)
|
||||
public void startTimedHuntingZone(int zoneId, long delay)
|
||||
{
|
||||
// TODO: Delay window.
|
||||
// sendPacket(new TimedHuntingZoneEnter((int) (delay / 60 / 1000)));
|
||||
@@ -14186,7 +14200,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
_timedHuntingZoneFinishTask = ThreadPool.schedule(() ->
|
||||
{
|
||||
if ((isOnlineInt() > 0) && isInTimedHuntingZone())
|
||||
if ((isOnlineInt() > 0) && isInTimedHuntingZone(zoneId))
|
||||
{
|
||||
sendPacket(TimedHuntingZoneExit.STATIC_PACKET);
|
||||
abortCast();
|
||||
|
||||
@@ -63,7 +63,7 @@ public class PlayerVariables extends AbstractVariables
|
||||
public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling";
|
||||
public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat";
|
||||
public static final String DELUSION_RETURN = "DELUSION_RETURN";
|
||||
public static final String HUNTING_ZONE_RESET_TIME = "HUNTING_ZONE_RESET_TIME";
|
||||
public static final String HUNTING_ZONE_RESET_TIME = "HUNTING_ZONE_RESET_TIME_";
|
||||
|
||||
private final int _objectId;
|
||||
|
||||
|
||||
@@ -633,10 +633,10 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
// Check if in time limited hunting zone.
|
||||
final long exitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME, 0);
|
||||
if (exitTime > System.currentTimeMillis())
|
||||
final long pirateTombExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 2, 0);
|
||||
if (pirateTombExitTime > System.currentTimeMillis())
|
||||
{
|
||||
player.startTimedHuntingZone(exitTime - System.currentTimeMillis());
|
||||
player.startTimedHuntingZone(2, pirateTombExitTime - System.currentTimeMillis());
|
||||
}
|
||||
else if (player.isInTimedHuntingZone())
|
||||
{
|
||||
|
||||
@@ -28,12 +28,12 @@ import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
*/
|
||||
public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
{
|
||||
private int _fieldId;
|
||||
private int _zoneId;
|
||||
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
_fieldId = packet.readD();
|
||||
_zoneId = packet.readD();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME, 0) > System.currentTimeMillis())
|
||||
if (player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, 0) > System.currentTimeMillis())
|
||||
{
|
||||
if (player.isInTimedHuntingZone())
|
||||
{
|
||||
@@ -85,7 +85,7 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_fieldId == 2) && (player.getLevel() < 78))
|
||||
if ((_zoneId == 2) && (player.getLevel() < 78))
|
||||
{
|
||||
player.sendMessage("Your level is too low.");
|
||||
}
|
||||
@@ -93,8 +93,8 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
if (player.getAdena() > 10000)
|
||||
{
|
||||
player.reduceAdena("TimedHuntingZone", 10000, player, true);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME, System.currentTimeMillis() + 18000000); // 300 minutes
|
||||
switch (_fieldId)
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, System.currentTimeMillis() + 18000000); // 300 minutes
|
||||
switch (_zoneId)
|
||||
{
|
||||
case 2: // Ancient Pirates' Tomb
|
||||
{
|
||||
@@ -102,7 +102,7 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
break;
|
||||
}
|
||||
}
|
||||
player.startTimedHuntingZone(18000000); // 300 minutes
|
||||
player.startTimedHuntingZone(_zoneId, 18000000); // 300 minutes
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user