Addition of map teleport system.

Contributed by Norvox.
This commit is contained in:
MobiusDevelopment 2021-04-24 21:51:47 +00:00
parent 0c44e798ae
commit 330d002ca1
14 changed files with 886 additions and 4 deletions

View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/RaidTeleportListData.xsd">
<teleport id="29001" x="93001" y="7913" z="-3904" price="20" />
<teleport id="29006" x="17756" y="110388" z="-6648" price="20" />
<teleport id="29014" x="67180" y="28562" z="-3744" price="20" />
<teleport id="25004" x="-61466" y="79786" z="-3488" price="20" />
<teleport id="25095" x="168148" y="-20504" z="-3680" price="20" />
<teleport id="25152" x="119877" y="13565" z="-5184" price="20" />
<teleport id="25398" x="94774" y="81548" z="-3680" price="20" />
<teleport id="25217" x="115966" y="10530" z="-5136" price="20" />
<teleport id="25176" x="92127" y="119736" z="-2912" price="20" />
<teleport id="25026" x="137772" y="78637" z="-3608" price="20" />
<teleport id="25102" x="-23702" y="74952" z="-3672" price="20" />
<teleport id="25155" x="135981" y="79736" z="-3576" price="20" />
<teleport id="25431" x="158212" y="-13096" z="-2816" price="20" />
<teleport id="25441" x="81273" y="109691" z="-3056" price="20" />
<teleport id="25146" x="119277" y="20219" z="-5168" price="20" />
<teleport id="25366" x="82341" y="60738" z="-3496" price="20" />
<teleport id="25369" x="110571" y="11967" z="-5152" price="20" />
<teleport id="25044" x="165646" y="-20861" z="-2912" price="20" />
<teleport id="25051" x="166972" y="-21210" z="-3416" price="20" />
<teleport id="25057" x="94373" y="83153" z="-3560" price="20" />
<teleport id="25099" x="167711" y="-19190" z="-3072" price="20" />
<teleport id="25122" x="-27820" y="79612" z="-3576" price="20" />
<teleport id="25159" x="85179" y="87669" z="-3152" price="20" />
<teleport id="25226" x="-27463" y="84255" z="-3464" price="20" />
<teleport id="25230" x="-58461" y="75471" z="-3176" price="20" />
<teleport id="25241" x="91330" y="69898" z="-3464" price="20" />
<teleport id="25255" x="85189" y="119998" z="-2944" price="20" />
<teleport id="25256" x="-54418" y="81791" z="-3480" price="20" />
<teleport id="25420" x="66911" y="31145" z="-3720" price="20" />
<teleport id="25463" x="-63757" y="82701" z="-3432" price="20" />
<teleport id="25478" x="91189" y="110550" z="-3808" price="20" />
<teleport id="25163" x="87669" y="108230" z="-3088" price="20" />
<teleport id="25252" x="96835" y="109953" z="-3712" price="20" />
<teleport id="29025" x="116033" y="17447" z="10107" price="20" />
<teleport id="25738" x="96002" y="27789" z="-3640" price="20" />
<teleport id="25739" x="108543" y="27676" z="-3480" price="20" />
<teleport id="25742" x="95285" y="20886" z="-3120" price="20" />
<teleport id="25743" x="102675" y="26799" z="-3376" price="20" />
<teleport id="25746" x="170376" y="-19957" z="-3504" price="20" />
<teleport id="25747" x="108414" y="80429" z="-2808" price="20" />
<teleport id="25748" x="107567" y="86892" z="-3144" price="20" />
<teleport id="25749" x="133071" y="6662" z="-4344" price="20" />
<teleport id="25750" x="138820" y="3347" z="-4520" price="20" />
<teleport id="25751" x="135274" y="11909" z="-4144" price="20" />
<teleport id="25754" x="155519" y="-20579" z="-1776" price="20" />
<teleport id="25757" x="80223" y="85605" z="-3528" price="20" />
<teleport id="25766" x="-47586" y="141472" z="-2920" price="20" />
<teleport id="25767" x="-51042" y="135662" z="-2920" price="20" />
<teleport id="25773" x="-89953" y="105548" z="-3576" price="20" />
<teleport id="25775" x="-94488" y="109525" z="-3784" price="20" />
<teleport id="29068" x="125833" y="123041" z="-3952" price="20" />
<teleport id="25283" x="185059" y="-9610" z="-5488" price="20" />
<teleport id="25286" x="-6675" y="18505" z="-5488" price="20" />
<teleport id="25054" x="113489" y="16586" z="3960" price="20" />
<teleport id="25092" x="115968" y="16003" z="1944" price="20" />
<teleport id="25126" x="113058" y="15603" z="5984" price="20" />
<teleport id="25143" x="114243" y="14482" z="7992" price="20" />
<teleport id="25220" x="114635" y="18179" z="-2896" price="20" />
<teleport id="25444" x="112565" y="16055" z="-4376" price="20" />
<teleport id="25447" x="114660" y="13914" z="64" price="20" />
<teleport id="25450" x="113430" y="14836" z="9560" price="20" />
<teleport id="29022" x="43403" y="208710" z="-3752" price="20" />
<teleport id="25909" x="-89105" y="104554" z="-3312" price="20" />
<teleport id="25910" x="-89635" y="115127" z="-3400" price="20" />
<teleport id="25911" x="-92358" y="119334" z="-3488" price="20" />
<teleport id="25925" x="-60496" y="137347" z="-2392" price="20" />
<teleport id="25926" x="-58974" y="135294" z="-2392" price="20" />
<teleport id="25932" x="127644" y="114568" z="-3520" price="20" />
<teleport id="25768" x="176307" y="40572" z="-3824" price="20" />
<teleport id="25769" x="163749" y="42252" z="-3352" price="20" />
<teleport id="25770" x="168081" y="46863" z="-3672" price="20" />
<teleport id="25365" x="89837" y="67707" z="-3664" price="20" />
<teleport id="25103" x="86092" y="67675" z="-3328" price="20" />
<teleport id="25437" x="180790" y="37516" z="-4792" price="20" />
<teleport id="25745" x="180326" y="43505" z="-3840" price="20" />
<teleport id="25772" x="185073" y="36926" z="-4176" price="20" />
<teleport id="25774" x="166837" y="39190" z="-3616" price="20" />
<teleport id="25776" x="174507" y="42098" z="-4872" price="20" />
<teleport id="25777" x="178757" y="41533" z="-3688" price="20" />
<teleport id="25780" x="145002" y="86608" z="-3600" price="20" />
<teleport id="25781" x="147320" y="83986" z="-3624" price="20" />
<teleport id="25782" x="151096" y="83959" z="-3432" price="20" />
<teleport id="25783" x="148726" y="82720" z="-3264" price="20" />
<teleport id="25784" x="154506" y="81675" z="-3160" price="20" />
<teleport id="25385" x="114815" y="1744" z="-3720" price="20" />
<teleport id="25758" x="112793" y="-987" z="-3904" price="20" />
<teleport id="25759" x="119294" y="-1929" z="-3720" price="20" />
<teleport id="25760" x="123636" y="-4094" z="-3304" price="20" />
<teleport id="25761" x="120924" y="-7493" z="-3152" price="20" />
<teleport id="25762" x="119518" y="-2860" z="-3760" price="20" />
<teleport id="25763" x="115975" y="-5424" z="-3416" price="20" />
<teleport id="25173" x="133703" y="-14093" z="-2656" price="20" />
<teleport id="25260" x="133853" y="-8115" z="-3384" price="20" />
<teleport id="25158" x="128048" y="-5376" z="-3280" price="20" />
<teleport id="25125" x="135519" y="-17294" z="-2576" price="20" />
<teleport id="25755" x="129750" y="-9334" z="-3600" price="20" />
<teleport id="25756" x="128767" y="-11501" z="-3664" price="20" />
<teleport id="25127" x="89085" y="61867" z="-3688" price="20" />
</list>

View File

@ -0,0 +1,21 @@
<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="teleport" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:short" name="id" use="required"/>
<xs:attribute type="xs:int" name="x" use="required"/>
<xs:attribute type="xs:int" name="y" use="required"/>
<xs:attribute type="xs:short" name="z" use="required"/>
<xs:attribute type="xs:byte" name="price" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, TeleportListHolder> _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();
}
}

View File

@ -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<GameClient>
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),

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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());
}
}

View File

@ -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.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());
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/RaidTeleportListData.xsd">
<teleport id="29001" x="93001" y="7913" z="-3904" price="20" />
<teleport id="29006" x="17756" y="110388" z="-6648" price="20" />
<teleport id="29014" x="67180" y="28562" z="-3744" price="20" />
<teleport id="25004" x="-61466" y="79786" z="-3488" price="20" />
<teleport id="25095" x="168148" y="-20504" z="-3680" price="20" />
<teleport id="25152" x="119877" y="13565" z="-5184" price="20" />
<teleport id="25398" x="94774" y="81548" z="-3680" price="20" />
<teleport id="25217" x="115966" y="10530" z="-5136" price="20" />
<teleport id="25176" x="92127" y="119736" z="-2912" price="20" />
<teleport id="25026" x="137772" y="78637" z="-3608" price="20" />
<teleport id="25102" x="-23702" y="74952" z="-3672" price="20" />
<teleport id="25155" x="135981" y="79736" z="-3576" price="20" />
<teleport id="25431" x="158212" y="-13096" z="-2816" price="20" />
<teleport id="25441" x="81273" y="109691" z="-3056" price="20" />
<teleport id="25146" x="119277" y="20219" z="-5168" price="20" />
<teleport id="25366" x="82341" y="60738" z="-3496" price="20" />
<teleport id="25369" x="110571" y="11967" z="-5152" price="20" />
<teleport id="25044" x="165646" y="-20861" z="-2912" price="20" />
<teleport id="25051" x="166972" y="-21210" z="-3416" price="20" />
<teleport id="25057" x="94373" y="83153" z="-3560" price="20" />
<teleport id="25099" x="167711" y="-19190" z="-3072" price="20" />
<teleport id="25122" x="-27820" y="79612" z="-3576" price="20" />
<teleport id="25159" x="85179" y="87669" z="-3152" price="20" />
<teleport id="25226" x="-27463" y="84255" z="-3464" price="20" />
<teleport id="25230" x="-58461" y="75471" z="-3176" price="20" />
<teleport id="25241" x="91330" y="69898" z="-3464" price="20" />
<teleport id="25255" x="85189" y="119998" z="-2944" price="20" />
<teleport id="25256" x="-54418" y="81791" z="-3480" price="20" />
<teleport id="25420" x="66911" y="31145" z="-3720" price="20" />
<teleport id="25463" x="-63757" y="82701" z="-3432" price="20" />
<teleport id="25478" x="91189" y="110550" z="-3808" price="20" />
<teleport id="25163" x="87669" y="108230" z="-3088" price="20" />
<teleport id="25252" x="96835" y="109953" z="-3712" price="20" />
<teleport id="29025" x="116033" y="17447" z="10107" price="20" />
<teleport id="25738" x="96002" y="27789" z="-3640" price="20" />
<teleport id="25739" x="108543" y="27676" z="-3480" price="20" />
<teleport id="25742" x="95285" y="20886" z="-3120" price="20" />
<teleport id="25743" x="102675" y="26799" z="-3376" price="20" />
<teleport id="25746" x="170376" y="-19957" z="-3504" price="20" />
<teleport id="25747" x="108414" y="80429" z="-2808" price="20" />
<teleport id="25748" x="107567" y="86892" z="-3144" price="20" />
<teleport id="25749" x="133071" y="6662" z="-4344" price="20" />
<teleport id="25750" x="138820" y="3347" z="-4520" price="20" />
<teleport id="25751" x="135274" y="11909" z="-4144" price="20" />
<teleport id="25754" x="155519" y="-20579" z="-1776" price="20" />
<teleport id="25757" x="80223" y="85605" z="-3528" price="20" />
<teleport id="25766" x="-47586" y="141472" z="-2920" price="20" />
<teleport id="25767" x="-51042" y="135662" z="-2920" price="20" />
<teleport id="25773" x="-89953" y="105548" z="-3576" price="20" />
<teleport id="25775" x="-94488" y="109525" z="-3784" price="20" />
<teleport id="29068" x="125833" y="123041" z="-3952" price="20" />
<teleport id="25283" x="185059" y="-9610" z="-5488" price="20" />
<teleport id="25286" x="-6675" y="18505" z="-5488" price="20" />
<teleport id="25054" x="113489" y="16586" z="3960" price="20" />
<teleport id="25092" x="115968" y="16003" z="1944" price="20" />
<teleport id="25126" x="113058" y="15603" z="5984" price="20" />
<teleport id="25143" x="114243" y="14482" z="7992" price="20" />
<teleport id="25220" x="114635" y="18179" z="-2896" price="20" />
<teleport id="25444" x="112565" y="16055" z="-4376" price="20" />
<teleport id="25447" x="114660" y="13914" z="64" price="20" />
<teleport id="25450" x="113430" y="14836" z="9560" price="20" />
<teleport id="29022" x="43403" y="208710" z="-3752" price="20" />
<teleport id="25909" x="-89105" y="104554" z="-3312" price="20" />
<teleport id="25910" x="-89635" y="115127" z="-3400" price="20" />
<teleport id="25911" x="-92358" y="119334" z="-3488" price="20" />
<teleport id="25925" x="-60496" y="137347" z="-2392" price="20" />
<teleport id="25926" x="-58974" y="135294" z="-2392" price="20" />
<teleport id="25932" x="127644" y="114568" z="-3520" price="20" />
<teleport id="25768" x="176307" y="40572" z="-3824" price="20" />
<teleport id="25769" x="163749" y="42252" z="-3352" price="20" />
<teleport id="25770" x="168081" y="46863" z="-3672" price="20" />
<teleport id="25365" x="89837" y="67707" z="-3664" price="20" />
<teleport id="25103" x="86092" y="67675" z="-3328" price="20" />
<teleport id="25437" x="180790" y="37516" z="-4792" price="20" />
<teleport id="25745" x="180326" y="43505" z="-3840" price="20" />
<teleport id="25772" x="185073" y="36926" z="-4176" price="20" />
<teleport id="25774" x="166837" y="39190" z="-3616" price="20" />
<teleport id="25776" x="174507" y="42098" z="-4872" price="20" />
<teleport id="25777" x="178757" y="41533" z="-3688" price="20" />
<teleport id="25780" x="145002" y="86608" z="-3600" price="20" />
<teleport id="25781" x="147320" y="83986" z="-3624" price="20" />
<teleport id="25782" x="151096" y="83959" z="-3432" price="20" />
<teleport id="25783" x="148726" y="82720" z="-3264" price="20" />
<teleport id="25784" x="154506" y="81675" z="-3160" price="20" />
<teleport id="25385" x="114815" y="1744" z="-3720" price="20" />
<teleport id="25758" x="112793" y="-987" z="-3904" price="20" />
<teleport id="25759" x="119294" y="-1929" z="-3720" price="20" />
<teleport id="25760" x="123636" y="-4094" z="-3304" price="20" />
<teleport id="25761" x="120924" y="-7493" z="-3152" price="20" />
<teleport id="25762" x="119518" y="-2860" z="-3760" price="20" />
<teleport id="25763" x="115975" y="-5424" z="-3416" price="20" />
<teleport id="25173" x="133703" y="-14093" z="-2656" price="20" />
<teleport id="25260" x="133853" y="-8115" z="-3384" price="20" />
<teleport id="25158" x="128048" y="-5376" z="-3280" price="20" />
<teleport id="25125" x="135519" y="-17294" z="-2576" price="20" />
<teleport id="25755" x="129750" y="-9334" z="-3600" price="20" />
<teleport id="25756" x="128767" y="-11501" z="-3664" price="20" />
<teleport id="25127" x="89085" y="61867" z="-3688" price="20" />
</list>

View File

@ -0,0 +1,21 @@
<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="teleport" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:short" name="id" use="required"/>
<xs:attribute type="xs:int" name="x" use="required"/>
<xs:attribute type="xs:int" name="y" use="required"/>
<xs:attribute type="xs:short" name="z" use="required"/>
<xs:attribute type="xs:byte" name="price" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Integer, TeleportListHolder> _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();
}
}

View File

@ -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<GameClient>
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),

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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());
}
}

View File

@ -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.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());
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}