Improved support for instanced timed hunting zones.
This commit is contained in:
@@ -87,6 +87,7 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
int maxLevel = 999;
|
||||
int remainRefillTime = 3600;
|
||||
int refillTimeMax = 3600;
|
||||
int instanceId = 0;
|
||||
boolean weekly = false;
|
||||
Location enterLocation = null;
|
||||
for (Node zoneNode = listNode.getFirstChild(); zoneNode != null; zoneNode = zoneNode.getNextSibling())
|
||||
@@ -144,6 +145,11 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "instanceId":
|
||||
{
|
||||
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||
break;
|
||||
}
|
||||
case "weekly":
|
||||
{
|
||||
weekly = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||
@@ -151,7 +157,7 @@ public class TimedHuntingZoneData implements IXmlReader
|
||||
}
|
||||
}
|
||||
}
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, weekly, enterLocation));
|
||||
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, instanceId, weekly, enterLocation));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -14365,6 +14365,13 @@ public class PlayerInstance extends Playable
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
|
@@ -35,12 +35,13 @@ public class TimedHuntingZoneHolder
|
||||
private final int _maxLevel;
|
||||
private final int _remainRefillTime;
|
||||
private final int _refillTimeMax;
|
||||
private final int _instanceId;
|
||||
private final boolean _weekly;
|
||||
private final Location _enterLocation;
|
||||
private final int _mapX;
|
||||
private final int _mapY;
|
||||
|
||||
public TimedHuntingZoneHolder(int id, String name, int initialTime, int maximumAddedTime, int resetDelay, int entryItemId, int entryFee, int minLevel, int maxLevel, int remainRefillTime, int refillTimeMax, boolean weekly, Location enterLocation)
|
||||
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 weekly, Location enterLocation)
|
||||
{
|
||||
_id = id;
|
||||
_name = name;
|
||||
@@ -53,6 +54,7 @@ public class TimedHuntingZoneHolder
|
||||
_maxLevel = maxLevel;
|
||||
_remainRefillTime = remainRefillTime;
|
||||
_refillTimeMax = refillTimeMax;
|
||||
_instanceId = instanceId;
|
||||
_weekly = weekly;
|
||||
_enterLocation = enterLocation;
|
||||
_mapX = ((_enterLocation.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
||||
@@ -114,6 +116,11 @@ public class TimedHuntingZoneHolder
|
||||
return _refillTimeMax;
|
||||
}
|
||||
|
||||
public int getInstanceId()
|
||||
{
|
||||
return _instanceId;
|
||||
}
|
||||
|
||||
public boolean isWeekly()
|
||||
{
|
||||
return _weekly;
|
||||
|
@@ -19,6 +19,8 @@ package org.l2jmobius.gameserver.network.clientpackets.huntingzones;
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.QuestManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
@@ -99,6 +101,13 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final int instanceId = holder.getInstanceId();
|
||||
if ((instanceId > 0) && (InstanceManager.getInstance().getInstanceTime(player, instanceId) > Chronos.currentTimeMillis()))
|
||||
{
|
||||
player.sendMessage("This transcendent instance has not reset yet.");
|
||||
return;
|
||||
}
|
||||
|
||||
final long currentTime = Chronos.currentTimeMillis();
|
||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||
final long lastEntryTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, 0);
|
||||
@@ -132,7 +141,15 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
||||
player.teleToLocation(holder.getEnterLocation());
|
||||
|
||||
if (instanceId == 0)
|
||||
{
|
||||
player.teleToLocation(holder.getEnterLocation());
|
||||
}
|
||||
else // Transcendent zones.
|
||||
{
|
||||
QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + instanceId, null, player);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user