Timed hunting zone rework.
Contributed by dontknowdontcare.
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>100</minLevel>
|
||||
@@ -16,7 +15,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>105</minLevel>
|
||||
|
||||
Vendored
+24
-12
@@ -25,8 +25,7 @@ import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneChargeResult;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@@ -64,7 +63,7 @@ public class AddHuntingTime extends AbstractEffect
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= holder.getMaximumAddedTime()))
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
@@ -72,24 +71,37 @@ public class AddHuntingTime extends AbstractEffect
|
||||
return;
|
||||
}
|
||||
|
||||
final long remainRefill = player.getVariables().getInt(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRemainRefillTime());
|
||||
if ((_time < remainRefill) || (remainRefill == 0))
|
||||
long remainRefillTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRefillTimeMax());
|
||||
remainRefillTime -= _time / 1000;
|
||||
if (remainRefillTime < 0)
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
player.sendMessage("You cannot exceed the time zone limit.");
|
||||
player.sendMessage("Time for this zone can be extended no further.");
|
||||
return;
|
||||
}
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefillTime);
|
||||
|
||||
final long remainTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, holder.getInitialTime());
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime + _time);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefill - (_time / 1000));
|
||||
|
||||
final long remainTime;
|
||||
if (player.isInTimedHuntingZone(_zoneId))
|
||||
{
|
||||
remainTime = _time + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
player.startTimedHuntingZone(_zoneId, endTime);
|
||||
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((endTime + holder.getResetDelay()) < currentTime)
|
||||
{
|
||||
endTime = currentTime + holder.getInitialTime();
|
||||
}
|
||||
else if (endTime < currentTime)
|
||||
{
|
||||
endTime = currentTime;
|
||||
}
|
||||
remainTime = (endTime - currentTime) + _time;
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
}
|
||||
|
||||
player.sendPacket(new TimedHuntingZoneList(player));
|
||||
player.sendPacket(new TimedHuntingZoneChargeResult(_zoneId, (int) (remainTime / 1000), (int) remainRefillTime));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<xs:element type="xs:int" name="initialTime" />
|
||||
<xs:element type="xs:int" name="resetDelay" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="maxAddedTime" />
|
||||
<xs:element type="xs:int" name="remainRefillTime" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="refillTimeMax" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryItemId" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryFee" />
|
||||
@@ -19,6 +18,8 @@
|
||||
<xs:element type="xs:int" name="instanceId" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="soloInstance" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="pvpZone" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="noPvpZone" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||
<xs:attribute type="xs:string" name="name" use="optional" />
|
||||
|
||||
+13
-7
@@ -85,13 +85,14 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
int entryFee = 150000;
|
||||
int minLevel = 1;
|
||||
int maxLevel = 999;
|
||||
int remainRefillTime = 3600;
|
||||
int refillTimeMax = 3600;
|
||||
int instanceId = 0;
|
||||
boolean soloInstance = true;
|
||||
boolean weekly = false;
|
||||
Location enterLocation = null;
|
||||
Location exitLocation = null;
|
||||
boolean pvpZone = false;
|
||||
boolean noPvpZone = false;
|
||||
for (Node zoneNode = listNode.getFirstChild(); zoneNode != null; zoneNode = zoneNode.getNextSibling())
|
||||
{
|
||||
switch (zoneNode.getNodeName())
|
||||
@@ -143,11 +144,6 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
maxLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "remainRefillTime":
|
||||
{
|
||||
remainRefillTime = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "refillTimeMax":
|
||||
{
|
||||
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||
@@ -168,9 +164,19 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
weekly = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "pvpZone":
|
||||
{
|
||||
pvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "noPvpZone":
|
||||
{
|
||||
noPvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, instanceId, soloInstance, weekly, enterLocation, exitLocation));
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, refillTimeMax, instanceId, soloInstance, weekly, enterLocation, exitLocation, pvpZone, noPvpZone));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
package org.l2jmobius.gameserver.model.actor;
|
||||
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||
import org.l2jmobius.gameserver.enums.ClanWarState;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.stat.PlayableStat;
|
||||
import org.l2jmobius.gameserver.model.actor.status.PlayableStatus;
|
||||
@@ -31,6 +33,7 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureDeath;
|
||||
import org.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
@@ -230,6 +233,28 @@ public abstract class Playable extends Creature
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int zoneId)
|
||||
{
|
||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||
{
|
||||
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||
if (holder == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final int instanceId = holder.getInstanceId();
|
||||
if (instanceId > 0)
|
||||
{
|
||||
return isInInstance() && (instanceId == getInstanceWorld().getTemplateId());
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return True.
|
||||
*/
|
||||
|
||||
@@ -891,6 +891,7 @@ public class Player extends Playable
|
||||
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
||||
private boolean _resumedAutoPlay = false;
|
||||
|
||||
private TimedHuntingZoneHolder _lastTimeZone = null;
|
||||
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
||||
|
||||
private final List<QuestTimer> _questTimers = new ArrayList<>();
|
||||
@@ -4147,6 +4148,52 @@ public class Player extends Playable
|
||||
});
|
||||
}
|
||||
|
||||
public void updateRelationsToVisiblePlayers(boolean bothWays)
|
||||
{
|
||||
World.getInstance().forEachVisibleObject(this, Player.class, nearby ->
|
||||
{
|
||||
if (!isVisibleFor(nearby))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateRelation(this, nearby);
|
||||
if (bothWays)
|
||||
{
|
||||
nearby.updateRelation(nearby, this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateRelation(Player player, Player target)
|
||||
{
|
||||
final int relation = player.getRelation(target);
|
||||
final boolean isAutoAttackable = player.isAutoAttackable(target);
|
||||
final RelationCache oldrelation = player.getKnownRelations().get(target.getObjectId());
|
||||
if ((oldrelation == null) || (oldrelation.getRelation() != relation) || (oldrelation.isAutoAttackable() != isAutoAttackable))
|
||||
{
|
||||
final RelationChanged rc = new RelationChanged();
|
||||
rc.addRelation(player, relation, isAutoAttackable);
|
||||
if (player.hasSummon())
|
||||
{
|
||||
final Summon pet = player.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
rc.addRelation(pet, relation, isAutoAttackable);
|
||||
}
|
||||
if (player.hasServitors())
|
||||
{
|
||||
player.getServitors().values().forEach(s -> rc.addRelation(s, relation, isAutoAttackable));
|
||||
}
|
||||
}
|
||||
|
||||
// Delay by 125ms so the CharInfo packet of characters moving into field of view will arrive first,
|
||||
// otherwise this relation packet will be ignored by the client.
|
||||
ThreadPool.schedule(() -> target.sendPacket(rc), 125);
|
||||
player.getKnownRelations().put(target.getObjectId(), new RelationCache(relation, isAutoAttackable));
|
||||
}
|
||||
}
|
||||
|
||||
public void broadcastTitleInfo()
|
||||
{
|
||||
// Send a Server->Client packet UserInfo to this Player
|
||||
@@ -14581,11 +14628,23 @@ public class Player extends Playable
|
||||
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||
}
|
||||
|
||||
public TimedHuntingZoneHolder getLastTimeZone()
|
||||
{
|
||||
return _lastTimeZone;
|
||||
}
|
||||
|
||||
public void setLastTimeZone(TimedHuntingZoneHolder lastTimeZone)
|
||||
{
|
||||
_lastTimeZone = lastTimeZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTimedHuntingZone(int zoneId)
|
||||
{
|
||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||
{
|
||||
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||
|
||||
+15
-8
@@ -33,7 +33,6 @@ public class TimedHuntingZoneHolder
|
||||
private final int _entryFee;
|
||||
private final int _minLevel;
|
||||
private final int _maxLevel;
|
||||
private final int _remainRefillTime;
|
||||
private final int _refillTimeMax;
|
||||
private final int _instanceId;
|
||||
private final boolean _soloInstance;
|
||||
@@ -42,8 +41,10 @@ public class TimedHuntingZoneHolder
|
||||
private final Location _exitLocation;
|
||||
private final int _mapX;
|
||||
private final int _mapY;
|
||||
private final boolean _pvpZone;
|
||||
private final boolean _noPvpZone;
|
||||
|
||||
public TimedHuntingZoneHolder(int id, String name, int initialTime, int maximumAddedTime, int resetDelay, int entryItemId, int entryFee, int minLevel, int maxLevel, int remainRefillTime, int refillTimeMax, int instanceId, boolean soloInstance, boolean weekly, Location enterLocation, Location exitLocation)
|
||||
public TimedHuntingZoneHolder(int id, String name, int initialTime, int maximumAddedTime, int resetDelay, int entryItemId, int entryFee, int minLevel, int maxLevel, int refillTimeMax, int instanceId, boolean soloInstance, boolean weekly, Location enterLocation, Location exitLocation, boolean pvpZone, boolean noPvpZone)
|
||||
{
|
||||
_id = id;
|
||||
_name = name;
|
||||
@@ -54,13 +55,14 @@ public class TimedHuntingZoneHolder
|
||||
_entryFee = entryFee;
|
||||
_minLevel = minLevel;
|
||||
_maxLevel = maxLevel;
|
||||
_remainRefillTime = remainRefillTime;
|
||||
_refillTimeMax = refillTimeMax;
|
||||
_instanceId = instanceId;
|
||||
_soloInstance = soloInstance;
|
||||
_weekly = weekly;
|
||||
_enterLocation = enterLocation;
|
||||
_exitLocation = exitLocation;
|
||||
_pvpZone = pvpZone;
|
||||
_noPvpZone = noPvpZone;
|
||||
_mapX = ((_enterLocation.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
||||
_mapY = ((_enterLocation.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
||||
}
|
||||
@@ -110,11 +112,6 @@ public class TimedHuntingZoneHolder
|
||||
return _maxLevel;
|
||||
}
|
||||
|
||||
public int getRemainRefillTime()
|
||||
{
|
||||
return _remainRefillTime;
|
||||
}
|
||||
|
||||
public int getRefillTimeMax()
|
||||
{
|
||||
return _refillTimeMax;
|
||||
@@ -145,6 +142,16 @@ public class TimedHuntingZoneHolder
|
||||
return _exitLocation;
|
||||
}
|
||||
|
||||
public boolean isPvpZone()
|
||||
{
|
||||
return _pvpZone;
|
||||
}
|
||||
|
||||
public boolean isNoPvpZone()
|
||||
{
|
||||
return _noPvpZone;
|
||||
}
|
||||
|
||||
public int getMapX()
|
||||
{
|
||||
return _mapX;
|
||||
|
||||
+76
-12
@@ -16,20 +16,21 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.zone.type;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||
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.Playable;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneClose;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneExit;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
@@ -43,9 +44,29 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
if (!creature.isPlayer())
|
||||
{
|
||||
if (creature.isPlayable())
|
||||
{
|
||||
Playable summon = (Playable) creature;
|
||||
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||
{
|
||||
if (!summon.isInTimedHuntingZone(holder.getZoneId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.PVP, true);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.NO_PVP, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Check summons spawning or porting inside.
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
@@ -57,16 +78,25 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final int remainingTime = player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||
if (remainingTime > 0)
|
||||
{
|
||||
player.setLastTimeZone(holder);
|
||||
player.startTimedHuntingZone(holder.getZoneId(), remainingTime);
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.PVP, true);
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_A_COMBAT_ZONE);
|
||||
player.updateRelationsToVisiblePlayers(true);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.NO_PVP, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!player.isGM())
|
||||
{
|
||||
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
||||
@@ -79,22 +109,56 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
if (!creature.isPlayer())
|
||||
{
|
||||
if (creature.isPlayable())
|
||||
{
|
||||
final Playable summon = (Playable) creature;
|
||||
for (final TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||
{
|
||||
if (!summon.isInTimedHuntingZone(holder.getZoneId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.PVP, false);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.NO_PVP, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
if (player == null)
|
||||
{
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, false);
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
// We default to zone 6 aka Primeval Isle so we spawn in rune town by default.
|
||||
int nZoneId = 6;
|
||||
|
||||
final TimedHuntingZoneHolder lastTimeZone = player.getLastTimeZone();
|
||||
if (lastTimeZone != null)
|
||||
{
|
||||
if (!player.isInTimedHuntingZone(player.getX(), player.getY()))
|
||||
nZoneId = lastTimeZone.getZoneId();
|
||||
if (lastTimeZone.isPvpZone())
|
||||
{
|
||||
player.sendPacket(TimedHuntingZoneExit.STATIC_PACKET);
|
||||
player.sendPacket(TimedHuntingZoneClose.STATIC_PACKET);
|
||||
player.setInsideZone(ZoneId.PVP, false);
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_LEFT_A_COMBAT_ZONE);
|
||||
player.updateRelationsToVisiblePlayers(true);
|
||||
}
|
||||
}, 1000);
|
||||
else if (lastTimeZone.isNoPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.NO_PVP, false);
|
||||
}
|
||||
player.setLastTimeZone(null);
|
||||
}
|
||||
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, false);
|
||||
player.sendPacket(new TimedHuntingZoneExit(nZoneId));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -841,7 +841,7 @@ public enum OutgoingPackets
|
||||
EX_TIME_RESTRICT_FIELD_USER_ENTER(0xFE, 0x22C),
|
||||
EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT(0xFE, 0x22D),
|
||||
EX_TIME_RESTRICT_FIELD_USER_ALARM(0xFE, 0x22E),
|
||||
EX_TIME_RESTRICT_FIELD_USER_CLOSE(0xFE, 0x22F),
|
||||
EX_TIME_RESTRICT_FIELD_USER_EXIT(0xFE, 0x22F),
|
||||
EX_RANKING_CHAR_INFO(0xFE, 0x230),
|
||||
EX_RANKING_CHAR_HISTORY(0xFE, 0x231),
|
||||
EX_RANKING_CHAR_RANKERS(0xFE, 0x232),
|
||||
|
||||
-4
@@ -29,7 +29,6 @@ import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneClose;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
|
||||
/**
|
||||
@@ -158,9 +157,6 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
QuestManager.getInstance().getQuest("TimedHunting").notifyEvent("ENTER " + _zoneId, null, player);
|
||||
}
|
||||
|
||||
// Close window.
|
||||
player.sendPacket(TimedHuntingZoneClose.STATIC_PACKET);
|
||||
|
||||
// Send time icon.
|
||||
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
|
||||
}
|
||||
|
||||
+13
-5
@@ -21,20 +21,28 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZoneClose implements IClientOutgoingPacket
|
||||
public class TimedHuntingZoneChargeResult implements IClientOutgoingPacket
|
||||
{
|
||||
public static final TimedHuntingZoneClose STATIC_PACKET = new TimedHuntingZoneClose();
|
||||
private final int _zoneId;
|
||||
private final int _secondsLeft;
|
||||
private final int _newExtensionValue;
|
||||
|
||||
public TimedHuntingZoneClose()
|
||||
public TimedHuntingZoneChargeResult(int zoneId, int secondsLeft, int newExtensionValue)
|
||||
{
|
||||
_zoneId = zoneId;
|
||||
_secondsLeft = secondsLeft;
|
||||
_newExtensionValue = newExtensionValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CLOSE.writeId(packet);
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
packet.writeD(_secondsLeft); // Remaining Time in zone.
|
||||
packet.writeD(_newExtensionValue); // New Extension value.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+7
-6
@@ -21,21 +21,22 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius, Index
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZoneExit implements IClientOutgoingPacket
|
||||
{
|
||||
public static final TimedHuntingZoneExit STATIC_PACKET = new TimedHuntingZoneExit();
|
||||
private final int _zoneId;
|
||||
|
||||
public TimedHuntingZoneExit()
|
||||
public TimedHuntingZoneExit(final int zoneId)
|
||||
{
|
||||
_zoneId = zoneId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
public boolean write(final PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_ENTER.writeId(packet);
|
||||
packet.writeC(0); // bEnterSuccess
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_EXIT.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -62,7 +62,8 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket
|
||||
}
|
||||
packet.writeD(remainingTime / 1000); // remain time
|
||||
packet.writeD(holder.getMaximumAddedTime() / 1000);
|
||||
packet.writeD(_player.getVariables().getInt(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + holder.getZoneId(), holder.getRemainRefillTime()));
|
||||
long remainRefillTime = _player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + holder.getZoneId(), holder.getRefillTimeMax());
|
||||
packet.writeD((int) remainRefillTime);
|
||||
packet.writeD(holder.getRefillTimeMax());
|
||||
packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>100</minLevel>
|
||||
@@ -16,7 +15,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>105</minLevel>
|
||||
@@ -27,7 +25,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>107</minLevel>
|
||||
@@ -38,7 +35,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>18000</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>99</minLevel>
|
||||
@@ -49,7 +45,6 @@
|
||||
<initialTime>36000</initialTime> <!-- 10 hours -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>36000</maxAddedTime> <!-- 12 hours -->
|
||||
<remainRefillTime>0</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>110</minLevel>
|
||||
@@ -62,7 +57,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>3600</maxAddedTime> <!-- 1 hour -->
|
||||
<remainRefillTime>0</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>105</minLevel>
|
||||
|
||||
Vendored
+24
-12
@@ -25,8 +25,7 @@ import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneChargeResult;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@@ -64,7 +63,7 @@ public class AddHuntingTime extends AbstractEffect
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= holder.getMaximumAddedTime()))
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
@@ -72,24 +71,37 @@ public class AddHuntingTime extends AbstractEffect
|
||||
return;
|
||||
}
|
||||
|
||||
final long remainRefill = player.getVariables().getInt(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRemainRefillTime());
|
||||
if ((_time < remainRefill) || (remainRefill == 0))
|
||||
long remainRefillTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRefillTimeMax());
|
||||
remainRefillTime -= _time / 1000;
|
||||
if (remainRefillTime < 0)
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
player.sendMessage("You cannot exceed the time zone limit.");
|
||||
player.sendMessage("Time for this zone can be extended no further.");
|
||||
return;
|
||||
}
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefillTime);
|
||||
|
||||
final long remainTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, holder.getInitialTime());
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime + _time);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefill - (_time / 1000));
|
||||
|
||||
final long remainTime;
|
||||
if (player.isInTimedHuntingZone(_zoneId))
|
||||
{
|
||||
remainTime = _time + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
player.startTimedHuntingZone(_zoneId, endTime);
|
||||
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((endTime + holder.getResetDelay()) < currentTime)
|
||||
{
|
||||
endTime = currentTime + holder.getInitialTime();
|
||||
}
|
||||
else if (endTime < currentTime)
|
||||
{
|
||||
endTime = currentTime;
|
||||
}
|
||||
remainTime = (endTime - currentTime) + _time;
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
}
|
||||
|
||||
player.sendPacket(new TimedHuntingZoneList(player));
|
||||
player.sendPacket(new TimedHuntingZoneChargeResult(_zoneId, (int) (remainTime / 1000), (int) remainRefillTime));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<xs:element type="xs:int" name="initialTime" />
|
||||
<xs:element type="xs:int" name="resetDelay" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="maxAddedTime" />
|
||||
<xs:element type="xs:int" name="remainRefillTime" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="refillTimeMax" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryItemId" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryFee" />
|
||||
@@ -20,6 +19,8 @@
|
||||
<xs:element type="xs:boolean" name="soloInstance" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="useWorldPrefix" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="pvpZone" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="noPvpZone" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||
<xs:attribute type="xs:string" name="name" use="optional" />
|
||||
|
||||
+13
-7
@@ -85,7 +85,6 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
int entryFee = 150000;
|
||||
int minLevel = 1;
|
||||
int maxLevel = 999;
|
||||
int remainRefillTime = 3600;
|
||||
int refillTimeMax = 3600;
|
||||
int instanceId = 0;
|
||||
boolean soloInstance = true;
|
||||
@@ -93,6 +92,8 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
boolean useWorldPrefix = false;
|
||||
Location enterLocation = null;
|
||||
Location exitLocation = null;
|
||||
boolean pvpZone = false;
|
||||
boolean noPvpZone = false;
|
||||
for (Node zoneNode = listNode.getFirstChild(); zoneNode != null; zoneNode = zoneNode.getNextSibling())
|
||||
{
|
||||
switch (zoneNode.getNodeName())
|
||||
@@ -144,11 +145,6 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
maxLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "remainRefillTime":
|
||||
{
|
||||
remainRefillTime = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "refillTimeMax":
|
||||
{
|
||||
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||
@@ -174,9 +170,19 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
useWorldPrefix = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "pvpZone":
|
||||
{
|
||||
pvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "noPvpZone":
|
||||
{
|
||||
noPvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, instanceId, soloInstance, weekly, useWorldPrefix, enterLocation, exitLocation));
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, refillTimeMax, instanceId, soloInstance, weekly, useWorldPrefix, enterLocation, exitLocation, pvpZone, noPvpZone));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
package org.l2jmobius.gameserver.model.actor;
|
||||
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||
import org.l2jmobius.gameserver.enums.ClanWarState;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.stat.PlayableStat;
|
||||
import org.l2jmobius.gameserver.model.actor.status.PlayableStatus;
|
||||
@@ -31,6 +33,7 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureDeath;
|
||||
import org.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
@@ -230,6 +233,28 @@ public abstract class Playable extends Creature
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int zoneId)
|
||||
{
|
||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||
{
|
||||
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||
if (holder == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final int instanceId = holder.getInstanceId();
|
||||
if (instanceId > 0)
|
||||
{
|
||||
return isInInstance() && (instanceId == getInstanceWorld().getTemplateId());
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return True.
|
||||
*/
|
||||
|
||||
@@ -899,6 +899,7 @@ public class Player extends Playable
|
||||
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
||||
private boolean _resumedAutoPlay = false;
|
||||
|
||||
private TimedHuntingZoneHolder _lastTimeZone = null;
|
||||
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
||||
|
||||
private final HomunculusList _homunculusList = new HomunculusList(this);
|
||||
@@ -4185,6 +4186,52 @@ public class Player extends Playable
|
||||
});
|
||||
}
|
||||
|
||||
public void updateRelationsToVisiblePlayers(boolean bothWays)
|
||||
{
|
||||
World.getInstance().forEachVisibleObject(this, Player.class, nearby ->
|
||||
{
|
||||
if (!isVisibleFor(nearby))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateRelation(this, nearby);
|
||||
if (bothWays)
|
||||
{
|
||||
nearby.updateRelation(nearby, this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateRelation(Player player, Player target)
|
||||
{
|
||||
final long relation = player.getRelation(target);
|
||||
final boolean isAutoAttackable = player.isAutoAttackable(target);
|
||||
final RelationCache oldrelation = player.getKnownRelations().get(target.getObjectId());
|
||||
if ((oldrelation == null) || (oldrelation.getRelation() != relation) || (oldrelation.isAutoAttackable() != isAutoAttackable))
|
||||
{
|
||||
final RelationChanged rc = new RelationChanged();
|
||||
rc.addRelation(player, relation, isAutoAttackable);
|
||||
if (player.hasSummon())
|
||||
{
|
||||
final Summon pet = player.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
rc.addRelation(pet, relation, isAutoAttackable);
|
||||
}
|
||||
if (player.hasServitors())
|
||||
{
|
||||
player.getServitors().values().forEach(s -> rc.addRelation(s, relation, isAutoAttackable));
|
||||
}
|
||||
}
|
||||
|
||||
// Delay by 125ms so the CharInfo packet of characters moving into field of view will arrive first,
|
||||
// otherwise this relation packet will be ignored by the client.
|
||||
ThreadPool.schedule(() -> target.sendPacket(rc), 125);
|
||||
player.getKnownRelations().put(target.getObjectId(), new RelationCache(relation, isAutoAttackable));
|
||||
}
|
||||
}
|
||||
|
||||
public void broadcastTitleInfo()
|
||||
{
|
||||
// Send a Server->Client packet UserInfo to this Player
|
||||
@@ -14692,11 +14739,23 @@ public class Player extends Playable
|
||||
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||
}
|
||||
|
||||
public TimedHuntingZoneHolder getLastTimeZone()
|
||||
{
|
||||
return _lastTimeZone;
|
||||
}
|
||||
|
||||
public void setLastTimeZone(TimedHuntingZoneHolder lastTimeZone)
|
||||
{
|
||||
_lastTimeZone = lastTimeZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTimedHuntingZone(int zoneId)
|
||||
{
|
||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||
{
|
||||
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||
|
||||
+15
-8
@@ -33,7 +33,6 @@ public class TimedHuntingZoneHolder
|
||||
private final int _entryFee;
|
||||
private final int _minLevel;
|
||||
private final int _maxLevel;
|
||||
private final int _remainRefillTime;
|
||||
private final int _refillTimeMax;
|
||||
private final int _instanceId;
|
||||
private final boolean _soloInstance;
|
||||
@@ -43,8 +42,10 @@ public class TimedHuntingZoneHolder
|
||||
private final Location _exitLocation;
|
||||
private final int _mapX;
|
||||
private final int _mapY;
|
||||
private final boolean _pvpZone;
|
||||
private final boolean _noPvpZone;
|
||||
|
||||
public TimedHuntingZoneHolder(int id, String name, int initialTime, int maximumAddedTime, int resetDelay, int entryItemId, int entryFee, int minLevel, int maxLevel, int remainRefillTime, int refillTimeMax, int instanceId, boolean soloInstance, boolean weekly, boolean useWorldPrefix, Location enterLocation, Location exitLocation)
|
||||
public TimedHuntingZoneHolder(int id, String name, int initialTime, int maximumAddedTime, int resetDelay, int entryItemId, int entryFee, int minLevel, int maxLevel, int refillTimeMax, int instanceId, boolean soloInstance, boolean weekly, boolean useWorldPrefix, Location enterLocation, Location exitLocation, boolean pvpZone, boolean noPvpZone)
|
||||
{
|
||||
_id = id;
|
||||
_name = name;
|
||||
@@ -55,7 +56,6 @@ public class TimedHuntingZoneHolder
|
||||
_entryFee = entryFee;
|
||||
_minLevel = minLevel;
|
||||
_maxLevel = maxLevel;
|
||||
_remainRefillTime = remainRefillTime;
|
||||
_refillTimeMax = refillTimeMax;
|
||||
_instanceId = instanceId;
|
||||
_soloInstance = soloInstance;
|
||||
@@ -63,6 +63,8 @@ public class TimedHuntingZoneHolder
|
||||
_useWorldPrefix = useWorldPrefix;
|
||||
_enterLocation = enterLocation;
|
||||
_exitLocation = exitLocation;
|
||||
_pvpZone = pvpZone;
|
||||
_noPvpZone = noPvpZone;
|
||||
_mapX = ((_enterLocation.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
||||
_mapY = ((_enterLocation.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
||||
}
|
||||
@@ -112,11 +114,6 @@ public class TimedHuntingZoneHolder
|
||||
return _maxLevel;
|
||||
}
|
||||
|
||||
public int getRemainRefillTime()
|
||||
{
|
||||
return _remainRefillTime;
|
||||
}
|
||||
|
||||
public int getRefillTimeMax()
|
||||
{
|
||||
return _refillTimeMax;
|
||||
@@ -152,6 +149,16 @@ public class TimedHuntingZoneHolder
|
||||
return _exitLocation;
|
||||
}
|
||||
|
||||
public boolean isPvpZone()
|
||||
{
|
||||
return _pvpZone;
|
||||
}
|
||||
|
||||
public boolean isNoPvpZone()
|
||||
{
|
||||
return _noPvpZone;
|
||||
}
|
||||
|
||||
public int getMapX()
|
||||
{
|
||||
return _mapX;
|
||||
|
||||
+76
-12
@@ -16,20 +16,21 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.zone.type;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||
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.Playable;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneClose;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneExit;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
@@ -43,9 +44,29 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
if (!creature.isPlayer())
|
||||
{
|
||||
if (creature.isPlayable())
|
||||
{
|
||||
Playable summon = (Playable) creature;
|
||||
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||
{
|
||||
if (!summon.isInTimedHuntingZone(holder.getZoneId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.PVP, true);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.NO_PVP, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Check summons spawning or porting inside.
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
@@ -57,16 +78,25 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final int remainingTime = player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||
if (remainingTime > 0)
|
||||
{
|
||||
player.setLastTimeZone(holder);
|
||||
player.startTimedHuntingZone(holder.getZoneId(), remainingTime);
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.PVP, true);
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_A_COMBAT_ZONE);
|
||||
player.updateRelationsToVisiblePlayers(true);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.NO_PVP, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!player.isGM())
|
||||
{
|
||||
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
||||
@@ -79,22 +109,56 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
if (!creature.isPlayer())
|
||||
{
|
||||
if (creature.isPlayable())
|
||||
{
|
||||
final Playable summon = (Playable) creature;
|
||||
for (final TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||
{
|
||||
if (!summon.isInTimedHuntingZone(holder.getZoneId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.PVP, false);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.NO_PVP, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
if (player == null)
|
||||
{
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, false);
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
// We default to zone 6 aka Primeval Isle so we spawn in rune town by default.
|
||||
int nZoneId = 6;
|
||||
|
||||
final TimedHuntingZoneHolder lastTimeZone = player.getLastTimeZone();
|
||||
if (lastTimeZone != null)
|
||||
{
|
||||
if (!player.isInTimedHuntingZone(player.getX(), player.getY()))
|
||||
nZoneId = lastTimeZone.getZoneId();
|
||||
if (lastTimeZone.isPvpZone())
|
||||
{
|
||||
player.sendPacket(TimedHuntingZoneExit.STATIC_PACKET);
|
||||
player.sendPacket(TimedHuntingZoneClose.STATIC_PACKET);
|
||||
player.setInsideZone(ZoneId.PVP, false);
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_LEFT_A_COMBAT_ZONE);
|
||||
player.updateRelationsToVisiblePlayers(true);
|
||||
}
|
||||
}, 1000);
|
||||
else if (lastTimeZone.isNoPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.NO_PVP, false);
|
||||
}
|
||||
player.setLastTimeZone(null);
|
||||
}
|
||||
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, false);
|
||||
player.sendPacket(new TimedHuntingZoneExit(nZoneId));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -840,7 +840,7 @@ public enum OutgoingPackets
|
||||
EX_TIME_RESTRICT_FIELD_USER_ENTER(0xFE, 0x22A),
|
||||
EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT(0xFE, 0x22B),
|
||||
EX_TIME_RESTRICT_FIELD_USER_ALARM(0xFE, 0x22C),
|
||||
EX_TIME_RESTRICT_FIELD_USER_CLOSE(0xFE, 0x22D),
|
||||
EX_TIME_RESTRICT_FIELD_USER_EXIT(0xFE, 0x22D),
|
||||
EX_RANKING_CHAR_INFO(0xFE, 0x22E),
|
||||
EX_RANKING_CHAR_HISTORY(0xFE, 0x22F),
|
||||
EX_RANKING_CHAR_RANKERS(0xFE, 0x230),
|
||||
|
||||
-4
@@ -29,7 +29,6 @@ import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneClose;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
|
||||
/**
|
||||
@@ -158,9 +157,6 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
QuestManager.getInstance().getQuest("TimedHunting").notifyEvent("ENTER " + _zoneId, null, player);
|
||||
}
|
||||
|
||||
// Close window.
|
||||
player.sendPacket(TimedHuntingZoneClose.STATIC_PACKET);
|
||||
|
||||
// Send time icon.
|
||||
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
|
||||
}
|
||||
|
||||
+13
-5
@@ -21,20 +21,28 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZoneClose implements IClientOutgoingPacket
|
||||
public class TimedHuntingZoneChargeResult implements IClientOutgoingPacket
|
||||
{
|
||||
public static final TimedHuntingZoneClose STATIC_PACKET = new TimedHuntingZoneClose();
|
||||
private final int _zoneId;
|
||||
private final int _secondsLeft;
|
||||
private final int _newExtensionValue;
|
||||
|
||||
public TimedHuntingZoneClose()
|
||||
public TimedHuntingZoneChargeResult(int zoneId, int secondsLeft, int newExtensionValue)
|
||||
{
|
||||
_zoneId = zoneId;
|
||||
_secondsLeft = secondsLeft;
|
||||
_newExtensionValue = newExtensionValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CLOSE.writeId(packet);
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
packet.writeD(_secondsLeft); // Remaining Time in zone.
|
||||
packet.writeD(_newExtensionValue); // New Extension value.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+7
-6
@@ -21,21 +21,22 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius, Index
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZoneExit implements IClientOutgoingPacket
|
||||
{
|
||||
public static final TimedHuntingZoneExit STATIC_PACKET = new TimedHuntingZoneExit();
|
||||
private final int _zoneId;
|
||||
|
||||
public TimedHuntingZoneExit()
|
||||
public TimedHuntingZoneExit(final int zoneId)
|
||||
{
|
||||
_zoneId = zoneId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
public boolean write(final PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_ENTER.writeId(packet);
|
||||
packet.writeC(0); // bEnterSuccess
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_EXIT.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -62,7 +62,8 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket
|
||||
}
|
||||
packet.writeD(remainingTime / 1000); // remain time
|
||||
packet.writeD(holder.getMaximumAddedTime() / 1000);
|
||||
packet.writeD(_player.getVariables().getInt(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + holder.getZoneId(), holder.getRemainRefillTime()));
|
||||
long remainRefillTime = _player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + holder.getZoneId(), holder.getRefillTimeMax());
|
||||
packet.writeD((int) remainRefillTime);
|
||||
packet.writeD(holder.getRefillTimeMax());
|
||||
packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
||||
packet.writeC(0); // bUserBound
|
||||
|
||||
+30
-20
@@ -1,34 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<list enabled="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/TimedHuntingZoneData.xsd">
|
||||
<zone id="1" name="Storm Isle">
|
||||
<enterLocation>194291,176604,-1888</enterLocation>
|
||||
<enterLocation>194284,176597,-1888</enterLocation>
|
||||
<exitLocation>110975,220094,-3664</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>7200</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>100</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
<soloInstance>false</soloInstance>
|
||||
<noPvpZone>true</noPvpZone>
|
||||
</zone>
|
||||
<zone id="6" name="Primeval Isle">
|
||||
<enterLocation>9400,-21720,-3634</enterLocation>
|
||||
<enterLocation>9365,-21407,-3584</enterLocation>
|
||||
<exitLocation>43792,-48928,-792</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>7200</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>105</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
<soloInstance>false</soloInstance>
|
||||
</zone>
|
||||
<zone id="7" name="Isle of Souls">
|
||||
<enterLocation>-122259,73678,-2872</enterLocation>
|
||||
<enterLocation>-122260,73669,-2872</enterLocation>
|
||||
<exitLocation>148353,28032,-2264</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>86400</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>7200</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>107</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
@@ -36,46 +39,50 @@
|
||||
<soloInstance>false</soloInstance>
|
||||
</zone>
|
||||
<zone id="11" name="Abandoned Coal Mines">
|
||||
<enterLocation>139411,-169382,-1600</enterLocation>
|
||||
<enterLocation>139405,-169389,-1600</enterLocation>
|
||||
<exitLocation>146561,28042,-2264</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>18000</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>18000</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>99</minLevel>
|
||||
<maxLevel>105</maxLevel>
|
||||
<soloInstance>false</soloInstance>
|
||||
<noPvpZone>true</noPvpZone>
|
||||
</zone>
|
||||
<zone id="8" name="Tower of Insolence">
|
||||
<enterLocation>-82014,16247,-15416</enterLocation>
|
||||
<initialTime>36000</initialTime> <!-- 10 hours -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>36000</maxAddedTime> <!-- 12 hours -->
|
||||
<remainRefillTime>0</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>110</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
<instanceId>1020</instanceId>
|
||||
<soloInstance>false</soloInstance>
|
||||
<weekly>true</weekly>
|
||||
<useWorldPrefix>true</useWorldPrefix>
|
||||
</zone>
|
||||
<zone id="12" name="Imperial Tomb">
|
||||
<enterLocation>181409,-78389,-2728</enterLocation>
|
||||
<enterLocation>181406,-78395,-2728</enterLocation>
|
||||
<exitLocation>147714,-55409,-2728</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>3600</maxAddedTime> <!-- 1 hour -->
|
||||
<remainRefillTime>0</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>0</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>105</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
<soloInstance>false</soloInstance>
|
||||
</zone>
|
||||
<zone id="13" name="Corroded Fields">
|
||||
<enterLocation>90327,198818,-3280</enterLocation>
|
||||
<enterLocation>90359,198833,-3280</enterLocation>
|
||||
<exitLocation>111563,220512,-3664</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 3 hours -->
|
||||
<remainRefillTime>18000</remainRefillTime>
|
||||
<refillTimeMax>36000</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>100</minLevel>
|
||||
@@ -84,13 +91,16 @@
|
||||
<soloInstance>false</soloInstance>
|
||||
</zone>
|
||||
<zone id="14" name="Otherworldly Atelia Refinery">
|
||||
<enterLocation>-49013,15351,-8808</enterLocation>
|
||||
<enterLocation>-49020,15369,-8808</enterLocation>
|
||||
<exitLocation>82795,53888,-1488</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>112</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
<soloInstance>false</soloInstance>
|
||||
<weekly>true</weekly>
|
||||
<noPvpZone>true</noPvpZone>
|
||||
</zone>
|
||||
</list>
|
||||
+24
-12
@@ -25,8 +25,7 @@ import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneChargeResult;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@@ -64,7 +63,7 @@ public class AddHuntingTime extends AbstractEffect
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= holder.getMaximumAddedTime()))
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
@@ -72,24 +71,37 @@ public class AddHuntingTime extends AbstractEffect
|
||||
return;
|
||||
}
|
||||
|
||||
final long remainRefill = player.getVariables().getInt(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRemainRefillTime());
|
||||
if ((_time < remainRefill) || (remainRefill == 0))
|
||||
long remainRefillTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRefillTimeMax());
|
||||
remainRefillTime -= _time / 1000;
|
||||
if (remainRefillTime < 0)
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
player.sendMessage("You cannot exceed the time zone limit.");
|
||||
player.sendMessage("Time for this zone can be extended no further.");
|
||||
return;
|
||||
}
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefillTime);
|
||||
|
||||
final long remainTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, holder.getInitialTime());
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime + _time);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefill - (_time / 1000));
|
||||
|
||||
final long remainTime;
|
||||
if (player.isInTimedHuntingZone(_zoneId))
|
||||
{
|
||||
remainTime = _time + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
player.startTimedHuntingZone(_zoneId, endTime);
|
||||
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((endTime + holder.getResetDelay()) < currentTime)
|
||||
{
|
||||
endTime = currentTime + holder.getInitialTime();
|
||||
}
|
||||
else if (endTime < currentTime)
|
||||
{
|
||||
endTime = currentTime;
|
||||
}
|
||||
remainTime = (endTime - currentTime) + _time;
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
}
|
||||
|
||||
player.sendPacket(new TimedHuntingZoneList(player));
|
||||
player.sendPacket(new TimedHuntingZoneChargeResult(_zoneId, (int) (remainTime / 1000), (int) remainRefillTime));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -10,7 +10,6 @@
|
||||
<xs:element type="xs:int" name="initialTime" />
|
||||
<xs:element type="xs:int" name="resetDelay" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="maxAddedTime" />
|
||||
<xs:element type="xs:int" name="remainRefillTime" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="refillTimeMax" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryItemId" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryFee" />
|
||||
@@ -20,6 +19,8 @@
|
||||
<xs:element type="xs:boolean" name="soloInstance" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="useWorldPrefix" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="pvpZone" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="noPvpZone" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||
<xs:attribute type="xs:string" name="name" use="optional" />
|
||||
|
||||
+13
-7
@@ -85,7 +85,6 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
int entryFee = 150000;
|
||||
int minLevel = 1;
|
||||
int maxLevel = 999;
|
||||
int remainRefillTime = 3600;
|
||||
int refillTimeMax = 3600;
|
||||
int instanceId = 0;
|
||||
boolean soloInstance = true;
|
||||
@@ -93,6 +92,8 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
boolean useWorldPrefix = false;
|
||||
Location enterLocation = null;
|
||||
Location exitLocation = null;
|
||||
boolean pvpZone = false;
|
||||
boolean noPvpZone = false;
|
||||
for (Node zoneNode = listNode.getFirstChild(); zoneNode != null; zoneNode = zoneNode.getNextSibling())
|
||||
{
|
||||
switch (zoneNode.getNodeName())
|
||||
@@ -144,11 +145,6 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
maxLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "remainRefillTime":
|
||||
{
|
||||
remainRefillTime = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "refillTimeMax":
|
||||
{
|
||||
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||
@@ -174,9 +170,19 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
useWorldPrefix = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "pvpZone":
|
||||
{
|
||||
pvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "noPvpZone":
|
||||
{
|
||||
noPvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, instanceId, soloInstance, weekly, useWorldPrefix, enterLocation, exitLocation));
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, refillTimeMax, instanceId, soloInstance, weekly, useWorldPrefix, enterLocation, exitLocation, pvpZone, noPvpZone));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+25
@@ -17,9 +17,11 @@
|
||||
package org.l2jmobius.gameserver.model.actor;
|
||||
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||
import org.l2jmobius.gameserver.enums.ClanWarState;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.stat.PlayableStat;
|
||||
import org.l2jmobius.gameserver.model.actor.status.PlayableStatus;
|
||||
@@ -31,6 +33,7 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureDeath;
|
||||
import org.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
@@ -230,6 +233,28 @@ public abstract class Playable extends Creature
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int zoneId)
|
||||
{
|
||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||
{
|
||||
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||
if (holder == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final int instanceId = holder.getInstanceId();
|
||||
if (instanceId > 0)
|
||||
{
|
||||
return isInInstance() && (instanceId == getInstanceWorld().getTemplateId());
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return True.
|
||||
*/
|
||||
|
||||
+59
@@ -912,6 +912,7 @@ public class Player extends Playable
|
||||
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
||||
private boolean _resumedAutoPlay = false;
|
||||
|
||||
private TimedHuntingZoneHolder _lastTimeZone = null;
|
||||
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
||||
|
||||
private final HomunculusList _homunculusList = new HomunculusList(this);
|
||||
@@ -4202,6 +4203,52 @@ public class Player extends Playable
|
||||
});
|
||||
}
|
||||
|
||||
public void updateRelationsToVisiblePlayers(boolean bothWays)
|
||||
{
|
||||
World.getInstance().forEachVisibleObject(this, Player.class, nearby ->
|
||||
{
|
||||
if (!isVisibleFor(nearby))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateRelation(this, nearby);
|
||||
if (bothWays)
|
||||
{
|
||||
nearby.updateRelation(nearby, this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateRelation(Player player, Player target)
|
||||
{
|
||||
final long relation = player.getRelation(target);
|
||||
final boolean isAutoAttackable = player.isAutoAttackable(target);
|
||||
final RelationCache oldrelation = player.getKnownRelations().get(target.getObjectId());
|
||||
if ((oldrelation == null) || (oldrelation.getRelation() != relation) || (oldrelation.isAutoAttackable() != isAutoAttackable))
|
||||
{
|
||||
final RelationChanged rc = new RelationChanged();
|
||||
rc.addRelation(player, relation, isAutoAttackable);
|
||||
if (player.hasSummon())
|
||||
{
|
||||
final Summon pet = player.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
rc.addRelation(pet, relation, isAutoAttackable);
|
||||
}
|
||||
if (player.hasServitors())
|
||||
{
|
||||
player.getServitors().values().forEach(s -> rc.addRelation(s, relation, isAutoAttackable));
|
||||
}
|
||||
}
|
||||
|
||||
// Delay by 125ms so the CharInfo packet of characters moving into field of view will arrive first,
|
||||
// otherwise this relation packet will be ignored by the client.
|
||||
ThreadPool.schedule(() -> target.sendPacket(rc), 125);
|
||||
player.getKnownRelations().put(target.getObjectId(), new RelationCache(relation, isAutoAttackable));
|
||||
}
|
||||
}
|
||||
|
||||
public void broadcastTitleInfo()
|
||||
{
|
||||
// Send a Server->Client packet UserInfo to this Player
|
||||
@@ -14730,11 +14777,23 @@ public class Player extends Playable
|
||||
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||
}
|
||||
|
||||
public TimedHuntingZoneHolder getLastTimeZone()
|
||||
{
|
||||
return _lastTimeZone;
|
||||
}
|
||||
|
||||
public void setLastTimeZone(TimedHuntingZoneHolder lastTimeZone)
|
||||
{
|
||||
_lastTimeZone = lastTimeZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTimedHuntingZone(int zoneId)
|
||||
{
|
||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||
{
|
||||
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||
|
||||
+15
-8
@@ -33,7 +33,6 @@ public class TimedHuntingZoneHolder
|
||||
private final int _entryFee;
|
||||
private final int _minLevel;
|
||||
private final int _maxLevel;
|
||||
private final int _remainRefillTime;
|
||||
private final int _refillTimeMax;
|
||||
private final int _instanceId;
|
||||
private final boolean _soloInstance;
|
||||
@@ -43,8 +42,10 @@ public class TimedHuntingZoneHolder
|
||||
private final Location _exitLocation;
|
||||
private final int _mapX;
|
||||
private final int _mapY;
|
||||
private final boolean _pvpZone;
|
||||
private final boolean _noPvpZone;
|
||||
|
||||
public TimedHuntingZoneHolder(int id, String name, int initialTime, int maximumAddedTime, int resetDelay, int entryItemId, int entryFee, int minLevel, int maxLevel, int remainRefillTime, int refillTimeMax, int instanceId, boolean soloInstance, boolean weekly, boolean useWorldPrefix, Location enterLocation, Location exitLocation)
|
||||
public TimedHuntingZoneHolder(int id, String name, int initialTime, int maximumAddedTime, int resetDelay, int entryItemId, int entryFee, int minLevel, int maxLevel, int refillTimeMax, int instanceId, boolean soloInstance, boolean weekly, boolean useWorldPrefix, Location enterLocation, Location exitLocation, boolean pvpZone, boolean noPvpZone)
|
||||
{
|
||||
_id = id;
|
||||
_name = name;
|
||||
@@ -55,7 +56,6 @@ public class TimedHuntingZoneHolder
|
||||
_entryFee = entryFee;
|
||||
_minLevel = minLevel;
|
||||
_maxLevel = maxLevel;
|
||||
_remainRefillTime = remainRefillTime;
|
||||
_refillTimeMax = refillTimeMax;
|
||||
_instanceId = instanceId;
|
||||
_soloInstance = soloInstance;
|
||||
@@ -63,6 +63,8 @@ public class TimedHuntingZoneHolder
|
||||
_useWorldPrefix = useWorldPrefix;
|
||||
_enterLocation = enterLocation;
|
||||
_exitLocation = exitLocation;
|
||||
_pvpZone = pvpZone;
|
||||
_noPvpZone = noPvpZone;
|
||||
_mapX = ((_enterLocation.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
||||
_mapY = ((_enterLocation.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
||||
}
|
||||
@@ -112,11 +114,6 @@ public class TimedHuntingZoneHolder
|
||||
return _maxLevel;
|
||||
}
|
||||
|
||||
public int getRemainRefillTime()
|
||||
{
|
||||
return _remainRefillTime;
|
||||
}
|
||||
|
||||
public int getRefillTimeMax()
|
||||
{
|
||||
return _refillTimeMax;
|
||||
@@ -152,6 +149,16 @@ public class TimedHuntingZoneHolder
|
||||
return _exitLocation;
|
||||
}
|
||||
|
||||
public boolean isPvpZone()
|
||||
{
|
||||
return _pvpZone;
|
||||
}
|
||||
|
||||
public boolean isNoPvpZone()
|
||||
{
|
||||
return _noPvpZone;
|
||||
}
|
||||
|
||||
public int getMapX()
|
||||
{
|
||||
return _mapX;
|
||||
|
||||
+76
-12
@@ -16,20 +16,21 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.zone.type;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||
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.Playable;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneClose;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneExit;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
@@ -43,9 +44,29 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
if (!creature.isPlayer())
|
||||
{
|
||||
if (creature.isPlayable())
|
||||
{
|
||||
Playable summon = (Playable) creature;
|
||||
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||
{
|
||||
if (!summon.isInTimedHuntingZone(holder.getZoneId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.PVP, true);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.NO_PVP, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Check summons spawning or porting inside.
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
@@ -57,16 +78,25 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final int remainingTime = player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||
if (remainingTime > 0)
|
||||
{
|
||||
player.setLastTimeZone(holder);
|
||||
player.startTimedHuntingZone(holder.getZoneId(), remainingTime);
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.PVP, true);
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_A_COMBAT_ZONE);
|
||||
player.updateRelationsToVisiblePlayers(true);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.NO_PVP, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!player.isGM())
|
||||
{
|
||||
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
||||
@@ -79,22 +109,56 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
if (!creature.isPlayer())
|
||||
{
|
||||
if (creature.isPlayable())
|
||||
{
|
||||
final Playable summon = (Playable) creature;
|
||||
for (final TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||
{
|
||||
if (!summon.isInTimedHuntingZone(holder.getZoneId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.PVP, false);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.NO_PVP, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
if (player == null)
|
||||
{
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, false);
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
// We default to zone 6 aka Primeval Isle so we spawn in rune town by default.
|
||||
int nZoneId = 6;
|
||||
|
||||
final TimedHuntingZoneHolder lastTimeZone = player.getLastTimeZone();
|
||||
if (lastTimeZone != null)
|
||||
{
|
||||
if (!player.isInTimedHuntingZone(player.getX(), player.getY()))
|
||||
nZoneId = lastTimeZone.getZoneId();
|
||||
if (lastTimeZone.isPvpZone())
|
||||
{
|
||||
player.sendPacket(TimedHuntingZoneExit.STATIC_PACKET);
|
||||
player.sendPacket(TimedHuntingZoneClose.STATIC_PACKET);
|
||||
player.setInsideZone(ZoneId.PVP, false);
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_LEFT_A_COMBAT_ZONE);
|
||||
player.updateRelationsToVisiblePlayers(true);
|
||||
}
|
||||
}, 1000);
|
||||
else if (lastTimeZone.isNoPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.NO_PVP, false);
|
||||
}
|
||||
player.setLastTimeZone(null);
|
||||
}
|
||||
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, false);
|
||||
player.sendPacket(new TimedHuntingZoneExit(nZoneId));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -840,7 +840,7 @@ public enum OutgoingPackets
|
||||
EX_TIME_RESTRICT_FIELD_USER_ENTER(0xFE, 0x22A),
|
||||
EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT(0xFE, 0x22B),
|
||||
EX_TIME_RESTRICT_FIELD_USER_ALARM(0xFE, 0x22C),
|
||||
EX_TIME_RESTRICT_FIELD_USER_CLOSE(0xFE, 0x22D),
|
||||
EX_TIME_RESTRICT_FIELD_USER_EXIT(0xFE, 0x22D),
|
||||
EX_RANKING_CHAR_INFO(0xFE, 0x22E),
|
||||
EX_RANKING_CHAR_HISTORY(0xFE, 0x22F),
|
||||
EX_RANKING_CHAR_RANKERS(0xFE, 0x230),
|
||||
|
||||
-4
@@ -29,7 +29,6 @@ import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneClose;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
|
||||
/**
|
||||
@@ -158,9 +157,6 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
QuestManager.getInstance().getQuest("TimedHunting").notifyEvent("ENTER " + _zoneId, null, player);
|
||||
}
|
||||
|
||||
// Close window.
|
||||
player.sendPacket(TimedHuntingZoneClose.STATIC_PACKET);
|
||||
|
||||
// Send time icon.
|
||||
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
|
||||
}
|
||||
|
||||
+13
-5
@@ -21,20 +21,28 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZoneClose implements IClientOutgoingPacket
|
||||
public class TimedHuntingZoneChargeResult implements IClientOutgoingPacket
|
||||
{
|
||||
public static final TimedHuntingZoneClose STATIC_PACKET = new TimedHuntingZoneClose();
|
||||
private final int _zoneId;
|
||||
private final int _secondsLeft;
|
||||
private final int _newExtensionValue;
|
||||
|
||||
public TimedHuntingZoneClose()
|
||||
public TimedHuntingZoneChargeResult(int zoneId, int secondsLeft, int newExtensionValue)
|
||||
{
|
||||
_zoneId = zoneId;
|
||||
_secondsLeft = secondsLeft;
|
||||
_newExtensionValue = newExtensionValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CLOSE.writeId(packet);
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
packet.writeD(_secondsLeft); // Remaining Time in zone.
|
||||
packet.writeD(_newExtensionValue); // New Extension value.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+7
-6
@@ -21,21 +21,22 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius, Index
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZoneExit implements IClientOutgoingPacket
|
||||
{
|
||||
public static final TimedHuntingZoneExit STATIC_PACKET = new TimedHuntingZoneExit();
|
||||
private final int _zoneId;
|
||||
|
||||
public TimedHuntingZoneExit()
|
||||
public TimedHuntingZoneExit(final int zoneId)
|
||||
{
|
||||
_zoneId = zoneId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
public boolean write(final PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_ENTER.writeId(packet);
|
||||
packet.writeC(0); // bEnterSuccess
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_EXIT.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -62,7 +62,8 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket
|
||||
}
|
||||
packet.writeD(remainingTime / 1000); // remain time
|
||||
packet.writeD(holder.getMaximumAddedTime() / 1000);
|
||||
packet.writeD(_player.getVariables().getInt(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + holder.getZoneId(), holder.getRemainRefillTime()));
|
||||
long remainRefillTime = _player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + holder.getZoneId(), holder.getRefillTimeMax());
|
||||
packet.writeD((int) remainRefillTime);
|
||||
packet.writeD(holder.getRefillTimeMax());
|
||||
packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
||||
packet.writeC(0); // bUserBound
|
||||
|
||||
@@ -1,34 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<list enabled="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/TimedHuntingZoneData.xsd">
|
||||
<zone id="1" name="Storm Isle">
|
||||
<enterLocation>194291,176604,-1888</enterLocation>
|
||||
<enterLocation>194284,176597,-1888</enterLocation>
|
||||
<exitLocation>110975,220094,-3664</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>7200</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>100</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
<soloInstance>false</soloInstance>
|
||||
<noPvpZone>true</noPvpZone>
|
||||
</zone>
|
||||
<zone id="6" name="Primeval Isle">
|
||||
<enterLocation>9400,-21720,-3634</enterLocation>
|
||||
<enterLocation>9365,-21407,-3584</enterLocation>
|
||||
<exitLocation>43792,-48928,-792</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>7200</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>105</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
<soloInstance>false</soloInstance>
|
||||
</zone>
|
||||
<zone id="7" name="Isle of Souls">
|
||||
<enterLocation>-122259,73678,-2872</enterLocation>
|
||||
<enterLocation>-122260,73669,-2872</enterLocation>
|
||||
<exitLocation>148353,28032,-2264</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>86400</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>7200</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>107</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
@@ -36,34 +39,37 @@
|
||||
<soloInstance>false</soloInstance>
|
||||
</zone>
|
||||
<zone id="11" name="Abandoned Coal Mines">
|
||||
<enterLocation>139411,-169382,-1600</enterLocation>
|
||||
<enterLocation>139405,-169389,-1600</enterLocation>
|
||||
<exitLocation>146561,28042,-2264</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>18000</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>18000</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>99</minLevel>
|
||||
<maxLevel>105</maxLevel>
|
||||
<soloInstance>false</soloInstance>
|
||||
<noPvpZone>true</noPvpZone>
|
||||
</zone>
|
||||
<zone id="8" name="Tower of Insolence (Lower Floor)">
|
||||
<enterLocation>-82014,16247,-15416</enterLocation>
|
||||
<initialTime>36000</initialTime> <!-- 10 hours -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>36000</maxAddedTime> <!-- 12 hours -->
|
||||
<remainRefillTime>0</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>110</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
<instanceId>1020</instanceId>
|
||||
<soloInstance>false</soloInstance>
|
||||
<weekly>true</weekly>
|
||||
<useWorldPrefix>true</useWorldPrefix>
|
||||
</zone>
|
||||
<zone id="9" name="Tower of Insolence (Middle Floor)">
|
||||
<enterLocation>-147664,21384,-14517</enterLocation>
|
||||
<initialTime>36000</initialTime> <!-- 10 hours -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>36000</maxAddedTime> <!-- 12 hours -->
|
||||
<remainRefillTime>0</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>110</minLevel>
|
||||
@@ -72,22 +78,23 @@
|
||||
<useWorldPrefix>true</useWorldPrefix>
|
||||
</zone>
|
||||
<zone id="12" name="Imperial Tomb">
|
||||
<enterLocation>181409,-78389,-2728</enterLocation>
|
||||
<enterLocation>181406,-78395,-2728</enterLocation>
|
||||
<exitLocation>147714,-55409,-2728</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>3600</maxAddedTime> <!-- 1 hour -->
|
||||
<remainRefillTime>0</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>0</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>105</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
<soloInstance>false</soloInstance>
|
||||
</zone>
|
||||
<zone id="13" name="Corroded Fields">
|
||||
<enterLocation>90327,198818,-3280</enterLocation>
|
||||
<enterLocation>90359,198833,-3280</enterLocation>
|
||||
<exitLocation>111563,220512,-3664</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 3 hours -->
|
||||
<remainRefillTime>18000</remainRefillTime>
|
||||
<refillTimeMax>36000</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>100</minLevel>
|
||||
@@ -96,13 +103,16 @@
|
||||
<soloInstance>false</soloInstance>
|
||||
</zone>
|
||||
<zone id="14" name="Otherworldly Atelia Refinery">
|
||||
<enterLocation>-49013,15351,-8808</enterLocation>
|
||||
<enterLocation>-49020,15369,-8808</enterLocation>
|
||||
<exitLocation>82795,53888,-1488</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>112</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
<soloInstance>false</soloInstance>
|
||||
<weekly>true</weekly>
|
||||
<noPvpZone>true</noPvpZone>
|
||||
</zone>
|
||||
</list>
|
||||
Vendored
+24
-12
@@ -25,8 +25,7 @@ import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneChargeResult;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@@ -64,7 +63,7 @@ public class AddHuntingTime extends AbstractEffect
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= holder.getMaximumAddedTime()))
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
@@ -72,24 +71,37 @@ public class AddHuntingTime extends AbstractEffect
|
||||
return;
|
||||
}
|
||||
|
||||
final long remainRefill = player.getVariables().getInt(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRemainRefillTime());
|
||||
if ((_time < remainRefill) || (remainRefill == 0))
|
||||
long remainRefillTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRefillTimeMax());
|
||||
remainRefillTime -= _time / 1000;
|
||||
if (remainRefillTime < 0)
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
player.sendMessage("You cannot exceed the time zone limit.");
|
||||
player.sendMessage("Time for this zone can be extended no further.");
|
||||
return;
|
||||
}
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefillTime);
|
||||
|
||||
final long remainTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, holder.getInitialTime());
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime + _time);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefill - (_time / 1000));
|
||||
|
||||
final long remainTime;
|
||||
if (player.isInTimedHuntingZone(_zoneId))
|
||||
{
|
||||
remainTime = _time + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
player.startTimedHuntingZone(_zoneId, endTime);
|
||||
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((endTime + holder.getResetDelay()) < currentTime)
|
||||
{
|
||||
endTime = currentTime + holder.getInitialTime();
|
||||
}
|
||||
else if (endTime < currentTime)
|
||||
{
|
||||
endTime = currentTime;
|
||||
}
|
||||
remainTime = (endTime - currentTime) + _time;
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
}
|
||||
|
||||
player.sendPacket(new TimedHuntingZoneList(player));
|
||||
player.sendPacket(new TimedHuntingZoneChargeResult(_zoneId, (int) (remainTime / 1000), (int) remainRefillTime));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<xs:element type="xs:int" name="initialTime" />
|
||||
<xs:element type="xs:int" name="resetDelay" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="maxAddedTime" />
|
||||
<xs:element type="xs:int" name="remainRefillTime" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="refillTimeMax" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryItemId" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryFee" />
|
||||
@@ -20,6 +19,8 @@
|
||||
<xs:element type="xs:boolean" name="soloInstance" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="useWorldPrefix" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="pvpZone" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="noPvpZone" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||
<xs:attribute type="xs:string" name="name" use="optional" />
|
||||
|
||||
+13
-7
@@ -85,7 +85,6 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
int entryFee = 150000;
|
||||
int minLevel = 1;
|
||||
int maxLevel = 999;
|
||||
int remainRefillTime = 3600;
|
||||
int refillTimeMax = 3600;
|
||||
int instanceId = 0;
|
||||
boolean soloInstance = true;
|
||||
@@ -93,6 +92,8 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
boolean useWorldPrefix = false;
|
||||
Location enterLocation = null;
|
||||
Location exitLocation = null;
|
||||
boolean pvpZone = false;
|
||||
boolean noPvpZone = false;
|
||||
for (Node zoneNode = listNode.getFirstChild(); zoneNode != null; zoneNode = zoneNode.getNextSibling())
|
||||
{
|
||||
switch (zoneNode.getNodeName())
|
||||
@@ -144,11 +145,6 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
maxLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "remainRefillTime":
|
||||
{
|
||||
remainRefillTime = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "refillTimeMax":
|
||||
{
|
||||
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||
@@ -174,9 +170,19 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
useWorldPrefix = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "pvpZone":
|
||||
{
|
||||
pvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "noPvpZone":
|
||||
{
|
||||
noPvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, instanceId, soloInstance, weekly, useWorldPrefix, enterLocation, exitLocation));
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, refillTimeMax, instanceId, soloInstance, weekly, useWorldPrefix, enterLocation, exitLocation, pvpZone, noPvpZone));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
package org.l2jmobius.gameserver.model.actor;
|
||||
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||
import org.l2jmobius.gameserver.enums.ClanWarState;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.stat.PlayableStat;
|
||||
import org.l2jmobius.gameserver.model.actor.status.PlayableStatus;
|
||||
@@ -31,6 +33,7 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureDeath;
|
||||
import org.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
@@ -230,6 +233,28 @@ public abstract class Playable extends Creature
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int zoneId)
|
||||
{
|
||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||
{
|
||||
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||
if (holder == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final int instanceId = holder.getInstanceId();
|
||||
if (instanceId > 0)
|
||||
{
|
||||
return isInInstance() && (instanceId == getInstanceWorld().getTemplateId());
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return True.
|
||||
*/
|
||||
|
||||
@@ -914,6 +914,7 @@ public class Player extends Playable
|
||||
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
||||
private boolean _resumedAutoPlay = false;
|
||||
|
||||
private TimedHuntingZoneHolder _lastTimeZone = null;
|
||||
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
||||
|
||||
private final HomunculusList _homunculusList = new HomunculusList(this);
|
||||
@@ -4223,6 +4224,52 @@ public class Player extends Playable
|
||||
});
|
||||
}
|
||||
|
||||
public void updateRelationsToVisiblePlayers(boolean bothWays)
|
||||
{
|
||||
World.getInstance().forEachVisibleObject(this, Player.class, nearby ->
|
||||
{
|
||||
if (!isVisibleFor(nearby))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateRelation(this, nearby);
|
||||
if (bothWays)
|
||||
{
|
||||
nearby.updateRelation(nearby, this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateRelation(Player player, Player target)
|
||||
{
|
||||
final long relation = player.getRelation(target);
|
||||
final boolean isAutoAttackable = player.isAutoAttackable(target);
|
||||
final RelationCache oldrelation = player.getKnownRelations().get(target.getObjectId());
|
||||
if ((oldrelation == null) || (oldrelation.getRelation() != relation) || (oldrelation.isAutoAttackable() != isAutoAttackable))
|
||||
{
|
||||
final RelationChanged rc = new RelationChanged();
|
||||
rc.addRelation(player, relation, isAutoAttackable);
|
||||
if (player.hasSummon())
|
||||
{
|
||||
final Summon pet = player.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
rc.addRelation(pet, relation, isAutoAttackable);
|
||||
}
|
||||
if (player.hasServitors())
|
||||
{
|
||||
player.getServitors().values().forEach(s -> rc.addRelation(s, relation, isAutoAttackable));
|
||||
}
|
||||
}
|
||||
|
||||
// Delay by 125ms so the CharInfo packet of characters moving into field of view will arrive first,
|
||||
// otherwise this relation packet will be ignored by the client.
|
||||
ThreadPool.schedule(() -> target.sendPacket(rc), 125);
|
||||
player.getKnownRelations().put(target.getObjectId(), new RelationCache(relation, isAutoAttackable));
|
||||
}
|
||||
}
|
||||
|
||||
public void broadcastTitleInfo()
|
||||
{
|
||||
// Send a Server->Client packet UserInfo to this Player
|
||||
@@ -14780,11 +14827,23 @@ public class Player extends Playable
|
||||
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||
}
|
||||
|
||||
public TimedHuntingZoneHolder getLastTimeZone()
|
||||
{
|
||||
return _lastTimeZone;
|
||||
}
|
||||
|
||||
public void setLastTimeZone(TimedHuntingZoneHolder lastTimeZone)
|
||||
{
|
||||
_lastTimeZone = lastTimeZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTimedHuntingZone(int zoneId)
|
||||
{
|
||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||
{
|
||||
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||
|
||||
+15
-8
@@ -33,7 +33,6 @@ public class TimedHuntingZoneHolder
|
||||
private final int _entryFee;
|
||||
private final int _minLevel;
|
||||
private final int _maxLevel;
|
||||
private final int _remainRefillTime;
|
||||
private final int _refillTimeMax;
|
||||
private final int _instanceId;
|
||||
private final boolean _soloInstance;
|
||||
@@ -43,8 +42,10 @@ public class TimedHuntingZoneHolder
|
||||
private final Location _exitLocation;
|
||||
private final int _mapX;
|
||||
private final int _mapY;
|
||||
private final boolean _pvpZone;
|
||||
private final boolean _noPvpZone;
|
||||
|
||||
public TimedHuntingZoneHolder(int id, String name, int initialTime, int maximumAddedTime, int resetDelay, int entryItemId, int entryFee, int minLevel, int maxLevel, int remainRefillTime, int refillTimeMax, int instanceId, boolean soloInstance, boolean weekly, boolean useWorldPrefix, Location enterLocation, Location exitLocation)
|
||||
public TimedHuntingZoneHolder(int id, String name, int initialTime, int maximumAddedTime, int resetDelay, int entryItemId, int entryFee, int minLevel, int maxLevel, int refillTimeMax, int instanceId, boolean soloInstance, boolean weekly, boolean useWorldPrefix, Location enterLocation, Location exitLocation, boolean pvpZone, boolean noPvpZone)
|
||||
{
|
||||
_id = id;
|
||||
_name = name;
|
||||
@@ -55,7 +56,6 @@ public class TimedHuntingZoneHolder
|
||||
_entryFee = entryFee;
|
||||
_minLevel = minLevel;
|
||||
_maxLevel = maxLevel;
|
||||
_remainRefillTime = remainRefillTime;
|
||||
_refillTimeMax = refillTimeMax;
|
||||
_instanceId = instanceId;
|
||||
_soloInstance = soloInstance;
|
||||
@@ -63,6 +63,8 @@ public class TimedHuntingZoneHolder
|
||||
_useWorldPrefix = useWorldPrefix;
|
||||
_enterLocation = enterLocation;
|
||||
_exitLocation = exitLocation;
|
||||
_pvpZone = pvpZone;
|
||||
_noPvpZone = noPvpZone;
|
||||
_mapX = ((_enterLocation.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
||||
_mapY = ((_enterLocation.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
||||
}
|
||||
@@ -112,11 +114,6 @@ public class TimedHuntingZoneHolder
|
||||
return _maxLevel;
|
||||
}
|
||||
|
||||
public int getRemainRefillTime()
|
||||
{
|
||||
return _remainRefillTime;
|
||||
}
|
||||
|
||||
public int getRefillTimeMax()
|
||||
{
|
||||
return _refillTimeMax;
|
||||
@@ -152,6 +149,16 @@ public class TimedHuntingZoneHolder
|
||||
return _exitLocation;
|
||||
}
|
||||
|
||||
public boolean isPvpZone()
|
||||
{
|
||||
return _pvpZone;
|
||||
}
|
||||
|
||||
public boolean isNoPvpZone()
|
||||
{
|
||||
return _noPvpZone;
|
||||
}
|
||||
|
||||
public int getMapX()
|
||||
{
|
||||
return _mapX;
|
||||
|
||||
+76
-12
@@ -16,20 +16,21 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.zone.type;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||
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.Playable;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneClose;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneExit;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
@@ -43,9 +44,29 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
if (!creature.isPlayer())
|
||||
{
|
||||
if (creature.isPlayable())
|
||||
{
|
||||
Playable summon = (Playable) creature;
|
||||
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||
{
|
||||
if (!summon.isInTimedHuntingZone(holder.getZoneId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.PVP, true);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.NO_PVP, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Check summons spawning or porting inside.
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
@@ -57,16 +78,25 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final int remainingTime = player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||
if (remainingTime > 0)
|
||||
{
|
||||
player.setLastTimeZone(holder);
|
||||
player.startTimedHuntingZone(holder.getZoneId(), remainingTime);
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.PVP, true);
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_A_COMBAT_ZONE);
|
||||
player.updateRelationsToVisiblePlayers(true);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.NO_PVP, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!player.isGM())
|
||||
{
|
||||
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
||||
@@ -79,22 +109,56 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
if (!creature.isPlayer())
|
||||
{
|
||||
if (creature.isPlayable())
|
||||
{
|
||||
final Playable summon = (Playable) creature;
|
||||
for (final TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||
{
|
||||
if (!summon.isInTimedHuntingZone(holder.getZoneId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.PVP, false);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.NO_PVP, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
if (player == null)
|
||||
{
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, false);
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
// We default to zone 6 aka Primeval Isle so we spawn in rune town by default.
|
||||
int nZoneId = 6;
|
||||
|
||||
final TimedHuntingZoneHolder lastTimeZone = player.getLastTimeZone();
|
||||
if (lastTimeZone != null)
|
||||
{
|
||||
if (!player.isInTimedHuntingZone(player.getX(), player.getY()))
|
||||
nZoneId = lastTimeZone.getZoneId();
|
||||
if (lastTimeZone.isPvpZone())
|
||||
{
|
||||
player.sendPacket(TimedHuntingZoneExit.STATIC_PACKET);
|
||||
player.sendPacket(TimedHuntingZoneClose.STATIC_PACKET);
|
||||
player.setInsideZone(ZoneId.PVP, false);
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_LEFT_A_COMBAT_ZONE);
|
||||
player.updateRelationsToVisiblePlayers(true);
|
||||
}
|
||||
}, 1000);
|
||||
else if (lastTimeZone.isNoPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.NO_PVP, false);
|
||||
}
|
||||
player.setLastTimeZone(null);
|
||||
}
|
||||
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, false);
|
||||
player.sendPacket(new TimedHuntingZoneExit(nZoneId));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -840,7 +840,7 @@ public enum OutgoingPackets
|
||||
EX_TIME_RESTRICT_FIELD_USER_ENTER(0xFE, 0x22A),
|
||||
EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT(0xFE, 0x22B),
|
||||
EX_TIME_RESTRICT_FIELD_USER_ALARM(0xFE, 0x22C),
|
||||
EX_TIME_RESTRICT_FIELD_USER_CLOSE(0xFE, 0x22D),
|
||||
EX_TIME_RESTRICT_FIELD_USER_EXIT(0xFE, 0x22D),
|
||||
EX_RANKING_CHAR_INFO(0xFE, 0x22E),
|
||||
EX_RANKING_CHAR_HISTORY(0xFE, 0x22F),
|
||||
EX_RANKING_CHAR_RANKERS(0xFE, 0x230),
|
||||
|
||||
-4
@@ -29,7 +29,6 @@ import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneClose;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
|
||||
/**
|
||||
@@ -158,9 +157,6 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
QuestManager.getInstance().getQuest("TimedHunting").notifyEvent("ENTER " + _zoneId, null, player);
|
||||
}
|
||||
|
||||
// Close window.
|
||||
player.sendPacket(TimedHuntingZoneClose.STATIC_PACKET);
|
||||
|
||||
// Send time icon.
|
||||
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
|
||||
}
|
||||
|
||||
+13
-5
@@ -21,20 +21,28 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZoneClose implements IClientOutgoingPacket
|
||||
public class TimedHuntingZoneChargeResult implements IClientOutgoingPacket
|
||||
{
|
||||
public static final TimedHuntingZoneClose STATIC_PACKET = new TimedHuntingZoneClose();
|
||||
private final int _zoneId;
|
||||
private final int _secondsLeft;
|
||||
private final int _newExtensionValue;
|
||||
|
||||
public TimedHuntingZoneClose()
|
||||
public TimedHuntingZoneChargeResult(int zoneId, int secondsLeft, int newExtensionValue)
|
||||
{
|
||||
_zoneId = zoneId;
|
||||
_secondsLeft = secondsLeft;
|
||||
_newExtensionValue = newExtensionValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CLOSE.writeId(packet);
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
packet.writeD(_secondsLeft); // Remaining Time in zone.
|
||||
packet.writeD(_newExtensionValue); // New Extension value.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+7
-6
@@ -21,21 +21,22 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius, Index
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZoneExit implements IClientOutgoingPacket
|
||||
{
|
||||
public static final TimedHuntingZoneExit STATIC_PACKET = new TimedHuntingZoneExit();
|
||||
private final int _zoneId;
|
||||
|
||||
public TimedHuntingZoneExit()
|
||||
public TimedHuntingZoneExit(final int zoneId)
|
||||
{
|
||||
_zoneId = zoneId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
public boolean write(final PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_ENTER.writeId(packet);
|
||||
packet.writeC(0); // bEnterSuccess
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_EXIT.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -62,7 +62,8 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket
|
||||
}
|
||||
packet.writeD(remainingTime / 1000); // remain time
|
||||
packet.writeD(holder.getMaximumAddedTime() / 1000);
|
||||
packet.writeD(_player.getVariables().getInt(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + holder.getZoneId(), holder.getRemainRefillTime()));
|
||||
long remainRefillTime = _player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + holder.getZoneId(), holder.getRefillTimeMax());
|
||||
packet.writeD((int) remainRefillTime);
|
||||
packet.writeD(holder.getRefillTimeMax());
|
||||
packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
||||
packet.writeC(0); // bUserBound
|
||||
|
||||
@@ -1,34 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<list enabled="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/TimedHuntingZoneData.xsd">
|
||||
<zone id="1" name="Storm Isle">
|
||||
<enterLocation>194291,176604,-1888</enterLocation>
|
||||
<enterLocation>194284,176597,-1888</enterLocation>
|
||||
<exitLocation>110975,220094,-3664</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>7200</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>100</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
<soloInstance>false</soloInstance>
|
||||
<noPvpZone>true</noPvpZone>
|
||||
</zone>
|
||||
<zone id="6" name="Primeval Isle">
|
||||
<enterLocation>9400,-21720,-3634</enterLocation>
|
||||
<enterLocation>9365,-21407,-3584</enterLocation>
|
||||
<exitLocation>43792,-48928,-792</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>7200</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>105</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
<soloInstance>false</soloInstance>
|
||||
</zone>
|
||||
<zone id="7" name="Isle of Souls">
|
||||
<enterLocation>-122259,73678,-2872</enterLocation>
|
||||
<enterLocation>-122260,73669,-2872</enterLocation>
|
||||
<exitLocation>148353,28032,-2264</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>86400</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>7200</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>107</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
@@ -36,22 +39,23 @@
|
||||
<soloInstance>false</soloInstance>
|
||||
</zone>
|
||||
<zone id="11" name="Abandoned Coal Mines">
|
||||
<enterLocation>139411,-169382,-1600</enterLocation>
|
||||
<enterLocation>139405,-169389,-1600</enterLocation>
|
||||
<exitLocation>146561,28042,-2264</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>18000</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>18000</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>99</minLevel>
|
||||
<maxLevel>105</maxLevel>
|
||||
<soloInstance>false</soloInstance>
|
||||
<noPvpZone>true</noPvpZone>
|
||||
</zone>
|
||||
<zone id="20" name="Tower of Insolence (01 - 09 flours)">
|
||||
<enterLocation>-82014,16247,-15416</enterLocation>
|
||||
<initialTime>36000</initialTime> <!-- 10 hours -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>54000</maxAddedTime> <!-- 15 hours -->
|
||||
<remainRefillTime>18000</remainRefillTime> <!-- 300 mins -->
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>1500000</entryFee>
|
||||
<minLevel>110</minLevel>
|
||||
@@ -62,22 +66,23 @@
|
||||
<useWorldPrefix>true</useWorldPrefix>
|
||||
</zone>
|
||||
<zone id="12" name="Imperial Tomb">
|
||||
<enterLocation>181409,-78389,-2728</enterLocation>
|
||||
<enterLocation>181406,-78395,-2728</enterLocation>
|
||||
<exitLocation>147714,-55409,-2728</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>3600</maxAddedTime> <!-- 1 hour -->
|
||||
<remainRefillTime>0</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>0</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>105</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
<soloInstance>false</soloInstance>
|
||||
</zone>
|
||||
<zone id="13" name="Corroded Fields">
|
||||
<enterLocation>90327,198818,-3280</enterLocation>
|
||||
<enterLocation>90359,198833,-3280</enterLocation>
|
||||
<exitLocation>111563,220512,-3664</exitLocation>
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 3 hours -->
|
||||
<remainRefillTime>18000</remainRefillTime>
|
||||
<refillTimeMax>36000</refillTimeMax>
|
||||
<entryFee>150000</entryFee>
|
||||
<minLevel>100</minLevel>
|
||||
@@ -86,15 +91,17 @@
|
||||
<soloInstance>false</soloInstance>
|
||||
</zone>
|
||||
<zone id="15" name="Otherworldly Atelia Refinery">
|
||||
<enterLocation>-49013,15351,-8808</enterLocation>
|
||||
<enterLocation>-49020,15369,-8808</enterLocation>
|
||||
<exitLocation>82795,53888,-1488</exitLocation>
|
||||
<initialTime>36000</initialTime> <!-- 10 hour -->
|
||||
<resetDelay>864000</resetDelay> <!-- 10 days -->
|
||||
<maxAddedTime>43200</maxAddedTime> <!-- 12 hours -->
|
||||
<remainRefillTime>0</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<refillTimeMax>7200</refillTimeMax>
|
||||
<entryFee>1500000</entryFee>
|
||||
<minLevel>112</minLevel>
|
||||
<maxLevel>130</maxLevel>
|
||||
<soloInstance>false</soloInstance>
|
||||
<weekly>true</weekly>
|
||||
<noPvpZone>true</noPvpZone>
|
||||
</zone>
|
||||
</list>
|
||||
Vendored
+24
-12
@@ -25,8 +25,7 @@ import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneChargeResult;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@@ -64,7 +63,7 @@ public class AddHuntingTime extends AbstractEffect
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= holder.getMaximumAddedTime()))
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
@@ -72,24 +71,37 @@ public class AddHuntingTime extends AbstractEffect
|
||||
return;
|
||||
}
|
||||
|
||||
final long remainRefill = player.getVariables().getInt(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRemainRefillTime());
|
||||
if ((_time < remainRefill) || (remainRefill == 0))
|
||||
long remainRefillTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRefillTimeMax());
|
||||
remainRefillTime -= _time / 1000;
|
||||
if (remainRefillTime < 0)
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
player.sendMessage("You cannot exceed the time zone limit.");
|
||||
player.sendMessage("Time for this zone can be extended no further.");
|
||||
return;
|
||||
}
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefillTime);
|
||||
|
||||
final long remainTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, holder.getInitialTime());
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime + _time);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefill - (_time / 1000));
|
||||
|
||||
final long remainTime;
|
||||
if (player.isInTimedHuntingZone(_zoneId))
|
||||
{
|
||||
remainTime = _time + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
player.startTimedHuntingZone(_zoneId, endTime);
|
||||
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((endTime + holder.getResetDelay()) < currentTime)
|
||||
{
|
||||
endTime = currentTime + holder.getInitialTime();
|
||||
}
|
||||
else if (endTime < currentTime)
|
||||
{
|
||||
endTime = currentTime;
|
||||
}
|
||||
remainTime = (endTime - currentTime) + _time;
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
}
|
||||
|
||||
player.sendPacket(new TimedHuntingZoneList(player));
|
||||
player.sendPacket(new TimedHuntingZoneChargeResult(_zoneId, (int) (remainTime / 1000), (int) remainRefillTime));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<xs:element type="xs:int" name="initialTime" />
|
||||
<xs:element type="xs:int" name="resetDelay" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="maxAddedTime" />
|
||||
<xs:element type="xs:int" name="remainRefillTime" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="refillTimeMax" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryItemId" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryFee" />
|
||||
@@ -20,6 +19,8 @@
|
||||
<xs:element type="xs:boolean" name="soloInstance" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="useWorldPrefix" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="pvpZone" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="noPvpZone" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||
<xs:attribute type="xs:string" name="name" use="optional" />
|
||||
|
||||
+13
-7
@@ -85,7 +85,6 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
int entryFee = 150000;
|
||||
int minLevel = 1;
|
||||
int maxLevel = 999;
|
||||
int remainRefillTime = 3600;
|
||||
int refillTimeMax = 3600;
|
||||
int instanceId = 0;
|
||||
boolean soloInstance = true;
|
||||
@@ -93,6 +92,8 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
boolean useWorldPrefix = false;
|
||||
Location enterLocation = null;
|
||||
Location exitLocation = null;
|
||||
boolean pvpZone = false;
|
||||
boolean noPvpZone = false;
|
||||
for (Node zoneNode = listNode.getFirstChild(); zoneNode != null; zoneNode = zoneNode.getNextSibling())
|
||||
{
|
||||
switch (zoneNode.getNodeName())
|
||||
@@ -144,11 +145,6 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
maxLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "remainRefillTime":
|
||||
{
|
||||
remainRefillTime = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "refillTimeMax":
|
||||
{
|
||||
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||
@@ -174,9 +170,19 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
useWorldPrefix = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "pvpZone":
|
||||
{
|
||||
pvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "noPvpZone":
|
||||
{
|
||||
noPvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, instanceId, soloInstance, weekly, useWorldPrefix, enterLocation, exitLocation));
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, refillTimeMax, instanceId, soloInstance, weekly, useWorldPrefix, enterLocation, exitLocation, pvpZone, noPvpZone));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
package org.l2jmobius.gameserver.model.actor;
|
||||
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||
import org.l2jmobius.gameserver.enums.ClanWarState;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.stat.PlayableStat;
|
||||
import org.l2jmobius.gameserver.model.actor.status.PlayableStatus;
|
||||
@@ -31,6 +33,7 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureDeath;
|
||||
import org.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
@@ -230,6 +233,28 @@ public abstract class Playable extends Creature
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int zoneId)
|
||||
{
|
||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||
{
|
||||
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||
if (holder == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final int instanceId = holder.getInstanceId();
|
||||
if (instanceId > 0)
|
||||
{
|
||||
return isInInstance() && (instanceId == getInstanceWorld().getTemplateId());
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return True.
|
||||
*/
|
||||
|
||||
@@ -914,6 +914,7 @@ public class Player extends Playable
|
||||
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
||||
private boolean _resumedAutoPlay = false;
|
||||
|
||||
private TimedHuntingZoneHolder _lastTimeZone = null;
|
||||
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
||||
|
||||
private final HomunculusList _homunculusList = new HomunculusList(this);
|
||||
@@ -4251,6 +4252,52 @@ public class Player extends Playable
|
||||
});
|
||||
}
|
||||
|
||||
public void updateRelationsToVisiblePlayers(boolean bothWays)
|
||||
{
|
||||
World.getInstance().forEachVisibleObject(this, Player.class, nearby ->
|
||||
{
|
||||
if (!isVisibleFor(nearby))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateRelation(this, nearby);
|
||||
if (bothWays)
|
||||
{
|
||||
nearby.updateRelation(nearby, this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateRelation(Player player, Player target)
|
||||
{
|
||||
final long relation = player.getRelation(target);
|
||||
final boolean isAutoAttackable = player.isAutoAttackable(target);
|
||||
final RelationCache oldrelation = player.getKnownRelations().get(target.getObjectId());
|
||||
if ((oldrelation == null) || (oldrelation.getRelation() != relation) || (oldrelation.isAutoAttackable() != isAutoAttackable))
|
||||
{
|
||||
final RelationChanged rc = new RelationChanged();
|
||||
rc.addRelation(player, relation, isAutoAttackable);
|
||||
if (player.hasSummon())
|
||||
{
|
||||
final Summon pet = player.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
rc.addRelation(pet, relation, isAutoAttackable);
|
||||
}
|
||||
if (player.hasServitors())
|
||||
{
|
||||
player.getServitors().values().forEach(s -> rc.addRelation(s, relation, isAutoAttackable));
|
||||
}
|
||||
}
|
||||
|
||||
// Delay by 125ms so the CharInfo packet of characters moving into field of view will arrive first,
|
||||
// otherwise this relation packet will be ignored by the client.
|
||||
ThreadPool.schedule(() -> target.sendPacket(rc), 125);
|
||||
player.getKnownRelations().put(target.getObjectId(), new RelationCache(relation, isAutoAttackable));
|
||||
}
|
||||
}
|
||||
|
||||
public void broadcastTitleInfo()
|
||||
{
|
||||
// Send a Server->Client packet UserInfo to this Player
|
||||
@@ -14808,11 +14855,23 @@ public class Player extends Playable
|
||||
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||
}
|
||||
|
||||
public TimedHuntingZoneHolder getLastTimeZone()
|
||||
{
|
||||
return _lastTimeZone;
|
||||
}
|
||||
|
||||
public void setLastTimeZone(TimedHuntingZoneHolder lastTimeZone)
|
||||
{
|
||||
_lastTimeZone = lastTimeZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTimedHuntingZone(int zoneId)
|
||||
{
|
||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||
{
|
||||
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||
|
||||
+15
-8
@@ -33,7 +33,6 @@ public class TimedHuntingZoneHolder
|
||||
private final int _entryFee;
|
||||
private final int _minLevel;
|
||||
private final int _maxLevel;
|
||||
private final int _remainRefillTime;
|
||||
private final int _refillTimeMax;
|
||||
private final int _instanceId;
|
||||
private final boolean _soloInstance;
|
||||
@@ -43,8 +42,10 @@ public class TimedHuntingZoneHolder
|
||||
private final Location _exitLocation;
|
||||
private final int _mapX;
|
||||
private final int _mapY;
|
||||
private final boolean _pvpZone;
|
||||
private final boolean _noPvpZone;
|
||||
|
||||
public TimedHuntingZoneHolder(int id, String name, int initialTime, int maximumAddedTime, int resetDelay, int entryItemId, int entryFee, int minLevel, int maxLevel, int remainRefillTime, int refillTimeMax, int instanceId, boolean soloInstance, boolean weekly, boolean useWorldPrefix, Location enterLocation, Location exitLocation)
|
||||
public TimedHuntingZoneHolder(int id, String name, int initialTime, int maximumAddedTime, int resetDelay, int entryItemId, int entryFee, int minLevel, int maxLevel, int refillTimeMax, int instanceId, boolean soloInstance, boolean weekly, boolean useWorldPrefix, Location enterLocation, Location exitLocation, boolean pvpZone, boolean noPvpZone)
|
||||
{
|
||||
_id = id;
|
||||
_name = name;
|
||||
@@ -55,7 +56,6 @@ public class TimedHuntingZoneHolder
|
||||
_entryFee = entryFee;
|
||||
_minLevel = minLevel;
|
||||
_maxLevel = maxLevel;
|
||||
_remainRefillTime = remainRefillTime;
|
||||
_refillTimeMax = refillTimeMax;
|
||||
_instanceId = instanceId;
|
||||
_soloInstance = soloInstance;
|
||||
@@ -63,6 +63,8 @@ public class TimedHuntingZoneHolder
|
||||
_useWorldPrefix = useWorldPrefix;
|
||||
_enterLocation = enterLocation;
|
||||
_exitLocation = exitLocation;
|
||||
_pvpZone = pvpZone;
|
||||
_noPvpZone = noPvpZone;
|
||||
_mapX = ((_enterLocation.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
||||
_mapY = ((_enterLocation.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
||||
}
|
||||
@@ -112,11 +114,6 @@ public class TimedHuntingZoneHolder
|
||||
return _maxLevel;
|
||||
}
|
||||
|
||||
public int getRemainRefillTime()
|
||||
{
|
||||
return _remainRefillTime;
|
||||
}
|
||||
|
||||
public int getRefillTimeMax()
|
||||
{
|
||||
return _refillTimeMax;
|
||||
@@ -152,6 +149,16 @@ public class TimedHuntingZoneHolder
|
||||
return _exitLocation;
|
||||
}
|
||||
|
||||
public boolean isPvpZone()
|
||||
{
|
||||
return _pvpZone;
|
||||
}
|
||||
|
||||
public boolean isNoPvpZone()
|
||||
{
|
||||
return _noPvpZone;
|
||||
}
|
||||
|
||||
public int getMapX()
|
||||
{
|
||||
return _mapX;
|
||||
|
||||
+76
-12
@@ -16,20 +16,21 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.zone.type;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||
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.Playable;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneClose;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneExit;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
@@ -43,9 +44,29 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
if (!creature.isPlayer())
|
||||
{
|
||||
if (creature.isPlayable())
|
||||
{
|
||||
Playable summon = (Playable) creature;
|
||||
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||
{
|
||||
if (!summon.isInTimedHuntingZone(holder.getZoneId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.PVP, true);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.NO_PVP, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Check summons spawning or porting inside.
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
@@ -57,16 +78,25 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final int remainingTime = player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||
if (remainingTime > 0)
|
||||
{
|
||||
player.setLastTimeZone(holder);
|
||||
player.startTimedHuntingZone(holder.getZoneId(), remainingTime);
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.PVP, true);
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_A_COMBAT_ZONE);
|
||||
player.updateRelationsToVisiblePlayers(true);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.NO_PVP, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!player.isGM())
|
||||
{
|
||||
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
||||
@@ -79,22 +109,56 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
if (!creature.isPlayer())
|
||||
{
|
||||
if (creature.isPlayable())
|
||||
{
|
||||
final Playable summon = (Playable) creature;
|
||||
for (final TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||
{
|
||||
if (!summon.isInTimedHuntingZone(holder.getZoneId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.PVP, false);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.NO_PVP, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
if (player == null)
|
||||
{
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, false);
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
// We default to zone 6 aka Primeval Isle so we spawn in rune town by default.
|
||||
int nZoneId = 6;
|
||||
|
||||
final TimedHuntingZoneHolder lastTimeZone = player.getLastTimeZone();
|
||||
if (lastTimeZone != null)
|
||||
{
|
||||
if (!player.isInTimedHuntingZone(player.getX(), player.getY()))
|
||||
nZoneId = lastTimeZone.getZoneId();
|
||||
if (lastTimeZone.isPvpZone())
|
||||
{
|
||||
player.sendPacket(TimedHuntingZoneExit.STATIC_PACKET);
|
||||
player.sendPacket(TimedHuntingZoneClose.STATIC_PACKET);
|
||||
player.setInsideZone(ZoneId.PVP, false);
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_LEFT_A_COMBAT_ZONE);
|
||||
player.updateRelationsToVisiblePlayers(true);
|
||||
}
|
||||
}, 1000);
|
||||
else if (lastTimeZone.isNoPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.NO_PVP, false);
|
||||
}
|
||||
player.setLastTimeZone(null);
|
||||
}
|
||||
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, false);
|
||||
player.sendPacket(new TimedHuntingZoneExit(nZoneId));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -840,7 +840,7 @@ public enum OutgoingPackets
|
||||
EX_TIME_RESTRICT_FIELD_USER_ENTER(0xFE, 0x22A),
|
||||
EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT(0xFE, 0x22B),
|
||||
EX_TIME_RESTRICT_FIELD_USER_ALARM(0xFE, 0x22C),
|
||||
EX_TIME_RESTRICT_FIELD_USER_CLOSE(0xFE, 0x22D),
|
||||
EX_TIME_RESTRICT_FIELD_USER_EXIT(0xFE, 0x22D),
|
||||
EX_RANKING_CHAR_INFO(0xFE, 0x22E),
|
||||
EX_RANKING_CHAR_HISTORY(0xFE, 0x22F),
|
||||
EX_RANKING_CHAR_RANKERS(0xFE, 0x230),
|
||||
|
||||
-4
@@ -29,7 +29,6 @@ import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneClose;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
|
||||
/**
|
||||
@@ -158,9 +157,6 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
QuestManager.getInstance().getQuest("TimedHunting").notifyEvent("ENTER " + _zoneId, null, player);
|
||||
}
|
||||
|
||||
// Close window.
|
||||
player.sendPacket(TimedHuntingZoneClose.STATIC_PACKET);
|
||||
|
||||
// Send time icon.
|
||||
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
|
||||
}
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.network.serverpackets.huntingzones;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZoneChargeResult implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _zoneId;
|
||||
private final int _secondsLeft;
|
||||
private final int _newExtensionValue;
|
||||
|
||||
public TimedHuntingZoneChargeResult(int zoneId, int secondsLeft, int newExtensionValue)
|
||||
{
|
||||
_zoneId = zoneId;
|
||||
_secondsLeft = secondsLeft;
|
||||
_newExtensionValue = newExtensionValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
packet.writeD(_secondsLeft); // Remaining Time in zone.
|
||||
packet.writeD(_newExtensionValue); // New Extension value.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
-40
@@ -1,40 +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 org.l2jmobius.gameserver.network.serverpackets.huntingzones;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class TimedHuntingZoneClose implements IClientOutgoingPacket
|
||||
{
|
||||
public static final TimedHuntingZoneClose STATIC_PACKET = new TimedHuntingZoneClose();
|
||||
|
||||
public TimedHuntingZoneClose()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CLOSE.writeId(packet);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+7
-6
@@ -21,21 +21,22 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius, Index
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZoneExit implements IClientOutgoingPacket
|
||||
{
|
||||
public static final TimedHuntingZoneExit STATIC_PACKET = new TimedHuntingZoneExit();
|
||||
private final int _zoneId;
|
||||
|
||||
public TimedHuntingZoneExit()
|
||||
public TimedHuntingZoneExit(final int zoneId)
|
||||
{
|
||||
_zoneId = zoneId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
public boolean write(final PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_ENTER.writeId(packet);
|
||||
packet.writeC(0); // bEnterSuccess
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_EXIT.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -62,7 +62,8 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket
|
||||
}
|
||||
packet.writeD(remainingTime / 1000); // remain time
|
||||
packet.writeD(holder.getMaximumAddedTime() / 1000);
|
||||
packet.writeD(_player.getVariables().getInt(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + holder.getZoneId(), holder.getRemainRefillTime()));
|
||||
long remainRefillTime = _player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + holder.getZoneId(), holder.getRefillTimeMax());
|
||||
packet.writeD((int) remainRefillTime);
|
||||
packet.writeD(holder.getRefillTimeMax());
|
||||
packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
||||
packet.writeC(0); // bUserBound
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>18000</maxAddedTime> <!-- 5 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>78</minLevel>
|
||||
|
||||
Vendored
+24
-12
@@ -25,8 +25,7 @@ import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneChargeResult;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@@ -64,7 +63,7 @@ public class AddHuntingTime extends AbstractEffect
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= holder.getMaximumAddedTime()))
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
@@ -72,24 +71,37 @@ public class AddHuntingTime extends AbstractEffect
|
||||
return;
|
||||
}
|
||||
|
||||
final long remainRefill = player.getVariables().getInt(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRemainRefillTime());
|
||||
if ((_time < remainRefill) || (remainRefill == 0))
|
||||
long remainRefillTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRefillTimeMax());
|
||||
remainRefillTime -= _time / 1000;
|
||||
if (remainRefillTime < 0)
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
player.sendMessage("You cannot exceed the time zone limit.");
|
||||
player.sendMessage("Time for this zone can be extended no further.");
|
||||
return;
|
||||
}
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefillTime);
|
||||
|
||||
final long remainTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, holder.getInitialTime());
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime + _time);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefill - (_time / 1000));
|
||||
|
||||
final long remainTime;
|
||||
if (player.isInTimedHuntingZone(_zoneId))
|
||||
{
|
||||
remainTime = _time + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
player.startTimedHuntingZone(_zoneId, endTime);
|
||||
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((endTime + holder.getResetDelay()) < currentTime)
|
||||
{
|
||||
endTime = currentTime + holder.getInitialTime();
|
||||
}
|
||||
else if (endTime < currentTime)
|
||||
{
|
||||
endTime = currentTime;
|
||||
}
|
||||
remainTime = (endTime - currentTime) + _time;
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
}
|
||||
|
||||
player.sendPacket(new TimedHuntingZoneList(player));
|
||||
player.sendPacket(new TimedHuntingZoneChargeResult(_zoneId, (int) (remainTime / 1000), (int) remainRefillTime));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -10,7 +10,6 @@
|
||||
<xs:element type="xs:int" name="initialTime" />
|
||||
<xs:element type="xs:int" name="resetDelay" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="maxAddedTime" />
|
||||
<xs:element type="xs:int" name="remainRefillTime" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="refillTimeMax" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryItemId" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryFee" />
|
||||
@@ -19,6 +18,8 @@
|
||||
<xs:element type="xs:int" name="instanceId" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="soloInstance" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="pvpZone" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="noPvpZone" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||
<xs:attribute type="xs:string" name="name" use="optional" />
|
||||
|
||||
+14
-8
@@ -82,16 +82,17 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
int maxAddedTime = 0;
|
||||
int resetDelay = 0;
|
||||
int entryItemId = 57;
|
||||
int entryFee = 10000;
|
||||
int entryFee = 150000;
|
||||
int minLevel = 1;
|
||||
int maxLevel = 999;
|
||||
int remainRefillTime = 3600;
|
||||
int refillTimeMax = 3600;
|
||||
int instanceId = 0;
|
||||
boolean soloInstance = true;
|
||||
boolean weekly = false;
|
||||
Location enterLocation = null;
|
||||
Location exitLocation = null;
|
||||
boolean pvpZone = false;
|
||||
boolean noPvpZone = false;
|
||||
for (Node zoneNode = listNode.getFirstChild(); zoneNode != null; zoneNode = zoneNode.getNextSibling())
|
||||
{
|
||||
switch (zoneNode.getNodeName())
|
||||
@@ -143,11 +144,6 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
maxLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "remainRefillTime":
|
||||
{
|
||||
remainRefillTime = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "refillTimeMax":
|
||||
{
|
||||
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||
@@ -168,9 +164,19 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
weekly = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "pvpZone":
|
||||
{
|
||||
pvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "noPvpZone":
|
||||
{
|
||||
noPvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, instanceId, soloInstance, weekly, enterLocation, exitLocation));
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, refillTimeMax, instanceId, soloInstance, weekly, enterLocation, exitLocation, pvpZone, noPvpZone));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+25
@@ -17,9 +17,11 @@
|
||||
package org.l2jmobius.gameserver.model.actor;
|
||||
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||
import org.l2jmobius.gameserver.enums.ClanWarState;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.stat.PlayableStat;
|
||||
import org.l2jmobius.gameserver.model.actor.status.PlayableStatus;
|
||||
@@ -31,6 +33,7 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureDeath;
|
||||
import org.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
@@ -230,6 +233,28 @@ public abstract class Playable extends Creature
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int zoneId)
|
||||
{
|
||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||
{
|
||||
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||
if (holder == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final int instanceId = holder.getInstanceId();
|
||||
if (instanceId > 0)
|
||||
{
|
||||
return isInInstance() && (instanceId == getInstanceWorld().getTemplateId());
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return True.
|
||||
*/
|
||||
|
||||
+59
@@ -882,6 +882,7 @@ public class Player extends Playable
|
||||
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
||||
private boolean _resumedAutoPlay = false;
|
||||
|
||||
private TimedHuntingZoneHolder _lastTimeZone = null;
|
||||
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
||||
|
||||
private final List<QuestTimer> _questTimers = new ArrayList<>();
|
||||
@@ -4097,6 +4098,52 @@ public class Player extends Playable
|
||||
});
|
||||
}
|
||||
|
||||
public void updateRelationsToVisiblePlayers(boolean bothWays)
|
||||
{
|
||||
World.getInstance().forEachVisibleObject(this, Player.class, nearby ->
|
||||
{
|
||||
if (!isVisibleFor(nearby))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateRelation(this, nearby);
|
||||
if (bothWays)
|
||||
{
|
||||
nearby.updateRelation(nearby, this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateRelation(Player player, Player target)
|
||||
{
|
||||
final int relation = player.getRelation(target);
|
||||
final boolean isAutoAttackable = player.isAutoAttackable(target);
|
||||
final RelationCache oldrelation = player.getKnownRelations().get(target.getObjectId());
|
||||
if ((oldrelation == null) || (oldrelation.getRelation() != relation) || (oldrelation.isAutoAttackable() != isAutoAttackable))
|
||||
{
|
||||
final RelationChanged rc = new RelationChanged();
|
||||
rc.addRelation(player, relation, isAutoAttackable);
|
||||
if (player.hasSummon())
|
||||
{
|
||||
final Summon pet = player.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
rc.addRelation(pet, relation, isAutoAttackable);
|
||||
}
|
||||
if (player.hasServitors())
|
||||
{
|
||||
player.getServitors().values().forEach(s -> rc.addRelation(s, relation, isAutoAttackable));
|
||||
}
|
||||
}
|
||||
|
||||
// Delay by 125ms so the CharInfo packet of characters moving into field of view will arrive first,
|
||||
// otherwise this relation packet will be ignored by the client.
|
||||
ThreadPool.schedule(() -> target.sendPacket(rc), 125);
|
||||
player.getKnownRelations().put(target.getObjectId(), new RelationCache(relation, isAutoAttackable));
|
||||
}
|
||||
}
|
||||
|
||||
public void broadcastTitleInfo()
|
||||
{
|
||||
// Send a Server->Client packet UserInfo to this Player
|
||||
@@ -14494,11 +14541,23 @@ public class Player extends Playable
|
||||
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||
}
|
||||
|
||||
public TimedHuntingZoneHolder getLastTimeZone()
|
||||
{
|
||||
return _lastTimeZone;
|
||||
}
|
||||
|
||||
public void setLastTimeZone(TimedHuntingZoneHolder lastTimeZone)
|
||||
{
|
||||
_lastTimeZone = lastTimeZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTimedHuntingZone(int zoneId)
|
||||
{
|
||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||
{
|
||||
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||
|
||||
+15
-8
@@ -33,7 +33,6 @@ public class TimedHuntingZoneHolder
|
||||
private final int _entryFee;
|
||||
private final int _minLevel;
|
||||
private final int _maxLevel;
|
||||
private final int _remainRefillTime;
|
||||
private final int _refillTimeMax;
|
||||
private final int _instanceId;
|
||||
private final boolean _soloInstance;
|
||||
@@ -42,8 +41,10 @@ public class TimedHuntingZoneHolder
|
||||
private final Location _exitLocation;
|
||||
private final int _mapX;
|
||||
private final int _mapY;
|
||||
private final boolean _pvpZone;
|
||||
private final boolean _noPvpZone;
|
||||
|
||||
public TimedHuntingZoneHolder(int id, String name, int initialTime, int maximumAddedTime, int resetDelay, int entryItemId, int entryFee, int minLevel, int maxLevel, int remainRefillTime, int refillTimeMax, int instanceId, boolean soloInstance, boolean weekly, Location enterLocation, Location exitLocation)
|
||||
public TimedHuntingZoneHolder(int id, String name, int initialTime, int maximumAddedTime, int resetDelay, int entryItemId, int entryFee, int minLevel, int maxLevel, int refillTimeMax, int instanceId, boolean soloInstance, boolean weekly, Location enterLocation, Location exitLocation, boolean pvpZone, boolean noPvpZone)
|
||||
{
|
||||
_id = id;
|
||||
_name = name;
|
||||
@@ -54,13 +55,14 @@ public class TimedHuntingZoneHolder
|
||||
_entryFee = entryFee;
|
||||
_minLevel = minLevel;
|
||||
_maxLevel = maxLevel;
|
||||
_remainRefillTime = remainRefillTime;
|
||||
_refillTimeMax = refillTimeMax;
|
||||
_instanceId = instanceId;
|
||||
_soloInstance = soloInstance;
|
||||
_weekly = weekly;
|
||||
_enterLocation = enterLocation;
|
||||
_exitLocation = exitLocation;
|
||||
_pvpZone = pvpZone;
|
||||
_noPvpZone = noPvpZone;
|
||||
_mapX = ((_enterLocation.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
||||
_mapY = ((_enterLocation.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
||||
}
|
||||
@@ -110,11 +112,6 @@ public class TimedHuntingZoneHolder
|
||||
return _maxLevel;
|
||||
}
|
||||
|
||||
public int getRemainRefillTime()
|
||||
{
|
||||
return _remainRefillTime;
|
||||
}
|
||||
|
||||
public int getRefillTimeMax()
|
||||
{
|
||||
return _refillTimeMax;
|
||||
@@ -145,6 +142,16 @@ public class TimedHuntingZoneHolder
|
||||
return _exitLocation;
|
||||
}
|
||||
|
||||
public boolean isPvpZone()
|
||||
{
|
||||
return _pvpZone;
|
||||
}
|
||||
|
||||
public boolean isNoPvpZone()
|
||||
{
|
||||
return _noPvpZone;
|
||||
}
|
||||
|
||||
public int getMapX()
|
||||
{
|
||||
return _mapX;
|
||||
|
||||
+76
-12
@@ -16,20 +16,21 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.zone.type;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||
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.Playable;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneClose;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneExit;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
@@ -43,9 +44,29 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
if (!creature.isPlayer())
|
||||
{
|
||||
if (creature.isPlayable())
|
||||
{
|
||||
Playable summon = (Playable) creature;
|
||||
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||
{
|
||||
if (!summon.isInTimedHuntingZone(holder.getZoneId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.PVP, true);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.NO_PVP, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Check summons spawning or porting inside.
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
@@ -57,16 +78,25 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final int remainingTime = player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||
if (remainingTime > 0)
|
||||
{
|
||||
player.setLastTimeZone(holder);
|
||||
player.startTimedHuntingZone(holder.getZoneId(), remainingTime);
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.PVP, true);
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_A_COMBAT_ZONE);
|
||||
player.updateRelationsToVisiblePlayers(true);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.NO_PVP, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!player.isGM())
|
||||
{
|
||||
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
||||
@@ -79,22 +109,56 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
if (!creature.isPlayer())
|
||||
{
|
||||
if (creature.isPlayable())
|
||||
{
|
||||
final Playable summon = (Playable) creature;
|
||||
for (final TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||
{
|
||||
if (!summon.isInTimedHuntingZone(holder.getZoneId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.PVP, false);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.NO_PVP, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
if (player == null)
|
||||
{
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, false);
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
// We default to zone 6 aka Primeval Isle so we spawn in rune town by default.
|
||||
int nZoneId = 6;
|
||||
|
||||
final TimedHuntingZoneHolder lastTimeZone = player.getLastTimeZone();
|
||||
if (lastTimeZone != null)
|
||||
{
|
||||
if (!player.isInTimedHuntingZone(player.getX(), player.getY()))
|
||||
nZoneId = lastTimeZone.getZoneId();
|
||||
if (lastTimeZone.isPvpZone())
|
||||
{
|
||||
player.sendPacket(TimedHuntingZoneExit.STATIC_PACKET);
|
||||
player.sendPacket(TimedHuntingZoneClose.STATIC_PACKET);
|
||||
player.setInsideZone(ZoneId.PVP, false);
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_LEFT_A_COMBAT_ZONE);
|
||||
player.updateRelationsToVisiblePlayers(true);
|
||||
}
|
||||
}, 1000);
|
||||
else if (lastTimeZone.isNoPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.NO_PVP, false);
|
||||
}
|
||||
player.setLastTimeZone(null);
|
||||
}
|
||||
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, false);
|
||||
player.sendPacket(new TimedHuntingZoneExit(nZoneId));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -841,7 +841,7 @@ public enum OutgoingPackets
|
||||
EX_TIME_RESTRICT_FIELD_USER_ENTER(0xFE, 0x22C),
|
||||
EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT(0xFE, 0x22D),
|
||||
EX_TIME_RESTRICT_FIELD_USER_ALARM(0xFE, 0x22E),
|
||||
EX_TIME_RESTRICT_FIELD_USER_CLOSE(0xFE, 0x22F),
|
||||
EX_TIME_RESTRICT_FIELD_USER_EXIT(0xFE, 0x22F),
|
||||
EX_RANKING_CHAR_INFO(0xFE, 0x230),
|
||||
EX_RANKING_CHAR_HISTORY(0xFE, 0x231),
|
||||
EX_RANKING_CHAR_RANKERS(0xFE, 0x232),
|
||||
|
||||
+1
-5
@@ -29,7 +29,6 @@ import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneClose;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
|
||||
/**
|
||||
@@ -85,7 +84,7 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
player.sendMessage("Cannot use time-limited hunting zones while waiting for the Olympiad.");
|
||||
return;
|
||||
}
|
||||
if (player.isOnEvent() || (player.getBlockCheckerArena() > -1))
|
||||
if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1))
|
||||
{
|
||||
player.sendMessage("Cannot use time-limited hunting zones while registered on an event.");
|
||||
return;
|
||||
@@ -149,9 +148,6 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
||||
|
||||
// Close window.
|
||||
player.sendPacket(TimedHuntingZoneClose.STATIC_PACKET);
|
||||
|
||||
if (instanceId == 0)
|
||||
{
|
||||
player.teleToLocation(holder.getEnterLocation());
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.network.serverpackets.huntingzones;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZoneChargeResult implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _zoneId;
|
||||
private final int _secondsLeft;
|
||||
private final int _newExtensionValue;
|
||||
|
||||
public TimedHuntingZoneChargeResult(int zoneId, int secondsLeft, int newExtensionValue)
|
||||
{
|
||||
_zoneId = zoneId;
|
||||
_secondsLeft = secondsLeft;
|
||||
_newExtensionValue = newExtensionValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
packet.writeD(_secondsLeft); // Remaining Time in zone.
|
||||
packet.writeD(_newExtensionValue); // New Extension value.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
-40
@@ -1,40 +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 org.l2jmobius.gameserver.network.serverpackets.huntingzones;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class TimedHuntingZoneClose implements IClientOutgoingPacket
|
||||
{
|
||||
public static final TimedHuntingZoneClose STATIC_PACKET = new TimedHuntingZoneClose();
|
||||
|
||||
public TimedHuntingZoneClose()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CLOSE.writeId(packet);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+7
-6
@@ -21,21 +21,22 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius, Index
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZoneExit implements IClientOutgoingPacket
|
||||
{
|
||||
public static final TimedHuntingZoneExit STATIC_PACKET = new TimedHuntingZoneExit();
|
||||
private final int _zoneId;
|
||||
|
||||
public TimedHuntingZoneExit()
|
||||
public TimedHuntingZoneExit(final int zoneId)
|
||||
{
|
||||
_zoneId = zoneId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
public boolean write(final PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_ENTER.writeId(packet);
|
||||
packet.writeC(0); // bEnterSuccess
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_EXIT.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -62,7 +62,8 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket
|
||||
}
|
||||
packet.writeD(remainingTime / 1000); // remain time
|
||||
packet.writeD(holder.getMaximumAddedTime() / 1000);
|
||||
packet.writeD(_player.getVariables().getInt(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + holder.getZoneId(), holder.getRemainRefillTime()));
|
||||
long remainRefillTime = _player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + holder.getZoneId(), holder.getRefillTimeMax());
|
||||
packet.writeD((int) remainRefillTime);
|
||||
packet.writeD(holder.getRefillTimeMax());
|
||||
packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated
|
||||
}
|
||||
|
||||
-10
@@ -5,7 +5,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>43200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>40</minLevel>
|
||||
@@ -16,7 +15,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>18000</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>76</minLevel>
|
||||
@@ -27,7 +25,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>60</minLevel>
|
||||
@@ -38,7 +35,6 @@
|
||||
<initialTime>25200</initialTime> <!-- 7 hours -->
|
||||
<resetDelay>604800</resetDelay> <!-- 7 days -->
|
||||
<maxAddedTime>151200</maxAddedTime> <!-- 42 hours -->
|
||||
<remainRefillTime>126000</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>80</minLevel>
|
||||
@@ -50,7 +46,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>40</minLevel>
|
||||
@@ -62,7 +57,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>50</minLevel>
|
||||
@@ -74,7 +68,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>60</minLevel>
|
||||
@@ -86,7 +79,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>70</minLevel>
|
||||
@@ -98,7 +90,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>80</minLevel>
|
||||
@@ -110,7 +101,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>85</minLevel>
|
||||
|
||||
+24
-12
@@ -25,8 +25,7 @@ import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneChargeResult;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@@ -64,7 +63,7 @@ public class AddHuntingTime extends AbstractEffect
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= holder.getMaximumAddedTime()))
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
@@ -72,24 +71,37 @@ public class AddHuntingTime extends AbstractEffect
|
||||
return;
|
||||
}
|
||||
|
||||
final long remainRefill = player.getVariables().getInt(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRemainRefillTime());
|
||||
if ((_time < remainRefill) || (remainRefill == 0))
|
||||
long remainRefillTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRefillTimeMax());
|
||||
remainRefillTime -= _time / 1000;
|
||||
if (remainRefillTime < 0)
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
player.sendMessage("You cannot exceed the time zone limit.");
|
||||
player.sendMessage("Time for this zone can be extended no further.");
|
||||
return;
|
||||
}
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefillTime);
|
||||
|
||||
final long remainTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, holder.getInitialTime());
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime + _time);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefill - (_time / 1000));
|
||||
|
||||
final long remainTime;
|
||||
if (player.isInTimedHuntingZone(_zoneId))
|
||||
{
|
||||
remainTime = _time + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
player.startTimedHuntingZone(_zoneId, endTime);
|
||||
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((endTime + holder.getResetDelay()) < currentTime)
|
||||
{
|
||||
endTime = currentTime + holder.getInitialTime();
|
||||
}
|
||||
else if (endTime < currentTime)
|
||||
{
|
||||
endTime = currentTime;
|
||||
}
|
||||
remainTime = (endTime - currentTime) + _time;
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
}
|
||||
|
||||
player.sendPacket(new TimedHuntingZoneList(player));
|
||||
player.sendPacket(new TimedHuntingZoneChargeResult(_zoneId, (int) (remainTime / 1000), (int) remainRefillTime));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -244,7 +244,7 @@ public class TimedHunting extends AbstractInstance
|
||||
instance.setParameter("TimedHuntingTaskFinished", false);
|
||||
}
|
||||
player.sendPacket(new ExSendUIEvent(player, true, false, 600, 0, NpcStringId.TIME_LEFT));
|
||||
player.sendPacket(TimedHuntingZoneExit.STATIC_PACKET);
|
||||
player.sendPacket(new TimedHuntingZoneExit(player.getLastTimeZone().getZoneId()));
|
||||
|
||||
player.getEffectList().stopSkillEffects(SkillFinishType.REMOVED, BUFF);
|
||||
instance.setParameter("PlayerIsOut", true);
|
||||
|
||||
+2
-2
@@ -10,7 +10,6 @@
|
||||
<xs:element type="xs:int" name="initialTime" />
|
||||
<xs:element type="xs:int" name="resetDelay" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="maxAddedTime" />
|
||||
<xs:element type="xs:int" name="remainRefillTime" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="refillTimeMax" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryItemId" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryFee" />
|
||||
@@ -19,7 +18,8 @@
|
||||
<xs:element type="xs:int" name="instanceId" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="soloInstance" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="useWorldPrefix" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="pvpZone" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="noPvpZone" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||
<xs:attribute type="xs:string" name="name" use="optional" />
|
||||
|
||||
+13
-7
@@ -85,7 +85,6 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
int entryFee = 10000;
|
||||
int minLevel = 1;
|
||||
int maxLevel = 999;
|
||||
int remainRefillTime = 3600;
|
||||
int refillTimeMax = 3600;
|
||||
int instanceId = 0;
|
||||
boolean soloInstance = true;
|
||||
@@ -93,6 +92,8 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
boolean useWorldPrefix = false;
|
||||
Location enterLocation = null;
|
||||
Location exitLocation = null;
|
||||
boolean pvpZone = false;
|
||||
boolean noPvpZone = false;
|
||||
for (Node zoneNode = listNode.getFirstChild(); zoneNode != null; zoneNode = zoneNode.getNextSibling())
|
||||
{
|
||||
switch (zoneNode.getNodeName())
|
||||
@@ -144,11 +145,6 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
maxLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "remainRefillTime":
|
||||
{
|
||||
remainRefillTime = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "refillTimeMax":
|
||||
{
|
||||
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||
@@ -174,9 +170,19 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
useWorldPrefix = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "pvpZone":
|
||||
{
|
||||
pvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "noPvpZone":
|
||||
{
|
||||
noPvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, instanceId, soloInstance, weekly, useWorldPrefix, enterLocation, exitLocation));
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, refillTimeMax, instanceId, soloInstance, weekly, useWorldPrefix, enterLocation, exitLocation, pvpZone, noPvpZone));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+25
@@ -17,9 +17,11 @@
|
||||
package org.l2jmobius.gameserver.model.actor;
|
||||
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||
import org.l2jmobius.gameserver.enums.ClanWarState;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.stat.PlayableStat;
|
||||
import org.l2jmobius.gameserver.model.actor.status.PlayableStatus;
|
||||
@@ -31,6 +33,7 @@ import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureDeath;
|
||||
import org.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
@@ -230,6 +233,28 @@ public abstract class Playable extends Creature
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int zoneId)
|
||||
{
|
||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||
}
|
||||
|
||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||
{
|
||||
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||
if (holder == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final int instanceId = holder.getInstanceId();
|
||||
if (instanceId > 0)
|
||||
{
|
||||
return isInInstance() && (instanceId == getInstanceWorld().getTemplateId());
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return True.
|
||||
*/
|
||||
|
||||
+59
@@ -910,6 +910,7 @@ public class Player extends Playable
|
||||
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
||||
private boolean _resumedAutoPlay = false;
|
||||
|
||||
private TimedHuntingZoneHolder _lastTimeZone = null;
|
||||
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
||||
|
||||
private PlayerRandomCraft _randomCraft = null;
|
||||
@@ -4179,6 +4180,52 @@ public class Player extends Playable
|
||||
});
|
||||
}
|
||||
|
||||
public void updateRelationsToVisiblePlayers(boolean bothWays)
|
||||
{
|
||||
World.getInstance().forEachVisibleObject(this, Player.class, nearby ->
|
||||
{
|
||||
if (!isVisibleFor(nearby))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateRelation(this, nearby);
|
||||
if (bothWays)
|
||||
{
|
||||
nearby.updateRelation(nearby, this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateRelation(Player player, Player target)
|
||||
{
|
||||
final long relation = player.getRelation(target);
|
||||
final boolean isAutoAttackable = player.isAutoAttackable(target);
|
||||
final RelationCache oldrelation = player.getKnownRelations().get(target.getObjectId());
|
||||
if ((oldrelation == null) || (oldrelation.getRelation() != relation) || (oldrelation.isAutoAttackable() != isAutoAttackable))
|
||||
{
|
||||
final RelationChanged rc = new RelationChanged();
|
||||
rc.addRelation(player, relation, isAutoAttackable);
|
||||
if (player.hasSummon())
|
||||
{
|
||||
final Summon pet = player.getPet();
|
||||
if (pet != null)
|
||||
{
|
||||
rc.addRelation(pet, relation, isAutoAttackable);
|
||||
}
|
||||
if (player.hasServitors())
|
||||
{
|
||||
player.getServitors().values().forEach(s -> rc.addRelation(s, relation, isAutoAttackable));
|
||||
}
|
||||
}
|
||||
|
||||
// Delay by 125ms so the CharInfo packet of characters moving into field of view will arrive first,
|
||||
// otherwise this relation packet will be ignored by the client.
|
||||
ThreadPool.schedule(() -> target.sendPacket(rc), 125);
|
||||
player.getKnownRelations().put(target.getObjectId(), new RelationCache(relation, isAutoAttackable));
|
||||
}
|
||||
}
|
||||
|
||||
public void broadcastTitleInfo()
|
||||
{
|
||||
// Send a Server->Client packet UserInfo to this Player
|
||||
@@ -14780,11 +14827,23 @@ public class Player extends Playable
|
||||
getVariables().setIntegerList(PlayerVariables.AUTO_USE_SHORTCUTS, positions);
|
||||
}
|
||||
|
||||
public TimedHuntingZoneHolder getLastTimeZone()
|
||||
{
|
||||
return _lastTimeZone;
|
||||
}
|
||||
|
||||
public void setLastTimeZone(TimedHuntingZoneHolder lastTimeZone)
|
||||
{
|
||||
_lastTimeZone = lastTimeZone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTimedHuntingZone(int zoneId)
|
||||
{
|
||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||
{
|
||||
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||
|
||||
+15
-8
@@ -33,7 +33,6 @@ public class TimedHuntingZoneHolder
|
||||
private final int _entryFee;
|
||||
private final int _minLevel;
|
||||
private final int _maxLevel;
|
||||
private final int _remainRefillTime;
|
||||
private final int _refillTimeMax;
|
||||
private final int _instanceId;
|
||||
private final boolean _soloInstance;
|
||||
@@ -43,8 +42,10 @@ public class TimedHuntingZoneHolder
|
||||
private final Location _exitLocation;
|
||||
private final int _mapX;
|
||||
private final int _mapY;
|
||||
private final boolean _pvpZone;
|
||||
private final boolean _noPvpZone;
|
||||
|
||||
public TimedHuntingZoneHolder(int id, String name, int initialTime, int maximumAddedTime, int resetDelay, int entryItemId, int entryFee, int minLevel, int maxLevel, int remainRefillTime, int refillTimeMax, int instanceId, boolean soloInstance, boolean weekly, boolean useWorldPrefix, Location enterLocation, Location exitLocation)
|
||||
public TimedHuntingZoneHolder(int id, String name, int initialTime, int maximumAddedTime, int resetDelay, int entryItemId, int entryFee, int minLevel, int maxLevel, int refillTimeMax, int instanceId, boolean soloInstance, boolean weekly, boolean useWorldPrefix, Location enterLocation, Location exitLocation, boolean pvpZone, boolean noPvpZone)
|
||||
{
|
||||
_id = id;
|
||||
_name = name;
|
||||
@@ -55,7 +56,6 @@ public class TimedHuntingZoneHolder
|
||||
_entryFee = entryFee;
|
||||
_minLevel = minLevel;
|
||||
_maxLevel = maxLevel;
|
||||
_remainRefillTime = remainRefillTime;
|
||||
_refillTimeMax = refillTimeMax;
|
||||
_instanceId = instanceId;
|
||||
_soloInstance = soloInstance;
|
||||
@@ -63,6 +63,8 @@ public class TimedHuntingZoneHolder
|
||||
_useWorldPrefix = useWorldPrefix;
|
||||
_enterLocation = enterLocation;
|
||||
_exitLocation = exitLocation;
|
||||
_pvpZone = pvpZone;
|
||||
_noPvpZone = noPvpZone;
|
||||
_mapX = ((_enterLocation.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
||||
_mapY = ((_enterLocation.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
||||
}
|
||||
@@ -112,11 +114,6 @@ public class TimedHuntingZoneHolder
|
||||
return _maxLevel;
|
||||
}
|
||||
|
||||
public int getRemainRefillTime()
|
||||
{
|
||||
return _remainRefillTime;
|
||||
}
|
||||
|
||||
public int getRefillTimeMax()
|
||||
{
|
||||
return _refillTimeMax;
|
||||
@@ -152,6 +149,16 @@ public class TimedHuntingZoneHolder
|
||||
return _exitLocation;
|
||||
}
|
||||
|
||||
public boolean isPvpZone()
|
||||
{
|
||||
return _pvpZone;
|
||||
}
|
||||
|
||||
public boolean isNoPvpZone()
|
||||
{
|
||||
return _noPvpZone;
|
||||
}
|
||||
|
||||
public int getMapX()
|
||||
{
|
||||
return _mapX;
|
||||
|
||||
+76
-12
@@ -16,20 +16,21 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.zone.type;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||
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.Playable;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneClose;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneExit;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
@@ -43,9 +44,29 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
if (!creature.isPlayer())
|
||||
{
|
||||
if (creature.isPlayable())
|
||||
{
|
||||
Playable summon = (Playable) creature;
|
||||
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||
{
|
||||
if (!summon.isInTimedHuntingZone(holder.getZoneId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.PVP, true);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.NO_PVP, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Check summons spawning or porting inside.
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
@@ -57,16 +78,25 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final int remainingTime = player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||
if (remainingTime > 0)
|
||||
{
|
||||
player.setLastTimeZone(holder);
|
||||
player.startTimedHuntingZone(holder.getZoneId(), remainingTime);
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.PVP, true);
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_A_COMBAT_ZONE);
|
||||
player.updateRelationsToVisiblePlayers(true);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.NO_PVP, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!player.isGM())
|
||||
{
|
||||
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
||||
@@ -79,22 +109,56 @@ public class TimedHuntingZone extends ZoneType
|
||||
{
|
||||
if (!creature.isPlayer())
|
||||
{
|
||||
if (creature.isPlayable())
|
||||
{
|
||||
final Playable summon = (Playable) creature;
|
||||
for (final TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||
{
|
||||
if (!summon.isInTimedHuntingZone(holder.getZoneId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (holder.isPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.PVP, false);
|
||||
}
|
||||
else if (holder.isNoPvpZone())
|
||||
{
|
||||
summon.setInsideZone(ZoneId.NO_PVP, false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final Player player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
if (player == null)
|
||||
{
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, false);
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadPool.schedule(() ->
|
||||
// We default to zone 6 aka Primeval Isle so we spawn in rune town by default.
|
||||
int nZoneId = 6;
|
||||
|
||||
final TimedHuntingZoneHolder lastTimeZone = player.getLastTimeZone();
|
||||
if (lastTimeZone != null)
|
||||
{
|
||||
if (!player.isInTimedHuntingZone(player.getX(), player.getY()))
|
||||
nZoneId = lastTimeZone.getZoneId();
|
||||
if (lastTimeZone.isPvpZone())
|
||||
{
|
||||
player.sendPacket(TimedHuntingZoneExit.STATIC_PACKET);
|
||||
player.sendPacket(TimedHuntingZoneClose.STATIC_PACKET);
|
||||
player.setInsideZone(ZoneId.PVP, false);
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_LEFT_A_COMBAT_ZONE);
|
||||
player.updateRelationsToVisiblePlayers(true);
|
||||
}
|
||||
}, 1000);
|
||||
else if (lastTimeZone.isNoPvpZone())
|
||||
{
|
||||
player.setInsideZone(ZoneId.NO_PVP, false);
|
||||
}
|
||||
player.setLastTimeZone(null);
|
||||
}
|
||||
|
||||
player.setInsideZone(ZoneId.TIMED_HUNTING, false);
|
||||
player.sendPacket(new TimedHuntingZoneExit(nZoneId));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -840,7 +840,7 @@ public enum OutgoingPackets
|
||||
EX_TIME_RESTRICT_FIELD_USER_ENTER(0xFE, 0x22A),
|
||||
EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT(0xFE, 0x22B),
|
||||
EX_TIME_RESTRICT_FIELD_USER_ALARM(0xFE, 0x22C),
|
||||
EX_TIME_RESTRICT_FIELD_USER_CLOSE(0xFE, 0x22D),
|
||||
EX_TIME_RESTRICT_FIELD_USER_EXIT(0xFE, 0x22D),
|
||||
EX_RANKING_CHAR_INFO(0xFE, 0x22E),
|
||||
EX_RANKING_CHAR_HISTORY(0xFE, 0x22F),
|
||||
EX_RANKING_CHAR_RANKERS(0xFE, 0x230),
|
||||
|
||||
+1
-5
@@ -29,7 +29,6 @@ import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneClose;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
|
||||
/**
|
||||
@@ -85,7 +84,7 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
player.sendMessage("Cannot use time-limited hunting zones while waiting for the Olympiad.");
|
||||
return;
|
||||
}
|
||||
if (player.isOnEvent() || (player.getBlockCheckerArena() > -1))
|
||||
if (player.isRegisteredOnEvent() || (player.getBlockCheckerArena() > -1))
|
||||
{
|
||||
player.sendMessage("Cannot use time-limited hunting zones while registered on an event.");
|
||||
return;
|
||||
@@ -157,9 +156,6 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
||||
|
||||
// Close window.
|
||||
player.sendPacket(TimedHuntingZoneClose.STATIC_PACKET);
|
||||
|
||||
if (instanceId == 0)
|
||||
{
|
||||
player.teleToLocation(holder.getEnterLocation());
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.network.serverpackets.huntingzones;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZoneChargeResult implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _zoneId;
|
||||
private final int _secondsLeft;
|
||||
private final int _newExtensionValue;
|
||||
|
||||
public TimedHuntingZoneChargeResult(int zoneId, int secondsLeft, int newExtensionValue)
|
||||
{
|
||||
_zoneId = zoneId;
|
||||
_secondsLeft = secondsLeft;
|
||||
_newExtensionValue = newExtensionValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CHARGE_RESULT.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
packet.writeD(_secondsLeft); // Remaining Time in zone.
|
||||
packet.writeD(_newExtensionValue); // New Extension value.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
-40
@@ -1,40 +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 org.l2jmobius.gameserver.network.serverpackets.huntingzones;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class TimedHuntingZoneClose implements IClientOutgoingPacket
|
||||
{
|
||||
public static final TimedHuntingZoneClose STATIC_PACKET = new TimedHuntingZoneClose();
|
||||
|
||||
public TimedHuntingZoneClose()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_CLOSE.writeId(packet);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+7
-6
@@ -21,21 +21,22 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius, Index
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class TimedHuntingZoneExit implements IClientOutgoingPacket
|
||||
{
|
||||
public static final TimedHuntingZoneExit STATIC_PACKET = new TimedHuntingZoneExit();
|
||||
private final int _zoneId;
|
||||
|
||||
public TimedHuntingZoneExit()
|
||||
public TimedHuntingZoneExit(final int zoneId)
|
||||
{
|
||||
_zoneId = zoneId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
public boolean write(final PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_ENTER.writeId(packet);
|
||||
packet.writeC(0); // bEnterSuccess
|
||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_EXIT.writeId(packet);
|
||||
packet.writeD(_zoneId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -62,7 +62,8 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket
|
||||
}
|
||||
packet.writeD(remainingTime / 1000); // remain time
|
||||
packet.writeD(holder.getMaximumAddedTime() / 1000);
|
||||
packet.writeD(_player.getVariables().getInt(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + holder.getZoneId(), holder.getRemainRefillTime()));
|
||||
long remainRefillTime = _player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + holder.getZoneId(), holder.getRefillTimeMax());
|
||||
packet.writeD((int) remainRefillTime);
|
||||
packet.writeD(holder.getRefillTimeMax());
|
||||
packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
||||
packet.writeC(0); // bUserBound
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>43200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>40</minLevel>
|
||||
@@ -16,7 +15,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>21600</maxAddedTime> <!-- 6 hours -->
|
||||
<remainRefillTime>18000</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>76</minLevel>
|
||||
@@ -27,7 +25,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>7200</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>60</minLevel>
|
||||
@@ -38,7 +35,6 @@
|
||||
<initialTime>25200</initialTime> <!-- 7 hours -->
|
||||
<resetDelay>604800</resetDelay> <!-- 7 days -->
|
||||
<maxAddedTime>151200</maxAddedTime> <!-- 42 hours -->
|
||||
<remainRefillTime>126000</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>80</minLevel>
|
||||
@@ -50,7 +46,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 3600 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>1000000</entryFee>
|
||||
<minLevel>80</minLevel>
|
||||
@@ -61,7 +56,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>40</minLevel>
|
||||
@@ -73,7 +67,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>50</minLevel>
|
||||
@@ -85,7 +78,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>60</minLevel>
|
||||
@@ -97,7 +89,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>70</minLevel>
|
||||
@@ -109,7 +100,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>80</minLevel>
|
||||
@@ -121,7 +111,6 @@
|
||||
<initialTime>3600</initialTime> <!-- 1 hour -->
|
||||
<resetDelay>36000</resetDelay> <!-- 10 hours -->
|
||||
<maxAddedTime>46800</maxAddedTime> <!-- 13 hours -->
|
||||
<remainRefillTime>3600</remainRefillTime>
|
||||
<refillTimeMax>3600</refillTimeMax>
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>85</minLevel>
|
||||
|
||||
Vendored
+24
-12
@@ -25,8 +25,7 @@ import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.item.instance.Item;
|
||||
import org.l2jmobius.gameserver.model.skill.Skill;
|
||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneEnter;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneChargeResult;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@@ -64,7 +63,7 @@ public class AddHuntingTime extends AbstractEffect
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= holder.getMaximumAddedTime()))
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
@@ -72,24 +71,37 @@ public class AddHuntingTime extends AbstractEffect
|
||||
return;
|
||||
}
|
||||
|
||||
final long remainRefill = player.getVariables().getInt(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRemainRefillTime());
|
||||
if ((_time < remainRefill) || (remainRefill == 0))
|
||||
long remainRefillTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, holder.getRefillTimeMax());
|
||||
remainRefillTime -= _time / 1000;
|
||||
if (remainRefillTime < 0)
|
||||
{
|
||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||
player.sendMessage("You cannot exceed the time zone limit.");
|
||||
player.sendMessage("Time for this zone can be extended no further.");
|
||||
return;
|
||||
}
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefillTime);
|
||||
|
||||
final long remainTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, holder.getInitialTime());
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime + _time);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_REMAIN_REFILL + _zoneId, remainRefill - (_time / 1000));
|
||||
|
||||
final long remainTime;
|
||||
if (player.isInTimedHuntingZone(_zoneId))
|
||||
{
|
||||
remainTime = _time + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
player.startTimedHuntingZone(_zoneId, endTime);
|
||||
player.sendPacket(new TimedHuntingZoneEnter(player, _zoneId));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((endTime + holder.getResetDelay()) < currentTime)
|
||||
{
|
||||
endTime = currentTime + holder.getInitialTime();
|
||||
}
|
||||
else if (endTime < currentTime)
|
||||
{
|
||||
endTime = currentTime;
|
||||
}
|
||||
remainTime = (endTime - currentTime) + _time;
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, remainTime);
|
||||
}
|
||||
|
||||
player.sendPacket(new TimedHuntingZoneList(player));
|
||||
player.sendPacket(new TimedHuntingZoneChargeResult(_zoneId, (int) (remainTime / 1000), (int) remainRefillTime));
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -244,7 +244,7 @@ public class TimedHunting extends AbstractInstance
|
||||
instance.setParameter("TimedHuntingTaskFinished", false);
|
||||
}
|
||||
player.sendPacket(new ExSendUIEvent(player, true, false, 600, 0, NpcStringId.TIME_LEFT));
|
||||
player.sendPacket(TimedHuntingZoneExit.STATIC_PACKET);
|
||||
player.sendPacket(new TimedHuntingZoneExit(player.getLastTimeZone().getZoneId()));
|
||||
|
||||
player.getEffectList().stopSkillEffects(SkillFinishType.REMOVED, BUFF);
|
||||
instance.setParameter("PlayerIsOut", true);
|
||||
|
||||
+2
-2
@@ -10,7 +10,6 @@
|
||||
<xs:element type="xs:int" name="initialTime" />
|
||||
<xs:element type="xs:int" name="resetDelay" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="maxAddedTime" />
|
||||
<xs:element type="xs:int" name="remainRefillTime" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="refillTimeMax" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryItemId" minOccurs="0" />
|
||||
<xs:element type="xs:int" name="entryFee" />
|
||||
@@ -19,7 +18,8 @@
|
||||
<xs:element type="xs:int" name="instanceId" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="soloInstance" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="useWorldPrefix" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="pvpZone" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="noPvpZone" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||
<xs:attribute type="xs:string" name="name" use="optional" />
|
||||
|
||||
+13
-7
@@ -85,7 +85,6 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
int entryFee = 10000;
|
||||
int minLevel = 1;
|
||||
int maxLevel = 999;
|
||||
int remainRefillTime = 3600;
|
||||
int refillTimeMax = 3600;
|
||||
int instanceId = 0;
|
||||
boolean soloInstance = true;
|
||||
@@ -93,6 +92,8 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
boolean useWorldPrefix = false;
|
||||
Location enterLocation = null;
|
||||
Location exitLocation = null;
|
||||
boolean pvpZone = false;
|
||||
boolean noPvpZone = false;
|
||||
for (Node zoneNode = listNode.getFirstChild(); zoneNode != null; zoneNode = zoneNode.getNextSibling())
|
||||
{
|
||||
switch (zoneNode.getNodeName())
|
||||
@@ -144,11 +145,6 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
maxLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "remainRefillTime":
|
||||
{
|
||||
remainRefillTime = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "refillTimeMax":
|
||||
{
|
||||
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||
@@ -174,9 +170,19 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
useWorldPrefix = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "pvpZone":
|
||||
{
|
||||
pvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "noPvpZone":
|
||||
{
|
||||
noPvpZone = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, instanceId, soloInstance, weekly, useWorldPrefix, enterLocation, exitLocation));
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, refillTimeMax, instanceId, soloInstance, weekly, useWorldPrefix, enterLocation, exitLocation, pvpZone, noPvpZone));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user