From 7e473d3efd01564ae414cd6557e7ff648f233009 Mon Sep 17 00:00:00 2001 From: mobius <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sat, 3 Jan 2015 10:55:42 +0000 Subject: [PATCH] Added Sayune. --- trunk/dist/game/config/Custom.properties | 9 + trunk/dist/game/data/JumpTrack.xml | 488 ++++++++++++++++++ trunk/dist/game/data/xsd/zones.xsd | 2 + trunk/dist/game/data/zones/jumping.xml | 111 ++++ trunk/java/com/l2jserver/Config.java | 3 + .../com/l2jserver/gameserver/GameServer.java | 2 + .../instancemanager/JumpManager.java | 251 +++++++++ .../model/actor/instance/L2PcInstance.java | 21 + .../gameserver/model/zone/ZoneId.java | 3 +- .../model/zone/type/L2JumpZone.java | 139 +++++ .../network/L2GamePacketHandler.java | 4 +- .../clientpackets/MoveBackwardToLocation.java | 23 + .../network/clientpackets/RequestFlyMove.java | 57 ++ .../clientpackets/RequestFlyMoveStart.java | 80 +++ .../network/serverpackets/ExFlyMove.java | 75 +++ .../serverpackets/ExNotifyFlyMoveStart.java | 36 ++ 16 files changed, 1301 insertions(+), 3 deletions(-) create mode 100644 trunk/dist/game/data/JumpTrack.xml create mode 100644 trunk/dist/game/data/zones/jumping.xml create mode 100644 trunk/java/com/l2jserver/gameserver/instancemanager/JumpManager.java create mode 100644 trunk/java/com/l2jserver/gameserver/model/zone/type/L2JumpZone.java create mode 100644 trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestFlyMove.java create mode 100644 trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestFlyMoveStart.java create mode 100644 trunk/java/com/l2jserver/gameserver/network/serverpackets/ExFlyMove.java create mode 100644 trunk/java/com/l2jserver/gameserver/network/serverpackets/ExNotifyFlyMoveStart.java diff --git a/trunk/dist/game/config/Custom.properties b/trunk/dist/game/config/Custom.properties index 9cc4372d06..d8c3c11346 100644 --- a/trunk/dist/game/config/Custom.properties +++ b/trunk/dist/game/config/Custom.properties @@ -569,3 +569,12 @@ MobsSpawnNotRandom = 18812,18813,18814 # Default: 0 ShopMinRangeFromPlayer = 50 ShopMinRangeFromNpc = 100 + + +# --------------------------------------------------------------------------- +# Free Jumps (Sayune) for all Players +# --------------------------------------------------------------------------- + +# Enable Sayune for players that are not Awakened (4rth class) +# Default: False +FreeJumpsForAll = False diff --git a/trunk/dist/game/data/JumpTrack.xml b/trunk/dist/game/data/JumpTrack.xml new file mode 100644 index 0000000000..d348c8925d --- /dev/null +++ b/trunk/dist/game/data/JumpTrack.xml @@ -0,0 +1,488 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trunk/dist/game/data/xsd/zones.xsd b/trunk/dist/game/data/xsd/zones.xsd index 0994e8385c..10b9d551c3 100644 --- a/trunk/dist/game/data/xsd/zones.xsd +++ b/trunk/dist/game/data/xsd/zones.xsd @@ -54,6 +54,7 @@ + @@ -126,6 +127,7 @@ + diff --git a/trunk/dist/game/data/zones/jumping.xml b/trunk/dist/game/data/zones/jumping.xml new file mode 100644 index 0000000000..3195ab8cf7 --- /dev/null +++ b/trunk/dist/game/data/zones/jumping.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/java/com/l2jserver/Config.java b/trunk/java/com/l2jserver/Config.java index 2637991b92..80c2fb9c53 100644 --- a/trunk/java/com/l2jserver/Config.java +++ b/trunk/java/com/l2jserver/Config.java @@ -816,6 +816,7 @@ public final class Config public static List MOBS_LIST_NOT_RANDOM; public static int SHOP_MIN_RANGE_FROM_NPC; public static int SHOP_MIN_RANGE_FROM_PLAYER; + public static boolean FREE_JUMPS_FOR_ALL; // -------------------------------------------------- // NPC Settings @@ -2603,6 +2604,8 @@ public final class Config SHOP_MIN_RANGE_FROM_PLAYER = CustomSettings.getInt("ShopMinRangeFromPlayer", 50); SHOP_MIN_RANGE_FROM_NPC = CustomSettings.getInt("ShopMinRangeFromNpc", 100); + FREE_JUMPS_FOR_ALL = CustomSettings.getBoolean("FreeJumpsForAll", false); + // Load PvP L2Properties file (if exists) final PropertiesParser PVPSettings = new PropertiesParser(PVP_CONFIG_FILE); diff --git a/trunk/java/com/l2jserver/gameserver/GameServer.java b/trunk/java/com/l2jserver/gameserver/GameServer.java index e74f26a399..c1defc3f9b 100644 --- a/trunk/java/com/l2jserver/gameserver/GameServer.java +++ b/trunk/java/com/l2jserver/gameserver/GameServer.java @@ -118,6 +118,7 @@ import com.l2jserver.gameserver.instancemanager.GrandBossManager; import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.instancemanager.ItemAuctionManager; import com.l2jserver.gameserver.instancemanager.ItemsOnGroundManager; +import com.l2jserver.gameserver.instancemanager.JumpManager; import com.l2jserver.gameserver.instancemanager.MailManager; import com.l2jserver.gameserver.instancemanager.MapRegionManager; import com.l2jserver.gameserver.instancemanager.MentorManager; @@ -307,6 +308,7 @@ public class GameServer BoatManager.getInstance(); AirShipManager.getInstance(); ShuttleData.getInstance(); + JumpManager.getInstance(); GraciaSeedsManager.getInstance(); try diff --git a/trunk/java/com/l2jserver/gameserver/instancemanager/JumpManager.java b/trunk/java/com/l2jserver/gameserver/instancemanager/JumpManager.java new file mode 100644 index 0000000000..b55a491512 --- /dev/null +++ b/trunk/java/com/l2jserver/gameserver/instancemanager/JumpManager.java @@ -0,0 +1,251 @@ +/* + * Copyright (C) 2004-2015 L2J Server + * + * This file is part of L2J Server. + * + * L2J Server 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. + * + * L2J Server 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.l2jserver.gameserver.instancemanager; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.xml.parsers.DocumentBuilderFactory; + +import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; + +import com.l2jserver.Config; +import com.l2jserver.gameserver.model.L2World; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; +import com.l2jserver.gameserver.model.zone.L2ZoneType; +import com.l2jserver.gameserver.model.zone.ZoneId; +import com.l2jserver.gameserver.model.zone.type.L2JumpZone; +import com.l2jserver.gameserver.network.serverpackets.ExFlyMove; +import com.l2jserver.gameserver.network.serverpackets.FlyToLocation; +import com.l2jserver.gameserver.network.serverpackets.FlyToLocation.FlyType; + +/** + * JumpManager + * @author ALF + */ +public class JumpManager +{ + private static final Logger _log = Logger.getLogger(JumpManager.class.getName()); + private final Map _tracks = new HashMap<>(); + + public class Track extends HashMap + { + private static final long serialVersionUID = 1L; + public int x = 0; + public int y = 0; + public int z = 0; + } + + public class JumpWay extends ArrayList + { + private static final long serialVersionUID = 1L; + } + + public class JumpNode + { + private final int _x; + private final int _y; + private final int _z; + private final int _next; + + public JumpNode(int x, int y, int z, int next) + { + _x = x; + _y = y; + _z = z; + _next = next; + } + + public int getX() + { + return _x; + } + + public int getY() + { + return _y; + } + + public int getZ() + { + return _z; + } + + public int getNext() + { + return _next; + } + } + + protected JumpManager() + { + load(); + } + + public void load() + { + _tracks.clear(); + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setValidating(false); + factory.setIgnoringComments(true); + File file = new File(Config.DATAPACK_ROOT, "data/JumpTrack.xml"); + Document doc = null; + + if (file.exists()) + { + try + { + doc = factory.newDocumentBuilder().parse(file); + } + catch (Exception e) + { + _log.log(Level.WARNING, "Could not parse JumpTrack.xml file: " + e.getMessage(), e); + return; + } + Node root = doc.getFirstChild(); + for (Node t = root.getFirstChild(); t != null; t = t.getNextSibling()) + { + if (t.getNodeName().equals("track")) + { + Track track = new Track(); + int trackId = Integer.parseInt(t.getAttributes().getNamedItem("trackId").getNodeValue()); + try + { + track.x = Integer.parseInt(t.getAttributes().getNamedItem("ToX").getNodeValue()); + track.y = Integer.parseInt(t.getAttributes().getNamedItem("ToY").getNodeValue()); + track.z = Integer.parseInt(t.getAttributes().getNamedItem("ToZ").getNodeValue()); + } + catch (Exception e) + { + _log.info("track id:" + trackId + " missing tox toy toz"); + } + for (Node w = t.getFirstChild(); w != null; w = w.getNextSibling()) + { + if (w.getNodeName().equals("way")) + { + JumpWay jw = new JumpWay(); + int wayId = Integer.parseInt(w.getAttributes().getNamedItem("id").getNodeValue()); + for (Node j = w.getFirstChild(); j != null; j = j.getNextSibling()) + { + if (j.getNodeName().equals("jumpLoc")) + { + NamedNodeMap attrs = j.getAttributes(); + int next = Integer.parseInt(attrs.getNamedItem("next").getNodeValue()); + int x = Integer.parseInt(attrs.getNamedItem("x").getNodeValue()); + int y = Integer.parseInt(attrs.getNamedItem("y").getNodeValue()); + int z = Integer.parseInt(attrs.getNamedItem("z").getNodeValue()); + jw.add(new JumpNode(x, y, z, next)); + } + } + track.put(wayId, jw); + } + } + _tracks.put(trackId, track); + } + } + } + _log.info(getClass().getSimpleName() + ": Loaded " + _tracks.size() + " Jump Routes."); + } + + public int getTrackId(L2PcInstance player) + { + for (L2ZoneType zone : L2World.getInstance().getRegion(player.getX(), player.getY()).getZones()) + { + if (zone.isCharacterInZone(player) && (zone instanceof L2JumpZone)) + { + return ((L2JumpZone) zone).getTrackId(); + } + } + return -1; + } + + public Track getTrack(int trackId) + { + return _tracks.get(trackId); + } + + public JumpWay getJumpWay(int trackId, int wayId) + { + Track t = _tracks.get(trackId); + if (t != null) + { + return t.get(wayId); + } + return null; + } + + public void StartJump(L2PcInstance player) + { + if (!player.isInsideZone(ZoneId.JUMP)) + { + return; + } + player.setJumpTrackId(getTrackId(player)); + if (player.getJumpTrackId() == -1) + { + return; + } + JumpWay jw = getJumpWay(player.getJumpTrackId(), 0); + if (jw == null) + { + return; + } + Track t = getTrack(player.getJumpTrackId()); + if (!((t.x == 0) && (t.y == 0) && (t.z == 0))) + { + player.broadcastPacket(new FlyToLocation(player, t.x, t.y, t.z, FlyType.DUMMY)); + player.setXYZ(t.x, t.y, t.z); + } + player.sendPacket(new ExFlyMove(player.getObjectId(), player.getJumpTrackId(), jw)); + } + + public void NextJump(L2PcInstance player, int nextId) + { + if (player.getJumpTrackId() == -1) + { + return; + } + + JumpWay jw = getJumpWay(player.getJumpTrackId(), nextId); + if (jw == null) + { + player.enableAllSkills(); // unlock player skills + return; + } + player.sendPacket(new ExFlyMove(player.getObjectId(), player.getJumpTrackId(), jw)); + JumpNode n = jw.get(0); + player.setXYZ(n.getX(), n.getY(), n.getZ()); + } + + public static final JumpManager getInstance() + { + return SingletonHolder._instance; + } + + private static class SingletonHolder + { + protected static final JumpManager _instance = new JumpManager(); + } +} diff --git a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java index b65faef44e..ce46e85225 100644 --- a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java +++ b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java @@ -900,6 +900,8 @@ public final class L2PcInstance extends L2Playable private boolean _hasCharmOfCourage = false; + private int _jumpTrackId = 0; + /** * Create a new L2PcInstance and add it in the characters table of the database.
* Actions : @@ -14419,4 +14421,23 @@ public final class L2PcInstance extends L2Playable { getVariables().set("ABILITY_POINTS_USED", points); } + + public boolean isAwaken() + { + if (((getActiveClass() >= 139) && (getActiveClass() <= 181)) || (getActiveClass() >= 188)) + { + return true; + } + return false; + } + + public int getJumpTrackId() + { + return _jumpTrackId; + } + + public void setJumpTrackId(int jumpTrackId) + { + _jumpTrackId = jumpTrackId; + } } diff --git a/trunk/java/com/l2jserver/gameserver/model/zone/ZoneId.java b/trunk/java/com/l2jserver/gameserver/model/zone/ZoneId.java index d743d818c4..b382594958 100644 --- a/trunk/java/com/l2jserver/gameserver/model/zone/ZoneId.java +++ b/trunk/java/com/l2jserver/gameserver/model/zone/ZoneId.java @@ -46,7 +46,8 @@ public enum ZoneId ALTERED, NO_BOOKMARK, NO_ITEM_DROP, - NO_RESTART; + NO_RESTART, + JUMP; public static int getZoneCount() { diff --git a/trunk/java/com/l2jserver/gameserver/model/zone/type/L2JumpZone.java b/trunk/java/com/l2jserver/gameserver/model/zone/type/L2JumpZone.java new file mode 100644 index 0000000000..7e97699fb9 --- /dev/null +++ b/trunk/java/com/l2jserver/gameserver/model/zone/type/L2JumpZone.java @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2004-2015 L2J Server + * + * This file is part of L2J Server. + * + * L2J Server 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. + * + * L2J Server 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.l2jserver.gameserver.model.zone.type; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.Future; + +import com.l2jserver.Config; +import com.l2jserver.gameserver.ThreadPoolManager; +import com.l2jserver.gameserver.model.actor.L2Character; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; +import com.l2jserver.gameserver.model.zone.L2ZoneType; +import com.l2jserver.gameserver.model.zone.ZoneId; +import com.l2jserver.gameserver.network.serverpackets.ExNotifyFlyMoveStart; + +/** + * L2JumpZone zones + * @author ALF (r2max) + */ +public class L2JumpZone extends L2ZoneType +{ + private final Map> _task = new HashMap<>(); + private final int _startTask; + private final int _reuseTask; + private int _trackId; + + public L2JumpZone(int id) + { + super(id); + + _startTask = 10; + _reuseTask = 500; + _trackId = -1; + } + + @Override + public void setParameter(String name, String value) + { + if (name.equals("trackId")) + { + _trackId = Integer.parseInt(value); + } + else + { + super.setParameter(name, value); + } + } + + public int getTrackId() + { + return _trackId; + } + + @Override + protected void onEnter(L2Character character) + { + if (character.isPlayer()) + { + character.setInsideZone(ZoneId.JUMP, true); + } + + if (character instanceof L2PcInstance) + { + L2PcInstance plr = (L2PcInstance) character; + if (!plr.isAwaken() && !Config.FREE_JUMPS_FOR_ALL) + { + return; + } + stopTask(plr); + _task.put(plr.getObjectId(), ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new JumpReq(plr), _startTask, _reuseTask)); + } + } + + @Override + protected void onExit(L2Character character) + { + if (character.isPlayer()) + { + character.setInsideZone(ZoneId.JUMP, false); + } + stopTask(character); + } + + @Override + public void onDieInside(L2Character character) + { + onExit(character); + } + + @Override + public void onReviveInside(L2Character character) + { + onEnter(character); + } + + protected void stopTask(L2Character character) + { + int poid = character.getObjectId(); + Future t = _task.get(poid); + _task.remove(poid); + if (t != null) + { + t.cancel(false); + } + } + + class JumpReq implements Runnable + { + private final L2PcInstance player; + + JumpReq(L2PcInstance pl) + { + player = pl; + } + + @Override + public void run() + { + player.sendPacket(new ExNotifyFlyMoveStart()); + } + } +} diff --git a/trunk/java/com/l2jserver/gameserver/network/L2GamePacketHandler.java b/trunk/java/com/l2jserver/gameserver/network/L2GamePacketHandler.java index 25e9e8667e..181f802767 100644 --- a/trunk/java/com/l2jserver/gameserver/network/L2GamePacketHandler.java +++ b/trunk/java/com/l2jserver/gameserver/network/L2GamePacketHandler.java @@ -1302,7 +1302,7 @@ public final class L2GamePacketHandler implements IPacketHandler, // @ msg = new RequestExEscapeScene(); break; case 0x91: - // msg = new RequestFlyMove(); + msg = new RequestFlyMove(); break; case 0x92: // msg = new RequestSurrenderPledgeWarEX(); (chS) @@ -1392,7 +1392,7 @@ public final class L2GamePacketHandler implements IPacketHandler, // msg = new RequestFirstPlayStart(); break; case 0xAD: - // msg = new RequestFlyMoveStart(); + msg = new RequestFlyMoveStart(); break; case 0xAE: case 0xAF: diff --git a/trunk/java/com/l2jserver/gameserver/network/clientpackets/MoveBackwardToLocation.java b/trunk/java/com/l2jserver/gameserver/network/clientpackets/MoveBackwardToLocation.java index 1d879ca978..abdccdafdf 100644 --- a/trunk/java/com/l2jserver/gameserver/network/clientpackets/MoveBackwardToLocation.java +++ b/trunk/java/com/l2jserver/gameserver/network/clientpackets/MoveBackwardToLocation.java @@ -22,10 +22,13 @@ import java.nio.BufferUnderflowException; import com.l2jserver.Config; import com.l2jserver.gameserver.ai.CtrlIntention; +import com.l2jserver.gameserver.instancemanager.JumpManager; +import com.l2jserver.gameserver.instancemanager.JumpManager.JumpWay; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; +import com.l2jserver.gameserver.network.serverpackets.ExFlyMove; import com.l2jserver.gameserver.network.serverpackets.StopMove; import com.l2jserver.gameserver.util.Util; @@ -101,6 +104,26 @@ public class MoveBackwardToLocation extends L2GameClientPacket if (activeChar.getTeleMode() > 0) { + // Sayune + if ((activeChar.getTeleMode() == 3) || (activeChar.getTeleMode() == 4)) + { + if (activeChar.getTeleMode() == 3) + { + activeChar.setTeleMode(0); + } + activeChar.sendPacket(ActionFailed.STATIC_PACKET); + activeChar.stopMove(null, false); + activeChar.abortAttack(); + activeChar.abortCast(); + activeChar.setTarget(null); + activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + JumpWay jw = JumpManager.getInstance().new JumpWay(); + jw.add(JumpManager.getInstance().new JumpNode(_targetX, _targetY, _targetZ, -1)); + activeChar.sendPacket(new ExFlyMove(activeChar.getObjectId(), -1, jw)); + activeChar.setXYZ(_targetX, _targetY, _targetZ); + return; + } + if (activeChar.getTeleMode() == 1) { activeChar.setTeleMode(0); diff --git a/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestFlyMove.java b/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestFlyMove.java new file mode 100644 index 0000000000..233d317d73 --- /dev/null +++ b/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestFlyMove.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2004-2015 L2J Server + * + * This file is part of L2J Server. + * + * L2J Server 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. + * + * L2J Server 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.l2jserver.gameserver.network.clientpackets; + +import com.l2jserver.gameserver.instancemanager.JumpManager; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; + +/** + * Format: (ch)d + * @author mrTJO + */ +public final class RequestFlyMove extends L2GameClientPacket +{ + private static final String _C__D0_94_REQUESTFLYMOVE = "[C] D0:94 RequestFlyMove"; + int _nextPoint; + + @Override + protected void readImpl() + { + _nextPoint = readD(); + } + + @Override + protected void runImpl() + { + final L2PcInstance activeChar = getClient().getActiveChar(); + + if (activeChar == null) + { + return; + } + + JumpManager.getInstance().NextJump(activeChar, _nextPoint); + } + + @Override + public String getType() + { + return _C__D0_94_REQUESTFLYMOVE; + } +} diff --git a/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestFlyMoveStart.java b/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestFlyMoveStart.java new file mode 100644 index 0000000000..b95e65a265 --- /dev/null +++ b/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestFlyMoveStart.java @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2004-2015 L2J Server + * + * This file is part of L2J Server. + * + * L2J Server 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. + * + * L2J Server 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.l2jserver.gameserver.network.clientpackets; + +import com.l2jserver.gameserver.instancemanager.JumpManager; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; + +public final class RequestFlyMoveStart extends L2GameClientPacket +{ + private static final String _C__D0_AD_REQUESTFLYMOVESTART = "[C] D0:AD RequestFlyMoveStart"; + + @Override + protected void readImpl() + { + } + + @Override + protected void runImpl() + { + final L2PcInstance activeChar = getClient().getActiveChar(); + + if (activeChar == null) + { + return; + } + if (activeChar.isFlying() || activeChar.isMounted() || activeChar.isFlyingMounted() || activeChar.isInBoat() || activeChar.isInAirShip()) + { + return; + } + if (activeChar.isTransformed() || activeChar.isCursedWeaponEquipped() || activeChar.isFishing()) + { + return; + } + if (activeChar.isCastingNow() || activeChar.isCastingSimultaneouslyNow() || activeChar.isAttackingNow() || activeChar.isInCombat() || activeChar.isInDuel()) + { + return; + } + if (activeChar.isStunned() || activeChar.isParalyzed() || activeChar.isSleeping() || activeChar.isAfraid() || activeChar.isAlikeDead() || activeChar.isFakeDeath()) + { + return; + } + if (activeChar.isDead() || activeChar.isOutOfControl() || activeChar.isMovementDisabled()) + { + return; + } + if (activeChar.isSitting() || activeChar.isMoving() || activeChar.isTeleporting()) + { + return; + } + if (activeChar.isInStoreMode() || activeChar.isInCraftMode() || activeChar.isInOlympiadMode()) + { + return; + } + + activeChar.disableAllSkills(); // lock player skills + JumpManager.getInstance().StartJump(activeChar); + } + + @Override + public String getType() + { + return _C__D0_AD_REQUESTFLYMOVESTART; + } +} diff --git a/trunk/java/com/l2jserver/gameserver/network/serverpackets/ExFlyMove.java b/trunk/java/com/l2jserver/gameserver/network/serverpackets/ExFlyMove.java new file mode 100644 index 0000000000..2205bb78e9 --- /dev/null +++ b/trunk/java/com/l2jserver/gameserver/network/serverpackets/ExFlyMove.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2004-2015 L2J Server + * + * This file is part of L2J Server. + * + * L2J Server 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. + * + * L2J Server 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.l2jserver.gameserver.network.serverpackets; + +import com.l2jserver.gameserver.instancemanager.JumpManager.JumpNode; +import com.l2jserver.gameserver.instancemanager.JumpManager.JumpWay; + +/** + * Created by IntelliJ IDEA. User: Keiichi Date: 27.05.2011 Time: 12:06:19 To change this template use File | Settings | File Templates. + */ +public class ExFlyMove extends L2GameServerPacket +{ + final int _objId; + final int _trackId; + final JumpWay _jw; + + public ExFlyMove(int objid, int trackId, JumpWay jw) + { + _objId = objid; + _trackId = trackId; + _jw = jw; + } + + @Override + protected void writeImpl() + { + if (_jw == null) + { + return; + } + writeC(0xfe); + writeH(0xe8); + writeD(_objId); + + if (_jw.size() == 1) + { + writeD(2); + + } + else + { + writeD(0); + } + writeD(0); + writeD(_trackId); + + writeD(_jw.size()); + for (JumpNode n : _jw) + { + writeD(n.getNext()); + writeD(0); + + writeD(n.getX()); + writeD(n.getY()); + writeD(n.getZ()); + + } + } +} diff --git a/trunk/java/com/l2jserver/gameserver/network/serverpackets/ExNotifyFlyMoveStart.java b/trunk/java/com/l2jserver/gameserver/network/serverpackets/ExNotifyFlyMoveStart.java new file mode 100644 index 0000000000..bb1a81b373 --- /dev/null +++ b/trunk/java/com/l2jserver/gameserver/network/serverpackets/ExNotifyFlyMoveStart.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2004-2015 L2J Server + * + * This file is part of L2J Server. + * + * L2J Server 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. + * + * L2J Server 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.l2jserver.gameserver.network.serverpackets; + +/** + * @author mrTJO + */ +public final class ExNotifyFlyMoveStart extends L2GameServerPacket +{ + public ExNotifyFlyMoveStart() + { + } + + @Override + protected void writeImpl() + { + writeC(0xFE); + writeH(0x110); + } +}