Addition of Player isInTimedHuntingZone method.

This commit is contained in:
MobiusDevelopment
2022-08-30 23:32:54 +00:00
parent 98166d7d78
commit 54578fc855
32 changed files with 90 additions and 52 deletions

View File

@@ -10737,7 +10737,7 @@ public class Player extends Playable
}
// Close time limited zone window.
if (!isInsideZone(ZoneId.TIMED_HUNTING))
if (!isInTimedHuntingZone())
{
stopTimedHuntingZoneTask();
}
@@ -11204,7 +11204,7 @@ public class Player extends Playable
}
// Exit timed hunting zone.
if (isInTimedHuntingZone(getX(), getY()))
if (isInTimedHuntingZone())
{
teleToLocation(TeleportWhereType.TOWN);
storeCharBase();
@@ -14714,6 +14714,11 @@ public class Player extends Playable
return (holder.getMapX() == (((locX - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN)) && (holder.getMapY() == (((locY - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN));
}
public boolean isInTimedHuntingZone()
{
return isInTimedHuntingZone(getX(), getY());
}
public boolean isInTimedHuntingZone(int x, int y)
{
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())

View File

@@ -90,7 +90,7 @@ public class TimedHuntingZone extends ZoneType
ThreadPool.schedule(() ->
{
if (!player.isInTimedHuntingZone(player.getX(), player.getY()))
if (!player.isInTimedHuntingZone())
{
player.sendPacket(new TimedHuntingZoneExit(player.getVariables().getInt(PlayerVariables.LAST_HUNTING_ZONE_ID, 0)));
}

View File

@@ -89,7 +89,7 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
player.sendMessage("Cannot use time-limited hunting zones while registered on an event.");
return;
}
if (player.isInInstance() || player.isInTimedHuntingZone(player.getX(), player.getY()))
if (player.isInInstance() || player.isInTimedHuntingZone())
{
player.sendMessage("Cannot use time-limited hunting zones while in an instance.");
return;