Improved support for instanced timed hunting zones.
This commit is contained in:
parent
0537478023
commit
432f235dc5
@ -15,6 +15,7 @@
|
||||
<xs:element type="xs:int" name="entryFee" />
|
||||
<xs:element type="xs:short" name="minLevel" />
|
||||
<xs:element type="xs:short" name="maxLevel" />
|
||||
<xs:element type="xs:int" name="instanceId" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14292,6 +14292,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
|
||||
{
|
||||
|
@ -15,6 +15,7 @@
|
||||
<xs:element type="xs:int" name="entryFee" />
|
||||
<xs:element type="xs:short" name="minLevel" />
|
||||
<xs:element type="xs:short" name="maxLevel" />
|
||||
<xs:element type="xs:int" name="instanceId" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -15,6 +15,7 @@
|
||||
<xs:element type="xs:int" name="entryFee" />
|
||||
<xs:element type="xs:short" name="minLevel" />
|
||||
<xs:element type="xs:short" name="maxLevel" />
|
||||
<xs:element type="xs:int" name="instanceId" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14403,6 +14403,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
|
||||
{
|
||||
|
@ -15,6 +15,7 @@
|
||||
<xs:element type="xs:int" name="entryFee" />
|
||||
<xs:element type="xs:short" name="minLevel" />
|
||||
<xs:element type="xs:short" name="maxLevel" />
|
||||
<xs:element type="xs:int" name="instanceId" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14272,6 +14272,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
|
||||
{
|
||||
|
@ -55,6 +55,7 @@
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>40</minLevel>
|
||||
<maxLevel>49</maxLevel>
|
||||
<instanceId>1101</instanceId>
|
||||
</zone>
|
||||
<zone id="102" name="Transcendent Instance Zone 2">
|
||||
<enterLocation>125277,70262,-4408</enterLocation>
|
||||
@ -66,6 +67,7 @@
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>50</minLevel>
|
||||
<maxLevel>59</maxLevel>
|
||||
<instanceId>1102</instanceId>
|
||||
</zone>
|
||||
<zone id="103" name="Transcendent Instance Zone 3">
|
||||
<enterLocation>148724,-22366,-3436</enterLocation>
|
||||
@ -77,6 +79,7 @@
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>60</minLevel>
|
||||
<maxLevel>69</maxLevel>
|
||||
<instanceId>1103</instanceId>
|
||||
</zone>
|
||||
<zone id="104" name="Transcendent Instance Zone 4">
|
||||
<enterLocation>167965,28800,-3606</enterLocation>
|
||||
@ -88,6 +91,7 @@
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>70</minLevel>
|
||||
<maxLevel>79</maxLevel>
|
||||
<instanceId>1104</instanceId>
|
||||
</zone>
|
||||
<zone id="106" name="Transcendent Instance Zone 6">
|
||||
<enterLocation>99797,110524,-3702</enterLocation>
|
||||
@ -99,6 +103,7 @@
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>80</minLevel>
|
||||
<maxLevel>999</maxLevel>
|
||||
<instanceId>1106</instanceId>
|
||||
</zone>
|
||||
<zone id="107" name="Transcendent Instance Zone 7">
|
||||
<enterLocation>-50416,145363,-2825</enterLocation>
|
||||
@ -110,5 +115,6 @@
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>85</minLevel>
|
||||
<maxLevel>999</maxLevel>
|
||||
<instanceId>1107</instanceId>
|
||||
</zone>
|
||||
</list>
|
@ -69,7 +69,7 @@ public class TranscendentZone extends AbstractInstance
|
||||
{
|
||||
if (event.startsWith("ENTER"))
|
||||
{
|
||||
enterInstance(player, npc, 1000 + Integer.parseInt(event.split(" ")[1]));
|
||||
enterInstance(player, npc, Integer.parseInt(event.split(" ")[1]));
|
||||
}
|
||||
else if (event.startsWith("FINISH"))
|
||||
{
|
||||
|
@ -15,6 +15,7 @@
|
||||
<xs:element type="xs:int" name="entryFee" />
|
||||
<xs:element type="xs:short" name="minLevel" />
|
||||
<xs:element type="xs:short" name="maxLevel" />
|
||||
<xs:element type="xs:int" name="instanceId" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14533,6 +14533,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;
|
||||
|
@ -101,7 +101,8 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_zoneId >= 101) && (_zoneId <= 107) && (InstanceManager.getInstance().getInstanceTime(player, 1000 + _zoneId) > Chronos.currentTimeMillis()))
|
||||
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;
|
||||
@ -141,13 +142,13 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
||||
|
||||
if ((_zoneId < 101) || (_zoneId > 107))
|
||||
if (instanceId == 0)
|
||||
{
|
||||
player.teleToLocation(holder.getEnterLocation());
|
||||
}
|
||||
else // Transcendent zones.
|
||||
{
|
||||
QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + _zoneId, null, player);
|
||||
QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + instanceId, null, player);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -55,6 +55,7 @@
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>40</minLevel>
|
||||
<maxLevel>49</maxLevel>
|
||||
<instanceId>1101</instanceId>
|
||||
</zone>
|
||||
<zone id="102" name="Transcendent Instance Zone 2">
|
||||
<enterLocation>125277,70262,-4408</enterLocation>
|
||||
@ -66,6 +67,7 @@
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>50</minLevel>
|
||||
<maxLevel>59</maxLevel>
|
||||
<instanceId>1102</instanceId>
|
||||
</zone>
|
||||
<zone id="103" name="Transcendent Instance Zone 3">
|
||||
<enterLocation>148724,-22366,-3436</enterLocation>
|
||||
@ -77,6 +79,7 @@
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>60</minLevel>
|
||||
<maxLevel>69</maxLevel>
|
||||
<instanceId>1103</instanceId>
|
||||
</zone>
|
||||
<zone id="104" name="Transcendent Instance Zone 4">
|
||||
<enterLocation>167965,28800,-3606</enterLocation>
|
||||
@ -88,6 +91,7 @@
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>70</minLevel>
|
||||
<maxLevel>79</maxLevel>
|
||||
<instanceId>1104</instanceId>
|
||||
</zone>
|
||||
<zone id="106" name="Transcendent Instance Zone 6">
|
||||
<enterLocation>99797,110524,-3702</enterLocation>
|
||||
@ -99,6 +103,7 @@
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>80</minLevel>
|
||||
<maxLevel>999</maxLevel>
|
||||
<instanceId>1106</instanceId>
|
||||
</zone>
|
||||
<zone id="107" name="Transcendent Instance Zone 7">
|
||||
<enterLocation>-50416,145363,-2825</enterLocation>
|
||||
@ -110,5 +115,6 @@
|
||||
<entryFee>10000</entryFee>
|
||||
<minLevel>85</minLevel>
|
||||
<maxLevel>999</maxLevel>
|
||||
<instanceId>1107</instanceId>
|
||||
</zone>
|
||||
</list>
|
@ -69,7 +69,7 @@ public class TranscendentZone extends AbstractInstance
|
||||
{
|
||||
if (event.startsWith("ENTER"))
|
||||
{
|
||||
enterInstance(player, npc, 1000 + Integer.parseInt(event.split(" ")[1]));
|
||||
enterInstance(player, npc, Integer.parseInt(event.split(" ")[1]));
|
||||
}
|
||||
else if (event.startsWith("FINISH"))
|
||||
{
|
||||
|
@ -15,6 +15,7 @@
|
||||
<xs:element type="xs:int" name="entryFee" />
|
||||
<xs:element type="xs:short" name="minLevel" />
|
||||
<xs:element type="xs:short" name="maxLevel" />
|
||||
<xs:element type="xs:int" name="instanceId" minOccurs="0" />
|
||||
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14611,6 +14611,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;
|
||||
|
@ -101,7 +101,8 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_zoneId >= 101) && (_zoneId <= 107) && (InstanceManager.getInstance().getInstanceTime(player, 1000 + _zoneId) > Chronos.currentTimeMillis()))
|
||||
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;
|
||||
@ -141,13 +142,13 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
||||
|
||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
||||
|
||||
if ((_zoneId < 101) || (_zoneId > 107))
|
||||
if (instanceId == 0)
|
||||
{
|
||||
player.teleToLocation(holder.getEnterLocation());
|
||||
}
|
||||
else // Transcendent zones.
|
||||
{
|
||||
QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + _zoneId, null, player);
|
||||
QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + instanceId, null, player);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user