Unhardcoded timed hunting zone data.
This commit is contained in:
@@ -1,19 +0,0 @@
|
|||||||
# ---------------------------------------------------------------------------
|
|
||||||
# Time Limited Zones
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Initial free time.
|
|
||||||
# Default: 3600000 (1 hour)
|
|
||||||
InitialTime = 3600000
|
|
||||||
|
|
||||||
# Maximum added time.
|
|
||||||
# Default: 18000000 (5 hours)
|
|
||||||
MaximumAddedTime = 18000000
|
|
||||||
|
|
||||||
# Reset delay.
|
|
||||||
# Default: 36000000 (10 hours)
|
|
||||||
ResetDelay = 36000000
|
|
||||||
|
|
||||||
# Teleport fee.
|
|
||||||
# Default: 150000
|
|
||||||
TeleportFee = 150000
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?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>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>21600000</maxAddedTime> <!-- 6 hours -->
|
||||||
|
<remainRefillTime>3600</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>150000</entryFee>
|
||||||
|
<minLevel>100</minLevel>
|
||||||
|
<maxLevel>120</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="6" name="Primeval Isle">
|
||||||
|
<enterLocation>9400,-21720,-3634</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>21600000</maxAddedTime> <!-- 6 hours -->
|
||||||
|
<remainRefillTime>3600</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>150000</entryFee>
|
||||||
|
<minLevel>105</minLevel>
|
||||||
|
<maxLevel>120</maxLevel>
|
||||||
|
</zone>
|
||||||
|
</list>
|
||||||
Vendored
+12
-5
@@ -16,16 +16,17 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.effecthandlers;
|
package handlers.effecthandlers;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneList;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
@@ -56,9 +57,15 @@ public class AddHuntingTime extends AbstractEffect
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(_zoneId);
|
||||||
|
if (holder == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||||
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_TIME))
|
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= holder.getMaximumAddedTime()))
|
||||||
{
|
{
|
||||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
player.sendMessage("You cannot exceed the time zone limit.");
|
||||||
@@ -72,9 +79,9 @@ public class AddHuntingTime extends AbstractEffect
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
if ((endTime + holder.getResetDelay()) < currentTime)
|
||||||
{
|
{
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
endTime = currentTime + holder.getInitialTime();
|
||||||
}
|
}
|
||||||
else if (endTime < currentTime)
|
else if (endTime < currentTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<xs:element name="list">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="zone" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element type="xs:string" name="enterLocation" />
|
||||||
|
<xs:element type="xs:int" name="initialTime" />
|
||||||
|
<xs:element type="xs:int" name="resetDelay" />
|
||||||
|
<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" />
|
||||||
|
<xs:element type="xs:short" name="minLevel" />
|
||||||
|
<xs:element type="xs:short" name="maxLevel" />
|
||||||
|
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||||
|
<xs:attribute type="xs:string" name="name" use="optional" />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:boolean" name="enabled" />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -104,7 +104,6 @@ public class Config
|
|||||||
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
||||||
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||||
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
||||||
private static final String TIME_LIMITED_ZONE_CONFIG_FILE = "./config/TimeLimitedZones.ini";
|
|
||||||
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
||||||
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||||
private static final String HEXID_FILE = "./config/hexid.txt";
|
private static final String HEXID_FILE = "./config/hexid.txt";
|
||||||
@@ -839,10 +838,6 @@ public class Config
|
|||||||
public static String TELNET_HOSTNAME;
|
public static String TELNET_HOSTNAME;
|
||||||
public static List<String> TELNET_HOSTS;
|
public static List<String> TELNET_HOSTS;
|
||||||
public static int TELNET_PORT;
|
public static int TELNET_PORT;
|
||||||
public static long TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_TIME;
|
|
||||||
public static long TIME_LIMITED_ZONE_RESET_DELAY;
|
|
||||||
public static long TIME_LIMITED_ZONE_TELEPORT_FEE;
|
|
||||||
public static boolean TRAINING_CAMP_ENABLE;
|
public static boolean TRAINING_CAMP_ENABLE;
|
||||||
public static boolean TRAINING_CAMP_PREMIUM_ONLY;
|
public static boolean TRAINING_CAMP_PREMIUM_ONLY;
|
||||||
public static int TRAINING_CAMP_MAX_DURATION;
|
public static int TRAINING_CAMP_MAX_DURATION;
|
||||||
@@ -1988,13 +1983,6 @@ public class Config
|
|||||||
TELNET_PASSWORD = telnetSettings.getString("Password", "");
|
TELNET_PASSWORD = telnetSettings.getString("Password", "");
|
||||||
TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(","));
|
TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(","));
|
||||||
|
|
||||||
// Load Time Limited Zone config file (if exists)
|
|
||||||
final PropertiesParser timeLimitedZoneSettings = new PropertiesParser(TIME_LIMITED_ZONE_CONFIG_FILE);
|
|
||||||
TIME_LIMITED_ZONE_INITIAL_TIME = timeLimitedZoneSettings.getLong("InitialTime", 3600000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_TIME = timeLimitedZoneSettings.getLong("MaximumAddedTime", 18000000);
|
|
||||||
TIME_LIMITED_ZONE_RESET_DELAY = timeLimitedZoneSettings.getLong("ResetDelay", 36000000);
|
|
||||||
TIME_LIMITED_ZONE_TELEPORT_FEE = timeLimitedZoneSettings.getLong("TeleportFee", 150000);
|
|
||||||
|
|
||||||
// Load Training Camp config file (if exists)
|
// Load Training Camp config file (if exists)
|
||||||
final PropertiesParser trainingCampSettings = new PropertiesParser(TRAINING_CAMP_CONFIG_FILE);
|
final PropertiesParser trainingCampSettings = new PropertiesParser(TRAINING_CAMP_CONFIG_FILE);
|
||||||
TRAINING_CAMP_ENABLE = trainingCampSettings.getBoolean("TrainingCampEnable", false);
|
TRAINING_CAMP_ENABLE = trainingCampSettings.getBoolean("TrainingCampEnable", false);
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ import org.l2jmobius.gameserver.data.xml.SpawnData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.StaticObjectData;
|
import org.l2jmobius.gameserver.data.xml.StaticObjectData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TeleportListData;
|
import org.l2jmobius.gameserver.data.xml.TeleportListData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TeleporterData;
|
import org.l2jmobius.gameserver.data.xml.TeleporterData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TransformData;
|
import org.l2jmobius.gameserver.data.xml.TransformData;
|
||||||
import org.l2jmobius.gameserver.data.xml.VariationData;
|
import org.l2jmobius.gameserver.data.xml.VariationData;
|
||||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
@@ -351,6 +352,7 @@ public class GameServer
|
|||||||
CrestTable.getInstance();
|
CrestTable.getInstance();
|
||||||
TeleportListData.getInstance();
|
TeleportListData.getInstance();
|
||||||
TeleporterData.getInstance();
|
TeleporterData.getInstance();
|
||||||
|
TimedHuntingZoneData.getInstance();
|
||||||
MatchingRoomManager.getInstance();
|
MatchingRoomManager.getInstance();
|
||||||
PetitionManager.getInstance();
|
PetitionManager.getInstance();
|
||||||
CursedWeaponsManager.getInstance();
|
CursedWeaponsManager.getInstance();
|
||||||
|
|||||||
+186
@@ -0,0 +1,186 @@
|
|||||||
|
/*
|
||||||
|
* 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.data.xml;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.NamedNodeMap;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
|
import org.l2jmobius.commons.util.IXmlReader;
|
||||||
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneData implements IXmlReader
|
||||||
|
{
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(TimedHuntingZoneData.class.getName());
|
||||||
|
|
||||||
|
private final Map<Integer, TimedHuntingZoneHolder> _timedHuntingZoneData = new HashMap<>();
|
||||||
|
|
||||||
|
protected TimedHuntingZoneData()
|
||||||
|
{
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load()
|
||||||
|
{
|
||||||
|
_timedHuntingZoneData.clear();
|
||||||
|
parseDatapackFile("data/TimedHuntingZoneData.xml");
|
||||||
|
|
||||||
|
if (!_timedHuntingZoneData.isEmpty())
|
||||||
|
{
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _timedHuntingZoneData.size() + " timed hunting zones.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": System is disabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void parseDocument(Document doc, File f)
|
||||||
|
{
|
||||||
|
for (Node xmlNode = doc.getFirstChild(); xmlNode != null; xmlNode = xmlNode.getNextSibling())
|
||||||
|
{
|
||||||
|
if ("list".equalsIgnoreCase(xmlNode.getNodeName()))
|
||||||
|
{
|
||||||
|
final NamedNodeMap listAttributes = xmlNode.getAttributes();
|
||||||
|
final Node attribute = listAttributes.getNamedItem("enabled");
|
||||||
|
if ((attribute != null) && Boolean.parseBoolean(attribute.getNodeValue()))
|
||||||
|
{
|
||||||
|
for (Node listNode = xmlNode.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
|
||||||
|
{
|
||||||
|
if ("zone".equalsIgnoreCase(listNode.getNodeName()))
|
||||||
|
{
|
||||||
|
final NamedNodeMap zoneAttributes = listNode.getAttributes();
|
||||||
|
int id = parseInteger(zoneAttributes, "id");
|
||||||
|
String name = parseString(zoneAttributes, "name", "");
|
||||||
|
int initialTime = 0;
|
||||||
|
int maxAddedTime = 0;
|
||||||
|
int resetDelay = 0;
|
||||||
|
int entryItemId = 57;
|
||||||
|
int entryFee = 150000;
|
||||||
|
int minLevel = 1;
|
||||||
|
int maxLevel = 999;
|
||||||
|
int remainRefillTime = 3600;
|
||||||
|
int refillTimeMax = 3600;
|
||||||
|
boolean weekly = false;
|
||||||
|
Location enterLocation = null;
|
||||||
|
for (Node zoneNode = listNode.getFirstChild(); zoneNode != null; zoneNode = zoneNode.getNextSibling())
|
||||||
|
{
|
||||||
|
switch (zoneNode.getNodeName())
|
||||||
|
{
|
||||||
|
case "enterLocation":
|
||||||
|
{
|
||||||
|
final String[] coordinates = zoneNode.getTextContent().split(",");
|
||||||
|
enterLocation = new Location(Integer.parseInt(coordinates[0]), Integer.parseInt(coordinates[1]), Integer.parseInt(coordinates[2]));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "initialTime":
|
||||||
|
{
|
||||||
|
initialTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "maxAddedTime":
|
||||||
|
{
|
||||||
|
maxAddedTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "resetDelay":
|
||||||
|
{
|
||||||
|
resetDelay = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "entryItemId":
|
||||||
|
{
|
||||||
|
entryItemId = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "entryFee":
|
||||||
|
{
|
||||||
|
entryFee = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "minLevel":
|
||||||
|
{
|
||||||
|
minLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "maxLevel":
|
||||||
|
{
|
||||||
|
maxLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "remainRefillTime":
|
||||||
|
{
|
||||||
|
remainRefillTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "refillTimeMax":
|
||||||
|
{
|
||||||
|
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "weekly":
|
||||||
|
{
|
||||||
|
weekly = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, weekly, enterLocation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimedHuntingZoneHolder getHuntingZone(int zoneId)
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.get(zoneId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<TimedHuntingZoneHolder> getAllHuntingZones()
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSize()
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TimedHuntingZoneData getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final TimedHuntingZoneData INSTANCE = new TimedHuntingZoneData();
|
||||||
|
}
|
||||||
|
}
|
||||||
+21
-17
@@ -83,6 +83,7 @@ import org.l2jmobius.gameserver.data.xml.SendMessageLocalisationData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillTreeData;
|
import org.l2jmobius.gameserver.data.xml.SkillTreeData;
|
||||||
import org.l2jmobius.gameserver.data.xml.SymbolSealData;
|
import org.l2jmobius.gameserver.data.xml.SymbolSealData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.enums.AdminTeleportType;
|
import org.l2jmobius.gameserver.enums.AdminTeleportType;
|
||||||
import org.l2jmobius.gameserver.enums.BroochJewel;
|
import org.l2jmobius.gameserver.enums.BroochJewel;
|
||||||
import org.l2jmobius.gameserver.enums.CastleSide;
|
import org.l2jmobius.gameserver.enums.CastleSide;
|
||||||
@@ -231,6 +232,7 @@ import org.l2jmobius.gameserver.model.holders.RecipeHolder;
|
|||||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SkillUseHolder;
|
import org.l2jmobius.gameserver.model.holders.SkillUseHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.TrainingHolder;
|
import org.l2jmobius.gameserver.model.holders.TrainingHolder;
|
||||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||||
import org.l2jmobius.gameserver.model.interfaces.ILocational;
|
import org.l2jmobius.gameserver.model.interfaces.ILocational;
|
||||||
@@ -14276,12 +14278,6 @@ public class PlayerInstance extends Playable
|
|||||||
return _autoUseSettings;
|
return _autoUseSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int x, int y)
|
|
||||||
{
|
|
||||||
return isInTimedHuntingZone(1, x, y) // Storm Isle
|
|
||||||
|| isInTimedHuntingZone(6, x, y); // Primeval Isle
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId)
|
public boolean isInTimedHuntingZone(int zoneId)
|
||||||
{
|
{
|
||||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||||
@@ -14289,18 +14285,21 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||||
{
|
{
|
||||||
final int x = ((locX - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||||
final int y = ((locY - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
if (holder == null)
|
||||||
|
|
||||||
switch (zoneId)
|
|
||||||
{
|
{
|
||||||
case 1: // Storm Isle
|
return false;
|
||||||
{
|
|
||||||
return (x == 25) && (y == 23);
|
|
||||||
}
|
}
|
||||||
case 6: // Primeval Isle
|
return (holder.getMapX() == (((locX - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN)) && (holder.getMapY() == (((locY - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInTimedHuntingZone(int x, int y)
|
||||||
{
|
{
|
||||||
return (x == 20) && (y == 17);
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
|
{
|
||||||
|
if (isInTimedHuntingZone(holder.getZoneId(), x, y))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -14344,8 +14343,13 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTimedHuntingZoneRemainingTime(int zoneId)
|
public int getTimedHuntingZoneRemainingTime(int zoneId)
|
||||||
{
|
{
|
||||||
return Math.max(getVariables().getLong(PlayerVariables.HUNTING_ZONE_TIME + zoneId, 0), 0);
|
return Math.max(getVariables().getInt(PlayerVariables.HUNTING_ZONE_TIME + zoneId, 0), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTimedHuntingZoneInitialEntry(int zoneId)
|
||||||
|
{
|
||||||
|
return Math.max(getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + zoneId, 0), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.l2jmobius.gameserver.model.holders;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
|
import org.l2jmobius.gameserver.model.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneHolder
|
||||||
|
{
|
||||||
|
private final int _id;
|
||||||
|
private final String _name;
|
||||||
|
private final int _initialTime;
|
||||||
|
private final int _maximumAddedTime;
|
||||||
|
private final int _resetDelay;
|
||||||
|
private final int _entryItemId;
|
||||||
|
private final int _entryFee;
|
||||||
|
private final int _minLevel;
|
||||||
|
private final int _maxLevel;
|
||||||
|
private final int _remainRefillTime;
|
||||||
|
private final int _refillTimeMax;
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
_id = id;
|
||||||
|
_name = name;
|
||||||
|
_initialTime = initialTime;
|
||||||
|
_maximumAddedTime = maximumAddedTime;
|
||||||
|
_resetDelay = resetDelay;
|
||||||
|
_entryItemId = entryItemId;
|
||||||
|
_entryFee = entryFee;
|
||||||
|
_minLevel = minLevel;
|
||||||
|
_maxLevel = maxLevel;
|
||||||
|
_remainRefillTime = remainRefillTime;
|
||||||
|
_refillTimeMax = refillTimeMax;
|
||||||
|
_weekly = weekly;
|
||||||
|
_enterLocation = enterLocation;
|
||||||
|
_mapX = ((_enterLocation.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
||||||
|
_mapY = ((_enterLocation.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZoneId()
|
||||||
|
{
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZoneName()
|
||||||
|
{
|
||||||
|
return _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInitialTime()
|
||||||
|
{
|
||||||
|
return _initialTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaximumAddedTime()
|
||||||
|
{
|
||||||
|
return _maximumAddedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getResetDelay()
|
||||||
|
{
|
||||||
|
return _resetDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEntryItemId()
|
||||||
|
{
|
||||||
|
return _entryItemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEntryFee()
|
||||||
|
{
|
||||||
|
return _entryFee;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinLevel()
|
||||||
|
{
|
||||||
|
return _minLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxLevel()
|
||||||
|
{
|
||||||
|
return _maxLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRemainRefillTime()
|
||||||
|
{
|
||||||
|
return _remainRefillTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRefillTimeMax()
|
||||||
|
{
|
||||||
|
return _refillTimeMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWeekly()
|
||||||
|
{
|
||||||
|
return _weekly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getEnterLocation()
|
||||||
|
{
|
||||||
|
return _enterLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMapX()
|
||||||
|
{
|
||||||
|
return _mapX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMapY()
|
||||||
|
{
|
||||||
|
return _mapY;
|
||||||
|
}
|
||||||
|
}
|
||||||
+17
-9
@@ -16,13 +16,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.zone.type;
|
package org.l2jmobius.gameserver.model.zone.type;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||||
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneExit;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneExit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
@@ -42,17 +44,23 @@ public class TimedHuntingZone extends ZoneType
|
|||||||
{
|
{
|
||||||
player.setInsideZone(ZoneId.TIMED_HUNTING, true);
|
player.setInsideZone(ZoneId.TIMED_HUNTING, true);
|
||||||
|
|
||||||
final long stormIsleExitTime = player.getTimedHuntingZoneRemainingTime(1);
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
final long primevalIsleExitTime = player.getTimedHuntingZoneRemainingTime(6);
|
|
||||||
if ((stormIsleExitTime > 0) && player.isInTimedHuntingZone(1))
|
|
||||||
{
|
{
|
||||||
player.startTimedHuntingZone(1, stormIsleExitTime);
|
if (!player.isInTimedHuntingZone(holder.getZoneId()))
|
||||||
}
|
|
||||||
else if ((primevalIsleExitTime > 0) && player.isInTimedHuntingZone(6))
|
|
||||||
{
|
{
|
||||||
player.startTimedHuntingZone(6, primevalIsleExitTime);
|
continue;
|
||||||
}
|
}
|
||||||
else if (!player.isGM())
|
|
||||||
|
final int remainingTime = player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||||
|
if (remainingTime > 0)
|
||||||
|
{
|
||||||
|
player.startTimedHuntingZone(holder.getZoneId(), remainingTime);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!player.isGM())
|
||||||
{
|
{
|
||||||
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -75,6 +75,8 @@ import org.l2jmobius.gameserver.network.clientpackets.ensoul.RequestTryEnSoulExt
|
|||||||
import org.l2jmobius.gameserver.network.clientpackets.equipmentupgrade.RequestUpgradeSystemResult;
|
import org.l2jmobius.gameserver.network.clientpackets.equipmentupgrade.RequestUpgradeSystemResult;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.faction.RequestUserFactionInfo;
|
import org.l2jmobius.gameserver.network.clientpackets.faction.RequestUserFactionInfo;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
import org.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
||||||
|
import org.l2jmobius.gameserver.network.clientpackets.huntingzones.ExTimedHuntingZoneEnter;
|
||||||
|
import org.l2jmobius.gameserver.network.clientpackets.huntingzones.ExTimedHuntingZoneList;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGameStartInfo;
|
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGameStartInfo;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.mentoring.ConfirmMenteeAdd;
|
import org.l2jmobius.gameserver.network.clientpackets.mentoring.ConfirmMenteeAdd;
|
||||||
@@ -111,8 +113,6 @@ import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingChar
|
|||||||
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharRankers;
|
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharRankers;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
|
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
|
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sessionzones.ExTimedHuntingZoneEnter;
|
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sessionzones.ExTimedHuntingZoneList;
|
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
|
||||||
|
|||||||
+25
-23
@@ -14,12 +14,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.clientpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
@@ -85,52 +87,52 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((_zoneId == 1) && (player.getLevel() < 100)) //
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(_zoneId);
|
||||||
|| ((_zoneId == 6) && (player.getLevel() < 105)) //
|
if (holder == null)
|
||||||
)
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((player.getLevel() < holder.getMinLevel()) || (player.getLevel() > holder.getMaxLevel()))
|
||||||
{
|
{
|
||||||
player.sendMessage("Your level does not correspond the zone equivalent.");
|
player.sendMessage("Your level does not correspond the zone equivalent.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||||
final long lastEntryTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, 0);
|
final long lastEntryTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, 0);
|
||||||
if ((lastEntryTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
if ((lastEntryTime + holder.getResetDelay()) < currentTime)
|
||||||
{
|
{
|
||||||
if (endTime == currentTime)
|
if (endTime == currentTime)
|
||||||
{
|
{
|
||||||
endTime += Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
endTime += holder.getInitialTime();
|
||||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, currentTime);
|
player.getVariables().set(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, currentTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endTime > currentTime)
|
if (endTime > currentTime)
|
||||||
{
|
{
|
||||||
if (player.getAdena() > Config.TIME_LIMITED_ZONE_TELEPORT_FEE)
|
if (holder.getEntryItemId() == Inventory.ADENA_ID)
|
||||||
{
|
{
|
||||||
player.reduceAdena("TimedHuntingZone", Config.TIME_LIMITED_ZONE_TELEPORT_FEE, player, true);
|
if (player.getAdena() > holder.getEntryFee())
|
||||||
|
{
|
||||||
|
player.reduceAdena("TimedHuntingZone", holder.getEntryFee(), player, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(SystemMessageId.NOT_ENOUGH_ADENA);
|
player.sendPacket(SystemMessageId.NOT_ENOUGH_ADENA);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (!player.destroyItemByItemId("TimedHuntingZone", holder.getEntryItemId(), holder.getEntryFee(), player, true))
|
||||||
|
{
|
||||||
|
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_REQUIRED_ITEMS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
||||||
|
player.teleToLocation(holder.getEnterLocation());
|
||||||
switch (_zoneId)
|
|
||||||
{
|
|
||||||
case 1: // Storm Isle
|
|
||||||
{
|
|
||||||
player.teleToLocation(194291, 176604, -1888);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 6: // Primeval Isle
|
|
||||||
{
|
|
||||||
player.teleToLocation(9400, -21720, -3634);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
+2
-2
@@ -14,13 +14,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.clientpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneList;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.serverpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.serverpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
+23
-27
@@ -14,12 +14,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.serverpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||||
@@ -42,35 +43,30 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket
|
|||||||
public boolean write(PacketWriter packet)
|
public boolean write(PacketWriter packet)
|
||||||
{
|
{
|
||||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_LIST.writeId(packet);
|
OutgoingPackets.EX_TIME_RESTRICT_FIELD_LIST.writeId(packet);
|
||||||
|
int remainingTime;
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
long endTime;
|
packet.writeD(TimedHuntingZoneData.getInstance().getSize()); // zone count
|
||||||
packet.writeD(1); // zone count
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
|
|
||||||
// Ancient Pirates' Tomb
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(2); // zone id
|
|
||||||
packet.writeD(78); // min level
|
|
||||||
packet.writeD(999); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(2);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
{
|
||||||
endTime += currentTime;
|
packet.writeD(holder.getEntryFee() == 0 ? 0 : 1); // required item count
|
||||||
}
|
packet.writeD(holder.getEntryItemId());
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
packet.writeQ(holder.getEntryFee());
|
||||||
|
packet.writeD(holder.isWeekly() ? 0 : 1); // reset cycle
|
||||||
|
packet.writeD(holder.getZoneId());
|
||||||
|
packet.writeD(holder.getMinLevel());
|
||||||
|
packet.writeD(holder.getMaxLevel());
|
||||||
|
packet.writeD(holder.getInitialTime() / 1000); // remain time base
|
||||||
|
remainingTime = _player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||||
|
if ((remainingTime == 0) && ((_player.getTimedHuntingZoneInitialEntry(1) + holder.getResetDelay()) < currentTime))
|
||||||
{
|
{
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
remainingTime = holder.getInitialTime();
|
||||||
|
}
|
||||||
|
packet.writeD(remainingTime / 1000); // remain time
|
||||||
|
packet.writeD(holder.getMaximumAddedTime() / 1000);
|
||||||
|
packet.writeD(holder.getRemainRefillTime());
|
||||||
|
packet.writeD(holder.getRefillTimeMax());
|
||||||
|
packet.writeC(!_isInTimedHuntingZone || _player.isInTimedHuntingZone(holder.getZoneId()) ? 1 : 0); // field activated
|
||||||
}
|
}
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
packet.writeD(3600); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
-100
@@ -1,100 +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.sessionzones;
|
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Mobius
|
|
||||||
*/
|
|
||||||
public class TimedHuntingZoneList implements IClientOutgoingPacket
|
|
||||||
{
|
|
||||||
private final PlayerInstance _player;
|
|
||||||
private final boolean _isInTimedHuntingZone;
|
|
||||||
|
|
||||||
public TimedHuntingZoneList(PlayerInstance player)
|
|
||||||
{
|
|
||||||
_player = player;
|
|
||||||
_isInTimedHuntingZone = player.isInsideZone(ZoneId.TIMED_HUNTING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean write(PacketWriter packet)
|
|
||||||
{
|
|
||||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_LIST.writeId(packet);
|
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
|
||||||
long endTime;
|
|
||||||
packet.writeD(2); // zone count
|
|
||||||
|
|
||||||
// Storm Isle
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(1); // zone id
|
|
||||||
packet.writeD(100); // min level
|
|
||||||
packet.writeD(120); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(1);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
packet.writeD(3600); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated
|
|
||||||
|
|
||||||
// Primeval Isle
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(6); // zone id
|
|
||||||
packet.writeD(105); // min level
|
|
||||||
packet.writeD(120); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(6);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
packet.writeD(3600); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeC(_isInTimedHuntingZone ? 0 : 1); // field activated
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
# ---------------------------------------------------------------------------
|
|
||||||
# Time Limited Zones
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Initial free time.
|
|
||||||
# Default: 3600000 (1 hour)
|
|
||||||
InitialTime = 3600000
|
|
||||||
|
|
||||||
# Initial free time.
|
|
||||||
# Default: 36000000 (10 hour)
|
|
||||||
InitialTimeWeekly = 36000000
|
|
||||||
|
|
||||||
# Maximum added time.
|
|
||||||
# Default: 18000000 (6 hours)
|
|
||||||
MaximumAddedTime = 21600000
|
|
||||||
|
|
||||||
# Maximum added time Weekly.
|
|
||||||
# Default: 43200000 (12 hours)
|
|
||||||
MaximumAddedTimeWeekly = 43200000
|
|
||||||
|
|
||||||
# Reset delay.
|
|
||||||
# Default: 36000000 (10 hours)
|
|
||||||
ResetDelay = 36000000
|
|
||||||
|
|
||||||
# Reset Weekly.
|
|
||||||
# Default: 604800000 (7 Days)
|
|
||||||
ResetWeekly = 604800000
|
|
||||||
|
|
||||||
# Teleport fee.
|
|
||||||
# Default: 150000
|
|
||||||
TeleportFee = 150000
|
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
<?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>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>21600000</maxAddedTime> <!-- 6 hours -->
|
||||||
|
<remainRefillTime>43200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>150000</entryFee>
|
||||||
|
<minLevel>100</minLevel>
|
||||||
|
<maxLevel>120</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="6" name="Primeval Isle">
|
||||||
|
<enterLocation>9400,-21720,-3634</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>21600000</maxAddedTime> <!-- 6 hours -->
|
||||||
|
<remainRefillTime>43200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>150000</entryFee>
|
||||||
|
<minLevel>105</minLevel>
|
||||||
|
<maxLevel>120</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="7" name="Golden Altar">
|
||||||
|
<enterLocation>-122259,73678,-2872</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>21600000</maxAddedTime> <!-- 6 hours -->
|
||||||
|
<remainRefillTime>43200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>150000</entryFee>
|
||||||
|
<minLevel>107</minLevel>
|
||||||
|
<maxLevel>120</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="11" name="Abandoned Coal Mines">
|
||||||
|
<enterLocation>139411,-169382,-1600</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>21600000</maxAddedTime> <!-- 6 hours -->
|
||||||
|
<remainRefillTime>43200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>150000</entryFee>
|
||||||
|
<minLevel>99</minLevel>
|
||||||
|
<maxLevel>105</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="8" name="Tower of Insolence">
|
||||||
|
<enterLocation>-82014,16247,-15416</enterLocation>
|
||||||
|
<initialTime>36000000</initialTime> <!-- 10 hours -->
|
||||||
|
<resetDelay>604800000</resetDelay> <!-- 7 days -->
|
||||||
|
<maxAddedTime>43200000</maxAddedTime> <!-- 12 hours -->
|
||||||
|
<remainRefillTime>43200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>150000</entryFee>
|
||||||
|
<minLevel>110</minLevel>
|
||||||
|
<maxLevel>130</maxLevel>
|
||||||
|
<weekly>true</weekly>
|
||||||
|
</zone>
|
||||||
|
<zone id="12" name="Imperial Tomb">
|
||||||
|
<enterLocation>181409,-78389,-2728</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>21600000</maxAddedTime> <!-- 6 hours -->
|
||||||
|
<remainRefillTime>43200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>150000</entryFee>
|
||||||
|
<minLevel>105</minLevel>
|
||||||
|
<maxLevel>130</maxLevel>
|
||||||
|
</zone>
|
||||||
|
</list>
|
||||||
Vendored
+11
-14
@@ -16,16 +16,17 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.effecthandlers;
|
package handlers.effecthandlers;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneList;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
@@ -56,15 +57,15 @@ public class AddHuntingTime extends AbstractEffect
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(_zoneId);
|
||||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
if (holder == null)
|
||||||
if ((_zoneId == 8) && (endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_TIME_WEEKLY))
|
|
||||||
{
|
{
|
||||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_TIME))
|
|
||||||
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
|
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);
|
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
player.sendMessage("You cannot exceed the time zone limit.");
|
||||||
@@ -78,13 +79,9 @@ public class AddHuntingTime extends AbstractEffect
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((_zoneId == 8) && ((endTime + Config.TIME_LIMITED_ZONE_RESET_WEEKLY) < currentTime))
|
if ((endTime + holder.getResetDelay()) < currentTime)
|
||||||
{
|
{
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME_WEEKLY;
|
endTime = currentTime + holder.getInitialTime();
|
||||||
}
|
|
||||||
else if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
}
|
||||||
else if (endTime < currentTime)
|
else if (endTime < currentTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<xs:element name="list">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="zone" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element type="xs:string" name="enterLocation" />
|
||||||
|
<xs:element type="xs:int" name="initialTime" />
|
||||||
|
<xs:element type="xs:int" name="resetDelay" />
|
||||||
|
<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" />
|
||||||
|
<xs:element type="xs:short" name="minLevel" />
|
||||||
|
<xs:element type="xs:short" name="maxLevel" />
|
||||||
|
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||||
|
<xs:attribute type="xs:string" name="name" use="optional" />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:boolean" name="enabled" />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -104,7 +104,6 @@ public class Config
|
|||||||
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
||||||
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||||
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
||||||
private static final String TIME_LIMITED_ZONE_CONFIG_FILE = "./config/TimeLimitedZones.ini";
|
|
||||||
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
||||||
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||||
private static final String HEXID_FILE = "./config/hexid.txt";
|
private static final String HEXID_FILE = "./config/hexid.txt";
|
||||||
@@ -836,13 +835,6 @@ public class Config
|
|||||||
public static String TELNET_HOSTNAME;
|
public static String TELNET_HOSTNAME;
|
||||||
public static List<String> TELNET_HOSTS;
|
public static List<String> TELNET_HOSTS;
|
||||||
public static int TELNET_PORT;
|
public static int TELNET_PORT;
|
||||||
public static long TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
public static long TIME_LIMITED_ZONE_INITIAL_TIME_WEEKLY;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_TIME;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_TIME_WEEKLY;
|
|
||||||
public static long TIME_LIMITED_ZONE_RESET_DELAY;
|
|
||||||
public static long TIME_LIMITED_ZONE_RESET_WEEKLY;
|
|
||||||
public static long TIME_LIMITED_ZONE_TELEPORT_FEE;
|
|
||||||
public static boolean TRAINING_CAMP_ENABLE;
|
public static boolean TRAINING_CAMP_ENABLE;
|
||||||
public static boolean TRAINING_CAMP_PREMIUM_ONLY;
|
public static boolean TRAINING_CAMP_PREMIUM_ONLY;
|
||||||
public static int TRAINING_CAMP_MAX_DURATION;
|
public static int TRAINING_CAMP_MAX_DURATION;
|
||||||
@@ -1988,16 +1980,6 @@ public class Config
|
|||||||
TELNET_PASSWORD = telnetSettings.getString("Password", "");
|
TELNET_PASSWORD = telnetSettings.getString("Password", "");
|
||||||
TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(","));
|
TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(","));
|
||||||
|
|
||||||
// Load Time Limited Zone config file (if exists)
|
|
||||||
final PropertiesParser timeLimitedZoneSettings = new PropertiesParser(TIME_LIMITED_ZONE_CONFIG_FILE);
|
|
||||||
TIME_LIMITED_ZONE_INITIAL_TIME = timeLimitedZoneSettings.getLong("InitialTime", 3600000);
|
|
||||||
TIME_LIMITED_ZONE_INITIAL_TIME_WEEKLY = timeLimitedZoneSettings.getLong("InitialTimeWeekly", 36000000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_TIME = timeLimitedZoneSettings.getLong("MaximumAddedTime", 21600000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_TIME_WEEKLY = timeLimitedZoneSettings.getLong("MaximumAddedTimeWeekly", 43200000);
|
|
||||||
TIME_LIMITED_ZONE_RESET_DELAY = timeLimitedZoneSettings.getLong("ResetDelay", 36000000);
|
|
||||||
TIME_LIMITED_ZONE_RESET_WEEKLY = timeLimitedZoneSettings.getLong("ResetWeekly", 604800000);
|
|
||||||
TIME_LIMITED_ZONE_TELEPORT_FEE = timeLimitedZoneSettings.getLong("TeleportFee", 150000);
|
|
||||||
|
|
||||||
// Load Training Camp config file (if exists)
|
// Load Training Camp config file (if exists)
|
||||||
final PropertiesParser trainingCampSettings = new PropertiesParser(TRAINING_CAMP_CONFIG_FILE);
|
final PropertiesParser trainingCampSettings = new PropertiesParser(TRAINING_CAMP_CONFIG_FILE);
|
||||||
TRAINING_CAMP_ENABLE = trainingCampSettings.getBoolean("TrainingCampEnable", false);
|
TRAINING_CAMP_ENABLE = trainingCampSettings.getBoolean("TrainingCampEnable", false);
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ import org.l2jmobius.gameserver.data.xml.SpawnData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.StaticObjectData;
|
import org.l2jmobius.gameserver.data.xml.StaticObjectData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TeleportListData;
|
import org.l2jmobius.gameserver.data.xml.TeleportListData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TeleporterData;
|
import org.l2jmobius.gameserver.data.xml.TeleporterData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TransformData;
|
import org.l2jmobius.gameserver.data.xml.TransformData;
|
||||||
import org.l2jmobius.gameserver.data.xml.VariationData;
|
import org.l2jmobius.gameserver.data.xml.VariationData;
|
||||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
@@ -349,6 +350,7 @@ public class GameServer
|
|||||||
CrestTable.getInstance();
|
CrestTable.getInstance();
|
||||||
TeleportListData.getInstance();
|
TeleportListData.getInstance();
|
||||||
TeleporterData.getInstance();
|
TeleporterData.getInstance();
|
||||||
|
TimedHuntingZoneData.getInstance();
|
||||||
MatchingRoomManager.getInstance();
|
MatchingRoomManager.getInstance();
|
||||||
PetitionManager.getInstance();
|
PetitionManager.getInstance();
|
||||||
CursedWeaponsManager.getInstance();
|
CursedWeaponsManager.getInstance();
|
||||||
|
|||||||
+186
@@ -0,0 +1,186 @@
|
|||||||
|
/*
|
||||||
|
* 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.data.xml;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.NamedNodeMap;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
|
import org.l2jmobius.commons.util.IXmlReader;
|
||||||
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneData implements IXmlReader
|
||||||
|
{
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(TimedHuntingZoneData.class.getName());
|
||||||
|
|
||||||
|
private final Map<Integer, TimedHuntingZoneHolder> _timedHuntingZoneData = new HashMap<>();
|
||||||
|
|
||||||
|
protected TimedHuntingZoneData()
|
||||||
|
{
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load()
|
||||||
|
{
|
||||||
|
_timedHuntingZoneData.clear();
|
||||||
|
parseDatapackFile("data/TimedHuntingZoneData.xml");
|
||||||
|
|
||||||
|
if (!_timedHuntingZoneData.isEmpty())
|
||||||
|
{
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _timedHuntingZoneData.size() + " timed hunting zones.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": System is disabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void parseDocument(Document doc, File f)
|
||||||
|
{
|
||||||
|
for (Node xmlNode = doc.getFirstChild(); xmlNode != null; xmlNode = xmlNode.getNextSibling())
|
||||||
|
{
|
||||||
|
if ("list".equalsIgnoreCase(xmlNode.getNodeName()))
|
||||||
|
{
|
||||||
|
final NamedNodeMap listAttributes = xmlNode.getAttributes();
|
||||||
|
final Node attribute = listAttributes.getNamedItem("enabled");
|
||||||
|
if ((attribute != null) && Boolean.parseBoolean(attribute.getNodeValue()))
|
||||||
|
{
|
||||||
|
for (Node listNode = xmlNode.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
|
||||||
|
{
|
||||||
|
if ("zone".equalsIgnoreCase(listNode.getNodeName()))
|
||||||
|
{
|
||||||
|
final NamedNodeMap zoneAttributes = listNode.getAttributes();
|
||||||
|
int id = parseInteger(zoneAttributes, "id");
|
||||||
|
String name = parseString(zoneAttributes, "name", "");
|
||||||
|
int initialTime = 0;
|
||||||
|
int maxAddedTime = 0;
|
||||||
|
int resetDelay = 0;
|
||||||
|
int entryItemId = 57;
|
||||||
|
int entryFee = 150000;
|
||||||
|
int minLevel = 1;
|
||||||
|
int maxLevel = 999;
|
||||||
|
int remainRefillTime = 3600;
|
||||||
|
int refillTimeMax = 3600;
|
||||||
|
boolean weekly = false;
|
||||||
|
Location enterLocation = null;
|
||||||
|
for (Node zoneNode = listNode.getFirstChild(); zoneNode != null; zoneNode = zoneNode.getNextSibling())
|
||||||
|
{
|
||||||
|
switch (zoneNode.getNodeName())
|
||||||
|
{
|
||||||
|
case "enterLocation":
|
||||||
|
{
|
||||||
|
final String[] coordinates = zoneNode.getTextContent().split(",");
|
||||||
|
enterLocation = new Location(Integer.parseInt(coordinates[0]), Integer.parseInt(coordinates[1]), Integer.parseInt(coordinates[2]));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "initialTime":
|
||||||
|
{
|
||||||
|
initialTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "maxAddedTime":
|
||||||
|
{
|
||||||
|
maxAddedTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "resetDelay":
|
||||||
|
{
|
||||||
|
resetDelay = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "entryItemId":
|
||||||
|
{
|
||||||
|
entryItemId = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "entryFee":
|
||||||
|
{
|
||||||
|
entryFee = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "minLevel":
|
||||||
|
{
|
||||||
|
minLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "maxLevel":
|
||||||
|
{
|
||||||
|
maxLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "remainRefillTime":
|
||||||
|
{
|
||||||
|
remainRefillTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "refillTimeMax":
|
||||||
|
{
|
||||||
|
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "weekly":
|
||||||
|
{
|
||||||
|
weekly = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, weekly, enterLocation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimedHuntingZoneHolder getHuntingZone(int zoneId)
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.get(zoneId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<TimedHuntingZoneHolder> getAllHuntingZones()
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSize()
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TimedHuntingZoneData getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final TimedHuntingZoneData INSTANCE = new TimedHuntingZoneData();
|
||||||
|
}
|
||||||
|
}
|
||||||
+18
-33
@@ -82,6 +82,7 @@ import org.l2jmobius.gameserver.data.xml.SendMessageLocalisationData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillTreeData;
|
import org.l2jmobius.gameserver.data.xml.SkillTreeData;
|
||||||
import org.l2jmobius.gameserver.data.xml.SymbolSealData;
|
import org.l2jmobius.gameserver.data.xml.SymbolSealData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.enums.AdminTeleportType;
|
import org.l2jmobius.gameserver.enums.AdminTeleportType;
|
||||||
import org.l2jmobius.gameserver.enums.BroochJewel;
|
import org.l2jmobius.gameserver.enums.BroochJewel;
|
||||||
import org.l2jmobius.gameserver.enums.CastleSide;
|
import org.l2jmobius.gameserver.enums.CastleSide;
|
||||||
@@ -229,6 +230,7 @@ import org.l2jmobius.gameserver.model.holders.RecipeHolder;
|
|||||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SkillUseHolder;
|
import org.l2jmobius.gameserver.model.holders.SkillUseHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.TrainingHolder;
|
import org.l2jmobius.gameserver.model.holders.TrainingHolder;
|
||||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||||
import org.l2jmobius.gameserver.model.interfaces.ILocational;
|
import org.l2jmobius.gameserver.model.interfaces.ILocational;
|
||||||
@@ -14314,16 +14316,6 @@ public class PlayerInstance extends Playable
|
|||||||
return _autoUseSettings;
|
return _autoUseSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int x, int y)
|
|
||||||
{
|
|
||||||
return isInTimedHuntingZone(1, x, y) // Storm Isle
|
|
||||||
|| isInTimedHuntingZone(6, x, y) // Primeval Isle
|
|
||||||
|| isInTimedHuntingZone(7, x, y) // Golden Altar
|
|
||||||
|| isInTimedHuntingZone(11, x, y) // Abandoned Coal Mines
|
|
||||||
|| isInTimedHuntingZone(8, x, y) // Tower of Insolence
|
|
||||||
|| isInTimedHuntingZone(12, x, y); // Imperial Tomb
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId)
|
public boolean isInTimedHuntingZone(int zoneId)
|
||||||
{
|
{
|
||||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||||
@@ -14331,33 +14323,21 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||||
{
|
{
|
||||||
final int x = ((locX - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||||
final int y = ((locY - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
if (holder == null)
|
||||||
switch (zoneId)
|
|
||||||
{
|
{
|
||||||
case 1: // Storm Isle
|
return false;
|
||||||
{
|
|
||||||
return (x == 25) && (y == 23);
|
|
||||||
}
|
}
|
||||||
case 6: // Primeval Isle
|
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 (x == 20) && (y == 17);
|
|
||||||
}
|
}
|
||||||
case 7: // Golden Altar
|
|
||||||
|
public boolean isInTimedHuntingZone(int x, int y)
|
||||||
{
|
{
|
||||||
return (x == 16) && (y == 20);
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
}
|
|
||||||
case 11: // Abandoned Coal Mines
|
|
||||||
{
|
{
|
||||||
return (x == 24) && (y == 12);
|
if (isInTimedHuntingZone(holder.getZoneId(), x, y))
|
||||||
}
|
|
||||||
case 8: // Tower of Insolence
|
|
||||||
{
|
{
|
||||||
return (x == 17) && (y == 18);
|
return true;
|
||||||
}
|
|
||||||
case 12: // Imperial Tomb
|
|
||||||
{
|
|
||||||
return (x == 25) && (y == 15);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -14401,9 +14381,14 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTimedHuntingZoneRemainingTime(int zoneId)
|
public int getTimedHuntingZoneRemainingTime(int zoneId)
|
||||||
{
|
{
|
||||||
return Math.max(getVariables().getLong(PlayerVariables.HUNTING_ZONE_TIME + zoneId, 0), 0);
|
return Math.max(getVariables().getInt(PlayerVariables.HUNTING_ZONE_TIME + zoneId, 0), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTimedHuntingZoneInitialEntry(int zoneId)
|
||||||
|
{
|
||||||
|
return Math.max(getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + zoneId, 0), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHomunculusHpBonus()
|
public int getHomunculusHpBonus()
|
||||||
|
|||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.l2jmobius.gameserver.model.holders;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
|
import org.l2jmobius.gameserver.model.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneHolder
|
||||||
|
{
|
||||||
|
private final int _id;
|
||||||
|
private final String _name;
|
||||||
|
private final int _initialTime;
|
||||||
|
private final int _maximumAddedTime;
|
||||||
|
private final int _resetDelay;
|
||||||
|
private final int _entryItemId;
|
||||||
|
private final int _entryFee;
|
||||||
|
private final int _minLevel;
|
||||||
|
private final int _maxLevel;
|
||||||
|
private final int _remainRefillTime;
|
||||||
|
private final int _refillTimeMax;
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
_id = id;
|
||||||
|
_name = name;
|
||||||
|
_initialTime = initialTime;
|
||||||
|
_maximumAddedTime = maximumAddedTime;
|
||||||
|
_resetDelay = resetDelay;
|
||||||
|
_entryItemId = entryItemId;
|
||||||
|
_entryFee = entryFee;
|
||||||
|
_minLevel = minLevel;
|
||||||
|
_maxLevel = maxLevel;
|
||||||
|
_remainRefillTime = remainRefillTime;
|
||||||
|
_refillTimeMax = refillTimeMax;
|
||||||
|
_weekly = weekly;
|
||||||
|
_enterLocation = enterLocation;
|
||||||
|
_mapX = ((_enterLocation.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
||||||
|
_mapY = ((_enterLocation.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZoneId()
|
||||||
|
{
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZoneName()
|
||||||
|
{
|
||||||
|
return _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInitialTime()
|
||||||
|
{
|
||||||
|
return _initialTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaximumAddedTime()
|
||||||
|
{
|
||||||
|
return _maximumAddedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getResetDelay()
|
||||||
|
{
|
||||||
|
return _resetDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEntryItemId()
|
||||||
|
{
|
||||||
|
return _entryItemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEntryFee()
|
||||||
|
{
|
||||||
|
return _entryFee;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinLevel()
|
||||||
|
{
|
||||||
|
return _minLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxLevel()
|
||||||
|
{
|
||||||
|
return _maxLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRemainRefillTime()
|
||||||
|
{
|
||||||
|
return _remainRefillTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRefillTimeMax()
|
||||||
|
{
|
||||||
|
return _refillTimeMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWeekly()
|
||||||
|
{
|
||||||
|
return _weekly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getEnterLocation()
|
||||||
|
{
|
||||||
|
return _enterLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMapX()
|
||||||
|
{
|
||||||
|
return _mapX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMapY()
|
||||||
|
{
|
||||||
|
return _mapY;
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
-26
@@ -16,13 +16,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.zone.type;
|
package org.l2jmobius.gameserver.model.zone.type;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||||
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneExit;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneExit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
@@ -42,37 +44,23 @@ public class TimedHuntingZone extends ZoneType
|
|||||||
{
|
{
|
||||||
player.setInsideZone(ZoneId.TIMED_HUNTING, true);
|
player.setInsideZone(ZoneId.TIMED_HUNTING, true);
|
||||||
|
|
||||||
final long stormIsleExitTime = player.getTimedHuntingZoneRemainingTime(1);
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
final long primevalIsleExitTime = player.getTimedHuntingZoneRemainingTime(6);
|
|
||||||
final long goldenAltarExitTime = player.getTimedHuntingZoneRemainingTime(7);
|
|
||||||
final long coalMinesExitTime = player.getTimedHuntingZoneRemainingTime(11);
|
|
||||||
final long toiExitTime = player.getTimedHuntingZoneRemainingTime(8);
|
|
||||||
final long imperialTombExitTime = player.getTimedHuntingZoneRemainingTime(12);
|
|
||||||
if ((stormIsleExitTime > 0) && player.isInTimedHuntingZone(1))
|
|
||||||
{
|
{
|
||||||
player.startTimedHuntingZone(1, stormIsleExitTime);
|
if (!player.isInTimedHuntingZone(holder.getZoneId()))
|
||||||
}
|
|
||||||
else if ((primevalIsleExitTime > 0) && player.isInTimedHuntingZone(6))
|
|
||||||
{
|
{
|
||||||
player.startTimedHuntingZone(6, primevalIsleExitTime);
|
continue;
|
||||||
}
|
}
|
||||||
else if ((goldenAltarExitTime > 0) && player.isInTimedHuntingZone(7))
|
|
||||||
|
final int remainingTime = player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||||
|
if (remainingTime > 0)
|
||||||
{
|
{
|
||||||
player.startTimedHuntingZone(7, goldenAltarExitTime);
|
player.startTimedHuntingZone(holder.getZoneId(), remainingTime);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if ((coalMinesExitTime > 0) && player.isInTimedHuntingZone(11))
|
break;
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(11, coalMinesExitTime);
|
|
||||||
}
|
}
|
||||||
else if ((toiExitTime > 0) && player.isInTimedHuntingZone(8))
|
|
||||||
{
|
if (!player.isGM())
|
||||||
player.startTimedHuntingZone(8, toiExitTime);
|
|
||||||
}
|
|
||||||
else if ((imperialTombExitTime > 0) && player.isInTimedHuntingZone(12))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(12, imperialTombExitTime);
|
|
||||||
}
|
|
||||||
else if (!player.isGM())
|
|
||||||
{
|
{
|
||||||
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -86,6 +86,8 @@ import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExHomunculusIns
|
|||||||
import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExHomunculusSummon;
|
import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExHomunculusSummon;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExRequestHomonculusList;
|
import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExRequestHomonculusList;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExRequestHomunculusActivate;
|
import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExRequestHomunculusActivate;
|
||||||
|
import org.l2jmobius.gameserver.network.clientpackets.huntingzones.ExTimedHuntingZoneEnter;
|
||||||
|
import org.l2jmobius.gameserver.network.clientpackets.huntingzones.ExTimedHuntingZoneList;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGameStartInfo;
|
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGameStartInfo;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.mentoring.ConfirmMenteeAdd;
|
import org.l2jmobius.gameserver.network.clientpackets.mentoring.ConfirmMenteeAdd;
|
||||||
@@ -121,8 +123,6 @@ import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingChar
|
|||||||
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharRankers;
|
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharRankers;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
|
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
|
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sessionzones.ExTimedHuntingZoneEnter;
|
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sessionzones.ExTimedHuntingZoneList;
|
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
|
||||||
|
|||||||
+25
-55
@@ -14,12 +14,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.clientpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
@@ -85,84 +87,52 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((_zoneId == 1) && (player.getLevel() < 100)) //
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(_zoneId);
|
||||||
|| ((_zoneId == 6) && (player.getLevel() < 105)) //
|
if (holder == null)
|
||||||
|| ((_zoneId == 7) && (player.getLevel() < 107)) //
|
{
|
||||||
|| (((_zoneId == 11) && ((player.getLevel() < 99) || (player.getLevel() > 105)))) //
|
return;
|
||||||
|| (((_zoneId == 12) && ((player.getLevel() < 110) || (player.getLevel() > 130)))) //
|
}
|
||||||
|| (((_zoneId == 13) && ((player.getLevel() < 105) || (player.getLevel() > 130)))) //
|
|
||||||
)
|
if ((player.getLevel() < holder.getMinLevel()) || (player.getLevel() > holder.getMaxLevel()))
|
||||||
{
|
{
|
||||||
player.sendMessage("Your level does not correspond the zone equivalent.");
|
player.sendMessage("Your level does not correspond the zone equivalent.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||||
final long lastEntryTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, 0);
|
final long lastEntryTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, 0);
|
||||||
if ((_zoneId == 8) && ((lastEntryTime + Config.TIME_LIMITED_ZONE_RESET_WEEKLY) < currentTime))
|
if ((lastEntryTime + holder.getResetDelay()) < currentTime)
|
||||||
{
|
{
|
||||||
if (endTime == currentTime)
|
if (endTime == currentTime)
|
||||||
{
|
{
|
||||||
endTime += Config.TIME_LIMITED_ZONE_INITIAL_TIME_WEEKLY;
|
endTime += holder.getInitialTime();
|
||||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, currentTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((lastEntryTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
if (endTime == currentTime)
|
|
||||||
{
|
|
||||||
endTime += Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, currentTime);
|
player.getVariables().set(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, currentTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endTime > currentTime)
|
if (endTime > currentTime)
|
||||||
{
|
{
|
||||||
if (player.getAdena() > Config.TIME_LIMITED_ZONE_TELEPORT_FEE)
|
if (holder.getEntryItemId() == Inventory.ADENA_ID)
|
||||||
{
|
{
|
||||||
player.reduceAdena("TimedHuntingZone", Config.TIME_LIMITED_ZONE_TELEPORT_FEE, player, true);
|
if (player.getAdena() > holder.getEntryFee())
|
||||||
|
{
|
||||||
|
player.reduceAdena("TimedHuntingZone", holder.getEntryFee(), player, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(SystemMessageId.NOT_ENOUGH_ADENA);
|
player.sendPacket(SystemMessageId.NOT_ENOUGH_ADENA);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (!player.destroyItemByItemId("TimedHuntingZone", holder.getEntryItemId(), holder.getEntryFee(), player, true))
|
||||||
|
{
|
||||||
|
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_REQUIRED_ITEMS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
||||||
|
player.teleToLocation(holder.getEnterLocation());
|
||||||
switch (_zoneId)
|
|
||||||
{
|
|
||||||
case 1: // Storm Isle
|
|
||||||
{
|
|
||||||
player.teleToLocation(194291, 176604, -1888);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 6: // Primeval Isle
|
|
||||||
{
|
|
||||||
player.teleToLocation(9400, -21720, -3634);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 7: // Golden Altar
|
|
||||||
{
|
|
||||||
player.teleToLocation(-122259, 73678, -2872);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 11: // Abandoned Coal Mines
|
|
||||||
{
|
|
||||||
player.teleToLocation(139411, -169382, -1600);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 8: // Tower of Insolence
|
|
||||||
{
|
|
||||||
player.teleToLocation(-82014, 16247, -15416);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 12: // Imperial Tomb
|
|
||||||
{
|
|
||||||
player.teleToLocation(181409, -78389, -2728);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
+2
-2
@@ -14,13 +14,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.clientpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneList;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.serverpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.serverpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
+73
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* 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.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneList implements IClientOutgoingPacket
|
||||||
|
{
|
||||||
|
private final PlayerInstance _player;
|
||||||
|
private final boolean _isInTimedHuntingZone;
|
||||||
|
|
||||||
|
public TimedHuntingZoneList(PlayerInstance player)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_isInTimedHuntingZone = player.isInsideZone(ZoneId.TIMED_HUNTING);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean write(PacketWriter packet)
|
||||||
|
{
|
||||||
|
OutgoingPackets.EX_TIME_RESTRICT_FIELD_LIST.writeId(packet);
|
||||||
|
int remainingTime;
|
||||||
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
|
packet.writeD(TimedHuntingZoneData.getInstance().getSize()); // zone count
|
||||||
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
|
{
|
||||||
|
packet.writeD(holder.getEntryFee() == 0 ? 0 : 1); // required item count
|
||||||
|
packet.writeD(holder.getEntryItemId());
|
||||||
|
packet.writeQ(holder.getEntryFee());
|
||||||
|
packet.writeD(holder.isWeekly() ? 0 : 1); // reset cycle
|
||||||
|
packet.writeD(holder.getZoneId());
|
||||||
|
packet.writeD(holder.getMinLevel());
|
||||||
|
packet.writeD(holder.getMaxLevel());
|
||||||
|
packet.writeD(holder.getInitialTime() / 1000); // remain time base
|
||||||
|
remainingTime = _player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||||
|
if ((remainingTime == 0) && ((_player.getTimedHuntingZoneInitialEntry(1) + holder.getResetDelay()) < currentTime))
|
||||||
|
{
|
||||||
|
remainingTime = holder.getInitialTime();
|
||||||
|
}
|
||||||
|
packet.writeD(remainingTime / 1000); // remain time
|
||||||
|
packet.writeD(holder.getMaximumAddedTime() / 1000);
|
||||||
|
packet.writeD(holder.getRemainRefillTime());
|
||||||
|
packet.writeD(holder.getRefillTimeMax());
|
||||||
|
packet.writeD(!_isInTimedHuntingZone || _player.isInTimedHuntingZone(holder.getZoneId()) ? 1 : 0); // field activated (272 C to D)
|
||||||
|
packet.writeH(0); // 245
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
-202
@@ -1,202 +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.sessionzones;
|
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Mobius
|
|
||||||
*/
|
|
||||||
public class TimedHuntingZoneList implements IClientOutgoingPacket
|
|
||||||
{
|
|
||||||
private final PlayerInstance _player;
|
|
||||||
private final boolean _isInTimedHuntingZone;
|
|
||||||
|
|
||||||
public TimedHuntingZoneList(PlayerInstance player)
|
|
||||||
{
|
|
||||||
_player = player;
|
|
||||||
_isInTimedHuntingZone = player.isInsideZone(ZoneId.TIMED_HUNTING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean write(PacketWriter packet)
|
|
||||||
{
|
|
||||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_LIST.writeId(packet);
|
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
|
||||||
long endTime;
|
|
||||||
packet.writeD(6); // zone count
|
|
||||||
|
|
||||||
// Storm Isle
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(1); // zone id
|
|
||||||
packet.writeD(100); // min level
|
|
||||||
packet.writeD(120); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(1);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
packet.writeD(3600); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0); // 245
|
|
||||||
|
|
||||||
// Primeval Isle
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(6); // zone id
|
|
||||||
packet.writeD(105); // min level
|
|
||||||
packet.writeD(120); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(6);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
packet.writeD(3600); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0); // 245
|
|
||||||
|
|
||||||
// Golden Altar
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(7); // zone id
|
|
||||||
packet.writeD(107); // min level
|
|
||||||
packet.writeD(120); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(7);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
packet.writeD(3600); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0); // 245
|
|
||||||
|
|
||||||
// Abandoned Coal Mines
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(11); // zone id
|
|
||||||
packet.writeD(99); // min level
|
|
||||||
packet.writeD(105); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(11);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
packet.writeD(3600); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0); // 245
|
|
||||||
|
|
||||||
// Tower of Insolence
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(0); // reset cycle
|
|
||||||
packet.writeD(8); // zone id
|
|
||||||
packet.writeD(110); // min level
|
|
||||||
packet.writeD(130); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME_WEEKLY / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(8);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_WEEKLY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME_WEEKLY;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME_WEEKLY / 1000));
|
|
||||||
packet.writeD(3600); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0); // 245
|
|
||||||
|
|
||||||
// Imperial Tomb
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(12); // zone id
|
|
||||||
packet.writeD(105); // min level
|
|
||||||
packet.writeD(130); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(12);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
packet.writeD(3600); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0); // 245
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
# ---------------------------------------------------------------------------
|
|
||||||
# Time Limited Zones
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Initial free time.
|
|
||||||
# Default: 3600000 (1 hour)
|
|
||||||
InitialTime = 3600000
|
|
||||||
|
|
||||||
# Initial free time.
|
|
||||||
# Default: 36000000 (10 hour)
|
|
||||||
InitialTimeWeekly = 36000000
|
|
||||||
|
|
||||||
# Maximum added time.
|
|
||||||
# Default: 18000000 (6 hours)
|
|
||||||
MaximumAddedTime = 21600000
|
|
||||||
|
|
||||||
# Maximum added time Weekly.
|
|
||||||
# Default: 43200000 (12 hours)
|
|
||||||
MaximumAddedTimeWeekly = 43200000
|
|
||||||
|
|
||||||
# Reset delay.
|
|
||||||
# Default: 36000000 (10 hours)
|
|
||||||
ResetDelay = 36000000
|
|
||||||
|
|
||||||
# Reset Weekly.
|
|
||||||
# Default: 604800000 (7 Days)
|
|
||||||
ResetWeekly = 604800000
|
|
||||||
|
|
||||||
# Teleport fee.
|
|
||||||
# Default: 150000
|
|
||||||
TeleportFee = 150000
|
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
<?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>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>21600000</maxAddedTime> <!-- 6 hours -->
|
||||||
|
<remainRefillTime>43200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>150000</entryFee>
|
||||||
|
<minLevel>100</minLevel>
|
||||||
|
<maxLevel>120</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="6" name="Primeval Isle">
|
||||||
|
<enterLocation>9400,-21720,-3634</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>21600000</maxAddedTime> <!-- 6 hours -->
|
||||||
|
<remainRefillTime>43200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>150000</entryFee>
|
||||||
|
<minLevel>105</minLevel>
|
||||||
|
<maxLevel>120</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="7" name="Golden Altar">
|
||||||
|
<enterLocation>-122259,73678,-2872</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>21600000</maxAddedTime> <!-- 6 hours -->
|
||||||
|
<remainRefillTime>43200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>150000</entryFee>
|
||||||
|
<minLevel>107</minLevel>
|
||||||
|
<maxLevel>120</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="11" name="Abandoned Coal Mines">
|
||||||
|
<enterLocation>139411,-169382,-1600</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>21600000</maxAddedTime> <!-- 6 hours -->
|
||||||
|
<remainRefillTime>43200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>150000</entryFee>
|
||||||
|
<minLevel>99</minLevel>
|
||||||
|
<maxLevel>105</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="8" name="Tower of Insolence">
|
||||||
|
<enterLocation>-82014,16247,-15416</enterLocation>
|
||||||
|
<initialTime>36000000</initialTime> <!-- 10 hours -->
|
||||||
|
<resetDelay>604800000</resetDelay> <!-- 7 days -->
|
||||||
|
<maxAddedTime>43200000</maxAddedTime> <!-- 12 hours -->
|
||||||
|
<remainRefillTime>43200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>150000</entryFee>
|
||||||
|
<minLevel>110</minLevel>
|
||||||
|
<maxLevel>130</maxLevel>
|
||||||
|
<weekly>true</weekly>
|
||||||
|
</zone>
|
||||||
|
<zone id="12" name="Imperial Tomb">
|
||||||
|
<enterLocation>181409,-78389,-2728</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>21600000</maxAddedTime> <!-- 6 hours -->
|
||||||
|
<remainRefillTime>43200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>150000</entryFee>
|
||||||
|
<minLevel>105</minLevel>
|
||||||
|
<maxLevel>130</maxLevel>
|
||||||
|
</zone>
|
||||||
|
</list>
|
||||||
+11
-14
@@ -16,16 +16,17 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.effecthandlers;
|
package handlers.effecthandlers;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneList;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
@@ -56,15 +57,15 @@ public class AddHuntingTime extends AbstractEffect
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(_zoneId);
|
||||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
if (holder == null)
|
||||||
if ((_zoneId == 8) && (endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_TIME_WEEKLY))
|
|
||||||
{
|
{
|
||||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_TIME))
|
|
||||||
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
|
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);
|
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
player.sendMessage("You cannot exceed the time zone limit.");
|
||||||
@@ -78,13 +79,9 @@ public class AddHuntingTime extends AbstractEffect
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((_zoneId == 8) && ((endTime + Config.TIME_LIMITED_ZONE_RESET_WEEKLY) < currentTime))
|
if ((endTime + holder.getResetDelay()) < currentTime)
|
||||||
{
|
{
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME_WEEKLY;
|
endTime = currentTime + holder.getInitialTime();
|
||||||
}
|
|
||||||
else if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
}
|
||||||
else if (endTime < currentTime)
|
else if (endTime < currentTime)
|
||||||
{
|
{
|
||||||
|
|||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<xs:element name="list">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="zone" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element type="xs:string" name="enterLocation" />
|
||||||
|
<xs:element type="xs:int" name="initialTime" />
|
||||||
|
<xs:element type="xs:int" name="resetDelay" />
|
||||||
|
<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" />
|
||||||
|
<xs:element type="xs:short" name="minLevel" />
|
||||||
|
<xs:element type="xs:short" name="maxLevel" />
|
||||||
|
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||||
|
<xs:attribute type="xs:string" name="name" use="optional" />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:boolean" name="enabled" />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -104,7 +104,6 @@ public class Config
|
|||||||
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
||||||
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||||
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
||||||
private static final String TIME_LIMITED_ZONE_CONFIG_FILE = "./config/TimeLimitedZones.ini";
|
|
||||||
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
||||||
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||||
private static final String HEXID_FILE = "./config/hexid.txt";
|
private static final String HEXID_FILE = "./config/hexid.txt";
|
||||||
@@ -836,13 +835,6 @@ public class Config
|
|||||||
public static String TELNET_HOSTNAME;
|
public static String TELNET_HOSTNAME;
|
||||||
public static List<String> TELNET_HOSTS;
|
public static List<String> TELNET_HOSTS;
|
||||||
public static int TELNET_PORT;
|
public static int TELNET_PORT;
|
||||||
public static long TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
public static long TIME_LIMITED_ZONE_INITIAL_TIME_WEEKLY;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_TIME;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_TIME_WEEKLY;
|
|
||||||
public static long TIME_LIMITED_ZONE_RESET_DELAY;
|
|
||||||
public static long TIME_LIMITED_ZONE_RESET_WEEKLY;
|
|
||||||
public static long TIME_LIMITED_ZONE_TELEPORT_FEE;
|
|
||||||
public static boolean TRAINING_CAMP_ENABLE;
|
public static boolean TRAINING_CAMP_ENABLE;
|
||||||
public static boolean TRAINING_CAMP_PREMIUM_ONLY;
|
public static boolean TRAINING_CAMP_PREMIUM_ONLY;
|
||||||
public static int TRAINING_CAMP_MAX_DURATION;
|
public static int TRAINING_CAMP_MAX_DURATION;
|
||||||
@@ -1988,16 +1980,6 @@ public class Config
|
|||||||
TELNET_PASSWORD = telnetSettings.getString("Password", "");
|
TELNET_PASSWORD = telnetSettings.getString("Password", "");
|
||||||
TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(","));
|
TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(","));
|
||||||
|
|
||||||
// Load Time Limited Zone config file (if exists)
|
|
||||||
final PropertiesParser timeLimitedZoneSettings = new PropertiesParser(TIME_LIMITED_ZONE_CONFIG_FILE);
|
|
||||||
TIME_LIMITED_ZONE_INITIAL_TIME = timeLimitedZoneSettings.getLong("InitialTime", 3600000);
|
|
||||||
TIME_LIMITED_ZONE_INITIAL_TIME_WEEKLY = timeLimitedZoneSettings.getLong("InitialTimeWeekly", 36000000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_TIME = timeLimitedZoneSettings.getLong("MaximumAddedTime", 21600000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_TIME_WEEKLY = timeLimitedZoneSettings.getLong("MaximumAddedTimeWeekly", 43200000);
|
|
||||||
TIME_LIMITED_ZONE_RESET_DELAY = timeLimitedZoneSettings.getLong("ResetDelay", 36000000);
|
|
||||||
TIME_LIMITED_ZONE_RESET_WEEKLY = timeLimitedZoneSettings.getLong("ResetWeekly", 604800000);
|
|
||||||
TIME_LIMITED_ZONE_TELEPORT_FEE = timeLimitedZoneSettings.getLong("TeleportFee", 150000);
|
|
||||||
|
|
||||||
// Load Training Camp config file (if exists)
|
// Load Training Camp config file (if exists)
|
||||||
final PropertiesParser trainingCampSettings = new PropertiesParser(TRAINING_CAMP_CONFIG_FILE);
|
final PropertiesParser trainingCampSettings = new PropertiesParser(TRAINING_CAMP_CONFIG_FILE);
|
||||||
TRAINING_CAMP_ENABLE = trainingCampSettings.getBoolean("TrainingCampEnable", false);
|
TRAINING_CAMP_ENABLE = trainingCampSettings.getBoolean("TrainingCampEnable", false);
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ import org.l2jmobius.gameserver.data.xml.SpawnData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.StaticObjectData;
|
import org.l2jmobius.gameserver.data.xml.StaticObjectData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TeleportListData;
|
import org.l2jmobius.gameserver.data.xml.TeleportListData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TeleporterData;
|
import org.l2jmobius.gameserver.data.xml.TeleporterData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TransformData;
|
import org.l2jmobius.gameserver.data.xml.TransformData;
|
||||||
import org.l2jmobius.gameserver.data.xml.VariationData;
|
import org.l2jmobius.gameserver.data.xml.VariationData;
|
||||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
@@ -349,6 +350,7 @@ public class GameServer
|
|||||||
CrestTable.getInstance();
|
CrestTable.getInstance();
|
||||||
TeleportListData.getInstance();
|
TeleportListData.getInstance();
|
||||||
TeleporterData.getInstance();
|
TeleporterData.getInstance();
|
||||||
|
TimedHuntingZoneData.getInstance();
|
||||||
MatchingRoomManager.getInstance();
|
MatchingRoomManager.getInstance();
|
||||||
PetitionManager.getInstance();
|
PetitionManager.getInstance();
|
||||||
CursedWeaponsManager.getInstance();
|
CursedWeaponsManager.getInstance();
|
||||||
|
|||||||
+186
@@ -0,0 +1,186 @@
|
|||||||
|
/*
|
||||||
|
* 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.data.xml;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.NamedNodeMap;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
|
import org.l2jmobius.commons.util.IXmlReader;
|
||||||
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneData implements IXmlReader
|
||||||
|
{
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(TimedHuntingZoneData.class.getName());
|
||||||
|
|
||||||
|
private final Map<Integer, TimedHuntingZoneHolder> _timedHuntingZoneData = new HashMap<>();
|
||||||
|
|
||||||
|
protected TimedHuntingZoneData()
|
||||||
|
{
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load()
|
||||||
|
{
|
||||||
|
_timedHuntingZoneData.clear();
|
||||||
|
parseDatapackFile("data/TimedHuntingZoneData.xml");
|
||||||
|
|
||||||
|
if (!_timedHuntingZoneData.isEmpty())
|
||||||
|
{
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _timedHuntingZoneData.size() + " timed hunting zones.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": System is disabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void parseDocument(Document doc, File f)
|
||||||
|
{
|
||||||
|
for (Node xmlNode = doc.getFirstChild(); xmlNode != null; xmlNode = xmlNode.getNextSibling())
|
||||||
|
{
|
||||||
|
if ("list".equalsIgnoreCase(xmlNode.getNodeName()))
|
||||||
|
{
|
||||||
|
final NamedNodeMap listAttributes = xmlNode.getAttributes();
|
||||||
|
final Node attribute = listAttributes.getNamedItem("enabled");
|
||||||
|
if ((attribute != null) && Boolean.parseBoolean(attribute.getNodeValue()))
|
||||||
|
{
|
||||||
|
for (Node listNode = xmlNode.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
|
||||||
|
{
|
||||||
|
if ("zone".equalsIgnoreCase(listNode.getNodeName()))
|
||||||
|
{
|
||||||
|
final NamedNodeMap zoneAttributes = listNode.getAttributes();
|
||||||
|
int id = parseInteger(zoneAttributes, "id");
|
||||||
|
String name = parseString(zoneAttributes, "name", "");
|
||||||
|
int initialTime = 0;
|
||||||
|
int maxAddedTime = 0;
|
||||||
|
int resetDelay = 0;
|
||||||
|
int entryItemId = 57;
|
||||||
|
int entryFee = 150000;
|
||||||
|
int minLevel = 1;
|
||||||
|
int maxLevel = 999;
|
||||||
|
int remainRefillTime = 3600;
|
||||||
|
int refillTimeMax = 3600;
|
||||||
|
boolean weekly = false;
|
||||||
|
Location enterLocation = null;
|
||||||
|
for (Node zoneNode = listNode.getFirstChild(); zoneNode != null; zoneNode = zoneNode.getNextSibling())
|
||||||
|
{
|
||||||
|
switch (zoneNode.getNodeName())
|
||||||
|
{
|
||||||
|
case "enterLocation":
|
||||||
|
{
|
||||||
|
final String[] coordinates = zoneNode.getTextContent().split(",");
|
||||||
|
enterLocation = new Location(Integer.parseInt(coordinates[0]), Integer.parseInt(coordinates[1]), Integer.parseInt(coordinates[2]));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "initialTime":
|
||||||
|
{
|
||||||
|
initialTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "maxAddedTime":
|
||||||
|
{
|
||||||
|
maxAddedTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "resetDelay":
|
||||||
|
{
|
||||||
|
resetDelay = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "entryItemId":
|
||||||
|
{
|
||||||
|
entryItemId = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "entryFee":
|
||||||
|
{
|
||||||
|
entryFee = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "minLevel":
|
||||||
|
{
|
||||||
|
minLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "maxLevel":
|
||||||
|
{
|
||||||
|
maxLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "remainRefillTime":
|
||||||
|
{
|
||||||
|
remainRefillTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "refillTimeMax":
|
||||||
|
{
|
||||||
|
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "weekly":
|
||||||
|
{
|
||||||
|
weekly = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, weekly, enterLocation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimedHuntingZoneHolder getHuntingZone(int zoneId)
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.get(zoneId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<TimedHuntingZoneHolder> getAllHuntingZones()
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSize()
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TimedHuntingZoneData getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final TimedHuntingZoneData INSTANCE = new TimedHuntingZoneData();
|
||||||
|
}
|
||||||
|
}
|
||||||
+18
-33
@@ -82,6 +82,7 @@ import org.l2jmobius.gameserver.data.xml.SendMessageLocalisationData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillTreeData;
|
import org.l2jmobius.gameserver.data.xml.SkillTreeData;
|
||||||
import org.l2jmobius.gameserver.data.xml.SymbolSealData;
|
import org.l2jmobius.gameserver.data.xml.SymbolSealData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.enums.AdminTeleportType;
|
import org.l2jmobius.gameserver.enums.AdminTeleportType;
|
||||||
import org.l2jmobius.gameserver.enums.BroochJewel;
|
import org.l2jmobius.gameserver.enums.BroochJewel;
|
||||||
import org.l2jmobius.gameserver.enums.CastleSide;
|
import org.l2jmobius.gameserver.enums.CastleSide;
|
||||||
@@ -229,6 +230,7 @@ import org.l2jmobius.gameserver.model.holders.RecipeHolder;
|
|||||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SkillUseHolder;
|
import org.l2jmobius.gameserver.model.holders.SkillUseHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.TrainingHolder;
|
import org.l2jmobius.gameserver.model.holders.TrainingHolder;
|
||||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||||
import org.l2jmobius.gameserver.model.interfaces.ILocational;
|
import org.l2jmobius.gameserver.model.interfaces.ILocational;
|
||||||
@@ -14324,16 +14326,6 @@ public class PlayerInstance extends Playable
|
|||||||
return _autoUseSettings;
|
return _autoUseSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int x, int y)
|
|
||||||
{
|
|
||||||
return isInTimedHuntingZone(1, x, y) // Storm Isle
|
|
||||||
|| isInTimedHuntingZone(6, x, y) // Primeval Isle
|
|
||||||
|| isInTimedHuntingZone(7, x, y) // Golden Altar
|
|
||||||
|| isInTimedHuntingZone(11, x, y) // Abandoned Coal Mines
|
|
||||||
|| isInTimedHuntingZone(8, x, y) // Tower of Insolence
|
|
||||||
|| isInTimedHuntingZone(12, x, y); // Imperial Tomb
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId)
|
public boolean isInTimedHuntingZone(int zoneId)
|
||||||
{
|
{
|
||||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||||
@@ -14341,33 +14333,21 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||||
{
|
{
|
||||||
final int x = ((locX - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||||
final int y = ((locY - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
if (holder == null)
|
||||||
switch (zoneId)
|
|
||||||
{
|
{
|
||||||
case 1: // Storm Isle
|
return false;
|
||||||
{
|
|
||||||
return (x == 25) && (y == 23);
|
|
||||||
}
|
}
|
||||||
case 6: // Primeval Isle
|
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 (x == 20) && (y == 17);
|
|
||||||
}
|
}
|
||||||
case 7: // Golden Altar
|
|
||||||
|
public boolean isInTimedHuntingZone(int x, int y)
|
||||||
{
|
{
|
||||||
return (x == 16) && (y == 20);
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
}
|
|
||||||
case 11: // Abandoned Coal Mines
|
|
||||||
{
|
{
|
||||||
return (x == 24) && (y == 12);
|
if (isInTimedHuntingZone(holder.getZoneId(), x, y))
|
||||||
}
|
|
||||||
case 8: // Tower of Insolence
|
|
||||||
{
|
{
|
||||||
return (x == 17) && (y == 18);
|
return true;
|
||||||
}
|
|
||||||
case 12: // Imperial Tomb
|
|
||||||
{
|
|
||||||
return (x == 25) && (y == 15);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -14411,9 +14391,14 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTimedHuntingZoneRemainingTime(int zoneId)
|
public int getTimedHuntingZoneRemainingTime(int zoneId)
|
||||||
{
|
{
|
||||||
return Math.max(getVariables().getLong(PlayerVariables.HUNTING_ZONE_TIME + zoneId, 0), 0);
|
return Math.max(getVariables().getInt(PlayerVariables.HUNTING_ZONE_TIME + zoneId, 0), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTimedHuntingZoneInitialEntry(int zoneId)
|
||||||
|
{
|
||||||
|
return Math.max(getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + zoneId, 0), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHomunculusHpBonus()
|
public int getHomunculusHpBonus()
|
||||||
|
|||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.l2jmobius.gameserver.model.holders;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
|
import org.l2jmobius.gameserver.model.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneHolder
|
||||||
|
{
|
||||||
|
private final int _id;
|
||||||
|
private final String _name;
|
||||||
|
private final int _initialTime;
|
||||||
|
private final int _maximumAddedTime;
|
||||||
|
private final int _resetDelay;
|
||||||
|
private final int _entryItemId;
|
||||||
|
private final int _entryFee;
|
||||||
|
private final int _minLevel;
|
||||||
|
private final int _maxLevel;
|
||||||
|
private final int _remainRefillTime;
|
||||||
|
private final int _refillTimeMax;
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
_id = id;
|
||||||
|
_name = name;
|
||||||
|
_initialTime = initialTime;
|
||||||
|
_maximumAddedTime = maximumAddedTime;
|
||||||
|
_resetDelay = resetDelay;
|
||||||
|
_entryItemId = entryItemId;
|
||||||
|
_entryFee = entryFee;
|
||||||
|
_minLevel = minLevel;
|
||||||
|
_maxLevel = maxLevel;
|
||||||
|
_remainRefillTime = remainRefillTime;
|
||||||
|
_refillTimeMax = refillTimeMax;
|
||||||
|
_weekly = weekly;
|
||||||
|
_enterLocation = enterLocation;
|
||||||
|
_mapX = ((_enterLocation.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
||||||
|
_mapY = ((_enterLocation.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZoneId()
|
||||||
|
{
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZoneName()
|
||||||
|
{
|
||||||
|
return _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInitialTime()
|
||||||
|
{
|
||||||
|
return _initialTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaximumAddedTime()
|
||||||
|
{
|
||||||
|
return _maximumAddedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getResetDelay()
|
||||||
|
{
|
||||||
|
return _resetDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEntryItemId()
|
||||||
|
{
|
||||||
|
return _entryItemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEntryFee()
|
||||||
|
{
|
||||||
|
return _entryFee;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinLevel()
|
||||||
|
{
|
||||||
|
return _minLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxLevel()
|
||||||
|
{
|
||||||
|
return _maxLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRemainRefillTime()
|
||||||
|
{
|
||||||
|
return _remainRefillTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRefillTimeMax()
|
||||||
|
{
|
||||||
|
return _refillTimeMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWeekly()
|
||||||
|
{
|
||||||
|
return _weekly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getEnterLocation()
|
||||||
|
{
|
||||||
|
return _enterLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMapX()
|
||||||
|
{
|
||||||
|
return _mapX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMapY()
|
||||||
|
{
|
||||||
|
return _mapY;
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
-26
@@ -16,13 +16,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.zone.type;
|
package org.l2jmobius.gameserver.model.zone.type;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||||
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneExit;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneExit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
@@ -42,37 +44,23 @@ public class TimedHuntingZone extends ZoneType
|
|||||||
{
|
{
|
||||||
player.setInsideZone(ZoneId.TIMED_HUNTING, true);
|
player.setInsideZone(ZoneId.TIMED_HUNTING, true);
|
||||||
|
|
||||||
final long stormIsleExitTime = player.getTimedHuntingZoneRemainingTime(1);
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
final long primevalIsleExitTime = player.getTimedHuntingZoneRemainingTime(6);
|
|
||||||
final long goldenAltarExitTime = player.getTimedHuntingZoneRemainingTime(7);
|
|
||||||
final long coalMinesExitTime = player.getTimedHuntingZoneRemainingTime(11);
|
|
||||||
final long toiExitTime = player.getTimedHuntingZoneRemainingTime(8);
|
|
||||||
final long imperialTombExitTime = player.getTimedHuntingZoneRemainingTime(12);
|
|
||||||
if ((stormIsleExitTime > 0) && player.isInTimedHuntingZone(1))
|
|
||||||
{
|
{
|
||||||
player.startTimedHuntingZone(1, stormIsleExitTime);
|
if (!player.isInTimedHuntingZone(holder.getZoneId()))
|
||||||
}
|
|
||||||
else if ((primevalIsleExitTime > 0) && player.isInTimedHuntingZone(6))
|
|
||||||
{
|
{
|
||||||
player.startTimedHuntingZone(6, primevalIsleExitTime);
|
continue;
|
||||||
}
|
}
|
||||||
else if ((goldenAltarExitTime > 0) && player.isInTimedHuntingZone(7))
|
|
||||||
|
final int remainingTime = player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||||
|
if (remainingTime > 0)
|
||||||
{
|
{
|
||||||
player.startTimedHuntingZone(7, goldenAltarExitTime);
|
player.startTimedHuntingZone(holder.getZoneId(), remainingTime);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if ((coalMinesExitTime > 0) && player.isInTimedHuntingZone(11))
|
break;
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(11, coalMinesExitTime);
|
|
||||||
}
|
}
|
||||||
else if ((toiExitTime > 0) && player.isInTimedHuntingZone(8))
|
|
||||||
{
|
if (!player.isGM())
|
||||||
player.startTimedHuntingZone(8, toiExitTime);
|
|
||||||
}
|
|
||||||
else if ((imperialTombExitTime > 0) && player.isInTimedHuntingZone(12))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(12, imperialTombExitTime);
|
|
||||||
}
|
|
||||||
else if (!player.isGM())
|
|
||||||
{
|
{
|
||||||
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -86,6 +86,8 @@ import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExHomunculusIns
|
|||||||
import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExHomunculusSummon;
|
import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExHomunculusSummon;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExRequestHomonculusList;
|
import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExRequestHomonculusList;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExRequestHomunculusActivate;
|
import org.l2jmobius.gameserver.network.clientpackets.homunculus.ExRequestHomunculusActivate;
|
||||||
|
import org.l2jmobius.gameserver.network.clientpackets.huntingzones.ExTimedHuntingZoneEnter;
|
||||||
|
import org.l2jmobius.gameserver.network.clientpackets.huntingzones.ExTimedHuntingZoneList;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGameStartInfo;
|
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGameStartInfo;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.mentoring.ConfirmMenteeAdd;
|
import org.l2jmobius.gameserver.network.clientpackets.mentoring.ConfirmMenteeAdd;
|
||||||
@@ -121,8 +123,6 @@ import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingChar
|
|||||||
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharRankers;
|
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharRankers;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
|
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
|
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sessionzones.ExTimedHuntingZoneEnter;
|
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sessionzones.ExTimedHuntingZoneList;
|
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
|
||||||
|
|||||||
+25
-55
@@ -14,12 +14,14 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.clientpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
@@ -85,84 +87,52 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((_zoneId == 1) && (player.getLevel() < 100)) //
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(_zoneId);
|
||||||
|| ((_zoneId == 6) && (player.getLevel() < 105)) //
|
if (holder == null)
|
||||||
|| ((_zoneId == 7) && (player.getLevel() < 107)) //
|
{
|
||||||
|| (((_zoneId == 11) && ((player.getLevel() < 99) || (player.getLevel() > 105)))) //
|
return;
|
||||||
|| (((_zoneId == 12) && ((player.getLevel() < 110) || (player.getLevel() > 130)))) //
|
}
|
||||||
|| (((_zoneId == 13) && ((player.getLevel() < 105) || (player.getLevel() > 130)))) //
|
|
||||||
)
|
if ((player.getLevel() < holder.getMinLevel()) || (player.getLevel() > holder.getMaxLevel()))
|
||||||
{
|
{
|
||||||
player.sendMessage("Your level does not correspond the zone equivalent.");
|
player.sendMessage("Your level does not correspond the zone equivalent.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||||
final long lastEntryTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, 0);
|
final long lastEntryTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, 0);
|
||||||
if ((_zoneId == 8) && ((lastEntryTime + Config.TIME_LIMITED_ZONE_RESET_WEEKLY) < currentTime))
|
if ((lastEntryTime + holder.getResetDelay()) < currentTime)
|
||||||
{
|
{
|
||||||
if (endTime == currentTime)
|
if (endTime == currentTime)
|
||||||
{
|
{
|
||||||
endTime += Config.TIME_LIMITED_ZONE_INITIAL_TIME_WEEKLY;
|
endTime += holder.getInitialTime();
|
||||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, currentTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((lastEntryTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
if (endTime == currentTime)
|
|
||||||
{
|
|
||||||
endTime += Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, currentTime);
|
player.getVariables().set(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, currentTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endTime > currentTime)
|
if (endTime > currentTime)
|
||||||
{
|
{
|
||||||
if (player.getAdena() > Config.TIME_LIMITED_ZONE_TELEPORT_FEE)
|
if (holder.getEntryItemId() == Inventory.ADENA_ID)
|
||||||
{
|
{
|
||||||
player.reduceAdena("TimedHuntingZone", Config.TIME_LIMITED_ZONE_TELEPORT_FEE, player, true);
|
if (player.getAdena() > holder.getEntryFee())
|
||||||
|
{
|
||||||
|
player.reduceAdena("TimedHuntingZone", holder.getEntryFee(), player, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendPacket(SystemMessageId.NOT_ENOUGH_ADENA);
|
player.sendPacket(SystemMessageId.NOT_ENOUGH_ADENA);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (!player.destroyItemByItemId("TimedHuntingZone", holder.getEntryItemId(), holder.getEntryFee(), player, true))
|
||||||
|
{
|
||||||
|
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_REQUIRED_ITEMS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
||||||
|
player.teleToLocation(holder.getEnterLocation());
|
||||||
switch (_zoneId)
|
|
||||||
{
|
|
||||||
case 1: // Storm Isle
|
|
||||||
{
|
|
||||||
player.teleToLocation(194291, 176604, -1888);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 6: // Primeval Isle
|
|
||||||
{
|
|
||||||
player.teleToLocation(9400, -21720, -3634);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 7: // Golden Altar
|
|
||||||
{
|
|
||||||
player.teleToLocation(-122259, 73678, -2872);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 11: // Abandoned Coal Mines
|
|
||||||
{
|
|
||||||
player.teleToLocation(139411, -169382, -1600);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 8: // Tower of Insolence
|
|
||||||
{
|
|
||||||
player.teleToLocation(-82014, 16247, -15416);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 12: // Imperial Tomb
|
|
||||||
{
|
|
||||||
player.teleToLocation(181409, -78389, -2728);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
+2
-2
@@ -14,13 +14,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.clientpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneList;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.serverpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.serverpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
+73
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* 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.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneList implements IClientOutgoingPacket
|
||||||
|
{
|
||||||
|
private final PlayerInstance _player;
|
||||||
|
private final boolean _isInTimedHuntingZone;
|
||||||
|
|
||||||
|
public TimedHuntingZoneList(PlayerInstance player)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_isInTimedHuntingZone = player.isInsideZone(ZoneId.TIMED_HUNTING);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean write(PacketWriter packet)
|
||||||
|
{
|
||||||
|
OutgoingPackets.EX_TIME_RESTRICT_FIELD_LIST.writeId(packet);
|
||||||
|
int remainingTime;
|
||||||
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
|
packet.writeD(TimedHuntingZoneData.getInstance().getSize()); // zone count
|
||||||
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
|
{
|
||||||
|
packet.writeD(holder.getEntryFee() == 0 ? 0 : 1); // required item count
|
||||||
|
packet.writeD(holder.getEntryItemId());
|
||||||
|
packet.writeQ(holder.getEntryFee());
|
||||||
|
packet.writeD(holder.isWeekly() ? 0 : 1); // reset cycle
|
||||||
|
packet.writeD(holder.getZoneId());
|
||||||
|
packet.writeD(holder.getMinLevel());
|
||||||
|
packet.writeD(holder.getMaxLevel());
|
||||||
|
packet.writeD(holder.getInitialTime() / 1000); // remain time base
|
||||||
|
remainingTime = _player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||||
|
if ((remainingTime == 0) && ((_player.getTimedHuntingZoneInitialEntry(1) + holder.getResetDelay()) < currentTime))
|
||||||
|
{
|
||||||
|
remainingTime = holder.getInitialTime();
|
||||||
|
}
|
||||||
|
packet.writeD(remainingTime / 1000); // remain time
|
||||||
|
packet.writeD(holder.getMaximumAddedTime() / 1000);
|
||||||
|
packet.writeD(holder.getRemainRefillTime());
|
||||||
|
packet.writeD(holder.getRefillTimeMax());
|
||||||
|
packet.writeD(!_isInTimedHuntingZone || _player.isInTimedHuntingZone(holder.getZoneId()) ? 1 : 0); // field activated (272 C to D)
|
||||||
|
packet.writeH(0); // 245
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
-202
@@ -1,202 +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.sessionzones;
|
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Mobius
|
|
||||||
*/
|
|
||||||
public class TimedHuntingZoneList implements IClientOutgoingPacket
|
|
||||||
{
|
|
||||||
private final PlayerInstance _player;
|
|
||||||
private final boolean _isInTimedHuntingZone;
|
|
||||||
|
|
||||||
public TimedHuntingZoneList(PlayerInstance player)
|
|
||||||
{
|
|
||||||
_player = player;
|
|
||||||
_isInTimedHuntingZone = player.isInsideZone(ZoneId.TIMED_HUNTING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean write(PacketWriter packet)
|
|
||||||
{
|
|
||||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_LIST.writeId(packet);
|
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
|
||||||
long endTime;
|
|
||||||
packet.writeD(6); // zone count
|
|
||||||
|
|
||||||
// Storm Isle
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(1); // zone id
|
|
||||||
packet.writeD(100); // min level
|
|
||||||
packet.writeD(120); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(1);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
packet.writeD(3600); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0); // 245
|
|
||||||
|
|
||||||
// Primeval Isle
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(6); // zone id
|
|
||||||
packet.writeD(105); // min level
|
|
||||||
packet.writeD(120); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(6);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
packet.writeD(3600); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0); // 245
|
|
||||||
|
|
||||||
// Golden Altar
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(7); // zone id
|
|
||||||
packet.writeD(107); // min level
|
|
||||||
packet.writeD(120); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(7);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
packet.writeD(3600); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0); // 245
|
|
||||||
|
|
||||||
// Abandoned Coal Mines
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(11); // zone id
|
|
||||||
packet.writeD(99); // min level
|
|
||||||
packet.writeD(105); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(11);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
packet.writeD(3600); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0); // 245
|
|
||||||
|
|
||||||
// Tower of Insolence
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(0); // reset cycle
|
|
||||||
packet.writeD(8); // zone id
|
|
||||||
packet.writeD(110); // min level
|
|
||||||
packet.writeD(130); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME_WEEKLY / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(8);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_WEEKLY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME_WEEKLY;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME_WEEKLY / 1000));
|
|
||||||
packet.writeD(3600); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0); // 245
|
|
||||||
|
|
||||||
// Imperial Tomb
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(12); // zone id
|
|
||||||
packet.writeD(105); // min level
|
|
||||||
packet.writeD(130); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(12);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
packet.writeD(3600); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0); // 245
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# ---------------------------------------------------------------------------
|
|
||||||
# Time Limited Zones
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Initial free time.
|
|
||||||
# Default: 3600000 (1 hour)
|
|
||||||
InitialTime = 3600000
|
|
||||||
|
|
||||||
# Maximum added time.
|
|
||||||
# Default: 18000000 (5 hours)
|
|
||||||
MaximumAddedTime = 18000000
|
|
||||||
|
|
||||||
# Reset delay.
|
|
||||||
# Default: 36000000 (10 hours)
|
|
||||||
ResetDelay = 36000000
|
|
||||||
|
|
||||||
# Teleport fee.
|
|
||||||
# Default: 10000
|
|
||||||
TeleportFee = 10000
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?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="2" name="Ancient Pirates' Tomb">
|
||||||
|
<enterLocation>17613,-76862,-6265</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>18000000</maxAddedTime> <!-- 5 hours -->
|
||||||
|
<remainRefillTime>3600</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>78</minLevel>
|
||||||
|
<maxLevel>999</maxLevel>
|
||||||
|
</zone>
|
||||||
|
</list>
|
||||||
Vendored
+12
-5
@@ -16,16 +16,17 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.effecthandlers;
|
package handlers.effecthandlers;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneList;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
@@ -56,9 +57,15 @@ public class AddHuntingTime extends AbstractEffect
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(_zoneId);
|
||||||
|
if (holder == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||||
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_TIME))
|
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= holder.getMaximumAddedTime()))
|
||||||
{
|
{
|
||||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
player.sendMessage("You cannot exceed the time zone limit.");
|
||||||
@@ -72,9 +79,9 @@ public class AddHuntingTime extends AbstractEffect
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
if ((endTime + holder.getResetDelay()) < currentTime)
|
||||||
{
|
{
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
endTime = currentTime + holder.getInitialTime();
|
||||||
}
|
}
|
||||||
else if (endTime < currentTime)
|
else if (endTime < currentTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<xs:element name="list">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="zone" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element type="xs:string" name="enterLocation" />
|
||||||
|
<xs:element type="xs:int" name="initialTime" />
|
||||||
|
<xs:element type="xs:int" name="resetDelay" />
|
||||||
|
<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" />
|
||||||
|
<xs:element type="xs:short" name="minLevel" />
|
||||||
|
<xs:element type="xs:short" name="maxLevel" />
|
||||||
|
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||||
|
<xs:attribute type="xs:string" name="name" use="optional" />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:boolean" name="enabled" />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -103,7 +103,6 @@ public class Config
|
|||||||
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
||||||
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||||
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
||||||
private static final String TIME_LIMITED_ZONE_CONFIG_FILE = "./config/TimeLimitedZones.ini";
|
|
||||||
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
||||||
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||||
private static final String HEXID_FILE = "./config/hexid.txt";
|
private static final String HEXID_FILE = "./config/hexid.txt";
|
||||||
@@ -845,10 +844,6 @@ public class Config
|
|||||||
public static String TELNET_HOSTNAME;
|
public static String TELNET_HOSTNAME;
|
||||||
public static List<String> TELNET_HOSTS;
|
public static List<String> TELNET_HOSTS;
|
||||||
public static int TELNET_PORT;
|
public static int TELNET_PORT;
|
||||||
public static long TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_TIME;
|
|
||||||
public static long TIME_LIMITED_ZONE_RESET_DELAY;
|
|
||||||
public static long TIME_LIMITED_ZONE_TELEPORT_FEE;
|
|
||||||
public static boolean TRAINING_CAMP_ENABLE;
|
public static boolean TRAINING_CAMP_ENABLE;
|
||||||
public static boolean TRAINING_CAMP_PREMIUM_ONLY;
|
public static boolean TRAINING_CAMP_PREMIUM_ONLY;
|
||||||
public static int TRAINING_CAMP_MAX_DURATION;
|
public static int TRAINING_CAMP_MAX_DURATION;
|
||||||
@@ -1892,13 +1887,6 @@ public class Config
|
|||||||
TELNET_PASSWORD = telnetSettings.getString("Password", "");
|
TELNET_PASSWORD = telnetSettings.getString("Password", "");
|
||||||
TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(","));
|
TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(","));
|
||||||
|
|
||||||
// Load Time Limited Zone config file (if exists)
|
|
||||||
final PropertiesParser timeLimitedZoneSettings = new PropertiesParser(TIME_LIMITED_ZONE_CONFIG_FILE);
|
|
||||||
TIME_LIMITED_ZONE_INITIAL_TIME = timeLimitedZoneSettings.getLong("InitialTime", 3600000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_TIME = timeLimitedZoneSettings.getLong("MaximumAddedTime", 18000000);
|
|
||||||
TIME_LIMITED_ZONE_RESET_DELAY = timeLimitedZoneSettings.getLong("ResetDelay", 36000000);
|
|
||||||
TIME_LIMITED_ZONE_TELEPORT_FEE = timeLimitedZoneSettings.getLong("TeleportFee", 10000);
|
|
||||||
|
|
||||||
// Load Training Camp config file (if exists)
|
// Load Training Camp config file (if exists)
|
||||||
final PropertiesParser trainingCampSettings = new PropertiesParser(TRAINING_CAMP_CONFIG_FILE);
|
final PropertiesParser trainingCampSettings = new PropertiesParser(TRAINING_CAMP_CONFIG_FILE);
|
||||||
TRAINING_CAMP_ENABLE = trainingCampSettings.getBoolean("TrainingCampEnable", false);
|
TRAINING_CAMP_ENABLE = trainingCampSettings.getBoolean("TrainingCampEnable", false);
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ import org.l2jmobius.gameserver.data.xml.SpawnData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.StaticObjectData;
|
import org.l2jmobius.gameserver.data.xml.StaticObjectData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TeleportListData;
|
import org.l2jmobius.gameserver.data.xml.TeleportListData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TeleporterData;
|
import org.l2jmobius.gameserver.data.xml.TeleporterData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TransformData;
|
import org.l2jmobius.gameserver.data.xml.TransformData;
|
||||||
import org.l2jmobius.gameserver.data.xml.VariationData;
|
import org.l2jmobius.gameserver.data.xml.VariationData;
|
||||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
@@ -347,6 +348,7 @@ public class GameServer
|
|||||||
CrestTable.getInstance();
|
CrestTable.getInstance();
|
||||||
TeleportListData.getInstance();
|
TeleportListData.getInstance();
|
||||||
TeleporterData.getInstance();
|
TeleporterData.getInstance();
|
||||||
|
TimedHuntingZoneData.getInstance();
|
||||||
MatchingRoomManager.getInstance();
|
MatchingRoomManager.getInstance();
|
||||||
PetitionManager.getInstance();
|
PetitionManager.getInstance();
|
||||||
CursedWeaponsManager.getInstance();
|
CursedWeaponsManager.getInstance();
|
||||||
|
|||||||
+186
@@ -0,0 +1,186 @@
|
|||||||
|
/*
|
||||||
|
* 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.data.xml;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.NamedNodeMap;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
|
import org.l2jmobius.commons.util.IXmlReader;
|
||||||
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneData implements IXmlReader
|
||||||
|
{
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(TimedHuntingZoneData.class.getName());
|
||||||
|
|
||||||
|
private final Map<Integer, TimedHuntingZoneHolder> _timedHuntingZoneData = new HashMap<>();
|
||||||
|
|
||||||
|
protected TimedHuntingZoneData()
|
||||||
|
{
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load()
|
||||||
|
{
|
||||||
|
_timedHuntingZoneData.clear();
|
||||||
|
parseDatapackFile("data/TimedHuntingZoneData.xml");
|
||||||
|
|
||||||
|
if (!_timedHuntingZoneData.isEmpty())
|
||||||
|
{
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _timedHuntingZoneData.size() + " timed hunting zones.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": System is disabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void parseDocument(Document doc, File f)
|
||||||
|
{
|
||||||
|
for (Node xmlNode = doc.getFirstChild(); xmlNode != null; xmlNode = xmlNode.getNextSibling())
|
||||||
|
{
|
||||||
|
if ("list".equalsIgnoreCase(xmlNode.getNodeName()))
|
||||||
|
{
|
||||||
|
final NamedNodeMap listAttributes = xmlNode.getAttributes();
|
||||||
|
final Node attribute = listAttributes.getNamedItem("enabled");
|
||||||
|
if ((attribute != null) && Boolean.parseBoolean(attribute.getNodeValue()))
|
||||||
|
{
|
||||||
|
for (Node listNode = xmlNode.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
|
||||||
|
{
|
||||||
|
if ("zone".equalsIgnoreCase(listNode.getNodeName()))
|
||||||
|
{
|
||||||
|
final NamedNodeMap zoneAttributes = listNode.getAttributes();
|
||||||
|
int id = parseInteger(zoneAttributes, "id");
|
||||||
|
String name = parseString(zoneAttributes, "name", "");
|
||||||
|
int initialTime = 0;
|
||||||
|
int maxAddedTime = 0;
|
||||||
|
int resetDelay = 0;
|
||||||
|
int entryItemId = 57;
|
||||||
|
int entryFee = 10000;
|
||||||
|
int minLevel = 1;
|
||||||
|
int maxLevel = 999;
|
||||||
|
int remainRefillTime = 3600;
|
||||||
|
int refillTimeMax = 3600;
|
||||||
|
boolean weekly = false;
|
||||||
|
Location enterLocation = null;
|
||||||
|
for (Node zoneNode = listNode.getFirstChild(); zoneNode != null; zoneNode = zoneNode.getNextSibling())
|
||||||
|
{
|
||||||
|
switch (zoneNode.getNodeName())
|
||||||
|
{
|
||||||
|
case "enterLocation":
|
||||||
|
{
|
||||||
|
final String[] coordinates = zoneNode.getTextContent().split(",");
|
||||||
|
enterLocation = new Location(Integer.parseInt(coordinates[0]), Integer.parseInt(coordinates[1]), Integer.parseInt(coordinates[2]));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "initialTime":
|
||||||
|
{
|
||||||
|
initialTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "maxAddedTime":
|
||||||
|
{
|
||||||
|
maxAddedTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "resetDelay":
|
||||||
|
{
|
||||||
|
resetDelay = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "entryItemId":
|
||||||
|
{
|
||||||
|
entryItemId = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "entryFee":
|
||||||
|
{
|
||||||
|
entryFee = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "minLevel":
|
||||||
|
{
|
||||||
|
minLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "maxLevel":
|
||||||
|
{
|
||||||
|
maxLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "remainRefillTime":
|
||||||
|
{
|
||||||
|
remainRefillTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "refillTimeMax":
|
||||||
|
{
|
||||||
|
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "weekly":
|
||||||
|
{
|
||||||
|
weekly = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, weekly, enterLocation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimedHuntingZoneHolder getHuntingZone(int zoneId)
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.get(zoneId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<TimedHuntingZoneHolder> getAllHuntingZones()
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSize()
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TimedHuntingZoneData getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final TimedHuntingZoneData INSTANCE = new TimedHuntingZoneData();
|
||||||
|
}
|
||||||
|
}
|
||||||
+21
-12
@@ -83,6 +83,7 @@ import org.l2jmobius.gameserver.data.xml.RecipeData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.SendMessageLocalisationData;
|
import org.l2jmobius.gameserver.data.xml.SendMessageLocalisationData;
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillTreeData;
|
import org.l2jmobius.gameserver.data.xml.SkillTreeData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.enums.AdminTeleportType;
|
import org.l2jmobius.gameserver.enums.AdminTeleportType;
|
||||||
import org.l2jmobius.gameserver.enums.BroochJewel;
|
import org.l2jmobius.gameserver.enums.BroochJewel;
|
||||||
import org.l2jmobius.gameserver.enums.CastleSide;
|
import org.l2jmobius.gameserver.enums.CastleSide;
|
||||||
@@ -232,6 +233,7 @@ import org.l2jmobius.gameserver.model.holders.PreparedMultisellListHolder;
|
|||||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SkillUseHolder;
|
import org.l2jmobius.gameserver.model.holders.SkillUseHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.TrainingHolder;
|
import org.l2jmobius.gameserver.model.holders.TrainingHolder;
|
||||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||||
import org.l2jmobius.gameserver.model.interfaces.ILocational;
|
import org.l2jmobius.gameserver.model.interfaces.ILocational;
|
||||||
@@ -14179,11 +14181,6 @@ public class PlayerInstance extends Playable
|
|||||||
return _autoUseSettings;
|
return _autoUseSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int x, int y)
|
|
||||||
{
|
|
||||||
return isInTimedHuntingZone(2, x, y); // Ancient Pirates' Tomb
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId)
|
public boolean isInTimedHuntingZone(int zoneId)
|
||||||
{
|
{
|
||||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||||
@@ -14191,14 +14188,21 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||||
{
|
{
|
||||||
final int x = ((locX - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||||
final int y = ((locY - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
if (holder == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
switch (zoneId)
|
public boolean isInTimedHuntingZone(int x, int y)
|
||||||
{
|
{
|
||||||
case 2: // Ancient Pirates' Tomb.
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
{
|
{
|
||||||
return (x == 20) && (y == 15);
|
if (isInTimedHuntingZone(holder.getZoneId(), x, y))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -14242,8 +14246,13 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTimedHuntingZoneRemainingTime(int zoneId)
|
public int getTimedHuntingZoneRemainingTime(int zoneId)
|
||||||
{
|
{
|
||||||
return Math.max(getVariables().getLong(PlayerVariables.HUNTING_ZONE_TIME + zoneId, 0), 0);
|
return Math.max(getVariables().getInt(PlayerVariables.HUNTING_ZONE_TIME + zoneId, 0), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTimedHuntingZoneInitialEntry(int zoneId)
|
||||||
|
{
|
||||||
|
return Math.max(getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + zoneId, 0), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.l2jmobius.gameserver.model.holders;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
|
import org.l2jmobius.gameserver.model.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneHolder
|
||||||
|
{
|
||||||
|
private final int _id;
|
||||||
|
private final String _name;
|
||||||
|
private final int _initialTime;
|
||||||
|
private final int _maximumAddedTime;
|
||||||
|
private final int _resetDelay;
|
||||||
|
private final int _entryItemId;
|
||||||
|
private final int _entryFee;
|
||||||
|
private final int _minLevel;
|
||||||
|
private final int _maxLevel;
|
||||||
|
private final int _remainRefillTime;
|
||||||
|
private final int _refillTimeMax;
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
_id = id;
|
||||||
|
_name = name;
|
||||||
|
_initialTime = initialTime;
|
||||||
|
_maximumAddedTime = maximumAddedTime;
|
||||||
|
_resetDelay = resetDelay;
|
||||||
|
_entryItemId = entryItemId;
|
||||||
|
_entryFee = entryFee;
|
||||||
|
_minLevel = minLevel;
|
||||||
|
_maxLevel = maxLevel;
|
||||||
|
_remainRefillTime = remainRefillTime;
|
||||||
|
_refillTimeMax = refillTimeMax;
|
||||||
|
_weekly = weekly;
|
||||||
|
_enterLocation = enterLocation;
|
||||||
|
_mapX = ((_enterLocation.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
||||||
|
_mapY = ((_enterLocation.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZoneId()
|
||||||
|
{
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZoneName()
|
||||||
|
{
|
||||||
|
return _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInitialTime()
|
||||||
|
{
|
||||||
|
return _initialTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaximumAddedTime()
|
||||||
|
{
|
||||||
|
return _maximumAddedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getResetDelay()
|
||||||
|
{
|
||||||
|
return _resetDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEntryItemId()
|
||||||
|
{
|
||||||
|
return _entryItemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEntryFee()
|
||||||
|
{
|
||||||
|
return _entryFee;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinLevel()
|
||||||
|
{
|
||||||
|
return _minLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxLevel()
|
||||||
|
{
|
||||||
|
return _maxLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRemainRefillTime()
|
||||||
|
{
|
||||||
|
return _remainRefillTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRefillTimeMax()
|
||||||
|
{
|
||||||
|
return _refillTimeMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWeekly()
|
||||||
|
{
|
||||||
|
return _weekly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getEnterLocation()
|
||||||
|
{
|
||||||
|
return _enterLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMapX()
|
||||||
|
{
|
||||||
|
return _mapX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMapY()
|
||||||
|
{
|
||||||
|
return _mapY;
|
||||||
|
}
|
||||||
|
}
|
||||||
+18
-5
@@ -16,13 +16,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.zone.type;
|
package org.l2jmobius.gameserver.model.zone.type;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||||
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneExit;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneExit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
@@ -42,12 +44,23 @@ public class TimedHuntingZone extends ZoneType
|
|||||||
{
|
{
|
||||||
player.setInsideZone(ZoneId.TIMED_HUNTING, true);
|
player.setInsideZone(ZoneId.TIMED_HUNTING, true);
|
||||||
|
|
||||||
final long pirateTombExitTime = player.getTimedHuntingZoneRemainingTime(2);
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
if ((pirateTombExitTime > 0) && player.isInTimedHuntingZone(2))
|
|
||||||
{
|
{
|
||||||
player.startTimedHuntingZone(2, pirateTombExitTime);
|
if (!player.isInTimedHuntingZone(holder.getZoneId()))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else if (!player.isGM())
|
|
||||||
|
final int remainingTime = player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||||
|
if (remainingTime > 0)
|
||||||
|
{
|
||||||
|
player.startTimedHuntingZone(holder.getZoneId(), remainingTime);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!player.isGM())
|
||||||
{
|
{
|
||||||
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -77,6 +77,8 @@ import org.l2jmobius.gameserver.network.clientpackets.ensoul.RequestItemEnsoul;
|
|||||||
import org.l2jmobius.gameserver.network.clientpackets.ensoul.RequestTryEnSoulExtraction;
|
import org.l2jmobius.gameserver.network.clientpackets.ensoul.RequestTryEnSoulExtraction;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.equipmentupgrade.RequestUpgradeSystemResult;
|
import org.l2jmobius.gameserver.network.clientpackets.equipmentupgrade.RequestUpgradeSystemResult;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
import org.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
||||||
|
import org.l2jmobius.gameserver.network.clientpackets.huntingzones.ExTimedHuntingZoneEnter;
|
||||||
|
import org.l2jmobius.gameserver.network.clientpackets.huntingzones.ExTimedHuntingZoneList;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGameStartInfo;
|
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGameStartInfo;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.mentoring.ConfirmMenteeAdd;
|
import org.l2jmobius.gameserver.network.clientpackets.mentoring.ConfirmMenteeAdd;
|
||||||
@@ -102,8 +104,6 @@ import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingChar
|
|||||||
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharRankers;
|
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharRankers;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
|
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
|
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sessionzones.ExTimedHuntingZoneEnter;
|
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sessionzones.ExTimedHuntingZoneList;
|
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
|
||||||
|
|||||||
+26
-16
@@ -14,15 +14,18 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.clientpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,45 +87,52 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_zoneId == 2) && (player.getLevel() < 78))
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(_zoneId);
|
||||||
|
if (holder == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((player.getLevel() < holder.getMinLevel()) || (player.getLevel() > holder.getMaxLevel()))
|
||||||
{
|
{
|
||||||
player.sendMessage("Your level does not correspond the zone equivalent.");
|
player.sendMessage("Your level does not correspond the zone equivalent.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||||
final long lastEntryTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, 0);
|
final long lastEntryTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, 0);
|
||||||
if ((lastEntryTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
if ((lastEntryTime + holder.getResetDelay()) < currentTime)
|
||||||
{
|
{
|
||||||
if (endTime == currentTime)
|
if (endTime == currentTime)
|
||||||
{
|
{
|
||||||
endTime += Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
endTime += holder.getInitialTime();
|
||||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, currentTime);
|
player.getVariables().set(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, currentTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endTime > currentTime)
|
if (endTime > currentTime)
|
||||||
{
|
{
|
||||||
if (player.getAdena() > Config.TIME_LIMITED_ZONE_TELEPORT_FEE)
|
if (holder.getEntryItemId() == Inventory.ADENA_ID)
|
||||||
{
|
{
|
||||||
player.reduceAdena("TimedHuntingZone", Config.TIME_LIMITED_ZONE_TELEPORT_FEE, player, true);
|
if (player.getAdena() > holder.getEntryFee())
|
||||||
|
{
|
||||||
|
player.reduceAdena("TimedHuntingZone", holder.getEntryFee(), player, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendMessage("Not enough adena.");
|
player.sendMessage("Not enough adena.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (!player.destroyItemByItemId("TimedHuntingZone", holder.getEntryItemId(), holder.getEntryFee(), player, true))
|
||||||
|
{
|
||||||
|
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_REQUIRED_ITEMS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
||||||
|
player.teleToLocation(holder.getEnterLocation());
|
||||||
switch (_zoneId)
|
|
||||||
{
|
|
||||||
case 2: // Ancient Pirates' Tomb
|
|
||||||
{
|
|
||||||
player.teleToLocation(17613, -76862, -6265);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
+2
-2
@@ -14,13 +14,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.clientpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneList;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.serverpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.serverpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
+72
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.l2jmobius.gameserver.network.serverpackets.huntingzones;
|
||||||
|
|
||||||
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneList implements IClientOutgoingPacket
|
||||||
|
{
|
||||||
|
private final PlayerInstance _player;
|
||||||
|
private final boolean _isInTimedHuntingZone;
|
||||||
|
|
||||||
|
public TimedHuntingZoneList(PlayerInstance player)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_isInTimedHuntingZone = player.isInsideZone(ZoneId.TIMED_HUNTING);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean write(PacketWriter packet)
|
||||||
|
{
|
||||||
|
OutgoingPackets.EX_TIME_RESTRICT_FIELD_LIST.writeId(packet);
|
||||||
|
int remainingTime;
|
||||||
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
|
packet.writeD(TimedHuntingZoneData.getInstance().getSize()); // zone count
|
||||||
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
|
{
|
||||||
|
packet.writeD(holder.getEntryFee() == 0 ? 0 : 1); // required item count
|
||||||
|
packet.writeD(holder.getEntryItemId());
|
||||||
|
packet.writeQ(holder.getEntryFee());
|
||||||
|
packet.writeD(holder.isWeekly() ? 0 : 1); // reset cycle
|
||||||
|
packet.writeD(holder.getZoneId());
|
||||||
|
packet.writeD(holder.getMinLevel());
|
||||||
|
packet.writeD(holder.getMaxLevel());
|
||||||
|
packet.writeD(holder.getInitialTime() / 1000); // remain time base
|
||||||
|
remainingTime = _player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||||
|
if ((remainingTime == 0) && ((_player.getTimedHuntingZoneInitialEntry(1) + holder.getResetDelay()) < currentTime))
|
||||||
|
{
|
||||||
|
remainingTime = holder.getInitialTime();
|
||||||
|
}
|
||||||
|
packet.writeD(remainingTime / 1000); // remain time
|
||||||
|
packet.writeD(holder.getMaximumAddedTime() / 1000);
|
||||||
|
packet.writeD(holder.getRemainRefillTime());
|
||||||
|
packet.writeD(holder.getRefillTimeMax());
|
||||||
|
packet.writeC(!_isInTimedHuntingZone || _player.isInTimedHuntingZone(holder.getZoneId()) ? 1 : 0); // field activated
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
-48
@@ -1,48 +0,0 @@
|
|||||||
# ---------------------------------------------------------------------------
|
|
||||||
# Time Limited Zones
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Initial free time.
|
|
||||||
# Default: 3600000 (1 hour)
|
|
||||||
InitialTime = 3600000
|
|
||||||
|
|
||||||
# Initial free time Primeval Isle.
|
|
||||||
# Default: 7200000 (1 hour)
|
|
||||||
PrimevalStart = 7200000
|
|
||||||
|
|
||||||
# Maximum Added time Primeval Isle.
|
|
||||||
# Default: 46800000 (13 hours)
|
|
||||||
PrimevalMaxTime = 46800000
|
|
||||||
|
|
||||||
# Maximum Added time Alligator Island.
|
|
||||||
# Default: 10800000 (3 hours)
|
|
||||||
AlligatorMaxTime = 10800000
|
|
||||||
|
|
||||||
# Maximum Added time Forgotten Primeval Garden.
|
|
||||||
# Default: 21600000 (6 hours)
|
|
||||||
PrimevalGardenMaxTime = 21600000
|
|
||||||
|
|
||||||
# Initial free time Antharas Lair.
|
|
||||||
# Default: 25200000 (7 hours)
|
|
||||||
AntharasLairStart = 25200000
|
|
||||||
|
|
||||||
# Maximum Added time Antharas Lair.
|
|
||||||
# Default: 151200000 (42 hours)
|
|
||||||
AntharasLairMaxTime = 151200000
|
|
||||||
|
|
||||||
# Reset delay Only Antharas Lair (Weekly).
|
|
||||||
# Default: 604800000 (7 Days)
|
|
||||||
AntharasLairResetDelay = 604800000
|
|
||||||
|
|
||||||
# Reset delay.
|
|
||||||
# Default: 36000000 (10 hours)
|
|
||||||
ResetDelay = 36000000
|
|
||||||
|
|
||||||
# Teleport fee.
|
|
||||||
# Default: 10000
|
|
||||||
TeleportFee = 10000
|
|
||||||
|
|
||||||
# TODO: NOT USED
|
|
||||||
# Maximum added time.
|
|
||||||
# Default: 18000000 (5 hours)
|
|
||||||
MaximumAddedTime = 18000000
|
|
||||||
+116
@@ -0,0 +1,116 @@
|
|||||||
|
<?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="Primeval Isle">
|
||||||
|
<enterLocation>9400,-21720,-3634</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> <!-- 13 hours -->
|
||||||
|
<remainRefillTime>43200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>40</minLevel>
|
||||||
|
<maxLevel>999</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="4" name="Forgotten Primeval Garden">
|
||||||
|
<enterLocation>-112937,213590,-13248</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>21600000</maxAddedTime> <!-- 6 hours -->
|
||||||
|
<remainRefillTime>18000</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>76</minLevel>
|
||||||
|
<maxLevel>999</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="11" name="Alligator Island">
|
||||||
|
<enterLocation>115528,191580,-3371</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> <!-- 13 hours -->
|
||||||
|
<remainRefillTime>7200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>60</minLevel>
|
||||||
|
<maxLevel>999</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="12" name="Antharas Lair">
|
||||||
|
<enterLocation>133247,114445,-3724</enterLocation>
|
||||||
|
<initialTime>25200000</initialTime> <!-- 7 hours -->
|
||||||
|
<resetDelay>604800000</resetDelay> <!-- 7 days -->
|
||||||
|
<maxAddedTime>151200000</maxAddedTime> <!-- 42 hours -->
|
||||||
|
<remainRefillTime>126000</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>80</minLevel>
|
||||||
|
<maxLevel>999</maxLevel>
|
||||||
|
<weekly>true</weekly>
|
||||||
|
</zone>
|
||||||
|
<!--
|
||||||
|
<zone id="101" name="Transcendent Instance Zone 1">
|
||||||
|
<enterLocation>63443,26304,-3755</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> 1 hour
|
||||||
|
<resetDelay>36000000</resetDelay> 10 hours
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> 13 hours
|
||||||
|
<remainRefillTime>3600</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>40</minLevel>
|
||||||
|
<maxLevel>49</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="102" name="Transcendent Instance Zone 2">
|
||||||
|
<enterLocation>125277,70262,-4408</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> 1 hour
|
||||||
|
<resetDelay>36000000</resetDelay> 10 hours
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> 13 hours
|
||||||
|
<remainRefillTime>3600</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>50</minLevel>
|
||||||
|
<maxLevel>59</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="103" name="Transcendent Instance Zone 3">
|
||||||
|
<enterLocation>148724,-22366,-3436</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> 1 hour
|
||||||
|
<resetDelay>36000000</resetDelay> 10 hours
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> 13 hours
|
||||||
|
<remainRefillTime>3600</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>60</minLevel>
|
||||||
|
<maxLevel>69</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="104" name="Transcendent Instance Zone 4">
|
||||||
|
<enterLocation>167965,28800,-3606</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> 1 hour
|
||||||
|
<resetDelay>36000000</resetDelay> 10 hours
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> 13 hours
|
||||||
|
<remainRefillTime>3600</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>70</minLevel>
|
||||||
|
<maxLevel>79</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="106" name="Transcendent Instance Zone 6">
|
||||||
|
<enterLocation>99797,110524,-3702</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> 1 hour
|
||||||
|
<resetDelay>36000000</resetDelay> 10 hours
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> 13 hours
|
||||||
|
<remainRefillTime>3600</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>80</minLevel>
|
||||||
|
<maxLevel>999</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="107" name="Transcendent Instance Zone 7">
|
||||||
|
<enterLocation>-50416,145363,-2825</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> 1 hour
|
||||||
|
<resetDelay>36000000</resetDelay> 10 hours
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> 13 hours
|
||||||
|
<remainRefillTime>3600</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>85</minLevel>
|
||||||
|
<maxLevel>999</maxLevel>
|
||||||
|
</zone>
|
||||||
|
-->
|
||||||
|
</list>
|
||||||
+12
-37
@@ -16,16 +16,17 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.effecthandlers;
|
package handlers.effecthandlers;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneList;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
@@ -56,33 +57,15 @@ public class AddHuntingTime extends AbstractEffect
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(_zoneId);
|
||||||
|
if (holder == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||||
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_TIME))
|
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= holder.getMaximumAddedTime()))
|
||||||
{
|
|
||||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_PRIMEVAL))
|
|
||||||
{
|
|
||||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_ALLIGATOR))
|
|
||||||
{
|
|
||||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_GARDEN))
|
|
||||||
{
|
|
||||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_ANTHARAS))
|
|
||||||
{
|
{
|
||||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
player.sendMessage("You cannot exceed the time zone limit.");
|
||||||
@@ -96,17 +79,9 @@ public class AddHuntingTime extends AbstractEffect
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
if ((endTime + holder.getResetDelay()) < currentTime)
|
||||||
{
|
{
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
endTime = currentTime + holder.getInitialTime();
|
||||||
}
|
|
||||||
else if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_PRIMEVAL;
|
|
||||||
}
|
|
||||||
else if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY_ANTHARAS) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_ANTHARAS;
|
|
||||||
}
|
}
|
||||||
else if (endTime < currentTime)
|
else if (endTime < currentTime)
|
||||||
{
|
{
|
||||||
|
|||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<xs:element name="list">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="zone" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element type="xs:string" name="enterLocation" />
|
||||||
|
<xs:element type="xs:int" name="initialTime" />
|
||||||
|
<xs:element type="xs:int" name="resetDelay" />
|
||||||
|
<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" />
|
||||||
|
<xs:element type="xs:short" name="minLevel" />
|
||||||
|
<xs:element type="xs:short" name="maxLevel" />
|
||||||
|
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||||
|
<xs:attribute type="xs:string" name="name" use="optional" />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:boolean" name="enabled" />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -103,7 +103,6 @@ public class Config
|
|||||||
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
||||||
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||||
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
||||||
private static final String TIME_LIMITED_ZONE_CONFIG_FILE = "./config/TimeLimitedZones.ini";
|
|
||||||
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
||||||
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||||
private static final String HEXID_FILE = "./config/hexid.txt";
|
private static final String HEXID_FILE = "./config/hexid.txt";
|
||||||
@@ -851,17 +850,6 @@ public class Config
|
|||||||
public static String TELNET_HOSTNAME;
|
public static String TELNET_HOSTNAME;
|
||||||
public static List<String> TELNET_HOSTS;
|
public static List<String> TELNET_HOSTS;
|
||||||
public static int TELNET_PORT;
|
public static int TELNET_PORT;
|
||||||
public static long TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
public static long TIME_LIMITED_ZONE_PRIMEVAL;
|
|
||||||
public static long TIME_LIMITED_ZONE_ANTHARAS;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_PRIMEVAL;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_ALLIGATOR;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_GARDEN;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_ANTHARAS;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_TIME;
|
|
||||||
public static long TIME_LIMITED_ZONE_RESET_DELAY;
|
|
||||||
public static long TIME_LIMITED_ZONE_RESET_DELAY_ANTHARAS;
|
|
||||||
public static long TIME_LIMITED_ZONE_TELEPORT_FEE;
|
|
||||||
public static boolean TRAINING_CAMP_ENABLE;
|
public static boolean TRAINING_CAMP_ENABLE;
|
||||||
public static boolean TRAINING_CAMP_PREMIUM_ONLY;
|
public static boolean TRAINING_CAMP_PREMIUM_ONLY;
|
||||||
public static int TRAINING_CAMP_MAX_DURATION;
|
public static int TRAINING_CAMP_MAX_DURATION;
|
||||||
@@ -1917,20 +1905,6 @@ public class Config
|
|||||||
TELNET_PASSWORD = telnetSettings.getString("Password", "");
|
TELNET_PASSWORD = telnetSettings.getString("Password", "");
|
||||||
TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(","));
|
TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(","));
|
||||||
|
|
||||||
// Load Time Limited Zone config file (if exists)
|
|
||||||
final PropertiesParser timeLimitedZoneSettings = new PropertiesParser(TIME_LIMITED_ZONE_CONFIG_FILE);
|
|
||||||
TIME_LIMITED_ZONE_PRIMEVAL = timeLimitedZoneSettings.getLong("PrimevalStart", 7200000);
|
|
||||||
TIME_LIMITED_ZONE_ANTHARAS = timeLimitedZoneSettings.getLong("AntharasLairStart", 25200000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_PRIMEVAL = timeLimitedZoneSettings.getLong("PrimevalMaxTime", 46800000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_ALLIGATOR = timeLimitedZoneSettings.getLong("AlligatorMaxTime", 10800000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_GARDEN = timeLimitedZoneSettings.getLong("PrimevalGardenMaxTime", 21600000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_ANTHARAS = timeLimitedZoneSettings.getLong("AntharasLairMaxTime", 151200000);
|
|
||||||
TIME_LIMITED_ZONE_INITIAL_TIME = timeLimitedZoneSettings.getLong("InitialTime", 3600000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_TIME = timeLimitedZoneSettings.getLong("MaximumAddedTime", 18000000);
|
|
||||||
TIME_LIMITED_ZONE_RESET_DELAY = timeLimitedZoneSettings.getLong("ResetDelay", 36000000);
|
|
||||||
TIME_LIMITED_ZONE_RESET_DELAY_ANTHARAS = timeLimitedZoneSettings.getLong("AntharasLairResetDelay", 604800000);
|
|
||||||
TIME_LIMITED_ZONE_TELEPORT_FEE = timeLimitedZoneSettings.getLong("TeleportFee", 10000);
|
|
||||||
|
|
||||||
// Load Magic Lamp config file (if exists)
|
// Load Magic Lamp config file (if exists)
|
||||||
final PropertiesParser magicLampSettings = new PropertiesParser(MAGIC_LAMP_FILE);
|
final PropertiesParser magicLampSettings = new PropertiesParser(MAGIC_LAMP_FILE);
|
||||||
ENABLE_MAGIC_LAMP = magicLampSettings.getBoolean("MagicLampEnabled", false);
|
ENABLE_MAGIC_LAMP = magicLampSettings.getBoolean("MagicLampEnabled", false);
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ import org.l2jmobius.gameserver.data.xml.SpawnData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.StaticObjectData;
|
import org.l2jmobius.gameserver.data.xml.StaticObjectData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TeleportListData;
|
import org.l2jmobius.gameserver.data.xml.TeleportListData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TeleporterData;
|
import org.l2jmobius.gameserver.data.xml.TeleporterData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TransformData;
|
import org.l2jmobius.gameserver.data.xml.TransformData;
|
||||||
import org.l2jmobius.gameserver.data.xml.VariationData;
|
import org.l2jmobius.gameserver.data.xml.VariationData;
|
||||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
@@ -355,6 +356,7 @@ public class GameServer
|
|||||||
CrestTable.getInstance();
|
CrestTable.getInstance();
|
||||||
TeleportListData.getInstance();
|
TeleportListData.getInstance();
|
||||||
TeleporterData.getInstance();
|
TeleporterData.getInstance();
|
||||||
|
TimedHuntingZoneData.getInstance();
|
||||||
MatchingRoomManager.getInstance();
|
MatchingRoomManager.getInstance();
|
||||||
PetitionManager.getInstance();
|
PetitionManager.getInstance();
|
||||||
CursedWeaponsManager.getInstance();
|
CursedWeaponsManager.getInstance();
|
||||||
|
|||||||
+186
@@ -0,0 +1,186 @@
|
|||||||
|
/*
|
||||||
|
* 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.data.xml;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.NamedNodeMap;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
|
import org.l2jmobius.commons.util.IXmlReader;
|
||||||
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneData implements IXmlReader
|
||||||
|
{
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(TimedHuntingZoneData.class.getName());
|
||||||
|
|
||||||
|
private final Map<Integer, TimedHuntingZoneHolder> _timedHuntingZoneData = new HashMap<>();
|
||||||
|
|
||||||
|
protected TimedHuntingZoneData()
|
||||||
|
{
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load()
|
||||||
|
{
|
||||||
|
_timedHuntingZoneData.clear();
|
||||||
|
parseDatapackFile("data/TimedHuntingZoneData.xml");
|
||||||
|
|
||||||
|
if (!_timedHuntingZoneData.isEmpty())
|
||||||
|
{
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _timedHuntingZoneData.size() + " timed hunting zones.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": System is disabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void parseDocument(Document doc, File f)
|
||||||
|
{
|
||||||
|
for (Node xmlNode = doc.getFirstChild(); xmlNode != null; xmlNode = xmlNode.getNextSibling())
|
||||||
|
{
|
||||||
|
if ("list".equalsIgnoreCase(xmlNode.getNodeName()))
|
||||||
|
{
|
||||||
|
final NamedNodeMap listAttributes = xmlNode.getAttributes();
|
||||||
|
final Node attribute = listAttributes.getNamedItem("enabled");
|
||||||
|
if ((attribute != null) && Boolean.parseBoolean(attribute.getNodeValue()))
|
||||||
|
{
|
||||||
|
for (Node listNode = xmlNode.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
|
||||||
|
{
|
||||||
|
if ("zone".equalsIgnoreCase(listNode.getNodeName()))
|
||||||
|
{
|
||||||
|
final NamedNodeMap zoneAttributes = listNode.getAttributes();
|
||||||
|
int id = parseInteger(zoneAttributes, "id");
|
||||||
|
String name = parseString(zoneAttributes, "name", "");
|
||||||
|
int initialTime = 0;
|
||||||
|
int maxAddedTime = 0;
|
||||||
|
int resetDelay = 0;
|
||||||
|
int entryItemId = 57;
|
||||||
|
int entryFee = 10000;
|
||||||
|
int minLevel = 1;
|
||||||
|
int maxLevel = 999;
|
||||||
|
int remainRefillTime = 3600;
|
||||||
|
int refillTimeMax = 3600;
|
||||||
|
boolean weekly = false;
|
||||||
|
Location enterLocation = null;
|
||||||
|
for (Node zoneNode = listNode.getFirstChild(); zoneNode != null; zoneNode = zoneNode.getNextSibling())
|
||||||
|
{
|
||||||
|
switch (zoneNode.getNodeName())
|
||||||
|
{
|
||||||
|
case "enterLocation":
|
||||||
|
{
|
||||||
|
final String[] coordinates = zoneNode.getTextContent().split(",");
|
||||||
|
enterLocation = new Location(Integer.parseInt(coordinates[0]), Integer.parseInt(coordinates[1]), Integer.parseInt(coordinates[2]));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "initialTime":
|
||||||
|
{
|
||||||
|
initialTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "maxAddedTime":
|
||||||
|
{
|
||||||
|
maxAddedTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "resetDelay":
|
||||||
|
{
|
||||||
|
resetDelay = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "entryItemId":
|
||||||
|
{
|
||||||
|
entryItemId = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "entryFee":
|
||||||
|
{
|
||||||
|
entryFee = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "minLevel":
|
||||||
|
{
|
||||||
|
minLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "maxLevel":
|
||||||
|
{
|
||||||
|
maxLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "remainRefillTime":
|
||||||
|
{
|
||||||
|
remainRefillTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "refillTimeMax":
|
||||||
|
{
|
||||||
|
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "weekly":
|
||||||
|
{
|
||||||
|
weekly = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, weekly, enterLocation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimedHuntingZoneHolder getHuntingZone(int zoneId)
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.get(zoneId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<TimedHuntingZoneHolder> getAllHuntingZones()
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSize()
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TimedHuntingZoneData getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final TimedHuntingZoneData INSTANCE = new TimedHuntingZoneData();
|
||||||
|
}
|
||||||
|
}
|
||||||
+20
-56
@@ -83,6 +83,7 @@ import org.l2jmobius.gameserver.data.xml.RecipeData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.SendMessageLocalisationData;
|
import org.l2jmobius.gameserver.data.xml.SendMessageLocalisationData;
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillTreeData;
|
import org.l2jmobius.gameserver.data.xml.SkillTreeData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.enums.AdminTeleportType;
|
import org.l2jmobius.gameserver.enums.AdminTeleportType;
|
||||||
import org.l2jmobius.gameserver.enums.BroochJewel;
|
import org.l2jmobius.gameserver.enums.BroochJewel;
|
||||||
import org.l2jmobius.gameserver.enums.CastleSide;
|
import org.l2jmobius.gameserver.enums.CastleSide;
|
||||||
@@ -233,6 +234,7 @@ import org.l2jmobius.gameserver.model.holders.PreparedMultisellListHolder;
|
|||||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SkillUseHolder;
|
import org.l2jmobius.gameserver.model.holders.SkillUseHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.TrainingHolder;
|
import org.l2jmobius.gameserver.model.holders.TrainingHolder;
|
||||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||||
import org.l2jmobius.gameserver.model.interfaces.ILocational;
|
import org.l2jmobius.gameserver.model.interfaces.ILocational;
|
||||||
@@ -14416,20 +14418,6 @@ public class PlayerInstance extends Playable
|
|||||||
return _autoUseSettings;
|
return _autoUseSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int x, int y)
|
|
||||||
{
|
|
||||||
return isInTimedHuntingZone(1, x, y) // Primeval Isle
|
|
||||||
|| isInTimedHuntingZone(4, x, y) // Primeval Garden
|
|
||||||
|| isInTimedHuntingZone(11, x, y) // Aligator Island
|
|
||||||
|| isInTimedHuntingZone(12, x, y) // Antharas Lair
|
|
||||||
|| isInTimedHuntingZone(101, x, y) // Transcendent Instance Zone 1
|
|
||||||
|| isInTimedHuntingZone(102, x, y) // Transcendent Instance Zone 2
|
|
||||||
|| isInTimedHuntingZone(103, x, y) // Transcendent Instance Zone 3
|
|
||||||
|| isInTimedHuntingZone(104, x, y) // Transcendent Instance Zone 4
|
|
||||||
|| isInTimedHuntingZone(106, x, y) // Transcendent Instance Zone 6
|
|
||||||
|| isInTimedHuntingZone(107, x, y); // Transcendent Instance Zone 7
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId)
|
public boolean isInTimedHuntingZone(int zoneId)
|
||||||
{
|
{
|
||||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||||
@@ -14437,50 +14425,21 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||||
{
|
{
|
||||||
final int x = ((locX - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||||
final int y = ((locY - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
if (holder == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
switch (zoneId)
|
public boolean isInTimedHuntingZone(int x, int y)
|
||||||
{
|
{
|
||||||
case 1: // Primeval Isle
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
{
|
{
|
||||||
return (x == 20) && (y == 17);
|
if (isInTimedHuntingZone(holder.getZoneId(), x, y))
|
||||||
}
|
|
||||||
case 4: // Primeval Garden
|
|
||||||
{
|
{
|
||||||
return (x == 24) && (y == 19);
|
return true;
|
||||||
}
|
|
||||||
case 11: // Primeval Garden
|
|
||||||
{
|
|
||||||
return (x == 23) && (y == 23);
|
|
||||||
}
|
|
||||||
case 12: // Antharas Lair
|
|
||||||
{
|
|
||||||
return (x == 25) && (y == 21);
|
|
||||||
}
|
|
||||||
case 101: // Transcendent Instance Zone 1
|
|
||||||
{
|
|
||||||
return (x == 21) && (y == 18);
|
|
||||||
}
|
|
||||||
case 102: // Transcendent Instance Zone 2
|
|
||||||
{
|
|
||||||
return (x == 23) && (y == 19);
|
|
||||||
}
|
|
||||||
case 103: // Transcendent Instance Zone 3
|
|
||||||
{
|
|
||||||
return (x == 24) && (y == 17);
|
|
||||||
}
|
|
||||||
case 104: // Transcendent Instance Zone 4
|
|
||||||
{
|
|
||||||
return (x == 24) && (y == 18);
|
|
||||||
}
|
|
||||||
case 106: // Transcendent Instance Zone 6
|
|
||||||
{
|
|
||||||
return (x == 23) && (y == 21);
|
|
||||||
}
|
|
||||||
case 107: // Transcendent Instance Zone 7
|
|
||||||
{
|
|
||||||
return (x == 18) && (y == 22);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -14524,9 +14483,14 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTimedHuntingZoneRemainingTime(int zoneId)
|
public int getTimedHuntingZoneRemainingTime(int zoneId)
|
||||||
{
|
{
|
||||||
return Math.max(getVariables().getLong(PlayerVariables.HUNTING_ZONE_TIME + zoneId, 0), 0);
|
return Math.max(getVariables().getInt(PlayerVariables.HUNTING_ZONE_TIME + zoneId, 0), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTimedHuntingZoneInitialEntry(int zoneId)
|
||||||
|
{
|
||||||
|
return Math.max(getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + zoneId, 0), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restoreRandomCraft()
|
private void restoreRandomCraft()
|
||||||
|
|||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.l2jmobius.gameserver.model.holders;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
|
import org.l2jmobius.gameserver.model.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneHolder
|
||||||
|
{
|
||||||
|
private final int _id;
|
||||||
|
private final String _name;
|
||||||
|
private final int _initialTime;
|
||||||
|
private final int _maximumAddedTime;
|
||||||
|
private final int _resetDelay;
|
||||||
|
private final int _entryItemId;
|
||||||
|
private final int _entryFee;
|
||||||
|
private final int _minLevel;
|
||||||
|
private final int _maxLevel;
|
||||||
|
private final int _remainRefillTime;
|
||||||
|
private final int _refillTimeMax;
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
_id = id;
|
||||||
|
_name = name;
|
||||||
|
_initialTime = initialTime;
|
||||||
|
_maximumAddedTime = maximumAddedTime;
|
||||||
|
_resetDelay = resetDelay;
|
||||||
|
_entryItemId = entryItemId;
|
||||||
|
_entryFee = entryFee;
|
||||||
|
_minLevel = minLevel;
|
||||||
|
_maxLevel = maxLevel;
|
||||||
|
_remainRefillTime = remainRefillTime;
|
||||||
|
_refillTimeMax = refillTimeMax;
|
||||||
|
_weekly = weekly;
|
||||||
|
_enterLocation = enterLocation;
|
||||||
|
_mapX = ((_enterLocation.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
||||||
|
_mapY = ((_enterLocation.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZoneId()
|
||||||
|
{
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZoneName()
|
||||||
|
{
|
||||||
|
return _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInitialTime()
|
||||||
|
{
|
||||||
|
return _initialTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaximumAddedTime()
|
||||||
|
{
|
||||||
|
return _maximumAddedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getResetDelay()
|
||||||
|
{
|
||||||
|
return _resetDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEntryItemId()
|
||||||
|
{
|
||||||
|
return _entryItemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEntryFee()
|
||||||
|
{
|
||||||
|
return _entryFee;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinLevel()
|
||||||
|
{
|
||||||
|
return _minLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxLevel()
|
||||||
|
{
|
||||||
|
return _maxLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRemainRefillTime()
|
||||||
|
{
|
||||||
|
return _remainRefillTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRefillTimeMax()
|
||||||
|
{
|
||||||
|
return _refillTimeMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWeekly()
|
||||||
|
{
|
||||||
|
return _weekly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getEnterLocation()
|
||||||
|
{
|
||||||
|
return _enterLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMapX()
|
||||||
|
{
|
||||||
|
return _mapX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMapY()
|
||||||
|
{
|
||||||
|
return _mapY;
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
-49
@@ -16,13 +16,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.zone.type;
|
package org.l2jmobius.gameserver.model.zone.type;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||||
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneExit;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneExit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
@@ -42,58 +44,23 @@ public class TimedHuntingZone extends ZoneType
|
|||||||
{
|
{
|
||||||
player.setInsideZone(ZoneId.TIMED_HUNTING, true);
|
player.setInsideZone(ZoneId.TIMED_HUNTING, true);
|
||||||
|
|
||||||
final long primevalIsleExitTime = player.getTimedHuntingZoneRemainingTime(1);
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
final long primevalGardenExitTime = player.getTimedHuntingZoneRemainingTime(4);
|
{
|
||||||
final long alligatorIslandExitTime = player.getTimedHuntingZoneRemainingTime(11);
|
if (!player.isInTimedHuntingZone(holder.getZoneId()))
|
||||||
final long antharasLairExitTime = player.getTimedHuntingZoneRemainingTime(12);
|
{
|
||||||
final long transcendent1ExitTime = player.getTimedHuntingZoneRemainingTime(101);
|
continue;
|
||||||
final long transcendent2ExitTime = player.getTimedHuntingZoneRemainingTime(102);
|
}
|
||||||
final long transcendent3ExitTime = player.getTimedHuntingZoneRemainingTime(103);
|
|
||||||
final long transcendent4ExitTime = player.getTimedHuntingZoneRemainingTime(104);
|
|
||||||
final long transcendent6ExitTime = player.getTimedHuntingZoneRemainingTime(106);
|
|
||||||
final long transcendent7ExitTime = player.getTimedHuntingZoneRemainingTime(107);
|
|
||||||
|
|
||||||
if ((primevalIsleExitTime > 0) && player.isInTimedHuntingZone(1))
|
final int remainingTime = player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||||
|
if (remainingTime > 0)
|
||||||
{
|
{
|
||||||
player.startTimedHuntingZone(1, primevalIsleExitTime);
|
player.startTimedHuntingZone(holder.getZoneId(), remainingTime);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if ((primevalGardenExitTime > 0) && player.isInTimedHuntingZone(4))
|
break;
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(4, primevalGardenExitTime);
|
|
||||||
}
|
}
|
||||||
else if ((alligatorIslandExitTime > 0) && player.isInTimedHuntingZone(11))
|
|
||||||
{
|
if (!player.isGM())
|
||||||
player.startTimedHuntingZone(11, alligatorIslandExitTime);
|
|
||||||
}
|
|
||||||
else if ((antharasLairExitTime > 0) && player.isInTimedHuntingZone(12))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(12, antharasLairExitTime);
|
|
||||||
}
|
|
||||||
else if ((transcendent1ExitTime > 0) && player.isInTimedHuntingZone(101))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(101, transcendent1ExitTime);
|
|
||||||
}
|
|
||||||
else if ((transcendent2ExitTime > 0) && player.isInTimedHuntingZone(102))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(102, transcendent2ExitTime);
|
|
||||||
}
|
|
||||||
else if ((transcendent3ExitTime > 0) && player.isInTimedHuntingZone(103))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(103, transcendent3ExitTime);
|
|
||||||
}
|
|
||||||
else if ((transcendent4ExitTime > 0) && player.isInTimedHuntingZone(104))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(104, transcendent4ExitTime);
|
|
||||||
}
|
|
||||||
else if ((transcendent6ExitTime > 0) && player.isInTimedHuntingZone(106))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(106, transcendent6ExitTime);
|
|
||||||
}
|
|
||||||
else if ((transcendent7ExitTime > 0) && player.isInTimedHuntingZone(107))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(107, transcendent7ExitTime);
|
|
||||||
}
|
|
||||||
else if (!player.isGM())
|
|
||||||
{
|
{
|
||||||
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -80,6 +80,8 @@ import org.l2jmobius.gameserver.network.clientpackets.ensoul.RequestItemEnsoul;
|
|||||||
import org.l2jmobius.gameserver.network.clientpackets.ensoul.RequestTryEnSoulExtraction;
|
import org.l2jmobius.gameserver.network.clientpackets.ensoul.RequestTryEnSoulExtraction;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.equipmentupgrade.RequestUpgradeSystemResult;
|
import org.l2jmobius.gameserver.network.clientpackets.equipmentupgrade.RequestUpgradeSystemResult;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
import org.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
||||||
|
import org.l2jmobius.gameserver.network.clientpackets.huntingzones.ExTimedHuntingZoneEnter;
|
||||||
|
import org.l2jmobius.gameserver.network.clientpackets.huntingzones.ExTimedHuntingZoneList;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.limitshop.RequestPurchaseLimitShopItemBuy;
|
import org.l2jmobius.gameserver.network.clientpackets.limitshop.RequestPurchaseLimitShopItemBuy;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.limitshop.RequestPurchaseLimitShopItemList;
|
import org.l2jmobius.gameserver.network.clientpackets.limitshop.RequestPurchaseLimitShopItemList;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
||||||
@@ -114,8 +116,6 @@ import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingChar
|
|||||||
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharRankers;
|
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharRankers;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
|
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
|
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sessionzones.ExTimedHuntingZoneEnter;
|
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sessionzones.ExTimedHuntingZoneList;
|
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
|
||||||
|
|||||||
+26
-66
@@ -14,15 +14,18 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.clientpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,95 +87,52 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((_zoneId == 1) && (player.getLevel() < 40)) //
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(_zoneId);
|
||||||
|| ((_zoneId == 4) && (player.getLevel() < 76)) //
|
if (holder == null)
|
||||||
|| ((_zoneId == 11) && (player.getLevel() < 60)) //
|
{
|
||||||
|| ((_zoneId == 12) && (player.getLevel() < 80)) //
|
return;
|
||||||
|| ((_zoneId == 101) && (player.getLevel() < 40)) //
|
}
|
||||||
)
|
|
||||||
|
if ((player.getLevel() < holder.getMinLevel()) || (player.getLevel() > holder.getMaxLevel()))
|
||||||
{
|
{
|
||||||
player.sendMessage("Your level does not correspond the zone equivalent.");
|
player.sendMessage("Your level does not correspond the zone equivalent.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||||
final long lastEntryTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, 0);
|
final long lastEntryTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, 0);
|
||||||
if ((lastEntryTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
if ((lastEntryTime + holder.getResetDelay()) < currentTime)
|
||||||
{
|
{
|
||||||
if (endTime == currentTime)
|
if (endTime == currentTime)
|
||||||
{
|
{
|
||||||
endTime += Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
endTime += holder.getInitialTime();
|
||||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, currentTime);
|
player.getVariables().set(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, currentTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endTime > currentTime)
|
if (endTime > currentTime)
|
||||||
{
|
{
|
||||||
if (player.getAdena() > Config.TIME_LIMITED_ZONE_TELEPORT_FEE)
|
if (holder.getEntryItemId() == Inventory.ADENA_ID)
|
||||||
{
|
{
|
||||||
player.reduceAdena("TimedHuntingZone", Config.TIME_LIMITED_ZONE_TELEPORT_FEE, player, true);
|
if (player.getAdena() > holder.getEntryFee())
|
||||||
|
{
|
||||||
|
player.reduceAdena("TimedHuntingZone", holder.getEntryFee(), player, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendMessage("Not enough adena.");
|
player.sendMessage("Not enough adena.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (!player.destroyItemByItemId("TimedHuntingZone", holder.getEntryItemId(), holder.getEntryFee(), player, true))
|
||||||
|
{
|
||||||
|
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_REQUIRED_ITEMS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
||||||
|
player.teleToLocation(holder.getEnterLocation());
|
||||||
switch (_zoneId)
|
|
||||||
{
|
|
||||||
case 1: // Primeval Isle
|
|
||||||
{
|
|
||||||
player.teleToLocation(9400, -21720, -3634);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 4: // Forgotten Primeval Garden
|
|
||||||
{
|
|
||||||
player.teleToLocation(-112937, 213590, -13248);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 11: // Aligator Island
|
|
||||||
{
|
|
||||||
player.teleToLocation(115528, 191580, -3371);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 12: // Antharas Lair
|
|
||||||
{
|
|
||||||
player.teleToLocation(133247, 114445, -3724);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 101: // Transcendent Instance Zone 1
|
|
||||||
{
|
|
||||||
player.teleToLocation(63443, 26304, -3755);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 102: // Transcendent Instance Zone 2
|
|
||||||
{
|
|
||||||
player.teleToLocation(125277, 70262, -4408);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 103: // Transcendent Instance Zone 3
|
|
||||||
{
|
|
||||||
player.teleToLocation(148724, -22366, -3436);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 104: // Transcendent Instance Zone 4
|
|
||||||
{
|
|
||||||
player.teleToLocation(167965, 28800, -3606);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 106: // Transcendent Instance Zone 6
|
|
||||||
{
|
|
||||||
player.teleToLocation(99797, 110524, -3702);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 107: // Transcendent Instance Zone 7
|
|
||||||
{
|
|
||||||
player.teleToLocation(-50416, 145363, -2825);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* 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.clientpackets.huntingzones;
|
||||||
|
|
||||||
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class ExTimedHuntingZoneList implements IClientIncomingPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final PlayerInstance player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
client.sendPacket(new TimedHuntingZoneList(player));
|
||||||
|
}
|
||||||
|
}
|
||||||
-47
@@ -1,47 +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.clientpackets.sessionzones;
|
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Mobius
|
|
||||||
*/
|
|
||||||
public class ExTimedHuntingZoneList implements IClientIncomingPacket
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public boolean read(GameClient client, PacketReader packet)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run(GameClient client)
|
|
||||||
{
|
|
||||||
final PlayerInstance player = client.getPlayer();
|
|
||||||
if (player == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
client.sendPacket(new TimedHuntingZoneList(player));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* 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 TimedHuntingZoneEnter implements IClientOutgoingPacket
|
||||||
|
{
|
||||||
|
private final int _remainingTime;
|
||||||
|
|
||||||
|
public TimedHuntingZoneEnter(int remainingTime)
|
||||||
|
{
|
||||||
|
_remainingTime = remainingTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean write(PacketWriter packet)
|
||||||
|
{
|
||||||
|
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_ENTER.writeId(packet);
|
||||||
|
packet.writeC(_remainingTime);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* 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 TimedHuntingZoneExit implements IClientOutgoingPacket
|
||||||
|
{
|
||||||
|
public static final TimedHuntingZoneExit STATIC_PACKET = new TimedHuntingZoneExit();
|
||||||
|
|
||||||
|
public TimedHuntingZoneExit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean write(PacketWriter packet)
|
||||||
|
{
|
||||||
|
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_EXIT.writeId(packet);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
+73
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* 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.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
|
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneList implements IClientOutgoingPacket
|
||||||
|
{
|
||||||
|
private final PlayerInstance _player;
|
||||||
|
private final boolean _isInTimedHuntingZone;
|
||||||
|
|
||||||
|
public TimedHuntingZoneList(PlayerInstance player)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_isInTimedHuntingZone = player.isInsideZone(ZoneId.TIMED_HUNTING);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean write(PacketWriter packet)
|
||||||
|
{
|
||||||
|
OutgoingPackets.EX_TIME_RESTRICT_FIELD_LIST.writeId(packet);
|
||||||
|
int remainingTime;
|
||||||
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
|
packet.writeD(TimedHuntingZoneData.getInstance().getSize()); // zone count
|
||||||
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
|
{
|
||||||
|
packet.writeD(holder.getEntryFee() == 0 ? 0 : 1); // required item count
|
||||||
|
packet.writeD(holder.getEntryItemId());
|
||||||
|
packet.writeQ(holder.getEntryFee());
|
||||||
|
packet.writeD(holder.isWeekly() ? 0 : 1); // reset cycle
|
||||||
|
packet.writeD(holder.getZoneId());
|
||||||
|
packet.writeD(holder.getMinLevel());
|
||||||
|
packet.writeD(holder.getMaxLevel());
|
||||||
|
packet.writeD(holder.getInitialTime() / 1000); // remain time base
|
||||||
|
remainingTime = _player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||||
|
if ((remainingTime == 0) && ((_player.getTimedHuntingZoneInitialEntry(1) + holder.getResetDelay()) < currentTime))
|
||||||
|
{
|
||||||
|
remainingTime = holder.getInitialTime();
|
||||||
|
}
|
||||||
|
packet.writeD(remainingTime / 1000); // remain time
|
||||||
|
packet.writeD(holder.getMaximumAddedTime() / 1000);
|
||||||
|
packet.writeD(holder.getRemainRefillTime());
|
||||||
|
packet.writeD(holder.getRefillTimeMax());
|
||||||
|
packet.writeD(!_isInTimedHuntingZone || _player.isInTimedHuntingZone(holder.getZoneId()) ? 1 : 0); // field activated (272 C to D)
|
||||||
|
packet.writeH(0); // 245
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
-42
@@ -1,42 +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.sessionzones;
|
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Mobius
|
|
||||||
*/
|
|
||||||
public class TimedHuntingZoneEnter implements IClientOutgoingPacket
|
|
||||||
{
|
|
||||||
private final int _remainingTime;
|
|
||||||
|
|
||||||
public TimedHuntingZoneEnter(int remainingTime)
|
|
||||||
{
|
|
||||||
_remainingTime = remainingTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean write(PacketWriter packet)
|
|
||||||
{
|
|
||||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_ENTER.writeId(packet);
|
|
||||||
packet.writeC(_remainingTime);
|
|
||||||
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.sessionzones;
|
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Mobius
|
|
||||||
*/
|
|
||||||
public class TimedHuntingZoneExit implements IClientOutgoingPacket
|
|
||||||
{
|
|
||||||
public static final TimedHuntingZoneExit STATIC_PACKET = new TimedHuntingZoneExit();
|
|
||||||
|
|
||||||
public TimedHuntingZoneExit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean write(PacketWriter packet)
|
|
||||||
{
|
|
||||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_USER_EXIT.writeId(packet);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-302
@@ -1,302 +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.sessionzones;
|
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
|
||||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Mobius
|
|
||||||
*/
|
|
||||||
public class TimedHuntingZoneList implements IClientOutgoingPacket
|
|
||||||
{
|
|
||||||
private final PlayerInstance _player;
|
|
||||||
private final boolean _isInTimedHuntingZone;
|
|
||||||
|
|
||||||
public TimedHuntingZoneList(PlayerInstance player)
|
|
||||||
{
|
|
||||||
_player = player;
|
|
||||||
_isInTimedHuntingZone = player.isInsideZone(ZoneId.TIMED_HUNTING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean write(PacketWriter packet)
|
|
||||||
{
|
|
||||||
OutgoingPackets.EX_TIME_RESTRICT_FIELD_LIST.writeId(packet);
|
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
|
||||||
long endTime;
|
|
||||||
packet.writeD(4); // zone count
|
|
||||||
|
|
||||||
// Primeval Isle
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(1); // zone id
|
|
||||||
packet.writeD(40); // min level
|
|
||||||
packet.writeD(999); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(1);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_PRIMEVAL;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_PRIMEVAL / 1000));
|
|
||||||
packet.writeD(43200); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0);
|
|
||||||
|
|
||||||
// Forgotten Primeval Garden
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(4); // zone id
|
|
||||||
packet.writeD(76); // min level
|
|
||||||
packet.writeD(999); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(4);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_GARDEN / 1000));
|
|
||||||
packet.writeD(18000); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0);
|
|
||||||
|
|
||||||
// Alligator Island
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(1); // reset cycle
|
|
||||||
packet.writeD(11); // zone id
|
|
||||||
packet.writeD(60); // min level
|
|
||||||
packet.writeD(999); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(11);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_ALLIGATOR / 1000));
|
|
||||||
packet.writeD(7200); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0);
|
|
||||||
|
|
||||||
// Antharas Lair
|
|
||||||
packet.writeD(1); // required item count
|
|
||||||
packet.writeD(57); // item id
|
|
||||||
packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
packet.writeD(0); // reset cycle
|
|
||||||
packet.writeD(12); // zone id
|
|
||||||
packet.writeD(80); // min level
|
|
||||||
packet.writeD(999); // max level
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
endTime = _player.getTimedHuntingZoneRemainingTime(12);
|
|
||||||
if (endTime > 0)
|
|
||||||
{
|
|
||||||
endTime += currentTime;
|
|
||||||
}
|
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY_ANTHARAS) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_ANTHARAS;
|
|
||||||
}
|
|
||||||
packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_ANTHARAS / 1000));
|
|
||||||
packet.writeD(126000); // remain refill time
|
|
||||||
packet.writeD(3600); // refill time max
|
|
||||||
packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
packet.writeH(0);
|
|
||||||
|
|
||||||
// Transcendent Instance Zone 1
|
|
||||||
// packet.writeD(1); // required item count
|
|
||||||
// packet.writeD(57); // item id
|
|
||||||
// packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
// packet.writeD(1); // reset cycle
|
|
||||||
// packet.writeD(101); // zone id
|
|
||||||
// packet.writeD(40); // min level
|
|
||||||
// packet.writeD(49); // max level
|
|
||||||
// packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
// endTime = _player.getTimedHuntingZoneRemainingTime(101);
|
|
||||||
// if (endTime > 0)
|
|
||||||
// {
|
|
||||||
// endTime += currentTime;
|
|
||||||
// }
|
|
||||||
// if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
// {
|
|
||||||
// endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
// }
|
|
||||||
// packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
// packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
// packet.writeD(3600); // remain refill time
|
|
||||||
// packet.writeD(3600); // refill time max
|
|
||||||
// packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
// packet.writeH(0);
|
|
||||||
|
|
||||||
// Transcendent Instance Zone 2
|
|
||||||
// packet.writeD(1); // required item count
|
|
||||||
// packet.writeD(57); // item id
|
|
||||||
// packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
// packet.writeD(1); // reset cycle
|
|
||||||
// packet.writeD(102); // zone id
|
|
||||||
// packet.writeD(50); // min level
|
|
||||||
// packet.writeD(59); // max level
|
|
||||||
// packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
// endTime = _player.getTimedHuntingZoneRemainingTime(102);
|
|
||||||
// if (endTime > 0)
|
|
||||||
// {
|
|
||||||
// endTime += currentTime;
|
|
||||||
// }
|
|
||||||
// if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
// {
|
|
||||||
// endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
// }
|
|
||||||
// packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
// packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
// packet.writeD(3600); // remain refill time
|
|
||||||
// packet.writeD(3600); // refill time max
|
|
||||||
// packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
// packet.writeH(0);
|
|
||||||
|
|
||||||
// Transcendent Instance Zone 3
|
|
||||||
// packet.writeD(1); // required item count
|
|
||||||
// packet.writeD(57); // item id
|
|
||||||
// packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
// packet.writeD(1); // reset cycle
|
|
||||||
// packet.writeD(103); // zone id
|
|
||||||
// packet.writeD(60); // min level
|
|
||||||
// packet.writeD(69); // max level
|
|
||||||
// packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
// endTime = _player.getTimedHuntingZoneRemainingTime(103);
|
|
||||||
// if (endTime > 0)
|
|
||||||
// {
|
|
||||||
// endTime += currentTime;
|
|
||||||
// }
|
|
||||||
// if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
// {
|
|
||||||
// endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
// }
|
|
||||||
// packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
// packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
// packet.writeD(3600); // remain refill time
|
|
||||||
// packet.writeD(3600); // refill time max
|
|
||||||
// packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
// packet.writeH(0);
|
|
||||||
|
|
||||||
// Transcendent Instance Zone 4
|
|
||||||
// packet.writeD(1); // required item count
|
|
||||||
// packet.writeD(57); // item id
|
|
||||||
// packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
// packet.writeD(1); // reset cycle
|
|
||||||
// packet.writeD(104); // zone id
|
|
||||||
// packet.writeD(70); // min level
|
|
||||||
// packet.writeD(79); // max level
|
|
||||||
// packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
// endTime = _player.getTimedHuntingZoneRemainingTime(104);
|
|
||||||
// if (endTime > 0)
|
|
||||||
// {
|
|
||||||
// endTime += currentTime;
|
|
||||||
// }
|
|
||||||
// if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
// {
|
|
||||||
// endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
// }
|
|
||||||
// packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
// packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
// packet.writeD(3600); // remain refill time
|
|
||||||
// packet.writeD(3600); // refill time max
|
|
||||||
// packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
// packet.writeH(0);
|
|
||||||
|
|
||||||
// Transcendent Instance Zone 6
|
|
||||||
// packet.writeD(1); // required item count
|
|
||||||
// packet.writeD(57); // item id
|
|
||||||
// packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
// packet.writeD(1); // reset cycle
|
|
||||||
// packet.writeD(106); // zone id
|
|
||||||
// packet.writeD(80); // min level
|
|
||||||
// packet.writeD(999); // max level
|
|
||||||
// packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
// endTime = _player.getTimedHuntingZoneRemainingTime(106);
|
|
||||||
// if (endTime > 0)
|
|
||||||
// {
|
|
||||||
// endTime += currentTime;
|
|
||||||
// }
|
|
||||||
// if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
// {
|
|
||||||
// endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
// }
|
|
||||||
// packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
// packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
// packet.writeD(3600); // remain refill time
|
|
||||||
// packet.writeD(3600); // refill time max
|
|
||||||
// packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
// packet.writeH(0);
|
|
||||||
|
|
||||||
// Transcendent Instance Zone 7
|
|
||||||
// packet.writeD(1); // required item count
|
|
||||||
// packet.writeD(57); // item id
|
|
||||||
// packet.writeQ(Config.TIME_LIMITED_ZONE_TELEPORT_FEE); // item count
|
|
||||||
// packet.writeD(1); // reset cycle
|
|
||||||
// packet.writeD(107); // zone id
|
|
||||||
// packet.writeD(85); // min level
|
|
||||||
// packet.writeD(999); // max level
|
|
||||||
// packet.writeD((int) (Config.TIME_LIMITED_ZONE_INITIAL_TIME / 1000)); // remain time base?
|
|
||||||
// endTime = _player.getTimedHuntingZoneRemainingTime(107);
|
|
||||||
// if (endTime > 0)
|
|
||||||
// {
|
|
||||||
// endTime += currentTime;
|
|
||||||
// }
|
|
||||||
// if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
// {
|
|
||||||
// endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
// }
|
|
||||||
// packet.writeD((int) (Math.max(endTime - currentTime, 0)) / 1000); // remain time
|
|
||||||
// packet.writeD((int) (Config.TIME_LIMITED_MAX_ADDED_TIME / 1000));
|
|
||||||
// packet.writeD(3600); // remain refill time
|
|
||||||
// packet.writeD(3600); // refill time max
|
|
||||||
// packet.writeD(_isInTimedHuntingZone ? 0 : 1); // field activated (272 C to D)
|
|
||||||
// packet.writeH(0);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
# ---------------------------------------------------------------------------
|
|
||||||
# Time Limited Zones
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Initial free time.
|
|
||||||
# Default: 3600000 (1 hour)
|
|
||||||
InitialTime = 3600000
|
|
||||||
|
|
||||||
# Initial free time Primeval Isle.
|
|
||||||
# Default: 7200000 (1 hour)
|
|
||||||
PrimevalStart = 7200000
|
|
||||||
|
|
||||||
# Maximum Added time Primeval Isle.
|
|
||||||
# Default: 46800000 (13 hours)
|
|
||||||
PrimevalMaxTime = 46800000
|
|
||||||
|
|
||||||
# Maximum Added time Alligator Island.
|
|
||||||
# Default: 10800000 (3 hours)
|
|
||||||
AlligatorMaxTime = 10800000
|
|
||||||
|
|
||||||
# Maximum Added time Forgotten Primeval Garden.
|
|
||||||
# Default: 21600000 (6 hours)
|
|
||||||
PrimevalGardenMaxTime = 21600000
|
|
||||||
|
|
||||||
# Initial free time Antharas Lair.
|
|
||||||
# Default: 25200000 (7 hours)
|
|
||||||
AntharasLairStart = 25200000
|
|
||||||
|
|
||||||
# Maximum Added time Antharas Lair.
|
|
||||||
# Default: 151200000 (42 hours)
|
|
||||||
AntharasLairMaxTime = 151200000
|
|
||||||
|
|
||||||
# Reset delay Only Antharas Lair (Weekly).
|
|
||||||
# Default: 604800000 (7 Days)
|
|
||||||
AntharasLairResetDelay = 604800000
|
|
||||||
|
|
||||||
# Reset delay.
|
|
||||||
# Default: 36000000 (10 hours)
|
|
||||||
ResetDelay = 36000000
|
|
||||||
|
|
||||||
# Teleport fee.
|
|
||||||
# Default: 10000
|
|
||||||
TeleportFee = 10000
|
|
||||||
|
|
||||||
# TODO: NOT USED
|
|
||||||
# Maximum added time.
|
|
||||||
# Default: 18000000 (5 hours)
|
|
||||||
MaximumAddedTime = 18000000
|
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
<?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="Primeval Isle">
|
||||||
|
<enterLocation>9400,-21720,-3634</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> <!-- 13 hours -->
|
||||||
|
<remainRefillTime>43200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>40</minLevel>
|
||||||
|
<maxLevel>999</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="4" name="Forgotten Primeval Garden">
|
||||||
|
<enterLocation>-112937,213590,-13248</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>21600000</maxAddedTime> <!-- 6 hours -->
|
||||||
|
<remainRefillTime>18000</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>76</minLevel>
|
||||||
|
<maxLevel>999</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="11" name="Alligator Island">
|
||||||
|
<enterLocation>115528,191580,-3371</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> <!-- 1 hour -->
|
||||||
|
<resetDelay>36000000</resetDelay> <!-- 10 hours -->
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> <!-- 13 hours -->
|
||||||
|
<remainRefillTime>7200</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>60</minLevel>
|
||||||
|
<maxLevel>999</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="12" name="Antharas Lair">
|
||||||
|
<enterLocation>133247,114445,-3724</enterLocation>
|
||||||
|
<initialTime>25200000</initialTime> <!-- 7 hours -->
|
||||||
|
<resetDelay>604800000</resetDelay> <!-- 7 days -->
|
||||||
|
<maxAddedTime>151200000</maxAddedTime> <!-- 42 hours -->
|
||||||
|
<remainRefillTime>126000</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>80</minLevel>
|
||||||
|
<maxLevel>999</maxLevel>
|
||||||
|
<weekly>true</weekly>
|
||||||
|
</zone>
|
||||||
|
<!--
|
||||||
|
<zone id="101" name="Transcendent Instance Zone 1">
|
||||||
|
<enterLocation>63443,26304,-3755</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> 1 hour
|
||||||
|
<resetDelay>36000000</resetDelay> 10 hours
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> 13 hours
|
||||||
|
<remainRefillTime>3600</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>40</minLevel>
|
||||||
|
<maxLevel>49</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="102" name="Transcendent Instance Zone 2">
|
||||||
|
<enterLocation>125277,70262,-4408</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> 1 hour
|
||||||
|
<resetDelay>36000000</resetDelay> 10 hours
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> 13 hours
|
||||||
|
<remainRefillTime>3600</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>50</minLevel>
|
||||||
|
<maxLevel>59</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="103" name="Transcendent Instance Zone 3">
|
||||||
|
<enterLocation>148724,-22366,-3436</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> 1 hour
|
||||||
|
<resetDelay>36000000</resetDelay> 10 hours
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> 13 hours
|
||||||
|
<remainRefillTime>3600</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>60</minLevel>
|
||||||
|
<maxLevel>69</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="104" name="Transcendent Instance Zone 4">
|
||||||
|
<enterLocation>167965,28800,-3606</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> 1 hour
|
||||||
|
<resetDelay>36000000</resetDelay> 10 hours
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> 13 hours
|
||||||
|
<remainRefillTime>3600</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>70</minLevel>
|
||||||
|
<maxLevel>79</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="106" name="Transcendent Instance Zone 6">
|
||||||
|
<enterLocation>99797,110524,-3702</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> 1 hour
|
||||||
|
<resetDelay>36000000</resetDelay> 10 hours
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> 13 hours
|
||||||
|
<remainRefillTime>3600</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>80</minLevel>
|
||||||
|
<maxLevel>999</maxLevel>
|
||||||
|
</zone>
|
||||||
|
<zone id="107" name="Transcendent Instance Zone 7">
|
||||||
|
<enterLocation>-50416,145363,-2825</enterLocation>
|
||||||
|
<initialTime>3600000</initialTime> 1 hour
|
||||||
|
<resetDelay>36000000</resetDelay> 10 hours
|
||||||
|
<maxAddedTime>46800000</maxAddedTime> 13 hours
|
||||||
|
<remainRefillTime>3600</remainRefillTime>
|
||||||
|
<refillTimeMax>3600</refillTimeMax>
|
||||||
|
<entryFee>10000</entryFee>
|
||||||
|
<minLevel>85</minLevel>
|
||||||
|
<maxLevel>999</maxLevel>
|
||||||
|
</zone>
|
||||||
|
-->
|
||||||
|
</list>
|
||||||
Vendored
+12
-37
@@ -16,16 +16,17 @@
|
|||||||
*/
|
*/
|
||||||
package handlers.effecthandlers;
|
package handlers.effecthandlers;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.StatSet;
|
import org.l2jmobius.gameserver.model.StatSet;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneList;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
@@ -56,33 +57,15 @@ public class AddHuntingTime extends AbstractEffect
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(_zoneId);
|
||||||
|
if (holder == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||||
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_TIME))
|
if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= holder.getMaximumAddedTime()))
|
||||||
{
|
|
||||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_PRIMEVAL))
|
|
||||||
{
|
|
||||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_ALLIGATOR))
|
|
||||||
{
|
|
||||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_GARDEN))
|
|
||||||
{
|
|
||||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if ((endTime > currentTime) && (((endTime - currentTime) + _time) >= Config.TIME_LIMITED_MAX_ADDED_ANTHARAS))
|
|
||||||
{
|
{
|
||||||
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
player.getInventory().addItem("AddHuntingTime effect refund", item.getId(), 1, player, player);
|
||||||
player.sendMessage("You cannot exceed the time zone limit.");
|
player.sendMessage("You cannot exceed the time zone limit.");
|
||||||
@@ -96,17 +79,9 @@ public class AddHuntingTime extends AbstractEffect
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
if ((endTime + holder.getResetDelay()) < currentTime)
|
||||||
{
|
{
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
endTime = currentTime + holder.getInitialTime();
|
||||||
}
|
|
||||||
else if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_PRIMEVAL;
|
|
||||||
}
|
|
||||||
else if ((endTime + Config.TIME_LIMITED_ZONE_RESET_DELAY_ANTHARAS) < currentTime)
|
|
||||||
{
|
|
||||||
endTime = currentTime + Config.TIME_LIMITED_ZONE_ANTHARAS;
|
|
||||||
}
|
}
|
||||||
else if (endTime < currentTime)
|
else if (endTime < currentTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<xs:element name="list">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="zone" maxOccurs="unbounded" minOccurs="0">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element type="xs:string" name="enterLocation" />
|
||||||
|
<xs:element type="xs:int" name="initialTime" />
|
||||||
|
<xs:element type="xs:int" name="resetDelay" />
|
||||||
|
<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" />
|
||||||
|
<xs:element type="xs:short" name="minLevel" />
|
||||||
|
<xs:element type="xs:short" name="maxLevel" />
|
||||||
|
<xs:element type="xs:boolean" name="weekly" minOccurs="0" />
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:byte" name="id" use="optional" />
|
||||||
|
<xs:attribute type="xs:string" name="name" use="optional" />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
<xs:attribute type="xs:boolean" name="enabled" />
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
</xs:schema>
|
||||||
@@ -103,7 +103,6 @@ public class Config
|
|||||||
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
||||||
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||||
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
||||||
private static final String TIME_LIMITED_ZONE_CONFIG_FILE = "./config/TimeLimitedZones.ini";
|
|
||||||
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
||||||
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||||
private static final String HEXID_FILE = "./config/hexid.txt";
|
private static final String HEXID_FILE = "./config/hexid.txt";
|
||||||
@@ -851,17 +850,6 @@ public class Config
|
|||||||
public static String TELNET_HOSTNAME;
|
public static String TELNET_HOSTNAME;
|
||||||
public static List<String> TELNET_HOSTS;
|
public static List<String> TELNET_HOSTS;
|
||||||
public static int TELNET_PORT;
|
public static int TELNET_PORT;
|
||||||
public static long TIME_LIMITED_ZONE_INITIAL_TIME;
|
|
||||||
public static long TIME_LIMITED_ZONE_PRIMEVAL;
|
|
||||||
public static long TIME_LIMITED_ZONE_ANTHARAS;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_PRIMEVAL;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_ALLIGATOR;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_GARDEN;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_ANTHARAS;
|
|
||||||
public static long TIME_LIMITED_MAX_ADDED_TIME;
|
|
||||||
public static long TIME_LIMITED_ZONE_RESET_DELAY;
|
|
||||||
public static long TIME_LIMITED_ZONE_RESET_DELAY_ANTHARAS;
|
|
||||||
public static long TIME_LIMITED_ZONE_TELEPORT_FEE;
|
|
||||||
public static boolean TRAINING_CAMP_ENABLE;
|
public static boolean TRAINING_CAMP_ENABLE;
|
||||||
public static boolean TRAINING_CAMP_PREMIUM_ONLY;
|
public static boolean TRAINING_CAMP_PREMIUM_ONLY;
|
||||||
public static int TRAINING_CAMP_MAX_DURATION;
|
public static int TRAINING_CAMP_MAX_DURATION;
|
||||||
@@ -1917,20 +1905,6 @@ public class Config
|
|||||||
TELNET_PASSWORD = telnetSettings.getString("Password", "");
|
TELNET_PASSWORD = telnetSettings.getString("Password", "");
|
||||||
TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(","));
|
TELNET_HOSTS = Arrays.asList(telnetSettings.getString("ListOfHosts", "127.0.0.1,::1").split(","));
|
||||||
|
|
||||||
// Load Time Limited Zone config file (if exists)
|
|
||||||
final PropertiesParser timeLimitedZoneSettings = new PropertiesParser(TIME_LIMITED_ZONE_CONFIG_FILE);
|
|
||||||
TIME_LIMITED_ZONE_PRIMEVAL = timeLimitedZoneSettings.getLong("PrimevalStart", 7200000);
|
|
||||||
TIME_LIMITED_ZONE_ANTHARAS = timeLimitedZoneSettings.getLong("AntharasLairStart", 25200000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_PRIMEVAL = timeLimitedZoneSettings.getLong("PrimevalMaxTime", 46800000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_ALLIGATOR = timeLimitedZoneSettings.getLong("AlligatorMaxTime", 10800000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_GARDEN = timeLimitedZoneSettings.getLong("PrimevalGardenMaxTime", 21600000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_ANTHARAS = timeLimitedZoneSettings.getLong("AntharasLairMaxTime", 151200000);
|
|
||||||
TIME_LIMITED_ZONE_INITIAL_TIME = timeLimitedZoneSettings.getLong("InitialTime", 3600000);
|
|
||||||
TIME_LIMITED_MAX_ADDED_TIME = timeLimitedZoneSettings.getLong("MaximumAddedTime", 18000000);
|
|
||||||
TIME_LIMITED_ZONE_RESET_DELAY = timeLimitedZoneSettings.getLong("ResetDelay", 36000000);
|
|
||||||
TIME_LIMITED_ZONE_RESET_DELAY_ANTHARAS = timeLimitedZoneSettings.getLong("AntharasLairResetDelay", 604800000);
|
|
||||||
TIME_LIMITED_ZONE_TELEPORT_FEE = timeLimitedZoneSettings.getLong("TeleportFee", 10000);
|
|
||||||
|
|
||||||
// Load Magic Lamp config file (if exists)
|
// Load Magic Lamp config file (if exists)
|
||||||
final PropertiesParser magicLampSettings = new PropertiesParser(MAGIC_LAMP_FILE);
|
final PropertiesParser magicLampSettings = new PropertiesParser(MAGIC_LAMP_FILE);
|
||||||
ENABLE_MAGIC_LAMP = magicLampSettings.getBoolean("MagicLampEnabled", false);
|
ENABLE_MAGIC_LAMP = magicLampSettings.getBoolean("MagicLampEnabled", false);
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ import org.l2jmobius.gameserver.data.xml.SpawnData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.StaticObjectData;
|
import org.l2jmobius.gameserver.data.xml.StaticObjectData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TeleportListData;
|
import org.l2jmobius.gameserver.data.xml.TeleportListData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TeleporterData;
|
import org.l2jmobius.gameserver.data.xml.TeleporterData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.data.xml.TransformData;
|
import org.l2jmobius.gameserver.data.xml.TransformData;
|
||||||
import org.l2jmobius.gameserver.data.xml.VariationData;
|
import org.l2jmobius.gameserver.data.xml.VariationData;
|
||||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||||
@@ -357,6 +358,7 @@ public class GameServer
|
|||||||
CrestTable.getInstance();
|
CrestTable.getInstance();
|
||||||
TeleportListData.getInstance();
|
TeleportListData.getInstance();
|
||||||
TeleporterData.getInstance();
|
TeleporterData.getInstance();
|
||||||
|
TimedHuntingZoneData.getInstance();
|
||||||
MatchingRoomManager.getInstance();
|
MatchingRoomManager.getInstance();
|
||||||
PetitionManager.getInstance();
|
PetitionManager.getInstance();
|
||||||
CursedWeaponsManager.getInstance();
|
CursedWeaponsManager.getInstance();
|
||||||
|
|||||||
+186
@@ -0,0 +1,186 @@
|
|||||||
|
/*
|
||||||
|
* 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.data.xml;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.NamedNodeMap;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
|
import org.l2jmobius.commons.util.IXmlReader;
|
||||||
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneData implements IXmlReader
|
||||||
|
{
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(TimedHuntingZoneData.class.getName());
|
||||||
|
|
||||||
|
private final Map<Integer, TimedHuntingZoneHolder> _timedHuntingZoneData = new HashMap<>();
|
||||||
|
|
||||||
|
protected TimedHuntingZoneData()
|
||||||
|
{
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load()
|
||||||
|
{
|
||||||
|
_timedHuntingZoneData.clear();
|
||||||
|
parseDatapackFile("data/TimedHuntingZoneData.xml");
|
||||||
|
|
||||||
|
if (!_timedHuntingZoneData.isEmpty())
|
||||||
|
{
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _timedHuntingZoneData.size() + " timed hunting zones.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": System is disabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void parseDocument(Document doc, File f)
|
||||||
|
{
|
||||||
|
for (Node xmlNode = doc.getFirstChild(); xmlNode != null; xmlNode = xmlNode.getNextSibling())
|
||||||
|
{
|
||||||
|
if ("list".equalsIgnoreCase(xmlNode.getNodeName()))
|
||||||
|
{
|
||||||
|
final NamedNodeMap listAttributes = xmlNode.getAttributes();
|
||||||
|
final Node attribute = listAttributes.getNamedItem("enabled");
|
||||||
|
if ((attribute != null) && Boolean.parseBoolean(attribute.getNodeValue()))
|
||||||
|
{
|
||||||
|
for (Node listNode = xmlNode.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
|
||||||
|
{
|
||||||
|
if ("zone".equalsIgnoreCase(listNode.getNodeName()))
|
||||||
|
{
|
||||||
|
final NamedNodeMap zoneAttributes = listNode.getAttributes();
|
||||||
|
int id = parseInteger(zoneAttributes, "id");
|
||||||
|
String name = parseString(zoneAttributes, "name", "");
|
||||||
|
int initialTime = 0;
|
||||||
|
int maxAddedTime = 0;
|
||||||
|
int resetDelay = 0;
|
||||||
|
int entryItemId = 57;
|
||||||
|
int entryFee = 10000;
|
||||||
|
int minLevel = 1;
|
||||||
|
int maxLevel = 999;
|
||||||
|
int remainRefillTime = 3600;
|
||||||
|
int refillTimeMax = 3600;
|
||||||
|
boolean weekly = false;
|
||||||
|
Location enterLocation = null;
|
||||||
|
for (Node zoneNode = listNode.getFirstChild(); zoneNode != null; zoneNode = zoneNode.getNextSibling())
|
||||||
|
{
|
||||||
|
switch (zoneNode.getNodeName())
|
||||||
|
{
|
||||||
|
case "enterLocation":
|
||||||
|
{
|
||||||
|
final String[] coordinates = zoneNode.getTextContent().split(",");
|
||||||
|
enterLocation = new Location(Integer.parseInt(coordinates[0]), Integer.parseInt(coordinates[1]), Integer.parseInt(coordinates[2]));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "initialTime":
|
||||||
|
{
|
||||||
|
initialTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "maxAddedTime":
|
||||||
|
{
|
||||||
|
maxAddedTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "resetDelay":
|
||||||
|
{
|
||||||
|
resetDelay = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "entryItemId":
|
||||||
|
{
|
||||||
|
entryItemId = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "entryFee":
|
||||||
|
{
|
||||||
|
entryFee = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "minLevel":
|
||||||
|
{
|
||||||
|
minLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "maxLevel":
|
||||||
|
{
|
||||||
|
maxLevel = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "remainRefillTime":
|
||||||
|
{
|
||||||
|
remainRefillTime = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "refillTimeMax":
|
||||||
|
{
|
||||||
|
refillTimeMax = Integer.parseInt(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "weekly":
|
||||||
|
{
|
||||||
|
weekly = Boolean.parseBoolean(zoneNode.getTextContent());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_timedHuntingZoneData.put(id, new TimedHuntingZoneHolder(id, name, initialTime, maxAddedTime, resetDelay, entryItemId, entryFee, minLevel, maxLevel, remainRefillTime, refillTimeMax, weekly, enterLocation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimedHuntingZoneHolder getHuntingZone(int zoneId)
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.get(zoneId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<TimedHuntingZoneHolder> getAllHuntingZones()
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSize()
|
||||||
|
{
|
||||||
|
return _timedHuntingZoneData.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TimedHuntingZoneData getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final TimedHuntingZoneData INSTANCE = new TimedHuntingZoneData();
|
||||||
|
}
|
||||||
|
}
|
||||||
+20
-56
@@ -83,6 +83,7 @@ import org.l2jmobius.gameserver.data.xml.RecipeData;
|
|||||||
import org.l2jmobius.gameserver.data.xml.SendMessageLocalisationData;
|
import org.l2jmobius.gameserver.data.xml.SendMessageLocalisationData;
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||||
import org.l2jmobius.gameserver.data.xml.SkillTreeData;
|
import org.l2jmobius.gameserver.data.xml.SkillTreeData;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.enums.AdminTeleportType;
|
import org.l2jmobius.gameserver.enums.AdminTeleportType;
|
||||||
import org.l2jmobius.gameserver.enums.BroochJewel;
|
import org.l2jmobius.gameserver.enums.BroochJewel;
|
||||||
import org.l2jmobius.gameserver.enums.CastleSide;
|
import org.l2jmobius.gameserver.enums.CastleSide;
|
||||||
@@ -233,6 +234,7 @@ import org.l2jmobius.gameserver.model.holders.PreparedMultisellListHolder;
|
|||||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SkillUseHolder;
|
import org.l2jmobius.gameserver.model.holders.SkillUseHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
import org.l2jmobius.gameserver.model.holders.SubClassHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.TrainingHolder;
|
import org.l2jmobius.gameserver.model.holders.TrainingHolder;
|
||||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||||
import org.l2jmobius.gameserver.model.interfaces.ILocational;
|
import org.l2jmobius.gameserver.model.interfaces.ILocational;
|
||||||
@@ -14430,20 +14432,6 @@ public class PlayerInstance extends Playable
|
|||||||
return _autoUseSettings;
|
return _autoUseSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int x, int y)
|
|
||||||
{
|
|
||||||
return isInTimedHuntingZone(1, x, y) // Primeval Isle
|
|
||||||
|| isInTimedHuntingZone(4, x, y) // Primeval Garden
|
|
||||||
|| isInTimedHuntingZone(11, x, y) // Aligator Island
|
|
||||||
|| isInTimedHuntingZone(12, x, y) // Antharas Lair
|
|
||||||
|| isInTimedHuntingZone(101, x, y) // Transcendent Instance Zone 1
|
|
||||||
|| isInTimedHuntingZone(102, x, y) // Transcendent Instance Zone 2
|
|
||||||
|| isInTimedHuntingZone(103, x, y) // Transcendent Instance Zone 3
|
|
||||||
|| isInTimedHuntingZone(104, x, y) // Transcendent Instance Zone 4
|
|
||||||
|| isInTimedHuntingZone(106, x, y) // Transcendent Instance Zone 6
|
|
||||||
|| isInTimedHuntingZone(107, x, y); // Transcendent Instance Zone 7
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId)
|
public boolean isInTimedHuntingZone(int zoneId)
|
||||||
{
|
{
|
||||||
return isInTimedHuntingZone(zoneId, getX(), getY());
|
return isInTimedHuntingZone(zoneId, getX(), getY());
|
||||||
@@ -14451,50 +14439,21 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
public boolean isInTimedHuntingZone(int zoneId, int locX, int locY)
|
||||||
{
|
{
|
||||||
final int x = ((locX - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId);
|
||||||
final int y = ((locY - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
if (holder == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
switch (zoneId)
|
public boolean isInTimedHuntingZone(int x, int y)
|
||||||
{
|
{
|
||||||
case 1: // Primeval Isle
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
{
|
{
|
||||||
return (x == 20) && (y == 17);
|
if (isInTimedHuntingZone(holder.getZoneId(), x, y))
|
||||||
}
|
|
||||||
case 4: // Primeval Garden
|
|
||||||
{
|
{
|
||||||
return (x == 24) && (y == 19);
|
return true;
|
||||||
}
|
|
||||||
case 11: // Primeval Garden
|
|
||||||
{
|
|
||||||
return (x == 23) && (y == 23);
|
|
||||||
}
|
|
||||||
case 12: // Antharas Lair
|
|
||||||
{
|
|
||||||
return (x == 25) && (y == 21);
|
|
||||||
}
|
|
||||||
case 101: // Transcendent Instance Zone 1
|
|
||||||
{
|
|
||||||
return (x == 21) && (y == 18);
|
|
||||||
}
|
|
||||||
case 102: // Transcendent Instance Zone 2
|
|
||||||
{
|
|
||||||
return (x == 23) && (y == 19);
|
|
||||||
}
|
|
||||||
case 103: // Transcendent Instance Zone 3
|
|
||||||
{
|
|
||||||
return (x == 24) && (y == 17);
|
|
||||||
}
|
|
||||||
case 104: // Transcendent Instance Zone 4
|
|
||||||
{
|
|
||||||
return (x == 24) && (y == 18);
|
|
||||||
}
|
|
||||||
case 106: // Transcendent Instance Zone 6
|
|
||||||
{
|
|
||||||
return (x == 23) && (y == 21);
|
|
||||||
}
|
|
||||||
case 107: // Transcendent Instance Zone 7
|
|
||||||
{
|
|
||||||
return (x == 18) && (y == 22);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -14538,9 +14497,14 @@ public class PlayerInstance extends Playable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTimedHuntingZoneRemainingTime(int zoneId)
|
public int getTimedHuntingZoneRemainingTime(int zoneId)
|
||||||
{
|
{
|
||||||
return Math.max(getVariables().getLong(PlayerVariables.HUNTING_ZONE_TIME + zoneId, 0), 0);
|
return Math.max(getVariables().getInt(PlayerVariables.HUNTING_ZONE_TIME + zoneId, 0), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTimedHuntingZoneInitialEntry(int zoneId)
|
||||||
|
{
|
||||||
|
return Math.max(getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + zoneId, 0), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restoreRandomCraft()
|
private void restoreRandomCraft()
|
||||||
|
|||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the L2J Mobius project.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.l2jmobius.gameserver.model.holders;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
|
import org.l2jmobius.gameserver.model.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class TimedHuntingZoneHolder
|
||||||
|
{
|
||||||
|
private final int _id;
|
||||||
|
private final String _name;
|
||||||
|
private final int _initialTime;
|
||||||
|
private final int _maximumAddedTime;
|
||||||
|
private final int _resetDelay;
|
||||||
|
private final int _entryItemId;
|
||||||
|
private final int _entryFee;
|
||||||
|
private final int _minLevel;
|
||||||
|
private final int _maxLevel;
|
||||||
|
private final int _remainRefillTime;
|
||||||
|
private final int _refillTimeMax;
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
_id = id;
|
||||||
|
_name = name;
|
||||||
|
_initialTime = initialTime;
|
||||||
|
_maximumAddedTime = maximumAddedTime;
|
||||||
|
_resetDelay = resetDelay;
|
||||||
|
_entryItemId = entryItemId;
|
||||||
|
_entryFee = entryFee;
|
||||||
|
_minLevel = minLevel;
|
||||||
|
_maxLevel = maxLevel;
|
||||||
|
_remainRefillTime = remainRefillTime;
|
||||||
|
_refillTimeMax = refillTimeMax;
|
||||||
|
_weekly = weekly;
|
||||||
|
_enterLocation = enterLocation;
|
||||||
|
_mapX = ((_enterLocation.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN;
|
||||||
|
_mapY = ((_enterLocation.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZoneId()
|
||||||
|
{
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZoneName()
|
||||||
|
{
|
||||||
|
return _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInitialTime()
|
||||||
|
{
|
||||||
|
return _initialTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaximumAddedTime()
|
||||||
|
{
|
||||||
|
return _maximumAddedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getResetDelay()
|
||||||
|
{
|
||||||
|
return _resetDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEntryItemId()
|
||||||
|
{
|
||||||
|
return _entryItemId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEntryFee()
|
||||||
|
{
|
||||||
|
return _entryFee;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinLevel()
|
||||||
|
{
|
||||||
|
return _minLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxLevel()
|
||||||
|
{
|
||||||
|
return _maxLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRemainRefillTime()
|
||||||
|
{
|
||||||
|
return _remainRefillTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRefillTimeMax()
|
||||||
|
{
|
||||||
|
return _refillTimeMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWeekly()
|
||||||
|
{
|
||||||
|
return _weekly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getEnterLocation()
|
||||||
|
{
|
||||||
|
return _enterLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMapX()
|
||||||
|
{
|
||||||
|
return _mapX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMapY()
|
||||||
|
{
|
||||||
|
return _mapY;
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
-49
@@ -16,13 +16,15 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.zone.type;
|
package org.l2jmobius.gameserver.model.zone.type;
|
||||||
|
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||||
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.sessionzones.TimedHuntingZoneExit;
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneExit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mobius
|
* @author Mobius
|
||||||
@@ -42,58 +44,23 @@ public class TimedHuntingZone extends ZoneType
|
|||||||
{
|
{
|
||||||
player.setInsideZone(ZoneId.TIMED_HUNTING, true);
|
player.setInsideZone(ZoneId.TIMED_HUNTING, true);
|
||||||
|
|
||||||
final long primevalIsleExitTime = player.getTimedHuntingZoneRemainingTime(1);
|
for (TimedHuntingZoneHolder holder : TimedHuntingZoneData.getInstance().getAllHuntingZones())
|
||||||
final long primevalGardenExitTime = player.getTimedHuntingZoneRemainingTime(4);
|
{
|
||||||
final long alligatorIslandExitTime = player.getTimedHuntingZoneRemainingTime(11);
|
if (!player.isInTimedHuntingZone(holder.getZoneId()))
|
||||||
final long antharasLairExitTime = player.getTimedHuntingZoneRemainingTime(12);
|
{
|
||||||
final long transcendent1ExitTime = player.getTimedHuntingZoneRemainingTime(101);
|
continue;
|
||||||
final long transcendent2ExitTime = player.getTimedHuntingZoneRemainingTime(102);
|
}
|
||||||
final long transcendent3ExitTime = player.getTimedHuntingZoneRemainingTime(103);
|
|
||||||
final long transcendent4ExitTime = player.getTimedHuntingZoneRemainingTime(104);
|
|
||||||
final long transcendent6ExitTime = player.getTimedHuntingZoneRemainingTime(106);
|
|
||||||
final long transcendent7ExitTime = player.getTimedHuntingZoneRemainingTime(107);
|
|
||||||
|
|
||||||
if ((primevalIsleExitTime > 0) && player.isInTimedHuntingZone(1))
|
final int remainingTime = player.getTimedHuntingZoneRemainingTime(holder.getZoneId());
|
||||||
|
if (remainingTime > 0)
|
||||||
{
|
{
|
||||||
player.startTimedHuntingZone(1, primevalIsleExitTime);
|
player.startTimedHuntingZone(holder.getZoneId(), remainingTime);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if ((primevalGardenExitTime > 0) && player.isInTimedHuntingZone(4))
|
break;
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(4, primevalGardenExitTime);
|
|
||||||
}
|
}
|
||||||
else if ((alligatorIslandExitTime > 0) && player.isInTimedHuntingZone(11))
|
|
||||||
{
|
if (!player.isGM())
|
||||||
player.startTimedHuntingZone(11, alligatorIslandExitTime);
|
|
||||||
}
|
|
||||||
else if ((antharasLairExitTime > 0) && player.isInTimedHuntingZone(12))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(12, antharasLairExitTime);
|
|
||||||
}
|
|
||||||
else if ((transcendent1ExitTime > 0) && player.isInTimedHuntingZone(101))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(101, transcendent1ExitTime);
|
|
||||||
}
|
|
||||||
else if ((transcendent2ExitTime > 0) && player.isInTimedHuntingZone(102))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(102, transcendent2ExitTime);
|
|
||||||
}
|
|
||||||
else if ((transcendent3ExitTime > 0) && player.isInTimedHuntingZone(103))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(103, transcendent3ExitTime);
|
|
||||||
}
|
|
||||||
else if ((transcendent4ExitTime > 0) && player.isInTimedHuntingZone(104))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(104, transcendent4ExitTime);
|
|
||||||
}
|
|
||||||
else if ((transcendent6ExitTime > 0) && player.isInTimedHuntingZone(106))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(106, transcendent6ExitTime);
|
|
||||||
}
|
|
||||||
else if ((transcendent7ExitTime > 0) && player.isInTimedHuntingZone(107))
|
|
||||||
{
|
|
||||||
player.startTimedHuntingZone(107, transcendent7ExitTime);
|
|
||||||
}
|
|
||||||
else if (!player.isGM())
|
|
||||||
{
|
{
|
||||||
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN));
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -80,6 +80,8 @@ import org.l2jmobius.gameserver.network.clientpackets.ensoul.RequestItemEnsoul;
|
|||||||
import org.l2jmobius.gameserver.network.clientpackets.ensoul.RequestTryEnSoulExtraction;
|
import org.l2jmobius.gameserver.network.clientpackets.ensoul.RequestTryEnSoulExtraction;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.equipmentupgrade.RequestUpgradeSystemResult;
|
import org.l2jmobius.gameserver.network.clientpackets.equipmentupgrade.RequestUpgradeSystemResult;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
import org.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
||||||
|
import org.l2jmobius.gameserver.network.clientpackets.huntingzones.ExTimedHuntingZoneEnter;
|
||||||
|
import org.l2jmobius.gameserver.network.clientpackets.huntingzones.ExTimedHuntingZoneList;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.limitshop.RequestPurchaseLimitShopItemBuy;
|
import org.l2jmobius.gameserver.network.clientpackets.limitshop.RequestPurchaseLimitShopItemBuy;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.limitshop.RequestPurchaseLimitShopItemList;
|
import org.l2jmobius.gameserver.network.clientpackets.limitshop.RequestPurchaseLimitShopItemList;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
||||||
@@ -114,8 +116,6 @@ import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingChar
|
|||||||
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharRankers;
|
import org.l2jmobius.gameserver.network.clientpackets.ranking.RequestRankingCharRankers;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
|
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMove;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
|
import org.l2jmobius.gameserver.network.clientpackets.sayune.RequestFlyMoveStart;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sessionzones.ExTimedHuntingZoneEnter;
|
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.sessionzones.ExTimedHuntingZoneList;
|
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.CannotMoveAnymoreInShuttle;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.MoveToLocationInShuttle;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
|
import org.l2jmobius.gameserver.network.clientpackets.shuttle.RequestShuttleGetOff;
|
||||||
|
|||||||
+26
-66
@@ -14,15 +14,18 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.sessionzones;
|
package org.l2jmobius.gameserver.network.clientpackets.huntingzones;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.commons.util.Chronos;
|
import org.l2jmobius.commons.util.Chronos;
|
||||||
|
import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder;
|
||||||
|
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||||
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,95 +87,52 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((_zoneId == 1) && (player.getLevel() < 40)) //
|
final TimedHuntingZoneHolder holder = TimedHuntingZoneData.getInstance().getHuntingZone(_zoneId);
|
||||||
|| ((_zoneId == 4) && (player.getLevel() < 76)) //
|
if (holder == null)
|
||||||
|| ((_zoneId == 11) && (player.getLevel() < 60)) //
|
{
|
||||||
|| ((_zoneId == 12) && (player.getLevel() < 80)) //
|
return;
|
||||||
|| ((_zoneId == 101) && (player.getLevel() < 40)) //
|
}
|
||||||
)
|
|
||||||
|
if ((player.getLevel() < holder.getMinLevel()) || (player.getLevel() > holder.getMaxLevel()))
|
||||||
{
|
{
|
||||||
player.sendMessage("Your level does not correspond the zone equivalent.");
|
player.sendMessage("Your level does not correspond the zone equivalent.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long currentTime = Chronos.currentTimeMillis();
|
final long currentTime = Chronos.currentTimeMillis();
|
||||||
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
long endTime = currentTime + player.getTimedHuntingZoneRemainingTime(_zoneId);
|
||||||
final long lastEntryTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, 0);
|
final long lastEntryTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, 0);
|
||||||
if ((lastEntryTime + Config.TIME_LIMITED_ZONE_RESET_DELAY) < currentTime)
|
if ((lastEntryTime + holder.getResetDelay()) < currentTime)
|
||||||
{
|
{
|
||||||
if (endTime == currentTime)
|
if (endTime == currentTime)
|
||||||
{
|
{
|
||||||
endTime += Config.TIME_LIMITED_ZONE_INITIAL_TIME;
|
endTime += holder.getInitialTime();
|
||||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, currentTime);
|
player.getVariables().set(PlayerVariables.HUNTING_ZONE_ENTRY + _zoneId, currentTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endTime > currentTime)
|
if (endTime > currentTime)
|
||||||
{
|
{
|
||||||
if (player.getAdena() > Config.TIME_LIMITED_ZONE_TELEPORT_FEE)
|
if (holder.getEntryItemId() == Inventory.ADENA_ID)
|
||||||
{
|
{
|
||||||
player.reduceAdena("TimedHuntingZone", Config.TIME_LIMITED_ZONE_TELEPORT_FEE, player, true);
|
if (player.getAdena() > holder.getEntryFee())
|
||||||
|
{
|
||||||
|
player.reduceAdena("TimedHuntingZone", holder.getEntryFee(), player, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendMessage("Not enough adena.");
|
player.sendMessage("Not enough adena.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (!player.destroyItemByItemId("TimedHuntingZone", holder.getEntryItemId(), holder.getEntryFee(), player, true))
|
||||||
|
{
|
||||||
|
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_REQUIRED_ITEMS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
player.getVariables().set(PlayerVariables.HUNTING_ZONE_TIME + _zoneId, endTime - currentTime);
|
||||||
|
player.teleToLocation(holder.getEnterLocation());
|
||||||
switch (_zoneId)
|
|
||||||
{
|
|
||||||
case 1: // Primeval Isle
|
|
||||||
{
|
|
||||||
player.teleToLocation(9400, -21720, -3634);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 4: // Forgotten Primeval Garden
|
|
||||||
{
|
|
||||||
player.teleToLocation(-112937, 213590, -13248);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 11: // Aligator Island
|
|
||||||
{
|
|
||||||
player.teleToLocation(115528, 191580, -3371);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 12: // Antharas Lair
|
|
||||||
{
|
|
||||||
player.teleToLocation(133247, 114445, -3724);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 101: // Transcendent Instance Zone 1
|
|
||||||
{
|
|
||||||
player.teleToLocation(63443, 26304, -3755);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 102: // Transcendent Instance Zone 2
|
|
||||||
{
|
|
||||||
player.teleToLocation(125277, 70262, -4408);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 103: // Transcendent Instance Zone 3
|
|
||||||
{
|
|
||||||
player.teleToLocation(148724, -22366, -3436);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 104: // Transcendent Instance Zone 4
|
|
||||||
{
|
|
||||||
player.teleToLocation(167965, 28800, -3606);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 106: // Transcendent Instance Zone 6
|
|
||||||
{
|
|
||||||
player.teleToLocation(99797, 110524, -3702);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 107: // Transcendent Instance Zone 7
|
|
||||||
{
|
|
||||||
player.teleToLocation(-50416, 145363, -2825);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* 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.clientpackets.huntingzones;
|
||||||
|
|
||||||
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mobius
|
||||||
|
*/
|
||||||
|
public class ExTimedHuntingZoneList implements IClientIncomingPacket
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public boolean read(GameClient client, PacketReader packet)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(GameClient client)
|
||||||
|
{
|
||||||
|
final PlayerInstance player = client.getPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
client.sendPacket(new TimedHuntingZoneList(player));
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user