");
+ return sb.toString();
+ });
+ msg.replace("%name%", holder.getName());
+ msg.replace("%pages%", result.getPagerTemplate());
+ msg.replace("%nodes%", result.getBodyTemplate());
+ activeChar.sendPacket(msg);
+ }
+
+ protected class ZoneNodeHolder
+ {
+ private String _name = "";
+ private Location _changingLoc = null;
+ private final List _nodes = new ArrayList<>();
+
+ public void setName(String name)
+ {
+ _name = name;
+ }
+
+ public String getName()
+ {
+ return _name;
+ }
+
+ public void setChangingLoc(Location loc)
+ {
+ _changingLoc = loc;
+ }
+
+ public Location getChangingLoc()
+ {
+ return _changingLoc;
+ }
+
+ public void addNode(Location loc)
+ {
+ _nodes.add(loc);
+ }
+
+ public List getNodes()
+ {
+ return _nodes;
+ }
+
+ public int indexOf(Location loc)
+ {
+ return _nodes.indexOf(loc);
+ }
+ }
+}
diff --git a/L2J_Mobius_Test/dist/game/data/scripts/handlers/bypasshandlers/QuestLink.java b/L2J_Mobius_Test/dist/game/data/scripts/handlers/bypasshandlers/QuestLink.java
index 02bf55dcba..8b4c757b8e 100644
--- a/L2J_Mobius_Test/dist/game/data/scripts/handlers/bypasshandlers/QuestLink.java
+++ b/L2J_Mobius_Test/dist/game/data/scripts/handlers/bypasshandlers/QuestLink.java
@@ -175,17 +175,7 @@ public class QuestLink implements IBypassHandler
}
else
{
- int questId = quest.getId();
- if (questId > 10000)
- {
- questId -= 5000;
- }
- else if (questId == 146)
- {
- questId = 640;
- }
-
- StringUtil.append(sb, "", String.valueOf(questId), state, "");
+ StringUtil.append(sb, "", String.valueOf(quest.getNpcStringId()), state, "");
}
sb.append("");
}
diff --git a/L2J_Mobius_Test/dist/game/data/scripts/quests/Q00146_TheZeroHour/Q00146_TheZeroHour.java b/L2J_Mobius_Test/dist/game/data/scripts/quests/Q00146_TheZeroHour/Q00146_TheZeroHour.java
index 002245f424..c9ead5de6e 100644
--- a/L2J_Mobius_Test/dist/game/data/scripts/quests/Q00146_TheZeroHour/Q00146_TheZeroHour.java
+++ b/L2J_Mobius_Test/dist/game/data/scripts/quests/Q00146_TheZeroHour/Q00146_TheZeroHour.java
@@ -46,6 +46,12 @@ public class Q00146_TheZeroHour extends Quest
registerQuestItems(FANG);
}
+ @Override
+ public int getNpcStringId()
+ {
+ return 640;
+ }
+
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java
index 2be18c6b8e..a7942e3e83 100644
--- a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java
@@ -17,6 +17,7 @@
package com.l2jmobius.gameserver.engines.items;
import java.io.File;
+import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
@@ -106,7 +107,7 @@ public final class DocumentItem extends DocumentBase
_currentItem.set.set("name", itemName);
_currentItem.set.set("additionalName", additionalName);
- final Node first = n.getFirstChild();
+ Node first = n.getFirstChild();
for (n = first; n != null; n = n.getNextSibling())
{
if ("table".equalsIgnoreCase(n.getNodeName()))
@@ -133,9 +134,9 @@ public final class DocumentItem extends DocumentBase
else if ("cond".equalsIgnoreCase(n.getNodeName()))
{
makeItem();
- final Condition condition = parseCondition(n.getFirstChild(), _currentItem.item);
- final Node msg = n.getAttributes().getNamedItem("msg");
- final Node msgId = n.getAttributes().getNamedItem("msgId");
+ Condition condition = parseCondition(n.getFirstChild(), _currentItem.item);
+ Node msg = n.getAttributes().getNamedItem("msg");
+ Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -143,7 +144,8 @@ public final class DocumentItem extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
- if ((n.getAttributes().getNamedItem("addName") != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
+ Node addName = n.getAttributes().getNamedItem("addName");
+ if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
}
@@ -157,13 +159,17 @@ public final class DocumentItem extends DocumentBase
private void makeItem() throws InvocationTargetException
{
+ // If item exists just reload the data.
if (_currentItem.item != null)
{
- return; // item is already created
+ _currentItem.item.set(_currentItem.set);
+ return;
}
+
try
{
- _currentItem.item = (L2Item) Class.forName("com.l2jmobius.gameserver.model.items.L2" + _currentItem.type).getConstructor(StatsSet.class).newInstance(_currentItem.set);
+ final Constructor> itemClass = Class.forName("com.l2jmobius.gameserver.model.items.L2" + _currentItem.type).getConstructor(StatsSet.class);
+ _currentItem.item = (L2Item) itemClass.newInstance(_currentItem.set);
}
catch (Exception e)
{
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/enums/PlayerAction.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/enums/PlayerAction.java
index a4f5f5aa8f..722babb84a 100644
--- a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/enums/PlayerAction.java
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/enums/PlayerAction.java
@@ -22,6 +22,8 @@ package com.l2jmobius.gameserver.enums;
public enum PlayerAction
{
ADMIN_COMMAND,
+ ADMIN_POINT_PICKING,
+ ADMIN_SHOW_TERRITORY,
USER_ENGAGE;
private final int _mask;
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java
index 5fc0e039fc..853ad73aad 100644
--- a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java
@@ -47,7 +47,11 @@ public final class QuestManager
public boolean reload(String questFolder)
{
final Quest q = getQuest(questFolder);
- return (q != null) && q.reload();
+ if (q == null)
+ {
+ return false;
+ }
+ return q.reload();
}
/**
@@ -58,7 +62,11 @@ public final class QuestManager
public boolean reload(int questId)
{
final Quest q = getQuest(questId);
- return (q != null) && q.reload();
+ if (q == null)
+ {
+ return false;
+ }
+ return q.reload();
}
/**
@@ -110,20 +118,20 @@ public final class QuestManager
}
/**
- * Calls {@link Quest#saveGlobalData()} in all quests and scripts.
+ * Calls {@link Quest#onSave()} in all quests and scripts.
*/
public void save()
{
// Save quests.
for (Quest quest : _quests.values())
{
- quest.saveGlobalData();
+ quest.onSave();
}
// Save scripts.
for (Quest script : _scripts.values())
{
- script.saveGlobalData();
+ script.onSave();
}
}
@@ -135,7 +143,11 @@ public final class QuestManager
*/
public Quest getQuest(String name)
{
- return _quests.containsKey(name) ? _quests.get(name) : _scripts.get(name);
+ if (_quests.containsKey(name))
+ {
+ return _quests.get(name);
+ }
+ return _scripts.get(name);
}
/**
@@ -180,11 +192,13 @@ public final class QuestManager
{
old.unload();
_log.info(getClass().getSimpleName() + ": Replaced quest " + old.getName() + " (" + old.getId() + ") with a new version!");
+
}
if (Config.ALT_DEV_SHOW_QUESTS_LOAD_IN_LOGS)
{
- _log.info("Loaded quest " + Util.splitWords(quest.getName().contains("_") ? quest.getName().substring(quest.getName().indexOf('_') + 1) : quest.getName()) + ".");
+ final String questName = quest.getName().contains("_") ? quest.getName().substring(quest.getName().indexOf('_') + 1) : quest.getName();
+ _log.info("Loaded quest " + Util.splitWords(questName) + ".");
}
}
@@ -215,7 +229,7 @@ public final class QuestManager
public boolean unload(Quest ms)
{
- ms.saveGlobalData();
+ ms.onSave();
return removeScript(ms);
}
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/events/EventType.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/events/EventType.java
index 755b0861f4..7ad8a419b8 100644
--- a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/events/EventType.java
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/events/EventType.java
@@ -62,6 +62,7 @@ import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerKarma
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLevelChanged;
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogin;
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
+import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPKChanged;
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerProfessionChange;
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerPvPChanged;
@@ -221,6 +222,7 @@ public enum EventType
ON_PLAYER_LOGIN(OnPlayerLogin.class, void.class),
ON_PLAYER_LOGOUT(OnPlayerLogout.class, void.class),
ON_PLAYER_PK_CHANGED(OnPlayerPKChanged.class, void.class),
+ ON_PLAYER_MOVE_REQUEST(OnPlayerMoveRequest.class, void.class, TerminateReturn.class),
ON_PLAYER_PROFESSION_CHANGE(OnPlayerProfessionChange.class, void.class),
ON_PLAYER_CHANGE_TO_AWAKENED_CLASS(OnPlayerChangeToAwakenedClass.class, void.class),
ON_PLAYER_PVP_CHANGED(OnPlayerPvPChanged.class, void.class),
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerMoveRequest.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerMoveRequest.java
new file mode 100644
index 0000000000..fbb066f040
--- /dev/null
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/events/impl/character/player/OnPlayerMoveRequest.java
@@ -0,0 +1,53 @@
+/*
+ * 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 .
+ */
+package com.l2jmobius.gameserver.model.events.impl.character.player;
+
+import com.l2jmobius.gameserver.model.Location;
+import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.events.EventType;
+import com.l2jmobius.gameserver.model.events.impl.IBaseEvent;
+
+/**
+ * @author UnAfraid
+ */
+public class OnPlayerMoveRequest implements IBaseEvent
+{
+ private final L2PcInstance _activeChar;
+ private final Location _location;
+
+ public OnPlayerMoveRequest(L2PcInstance activeChar, Location loc)
+ {
+ _activeChar = activeChar;
+ _location = loc;
+ }
+
+ public L2PcInstance getActiveChar()
+ {
+ return _activeChar;
+ }
+
+ public Location getLocation()
+ {
+ return _location;
+ }
+
+ @Override
+ public EventType getType()
+ {
+ return EventType.ON_PLAYER_MOVE_REQUEST;
+ }
+}
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2Armor.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2Armor.java
index 046d948df6..66eeee3b10 100644
--- a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2Armor.java
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2Armor.java
@@ -40,6 +40,12 @@ public final class L2Armor extends L2Item
public L2Armor(StatsSet set)
{
super(set);
+ }
+
+ @Override
+ public void set(StatsSet set)
+ {
+ super.set(set);
_type = set.getEnum("armor_type", ArmorType.class, ArmorType.NONE);
final int _bodyPart = getBodyPart();
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2EtcItem.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2EtcItem.java
index 29e10372dc..574c955b88 100644
--- a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2EtcItem.java
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2EtcItem.java
@@ -32,11 +32,11 @@ public final class L2EtcItem extends L2Item
{
private String _handler;
private EtcItemType _type;
- private final boolean _isBlessed;
- private final List _extractableItems;
- private final int _extractableCountMin;
- private final int _extractableCountMax;
- private final boolean _isInfinite;
+ private boolean _isBlessed;
+ private List _extractableItems;
+ private int _extractableCountMin;
+ private int _extractableCountMax;
+ private boolean _isInfinite;
/**
* Constructor for EtcItem.
@@ -45,6 +45,12 @@ public final class L2EtcItem extends L2Item
public L2EtcItem(StatsSet set)
{
super(set);
+ }
+
+ @Override
+ public void set(StatsSet set)
+ {
+ super.set(set);
_type = set.getEnum("etcitem_type", EtcItemType.class, EtcItemType.NONE);
// l2j custom - L2EtcItemType.SHOT
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2Item.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2Item.java
index 42d3017a3c..88510e673c 100644
--- a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2Item.java
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2Item.java
@@ -66,7 +66,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
public static final int TYPE1_WEAPON_RING_EARRING_NECKLACE = 0;
public static final int TYPE1_SHIELD_ARMOR = 1;
public static final int TYPE1_ITEM_QUESTITEM_ADENA = 4;
-
+
public static final int TYPE2_WEAPON = 0;
public static final int TYPE2_SHIELD_ARMOR = 1;
public static final int TYPE2_ACCESSORY = 2;
@@ -112,43 +112,43 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
public static final int SLOT_MULTI_ALLWEAPON = SLOT_LR_HAND | SLOT_R_HAND;
- private final int _itemId;
- private final int _displayId;
- private final String _name;
- private final String _additionalName;
- private final String _icon;
- private final int _weight;
- private final boolean _stackable;
- private final MaterialType _materialType;
- private final CrystalType _crystalType;
- private final int _equipReuseDelay;
- private final int _duration;
- private final int _time;
- private final int _autoDestroyTime;
- private final int _bodyPart;
- private final int _referencePrice;
- private final int _crystalCount;
- private final boolean _sellable;
- private final boolean _dropable;
- private final boolean _destroyable;
- private final boolean _tradeable;
- private final boolean _depositable;
- private final boolean _auctionable;
- private final int _enchantable;
- private final boolean _elementable;
- private final boolean _questItem;
- private final boolean _freightable;
- private final boolean _allow_self_resurrection;
- private final boolean _is_oly_restricted;
- private final boolean _for_npc;
- private final boolean _common;
- private final boolean _heroItem;
- private final boolean _pvpItem;
- private final boolean _immediate_effect;
- private final boolean _ex_immediate_effect;
- private final int _defaultEnchantLevel;
- private final ActionType _defaultAction;
- private final boolean _isBlessedItem;
+ private int _itemId;
+ private int _displayId;
+ private String _name;
+ private String _additionalName;
+ private String _icon;
+ private int _weight;
+ private boolean _stackable;
+ private MaterialType _materialType;
+ private CrystalType _crystalType;
+ private int _equipReuseDelay;
+ private int _duration;
+ private int _time;
+ private int _autoDestroyTime;
+ private int _bodyPart;
+ private int _referencePrice;
+ private int _crystalCount;
+ private boolean _sellable;
+ private boolean _dropable;
+ private boolean _destroyable;
+ private boolean _tradeable;
+ private boolean _depositable;
+ private boolean _auctionable;
+ private int _enchantable;
+ private boolean _elementable;
+ private boolean _questItem;
+ private boolean _freightable;
+ private boolean _allow_self_resurrection;
+ private boolean _is_oly_restricted;
+ private boolean _for_npc;
+ private boolean _common;
+ private boolean _heroItem;
+ private boolean _pvpItem;
+ private boolean _immediate_effect;
+ private boolean _ex_immediate_effect;
+ private int _defaultEnchantLevel;
+ private ActionType _defaultAction;
+ private boolean _isBlessedItem;
protected int _type1; // needed for item list (inventory)
protected int _type2; // different lists for armor, weapon, etc
@@ -159,13 +159,13 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
private SkillHolder _unequipSkill = null;
private SkillHolder _equipSkill = null;
- private final int _useSkillDisTime;
- private final int _reuseDelay;
- private final int _sharedReuseGroup;
+ private int _useSkillDisTime;
+ private int _reuseDelay;
+ private int _sharedReuseGroup;
- private final CommissionItemType _commissionItemType;
- private final int _compoundItem;
- private final float _compoundChance;
+ private CommissionItemType _commissionItemType;
+ private int _compoundItem;
+ private float _compoundChance;
/**
* Constructor of the L2Item that fill class variables.
@@ -173,6 +173,11 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
* @param set : StatsSet corresponding to a set of couples (key,value) for description of the item
*/
protected L2Item(StatsSet set)
+ {
+ set(set);
+ }
+
+ public void set(StatsSet set)
{
_itemId = set.getInt("item_id");
_displayId = set.getInt("displayId", _itemId);
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2Weapon.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2Weapon.java
index a77aeba526..3a78917498 100644
--- a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2Weapon.java
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/items/L2Weapon.java
@@ -40,19 +40,19 @@ import com.l2jmobius.util.StringUtil;
*/
public final class L2Weapon extends L2Item
{
- private final WeaponType _type;
- private final boolean _isMagicWeapon;
- private final int _rndDam;
- private final int _soulShotCount;
- private final int _spiritShotCount;
- private final int _mpConsume;
- private final int _baseAttackRange;
- private final int _baseAttackAngle;
+ private WeaponType _type;
+ private boolean _isMagicWeapon;
+ private int _rndDam;
+ private int _soulShotCount;
+ private int _spiritShotCount;
+ private int _mpConsume;
+ private int _baseAttackRange;
+ private int _baseAttackAngle;
/**
* Skill that activates when item is enchanted +4 (for duals).
*/
private SkillHolder _enchant4Skill = null;
- private final int _changeWeaponId;
+ private int _changeWeaponId;
// Attached skills for Special Abilities
private SkillHolder _skillsOnMagic;
@@ -60,15 +60,15 @@ public final class L2Weapon extends L2Item
private SkillHolder _skillsOnCrit;
private Condition _skillsOnCritCondition = null;
- private final int _reducedSoulshot;
- private final int _reducedSoulshotChance;
+ private int _reducedSoulshot;
+ private int _reducedSoulshotChance;
- private final int _reducedMpConsume;
- private final int _reducedMpConsumeChance;
+ private int _reducedMpConsume;
+ private int _reducedMpConsumeChance;
- private final boolean _isForceEquip;
- private final boolean _isAttackWeapon;
- private final boolean _useWeaponSkillsOnly;
+ private boolean _isForceEquip;
+ private boolean _isAttackWeapon;
+ private boolean _useWeaponSkillsOnly;
/**
* Constructor for Weapon.
@@ -77,6 +77,12 @@ public final class L2Weapon extends L2Item
public L2Weapon(StatsSet set)
{
super(set);
+ }
+
+ @Override
+ public void set(StatsSet set)
+ {
+ super.set(set);
_type = WeaponType.valueOf(set.getString("weapon_type", "none").toUpperCase());
_type1 = L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE;
_type2 = L2Item.TYPE2_WEAPON;
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/quest/Quest.java
index 61df2357c0..91349c199c 100644
--- a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/quest/Quest.java
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/quest/Quest.java
@@ -125,7 +125,7 @@ public class Quest extends AbstractScript implements IIdentifiable
QuestManager.getInstance().addScript(this);
}
- loadGlobalData();
+ onLoad();
}
/**
@@ -151,17 +151,17 @@ public class Quest extends AbstractScript implements IIdentifiable
* Children of this class can implement this function in order to define what variables to load and what structures to save them in.
* By default, nothing is loaded.
*/
- protected void loadGlobalData()
+ protected void onLoad()
{
}
/**
- * The function saveGlobalData is, by default, called at shutdown, for all quests, by the QuestManager.
+ * The function onSave is, by default, called at shutdown, for all quests, by the QuestManager.
* Children of this class can implement this function in order to convert their structures
* into tuples and make calls to save them to the database, if needed.
* By default, nothing is saved.
*/
- public void saveGlobalData()
+ public void onSave()
{
}
@@ -175,6 +175,14 @@ public class Quest extends AbstractScript implements IIdentifiable
return _questId;
}
+ /**
+ * @return the NpcStringId of the current quest, used in Quest link bypass
+ */
+ public int getNpcStringId()
+ {
+ return _questId > 10000 ? _questId - 5000 : _questId;
+ }
+
/**
* Add a new quest state of this quest to the database.
* @param player the owner of the newly created quest state
@@ -2679,7 +2687,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public boolean unload(boolean removeFromList)
{
- saveGlobalData();
+ onSave();
// cancel all pending timers before reloading.
// if timers ought to be restarted, the quest can take care of it
// with its code (example: save global data indicating what timer must be restarted).
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java
index 3c498f9e15..b4618d99c9 100644
--- a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java
@@ -134,4 +134,14 @@ public class ZoneNPoly extends L2ZoneForm
GeoData.getInstance().getHeight(x, y, _z1)
};
}
+
+ public int[] getX()
+ {
+ return _p.xpoints;
+ }
+
+ public int[] getY()
+ {
+ return _p.ypoints;
+ }
}
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java
index 236fab19d0..1d12cbb94a 100644
--- a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java
@@ -24,6 +24,9 @@ import com.l2jmobius.gameserver.instancemanager.JumpManager;
import com.l2jmobius.gameserver.instancemanager.JumpManager.JumpWay;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jmobius.gameserver.model.events.EventDispatcher;
+import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerMoveRequest;
+import com.l2jmobius.gameserver.model.events.returns.TerminateReturn;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import com.l2jmobius.gameserver.network.serverpackets.ExFlyMove;
@@ -46,7 +49,6 @@ public class MoveBackwardToLocation extends L2GameClientPacket
private int _originY;
private int _originZ;
- @SuppressWarnings("unused")
private int _moveMovement;
@Override
@@ -102,6 +104,16 @@ public class MoveBackwardToLocation extends L2GameClientPacket
// Validate position packets sends head level.
_targetZ += activeChar.getTemplate().getCollisionHeight();
+ if (_moveMovement == 1)
+ {
+ final TerminateReturn terminate = EventDispatcher.getInstance().notifyEvent(new OnPlayerMoveRequest(activeChar, new Location(_targetX, _targetY, _targetZ)), activeChar, TerminateReturn.class);
+ if ((terminate != null) && terminate.terminate())
+ {
+ activeChar.sendPacket(ActionFailed.STATIC_PACKET);
+ return;
+ }
+ }
+
if (activeChar.getTeleMode() > 0)
{
// Sayune
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/network/serverpackets/AbstractHtmlPacket.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/network/serverpackets/AbstractHtmlPacket.java
index c27557d719..28865df914 100644
--- a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/network/serverpackets/AbstractHtmlPacket.java
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/network/serverpackets/AbstractHtmlPacket.java
@@ -106,6 +106,11 @@ public abstract class AbstractHtmlPacket extends L2GameServerPacket
_html = _html.replaceAll(pattern, value.replaceAll("\\$", "\\\\\\$"));
}
+ public final void replace(String pattern, CharSequence value)
+ {
+ replace(pattern, String.valueOf(value));
+ }
+
public final void replace(String pattern, boolean val)
{
replace(pattern, String.valueOf(val));
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/network/serverpackets/ExShowTerritory.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/network/serverpackets/ExShowTerritory.java
new file mode 100644
index 0000000000..6887f2c57e
--- /dev/null
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/network/serverpackets/ExShowTerritory.java
@@ -0,0 +1,59 @@
+/*
+ * 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 .
+ */
+package com.l2jmobius.gameserver.network.serverpackets;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.l2jmobius.gameserver.model.interfaces.ILocational;
+
+/**
+ * Note: There is known issue with this packet, it cannot be removed unless game client is restarted!
+ * @author UnAfraid
+ */
+public class ExShowTerritory extends L2GameServerPacket
+{
+ private final int _minZ;
+ private final int _maxZ;
+ private final List _vertices = new ArrayList<>();
+
+ public ExShowTerritory(int minZ, int maxZ)
+ {
+ _minZ = minZ;
+ _maxZ = maxZ;
+ }
+
+ public void addVertice(ILocational loc)
+ {
+ _vertices.add(loc);
+ }
+
+ @Override
+ protected void writeImpl()
+ {
+ writeC(0xFE);
+ writeH(0x8D);
+ writeD(_vertices.size());
+ writeD(_minZ);
+ writeD(_maxZ);
+ for (ILocational loc : _vertices)
+ {
+ writeD(loc.getX());
+ writeD(loc.getY());
+ }
+ }
+}
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/scripting/ScriptEngineManager.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/scripting/ScriptEngineManager.java
index 1e54089f1b..fd41398b67 100644
--- a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/scripting/ScriptEngineManager.java
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/scripting/ScriptEngineManager.java
@@ -21,6 +21,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
@@ -29,6 +30,7 @@ import java.util.Map.Entry;
import java.util.Objects;
import java.util.Properties;
import java.util.ServiceLoader;
+import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -170,7 +172,7 @@ public final class ScriptEngineManager
checkExistingFile("ScriptList", SCRIPT_LIST_FILE);
final Map> files = new LinkedHashMap<>();
- final List extWithoutEngine = new LinkedList<>();
+ final Set extWithoutEngine = new HashSet<>();
Files.lines(SCRIPT_LIST_FILE).forEach(line ->
{
@@ -202,21 +204,14 @@ public final class ScriptEngineManager
final IExecutionContext engine = getEngineByExtension(ext);
if (engine == null)
{
- if (!extWithoutEngine.contains(ext))
+ if (extWithoutEngine.add(ext))
{
- extWithoutEngine.add(ext);
_log.warning("ScriptEngine: No engine registered for extension " + ext + "!");
}
return;
}
- List ll = files.get(engine);
- if (ll == null)
- {
- ll = new LinkedList<>();
- files.put(engine, ll);
- }
- ll.add(sourceFile);
+ files.computeIfAbsent(engine, k -> new LinkedList<>()).add(sourceFile);
});
for (Entry> entry : files.entrySet())
diff --git a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/scripting/java/JavaExecutionContext.java b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/scripting/java/JavaExecutionContext.java
index fc6011a1c6..984d27cfed 100644
--- a/L2J_Mobius_Test/java/com/l2jmobius/gameserver/scripting/java/JavaExecutionContext.java
+++ b/L2J_Mobius_Test/java/com/l2jmobius/gameserver/scripting/java/JavaExecutionContext.java
@@ -23,6 +23,7 @@ import java.nio.file.Path;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Logger;
@@ -99,8 +100,6 @@ public final class JavaExecutionContext extends AbstractExecutionContext options = new LinkedList<>();
addOptionIfNotNull(options, getProperty("source"), "-source");
@@ -133,12 +132,14 @@ public final class JavaExecutionContext extends AbstractExecutionContext sourcePathStrings = new LinkedList<>();
+ final List sourcePathStrings = new LinkedList<>();
for (Path sourcePath : sourcePaths)
{
sourcePathStrings.add(sourcePath.toString());
}
+ final StringWriter strOut = new StringWriter();
+ final PrintWriter out = new PrintWriter(strOut);
final boolean compilationSuccess = getScriptingEngine().getCompiler().getTask(out, fileManager, compilationDiagnostics, options, null, fileManager.getJavaFileObjectsFromStrings(sourcePathStrings)).call();
if (!compilationSuccess)
{
@@ -169,8 +170,8 @@ public final class JavaExecutionContext extends AbstractExecutionContext executionFailures = new LinkedHashMap<>();
- Iterable compiledClasses = fileManager.getCompiledClasses();
+ final Map executionFailures = new LinkedHashMap<>();
+ final Iterable compiledClasses = fileManager.getCompiledClasses();
for (final Path sourcePath : sourcePaths)
{
boolean found = false;