diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/RaidTeleportListData.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/RaidTeleportListData.xml
new file mode 100644
index 0000000000..ea53deaed3
--- /dev/null
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/RaidTeleportListData.xml
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/RaidTeleportListData.xsd b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/RaidTeleportListData.xsd
new file mode 100644
index 0000000000..f7b34f8222
--- /dev/null
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/RaidTeleportListData.xsd
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/RaidTeleportListData.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/RaidTeleportListData.java
new file mode 100644
index 0000000000..f2ddbbfadc
--- /dev/null
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/RaidTeleportListData.java
@@ -0,0 +1,81 @@
+/*
+ * 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 org.l2jmobius.gameserver.data.xml;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import org.w3c.dom.Document;
+
+import org.l2jmobius.commons.util.IXmlReader;
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
+
+/**
+ * @author Gustavo Fonseca
+ */
+public class RaidTeleportListData implements IXmlReader
+{
+ private static final Logger LOGGER = Logger.getLogger(RaidTeleportListData.class.getName());
+
+ private final Map _teleports = new HashMap<>();
+
+ protected RaidTeleportListData()
+ {
+ load();
+ }
+
+ @Override
+ public void load()
+ {
+ _teleports.clear();
+ parseDatapackFile("data/RaidTeleportListData.xml");
+ LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleports.size() + " teleports.");
+ }
+
+ @Override
+ public void parseDocument(Document doc, File f)
+ {
+ forEach(doc, "list", listNode -> forEach(listNode, "teleport", teleportNode ->
+ {
+ final StatSet set = new StatSet(parseAttributes(teleportNode));
+ final int tpId = set.getInt("id");
+ final int x = set.getInt("x");
+ final int y = set.getInt("y");
+ final int z = set.getInt("z");
+ final int tpPrice = set.getInt("price");
+ _teleports.put(tpId, new TeleportListHolder(tpId, x, y, z, tpPrice));
+ }));
+ }
+
+ public TeleportListHolder getTeleport(int teleportId)
+ {
+ return _teleports.get(teleportId);
+ }
+
+ public static RaidTeleportListData getInstance()
+ {
+ return SingletonHolder.INSTANCE;
+ }
+
+ private static class SingletonHolder
+ {
+ protected static final RaidTeleportListData INSTANCE = new RaidTeleportListData();
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
index d5a262ea2e..8141082940 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
@@ -126,6 +126,8 @@ import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTelepor
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTeleportFavoriteList;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTeleportFavoritesAddDel;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTeleportFavoritesUIToggle;
+import org.l2jmobius.gameserver.network.clientpackets.teleports.ExTeleportToRaidPosition;
+import org.l2jmobius.gameserver.network.clientpackets.teleports.RequestRaidTeleportInfo;
import org.l2jmobius.gameserver.network.clientpackets.training.NotifyTrainingRoomEnd;
/**
@@ -541,8 +543,8 @@ public enum ExIncomingPackets implements IIncomingPackets
EX_OLYMPIAD_RANKING_INFO(0x194, RequestOlympiadRankingInfo::new, ConnectionState.IN_GAME),
EX_OLYMPIAD_HERO_AND_LEGEND_INFO(0x195, RequestOlympiadHeroAndLegendInfo::new, ConnectionState.IN_GAME),
EX_CASTLEWAR_OBSERVER_START(0x196, null, ConnectionState.IN_GAME),
- EX_RAID_TELEPORT_INFO(0x197, null, ConnectionState.IN_GAME),
- EX_TELEPORT_TO_RAID_POSITION(0x198, null, ConnectionState.IN_GAME),
+ EX_RAID_TELEPORT_INFO(0x197, RequestRaidTeleportInfo::new, ConnectionState.IN_GAME),
+ EX_TELEPORT_TO_RAID_POSITION(0x198, ExTeleportToRaidPosition::new, ConnectionState.IN_GAME),
EX_CRAFT_EXTRACT(0x199, ExRequestRandomCraftExtract::new, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_INFO(0x19A, ExRequestRandomCraftInfo::new, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_LOCK_SLOTEX_CRAFT_RANDOM_INFO(0x19B, ExRequestRandomCraftLockSlot::new, ConnectionState.IN_GAME),
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/teleports/ExTeleportToRaidPosition.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/teleports/ExTeleportToRaidPosition.java
new file mode 100644
index 0000000000..6f87377bc0
--- /dev/null
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/teleports/ExTeleportToRaidPosition.java
@@ -0,0 +1,150 @@
+/*
+ * 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 org.l2jmobius.gameserver.network.clientpackets.teleports;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.commons.network.PacketReader;
+import org.l2jmobius.commons.util.Chronos;
+import org.l2jmobius.gameserver.data.xml.NpcData;
+import org.l2jmobius.gameserver.data.xml.RaidTeleportListData;
+import org.l2jmobius.gameserver.enums.RaidBossStatus;
+import org.l2jmobius.gameserver.instancemanager.CastleManager;
+import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
+import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
+import org.l2jmobius.gameserver.model.Location;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
+import org.l2jmobius.gameserver.model.effects.EffectFlag;
+import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
+import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
+import org.l2jmobius.gameserver.model.siege.Castle;
+import org.l2jmobius.gameserver.model.skills.CommonSkill;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.network.GameClient;
+import org.l2jmobius.gameserver.network.SystemMessageId;
+import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
+import org.l2jmobius.gameserver.network.serverpackets.teleports.ExRaidTeleportInfo;
+
+/**
+ * @author Gustavo Fonseca
+ */
+public class ExTeleportToRaidPosition implements IClientIncomingPacket
+{
+ private int _raidId;
+
+ @Override
+ public boolean read(GameClient client, PacketReader packet)
+ {
+ _raidId = packet.readD();
+ return true;
+ }
+
+ @Override
+ public void run(GameClient client)
+ {
+ final PlayerInstance player = client.getPlayer();
+ if (player == null)
+ {
+ return;
+ }
+
+ final TeleportListHolder teleport = RaidTeleportListData.getInstance().getTeleport(_raidId);
+ if (teleport == null)
+ {
+ LOGGER.warning("No registered teleport location for raid id: " + _raidId);
+ return;
+ }
+
+ // Dead characters cannot use teleports.
+ if (player.isDead())
+ {
+ player.sendPacket(SystemMessageId.DEAD_CHARACTERS_CANNOT_USE_TELEPORTS);
+ return;
+ }
+
+ final NpcTemplate template = NpcData.getInstance().getTemplate(_raidId);
+ if (template.isType("GrandBoss") && (GrandBossManager.getInstance().getBossStatus(_raidId) != 0))
+ {
+ player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
+ return;
+ }
+ else if (template.isType("RaidBoss") && (DBSpawnManager.getInstance().getNpcStatusId(_raidId) != RaidBossStatus.ALIVE))
+ {
+ player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
+ return;
+ }
+
+ // Players should not be able to teleport if in combat, or in a special location.
+ if (player.isCastingNow() || player.isInCombat() || player.isImmobilized() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInsideZone(ZoneId.TIMED_HUNTING))
+ {
+ player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
+ return;
+ }
+
+ // Karma related configurations.
+ if ((!Config.ALT_GAME_KARMA_PLAYER_CAN_TELEPORT || !Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK) && (player.getReputation() < 0))
+ {
+ player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
+ return;
+ }
+
+ // Cannot escape effect.
+ if (player.isAffected(EffectFlag.CANNOT_ESCAPE))
+ {
+ player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
+ return;
+ }
+
+ if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
+ {
+ final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
+ if ((castle != null) && castle.getSiege().isInProgress())
+ {
+ player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
+ return;
+ }
+ }
+
+ final int price;
+ if ((Chronos.currentTimeMillis() - player.getVariables().getLong("LastFreeRaidTeleportTime", 0)) > 86400000)
+ {
+ player.getVariables().set("LastFreeRaidTeleportTime", Chronos.currentTimeMillis());
+ price = 0;
+ }
+ else
+ {
+ price = teleport.getPrice();
+ }
+
+ if (price > 0)
+ {
+ if (player.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < price)
+ {
+ player.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
+ return;
+ }
+ player.destroyItemByItemId("TeleportToRaid", Inventory.LCOIN_ID, price, player, true);
+ }
+
+ player.abortCast();
+ player.stopMove(null);
+
+ player.setTeleportLocation(new Location(teleport.getX(), teleport.getY(), teleport.getZ()));
+ player.doCast(CommonSkill.TELEPORT.getSkill());
+ player.sendPacket(new ExRaidTeleportInfo());
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/teleports/RequestRaidTeleportInfo.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/teleports/RequestRaidTeleportInfo.java
new file mode 100644
index 0000000000..1ab3815be6
--- /dev/null
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/teleports/RequestRaidTeleportInfo.java
@@ -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 .
+ */
+package org.l2jmobius.gameserver.network.clientpackets.teleports;
+
+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.teleports.ExRaidTeleportInfo;
+
+/**
+ * @author Gustavo Fonseca
+ */
+public class RequestRaidTeleportInfo 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;
+ }
+
+ player.sendPacket(new ExRaidTeleportInfo());
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/teleports/ExRaidTeleportInfo.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/teleports/ExRaidTeleportInfo.java
new file mode 100644
index 0000000000..8e1e13d9a6
--- /dev/null
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/teleports/ExRaidTeleportInfo.java
@@ -0,0 +1,39 @@
+/*
+ * 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 org.l2jmobius.gameserver.network.serverpackets.teleports;
+
+import org.l2jmobius.commons.network.PacketWriter;
+import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
+
+/**
+ * @author GustavoFonseca
+ */
+public class ExRaidTeleportInfo implements IClientOutgoingPacket
+{
+ public ExRaidTeleportInfo()
+ {
+ }
+
+ @Override
+ public boolean write(PacketWriter packet)
+ {
+ OutgoingPackets.EX_RAID_TELEPORT_INFO.writeId(packet);
+ packet.writeD(1); // TODO: Character free teleport points from database or configuration.
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/RaidTeleportListData.xml b/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/RaidTeleportListData.xml
new file mode 100644
index 0000000000..ea53deaed3
--- /dev/null
+++ b/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/RaidTeleportListData.xml
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/xsd/RaidTeleportListData.xsd b/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/xsd/RaidTeleportListData.xsd
new file mode 100644
index 0000000000..f7b34f8222
--- /dev/null
+++ b/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/xsd/RaidTeleportListData.xsd
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/RaidTeleportListData.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/RaidTeleportListData.java
new file mode 100644
index 0000000000..e5dfd5be10
--- /dev/null
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/RaidTeleportListData.java
@@ -0,0 +1,81 @@
+/*
+ * 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 org.l2jmobius.gameserver.data.xml;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import org.w3c.dom.Document;
+
+import org.l2jmobius.commons.util.IXmlReader;
+import org.l2jmobius.gameserver.model.StatSet;
+import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
+
+/**
+ * @author Gustavo Fonseca
+ */
+public class RaidTeleportListData implements IXmlReader
+{
+ private static final Logger LOGGER = Logger.getLogger(RaidTeleportListData.class.getName());
+
+ private final Map _teleports = new HashMap<>();
+
+ protected RaidTeleportListData()
+ {
+ load();
+ }
+
+ @Override
+ public void load()
+ {
+ _teleports.clear();
+ parseDatapackFile("data/RaidTeleportListData.xml");
+ LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleports.size() + " teleports.");
+ }
+
+ @Override
+ public void parseDocument(Document doc, File f)
+ {
+ forEach(doc, "list", listNode -> forEach(listNode, "teleport", teleportNode ->
+ {
+ final StatSet set = new StatSet(parseAttributes(teleportNode));
+ final int tpId = set.getInt("id");
+ final int x = set.getInt("x");
+ final int y = set.getInt("y");
+ final int z = set.getInt("z");
+ final int tpPrice = set.getInt("price");
+ _teleports.put(tpId, new TeleportListHolder(tpId, x, y, z, tpPrice, false));
+ }));
+ }
+
+ public TeleportListHolder getTeleport(int teleportId)
+ {
+ return _teleports.get(teleportId);
+ }
+
+ public static RaidTeleportListData getInstance()
+ {
+ return SingletonHolder.INSTANCE;
+ }
+
+ private static class SingletonHolder
+ {
+ protected static final RaidTeleportListData INSTANCE = new RaidTeleportListData();
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
index 882764b552..52c3d580b8 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
@@ -126,6 +126,8 @@ import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTelepor
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTeleportFavoriteList;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTeleportFavoritesAddDel;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTeleportFavoritesUIToggle;
+import org.l2jmobius.gameserver.network.clientpackets.teleports.ExTeleportToRaidPosition;
+import org.l2jmobius.gameserver.network.clientpackets.teleports.RequestRaidTeleportInfo;
import org.l2jmobius.gameserver.network.clientpackets.training.NotifyTrainingRoomEnd;
/**
@@ -541,8 +543,8 @@ public enum ExIncomingPackets implements IIncomingPackets
EX_OLYMPIAD_RANKING_INFO(0x194, RequestOlympiadRankingInfo::new, ConnectionState.IN_GAME),
EX_OLYMPIAD_HERO_AND_LEGEND_INFO(0x195, RequestOlympiadHeroAndLegendInfo::new, ConnectionState.IN_GAME),
EX_CASTLEWAR_OBSERVER_START(0x196, null, ConnectionState.IN_GAME),
- EX_RAID_TELEPORT_INFO(0x197, null, ConnectionState.IN_GAME),
- EX_TELEPORT_TO_RAID_POSITION(0x198, null, ConnectionState.IN_GAME),
+ EX_RAID_TELEPORT_INFO(0x197, RequestRaidTeleportInfo::new, ConnectionState.IN_GAME),
+ EX_TELEPORT_TO_RAID_POSITION(0x198, ExTeleportToRaidPosition::new, ConnectionState.IN_GAME),
EX_CRAFT_EXTRACT(0x199, ExRequestRandomCraftExtract::new, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_INFO(0x19A, ExRequestRandomCraftInfo::new, ConnectionState.IN_GAME),
EX_CRAFT_RANDOM_LOCK_SLOTEX_CRAFT_RANDOM_INFO(0x19B, ExRequestRandomCraftLockSlot::new, ConnectionState.IN_GAME),
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/clientpackets/teleports/ExTeleportToRaidPosition.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/clientpackets/teleports/ExTeleportToRaidPosition.java
new file mode 100644
index 0000000000..6f87377bc0
--- /dev/null
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/clientpackets/teleports/ExTeleportToRaidPosition.java
@@ -0,0 +1,150 @@
+/*
+ * 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 org.l2jmobius.gameserver.network.clientpackets.teleports;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.commons.network.PacketReader;
+import org.l2jmobius.commons.util.Chronos;
+import org.l2jmobius.gameserver.data.xml.NpcData;
+import org.l2jmobius.gameserver.data.xml.RaidTeleportListData;
+import org.l2jmobius.gameserver.enums.RaidBossStatus;
+import org.l2jmobius.gameserver.instancemanager.CastleManager;
+import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
+import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
+import org.l2jmobius.gameserver.model.Location;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
+import org.l2jmobius.gameserver.model.effects.EffectFlag;
+import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
+import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
+import org.l2jmobius.gameserver.model.siege.Castle;
+import org.l2jmobius.gameserver.model.skills.CommonSkill;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.network.GameClient;
+import org.l2jmobius.gameserver.network.SystemMessageId;
+import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
+import org.l2jmobius.gameserver.network.serverpackets.teleports.ExRaidTeleportInfo;
+
+/**
+ * @author Gustavo Fonseca
+ */
+public class ExTeleportToRaidPosition implements IClientIncomingPacket
+{
+ private int _raidId;
+
+ @Override
+ public boolean read(GameClient client, PacketReader packet)
+ {
+ _raidId = packet.readD();
+ return true;
+ }
+
+ @Override
+ public void run(GameClient client)
+ {
+ final PlayerInstance player = client.getPlayer();
+ if (player == null)
+ {
+ return;
+ }
+
+ final TeleportListHolder teleport = RaidTeleportListData.getInstance().getTeleport(_raidId);
+ if (teleport == null)
+ {
+ LOGGER.warning("No registered teleport location for raid id: " + _raidId);
+ return;
+ }
+
+ // Dead characters cannot use teleports.
+ if (player.isDead())
+ {
+ player.sendPacket(SystemMessageId.DEAD_CHARACTERS_CANNOT_USE_TELEPORTS);
+ return;
+ }
+
+ final NpcTemplate template = NpcData.getInstance().getTemplate(_raidId);
+ if (template.isType("GrandBoss") && (GrandBossManager.getInstance().getBossStatus(_raidId) != 0))
+ {
+ player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
+ return;
+ }
+ else if (template.isType("RaidBoss") && (DBSpawnManager.getInstance().getNpcStatusId(_raidId) != RaidBossStatus.ALIVE))
+ {
+ player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
+ return;
+ }
+
+ // Players should not be able to teleport if in combat, or in a special location.
+ if (player.isCastingNow() || player.isInCombat() || player.isImmobilized() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInsideZone(ZoneId.TIMED_HUNTING))
+ {
+ player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
+ return;
+ }
+
+ // Karma related configurations.
+ if ((!Config.ALT_GAME_KARMA_PLAYER_CAN_TELEPORT || !Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK) && (player.getReputation() < 0))
+ {
+ player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
+ return;
+ }
+
+ // Cannot escape effect.
+ if (player.isAffected(EffectFlag.CANNOT_ESCAPE))
+ {
+ player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
+ return;
+ }
+
+ if (!Config.TELEPORT_WHILE_SIEGE_IN_PROGRESS)
+ {
+ final Castle castle = CastleManager.getInstance().getCastle(teleport.getX(), teleport.getY(), teleport.getZ());
+ if ((castle != null) && castle.getSiege().isInProgress())
+ {
+ player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
+ return;
+ }
+ }
+
+ final int price;
+ if ((Chronos.currentTimeMillis() - player.getVariables().getLong("LastFreeRaidTeleportTime", 0)) > 86400000)
+ {
+ player.getVariables().set("LastFreeRaidTeleportTime", Chronos.currentTimeMillis());
+ price = 0;
+ }
+ else
+ {
+ price = teleport.getPrice();
+ }
+
+ if (price > 0)
+ {
+ if (player.getInventory().getInventoryItemCount(Inventory.LCOIN_ID, -1) < price)
+ {
+ player.sendPacket(SystemMessageId.THERE_ARE_NOT_ENOUGH_L_COINS);
+ return;
+ }
+ player.destroyItemByItemId("TeleportToRaid", Inventory.LCOIN_ID, price, player, true);
+ }
+
+ player.abortCast();
+ player.stopMove(null);
+
+ player.setTeleportLocation(new Location(teleport.getX(), teleport.getY(), teleport.getZ()));
+ player.doCast(CommonSkill.TELEPORT.getSkill());
+ player.sendPacket(new ExRaidTeleportInfo());
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/clientpackets/teleports/RequestRaidTeleportInfo.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/clientpackets/teleports/RequestRaidTeleportInfo.java
new file mode 100644
index 0000000000..1ab3815be6
--- /dev/null
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/clientpackets/teleports/RequestRaidTeleportInfo.java
@@ -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 .
+ */
+package org.l2jmobius.gameserver.network.clientpackets.teleports;
+
+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.teleports.ExRaidTeleportInfo;
+
+/**
+ * @author Gustavo Fonseca
+ */
+public class RequestRaidTeleportInfo 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;
+ }
+
+ player.sendPacket(new ExRaidTeleportInfo());
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/serverpackets/teleports/ExRaidTeleportInfo.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/serverpackets/teleports/ExRaidTeleportInfo.java
new file mode 100644
index 0000000000..8e1e13d9a6
--- /dev/null
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/serverpackets/teleports/ExRaidTeleportInfo.java
@@ -0,0 +1,39 @@
+/*
+ * 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 org.l2jmobius.gameserver.network.serverpackets.teleports;
+
+import org.l2jmobius.commons.network.PacketWriter;
+import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
+
+/**
+ * @author GustavoFonseca
+ */
+public class ExRaidTeleportInfo implements IClientOutgoingPacket
+{
+ public ExRaidTeleportInfo()
+ {
+ }
+
+ @Override
+ public boolean write(PacketWriter packet)
+ {
+ OutgoingPackets.EX_RAID_TELEPORT_INFO.writeId(packet);
+ packet.writeD(1); // TODO: Character free teleport points from database or configuration.
+ return true;
+ }
+}
\ No newline at end of file