Multiple time limited zone checks on login.

This commit is contained in:
MobiusDevelopment
2020-01-23 01:58:41 +00:00
parent e3421df4c4
commit 3563a89445
2 changed files with 27 additions and 19 deletions

View File

@@ -648,19 +648,23 @@ public class EnterWorld implements IClientIncomingPacket
} }
// Check if in time limited hunting zone. // Check if in time limited hunting zone.
final long stormIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 1, 0); if (player.isInTimedHuntingZone())
final long primevalIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 6, 0);
if (stormIsleExitTime > System.currentTimeMillis())
{ {
player.startTimedHuntingZone(1, stormIsleExitTime - System.currentTimeMillis()); final long currentTime = System.currentTimeMillis();
} final long stormIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 1, 0);
else if (primevalIsleExitTime > System.currentTimeMillis()) final long primevalIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 6, 0);
{ if ((stormIsleExitTime > currentTime) && player.isInTimedHuntingZone(1))
player.startTimedHuntingZone(6, primevalIsleExitTime - System.currentTimeMillis()); {
} player.startTimedHuntingZone(1, stormIsleExitTime - currentTime);
else if (player.isInTimedHuntingZone()) }
{ else if ((primevalIsleExitTime > currentTime) && player.isInTimedHuntingZone(6))
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN)); {
player.startTimedHuntingZone(6, primevalIsleExitTime - currentTime);
}
else
{
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
}
} }
if (Config.ENABLE_ATTENDANCE_REWARDS) if (Config.ENABLE_ATTENDANCE_REWARDS)

View File

@@ -633,14 +633,18 @@ public class EnterWorld implements IClientIncomingPacket
} }
// Check if in time limited hunting zone. // Check if in time limited hunting zone.
final long pirateTombExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 2, 0); if (player.isInTimedHuntingZone())
if (pirateTombExitTime > System.currentTimeMillis())
{ {
player.startTimedHuntingZone(2, pirateTombExitTime - System.currentTimeMillis()); final long currentTime = System.currentTimeMillis();
} final long pirateTombExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 2, 0);
else if (player.isInTimedHuntingZone()) if ((pirateTombExitTime > currentTime) && player.isInTimedHuntingZone(2))
{ {
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN)); player.startTimedHuntingZone(1, pirateTombExitTime - currentTime);
}
else
{
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
}
} }
if (Config.ENABLE_ATTENDANCE_REWARDS) if (Config.ENABLE_ATTENDANCE_REWARDS)