Addition of timed hunting zones.
This commit is contained in:
@@ -135,7 +135,7 @@ public class CallPc extends AbstractEffect
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target.isFlyingMounted() || target.isCombatFlagEquipped() || target.isInTraingCamp() || target.isInTimedHuntingZone() || effector.isInTimedHuntingZone())
|
||||
if (target.isFlyingMounted() || target.isCombatFlagEquipped() || target.isInTraingCamp() || target.isInsideZone(ZoneId.TIMED_HUNTING) || effector.isInsideZone(ZoneId.TIMED_HUNTING))
|
||||
{
|
||||
effector.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA);
|
||||
return false;
|
||||
@@ -158,7 +158,7 @@ public class CallPc extends AbstractEffect
|
||||
}
|
||||
|
||||
final Instance instance = effector.getInstanceWorld();
|
||||
if (((instance != null) && !instance.isPlayerSummonAllowed()) || effector.isInTimedHuntingZone())
|
||||
if ((instance != null) && !instance.isPlayerSummonAllowed())
|
||||
{
|
||||
effector.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_FROM_YOUR_CURRENT_LOCATION);
|
||||
return false;
|
||||
|
||||
@@ -109,7 +109,7 @@ public class TeleportToPlayer extends AbstractEffect
|
||||
}
|
||||
|
||||
final Instance instance = target.getInstanceWorld();
|
||||
if (((instance != null) && !instance.isPlayerSummonAllowed()) || target.isInTimedHuntingZone())
|
||||
if (((instance != null) && !instance.isPlayerSummonAllowed()) || target.isInsideZone(ZoneId.TIMED_HUNTING))
|
||||
{
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING);
|
||||
sm.addString(target.getName());
|
||||
|
||||
@@ -173,6 +173,7 @@
|
||||
<xs:enumeration value="SayuneZone" />
|
||||
<xs:enumeration value="UndyingZone" />
|
||||
<xs:enumeration value="TeleportZone" />
|
||||
<xs:enumeration value="TimedHuntingZone" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
|
||||
12
L2J_Mobius_7.0_PreludeOfWar/dist/game/data/zones/timed_hunting.xml
vendored
Normal file
12
L2J_Mobius_7.0_PreludeOfWar/dist/game/data/zones/timed_hunting.xml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<list enabled="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/zones.xsd">
|
||||
<!-- Timed Hunting Zones -->
|
||||
<zone name="storm_isle_hz" type="TimedHuntingZone" shape="Cuboid" minZ="-16000" maxZ="10000">
|
||||
<node X="163840" Y="176604" />
|
||||
<node X="196607" Y="196607" />
|
||||
</zone>
|
||||
<zone name="primeval_isle_hz" type="TimedHuntingZone" shape="Cuboid" minZ="-16000" maxZ="10000">
|
||||
<node X="0" Y="-32768" />
|
||||
<node X="32767" Y="-1" />
|
||||
</zone>
|
||||
</list>
|
||||
@@ -79,6 +79,7 @@ import org.l2jmobius.gameserver.model.zone.type.SpawnTerritory;
|
||||
import org.l2jmobius.gameserver.model.zone.type.SwampZone;
|
||||
import org.l2jmobius.gameserver.model.zone.type.TaxZone;
|
||||
import org.l2jmobius.gameserver.model.zone.type.TeleportZone;
|
||||
import org.l2jmobius.gameserver.model.zone.type.TimedHuntingZone;
|
||||
import org.l2jmobius.gameserver.model.zone.type.UndyingZone;
|
||||
import org.l2jmobius.gameserver.model.zone.type.WaterZone;
|
||||
|
||||
@@ -457,6 +458,7 @@ public class ZoneManager implements IXmlReader
|
||||
_classZones.put(SwampZone.class, new ConcurrentHashMap<>());
|
||||
_classZones.put(TaxZone.class, new ConcurrentHashMap<>());
|
||||
_classZones.put(TeleportZone.class, new ConcurrentHashMap<>());
|
||||
_classZones.put(TimedHuntingZone.class, new ConcurrentHashMap<>());
|
||||
_classZones.put(UndyingZone.class, new ConcurrentHashMap<>());
|
||||
_classZones.put(WaterZone.class, new ConcurrentHashMap<>());
|
||||
_spawnTerritories.clear();
|
||||
|
||||
@@ -10332,7 +10332,7 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
// Close time limited zone window.
|
||||
if (!isInTimedHuntingZone())
|
||||
if (!isInsideZone(ZoneId.TIMED_HUNTING))
|
||||
{
|
||||
stopTimedHuntingZoneTask();
|
||||
}
|
||||
@@ -14168,11 +14168,6 @@ public class PlayerInstance extends Playable
|
||||
return _autoUseSettings;
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone()
|
||||
{
|
||||
return isInTimedHuntingZone(getX(), getY());
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int x, int y)
|
||||
{
|
||||
return isInTimedHuntingZone(1, x, y) // Storm Isle
|
||||
|
||||
@@ -48,7 +48,8 @@ public enum ZoneId
|
||||
SAYUNE,
|
||||
FISHING,
|
||||
UNDYING,
|
||||
TAX;
|
||||
TAX,
|
||||
TIMED_HUNTING;
|
||||
|
||||
public static int getZoneCount()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.gameserver.model.zone.type;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
public TimedHuntingZone(int id)
|
||||
{
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEnter(Creature creature)
|
||||
{
|
||||
final PlayerInstance player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, true);
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long stormIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 1, 0);
|
||||
final long primevalIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 6, 0);
|
||||
if ((stormIsleExitTime > currentTime) && player.isInTimedHuntingZone(1))
|
||||
{
|
||||
player.startTimedHuntingZone(1, stormIsleExitTime - currentTime);
|
||||
}
|
||||
else if ((primevalIsleExitTime > currentTime) && player.isInTimedHuntingZone(6))
|
||||
{
|
||||
player.startTimedHuntingZone(6, primevalIsleExitTime - currentTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExit(Creature creature)
|
||||
{
|
||||
final PlayerInstance player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,6 @@ import org.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.MailManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.PetitionManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ServerRestartManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
@@ -652,26 +651,6 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
player.updateAbnormalVisualEffects();
|
||||
}
|
||||
|
||||
// Check if in time limited hunting zone.
|
||||
if (player.isInTimedHuntingZone())
|
||||
{
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long stormIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 1, 0);
|
||||
final long primevalIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 6, 0);
|
||||
if ((stormIsleExitTime > currentTime) && player.isInTimedHuntingZone(1))
|
||||
{
|
||||
player.startTimedHuntingZone(1, stormIsleExitTime - currentTime);
|
||||
}
|
||||
else if ((primevalIsleExitTime > currentTime) && player.isInTimedHuntingZone(6))
|
||||
{
|
||||
player.startTimedHuntingZone(6, primevalIsleExitTime - currentTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.ENABLE_ATTENDANCE_REWARDS)
|
||||
{
|
||||
ThreadPool.schedule(() ->
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.entity.Castle;
|
||||
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
@@ -57,7 +58,7 @@ public class ExRequestTeleport implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
// Players should not be able to teleport if in combat, or in a special location.
|
||||
if (player.isCastingNow() || player.isInCombat() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInTimedHuntingZone())
|
||||
if (player.isCastingNow() || player.isInCombat() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInsideZone(ZoneId.TIMED_HUNTING))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
|
||||
return;
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.clientpackets;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
|
||||
/**
|
||||
@@ -48,7 +49,7 @@ public class RequestSaveBookMarkSlot implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.isInTimedHuntingZone())
|
||||
if (player.isInsideZone(ZoneId.TIMED_HUNTING))
|
||||
{
|
||||
player.sendMessage("You cannot bookmark this location.");
|
||||
return;
|
||||
|
||||
@@ -110,6 +110,8 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, endTime);
|
||||
|
||||
switch (_zoneId)
|
||||
{
|
||||
case 1: // Storm Isle
|
||||
@@ -123,9 +125,6 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, endTime);
|
||||
player.startTimedHuntingZone(_zoneId, endTime - currentTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
@@ -34,7 +35,7 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket
|
||||
public TimedHuntingZoneList(PlayerInstance player)
|
||||
{
|
||||
_player = player;
|
||||
_isInTimedHuntingZone = player.isInTimedHuntingZone();
|
||||
_isInTimedHuntingZone = player.isInsideZone(ZoneId.TIMED_HUNTING);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user