Addition of teleport list system.

Thanks to NviX.
This commit is contained in:
MobiusDevelopment 2019-09-21 11:26:27 +00:00
parent d36cb7ed7a
commit a5c2afbbca
7 changed files with 342 additions and 1 deletions

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/TeleportListData.xsd">
<teleport id="2" x="42111" y="148222" z="-3688" price="1650" /> <!-- Execution Grounds -->
<teleport id="3" x="46467" y="126885" z="-3720" price="1650" /> <!-- Partisan's Hideaway -->
<teleport id="4" x="15233" y="114153" z="-3576" price="1650" /> <!-- Cruma Marshlands -->
<teleport id="7" x="15689" y="142953" z="-2696" price="12000" /> <!-- Town of Dion -->
<teleport id="11" x="20505" y="189036" z="-3368" price="1650" /> <!-- Bee Hive -->
<teleport id="14" x="630" y="179184" z="-3720" price="1650" /> <!-- Plains of Dion -->
<teleport id="17" x="105918" y="109759" z="-3192" price="3000" /> <!-- Hardin's Academy -->
<teleport id="18" x="73024" y="118485" z="-3696" price="34200" /> <!-- Dragon Valley -->
<teleport id="19" x="132219" y="114392" z="-3720" price="34200" /> <!-- Antharas' Lair -->
<teleport id="21" x="70610" y="118363" z="-3664" price="1650" /> <!-- Death Pass -->
<teleport id="23" x="43408" y="206881" z="-3752" price="15300" /> <!-- Devil's Isle -->
<teleport id="24" x="47935" y="186810" z="-3480" price="3000" /> <!-- Giran Harbor -->
<teleport id="25" x="83386" y="148014" z="-3400" price="22500" /> <!-- Town of Giran -->
<teleport id="29" x="102369" y="137818" z="-3328" price="1650" /> <!-- Gorgon Flower Garden -->
<teleport id="32" x="-41137" y="122778" z="-2912" price="500" /> <!-- Ruins of Agony -->
<teleport id="34" x="-9970" y="175793" z="-4128" price="1650" /> <!-- Ant Nest -->
<teleport id="35" x="-80684" y="149770" z="-3040" price="11200" /> <!-- Gludin Village -->
<teleport id="36" x="-91080" y="149860" z="-3624" price="3000" /> <!-- Gludin Harbor -->
<teleport id="37" x="-14424" y="123972" z="-3120" price="12000" /> <!-- Town of Gludio -->
<teleport id="38" x="-46932" y="140883" z="-2936" price="1650" /> <!-- Abandoned Camp -->
<teleport id="46" x="-49332" y="207879" z="-3736" price="1650" /> <!-- Langk Lizardmen Dwellings -->
<teleport id="46" x="-45210" y="202654" z="-3592" price="1650" /> <!-- Langk Lizardmen Dwellings -->
<teleport id="49" x="-84191" y="244531" z="-3728" price="7200" /> <!-- Talking Island -->
<teleport id="53" x="-112367" y="234703" z="-3688" price="500" /> <!-- Elven Ruins -->
<teleport id="55" x="-106696" y="214691" z="-3424" price="500" /> <!-- Talking Island, Western Territory -->
<teleport id="56" x="-95336" y="240478" z="-3264" price="500" /> <!-- Talking Island, Eastern Territory -->
<teleport id="57" x="-70387" y="115501" z="-3472" price="1650" /> <!-- Fellmere Harvesting Grounds -->
<teleport id="58" x="-75311" y="169110" z="-3632" price="1650" /> <!-- Windmill Hill -->
<teleport id="58" x="-77643" y="166967" z="-3712" price="1650" /> <!-- Windmill Hill -->
<teleport id="62" x="-23789" y="169683" z="-3424" price="1650" /> <!-- Windawood Manor -->
<teleport id="66" x="-10612" y="75881" z="-3592" price="500" /> <!-- Neutral Zone -->
<teleport id="68" x="21362" y="51122" z="-3688" price="500" /> <!-- Elven Forest -->
<teleport id="70" x="46916" y="51420" z="-2976" price="7200" /> <!-- Elven Village -->
<teleport id="71" x="29294" y="74968" z="-3776" price="500" /> <!-- Elven Fortress -->
<teleport id="75" x="9800" y="15596" z="-4568" price="7200" /> <!-- Dark Elven Village -->
<teleport id="77" x="-21966" y="40544" z="-3192" price="500" /> <!-- Swampland -->
<teleport id="79" x="64328" y="26803" z="-3768" price="3900" /> <!-- Sea Of Spores -->
<teleport id="81" x="85391" y="16228" z="-3672" price="3900" /> <!-- Ivory Tower -->
<teleport id="82" x="82927" y="53255" z="-1488" price="12000" /> <!-- Town of Oren -->
<teleport id="84" x="87252" y="85514" z="-3056" price="3900" /> <!-- Plains of the Lizardmen -->
<teleport id="90" x="92278" y="15469" z="-4384" price="3900" /> <!-- Ivory Tower Crater -->
<teleport id="98" x="114649" y="11115" z="-5120" price="6750" /> <!-- Tower of Insolence -->
<teleport id="99" x="155310" y="-16339" z="-3320" price="6750" /> <!-- Blazing Swamp -->
<teleport id="101" x="187383" y="20498" z="-3584" price="6750" /> <!-- Seal of Shilen -->
<teleport id="102" x="177116" y="45786" z="-4168" price="15300" /> <!-- Giant's Cave -->
<teleport id="104" x="183961" y="20303" z="-3168" price="6750" /> <!-- Cemetery -->
<teleport id="105" x="142065" y="81300" z="-3000" price="3900" /> <!-- Forest of Mirrors -->
<teleport id="108" x="117051" y="76854" z="-2704" price="11200" /> <!-- Hunters Village -->
<teleport id="113" x="106517" y="-2871" z="-3416" price="6750" /> <!-- Ancient Battleground -->
<teleport id="115" x="184222" y="46666" z="-5864" price="15300" /> <!-- Silent Valley -->
<teleport id="117" x="138989" y="19915" z="-3592" price="6750" /> <!-- Plains of Glory -->
<teleport id="118" x="183543" y="-14974" z="-2768" price="3900" /> <!-- Fields of Massacre -->
<teleport id="119" x="159795" y="21131" z="-3696" price="6750" /> <!-- War-Torn Plains -->
<teleport id="131" x="-45158" y="-112583" z="-240" price="7200" /> <!-- Orc Village -->
<teleport id="133" x="9340" y="-112509" z="-2536" price="500" /> <!-- Cave of Trials -->
<teleport id="134" x="8652" y="-139941" z="-1144" price="500" /> <!-- Frozen Waterfalls -->
<teleport id="136" x="-10983" y="-117484" z="-2464" price="500" /> <!-- Immortal Plateau, Northern Region -->
<teleport id="137" x="-4190" y="-80040" z="-2696" price="500" /> <!-- Immortal Plateau, Southern Region -->
<teleport id="140" x="115190" y="-178176" z="-896" price="12000" /> <!-- Dwarven Village -->
<teleport id="142" x="139714" y="-177456" z="-1536" price="500" /> <!-- Abandoned Coal Mines -->
<teleport id="143" x="171946" y="-173352" z="3440" price="1650" /> <!-- Mithril Mines -->
<teleport id="145" x="124054" y="-200170" z="-3704" price="500" /> <!-- Western Mining Zone -->
<teleport id="146" x="169008" y="-208272" z="3496" price="1650" /> <!-- Eastern Mining Zone -->
<teleport id="181" x="147961" y="-55309" z="-2728" price="22500" /> <!-- Town of Goddard -->
<teleport id="184" x="144880" y="-113468" z="-2560" price="1650" /> <!-- Hot Springs -->
<teleport id="186" x="173494" y="-115521" z="-3760" price="15300" /> <!-- Forge Of The Gods -->
<teleport id="189" x="146990" y="-67128" z="-3640" price="34200" /> <!-- Ketra Orc Outpust -->
<teleport id="190" x="186699" y="-75915" z="-2824" price="15300" /> <!-- Imperial Tomb -->
<teleport id="193" x="165054" y="-47861" z="-3560" price="15300" /> <!-- Wall of the Argos -->
<teleport id="195" x="125740" y="-40864" z="-3736" price="34200" /> <!-- Varka Selenos Barraks -->
<teleport id="218" x="11560" y="-23942" z="-3640" price="15300" /> <!-- Forgotten Island -->
<teleport id="316" x="-99843" y="237583" z="-3568" price="500" /> <!-- Obelisk of Victory -->
<teleport id="317" x="115583" y="192261" z="-3488" price="3900" /> <!-- Alligator Island -->
<teleport id="318" x="-22224" y="14168" z="-3232" price="500" /> <!-- Dark Elven Forest -->
<teleport id="320" x="-61095" y="75104" z="-3352" price="500" /> <!-- Spider Nest -->
<teleport id="321" x="146856" y="25803" z="-2008" price="22500" /> <!-- Town of Aden -->
<teleport id="324" x="146440" y="46723" z="-3432" price="3000" /> <!-- Coliseum -->
<teleport id="402" x="-24653" y="78033" z="-3448" price="6750" /> <!-- The Patriot's Necropolis -->
<teleport id="403" x="-55701" y="78306" z="-3016" price="15300" /> <!-- Necropolis of Devotion -->
<teleport id="404" x="177347" y="173049" z="-1920" price="15300" /> <!-- Wind Plateau -->
<teleport id="405" x="82098" y="252437" z="-10592" price="15300" /> <!-- Garden of Eva -->
<teleport id="409" x="-111728" y="244330" z="-3448" price="500" /> <!-- Singing Waterfall -->
<teleport id="410" x="-21472" y="36244" z="-2776" price="500" /> <!-- Swampland North -->
<teleport id="411" x="124904" y="61992" z="-3920" price="3900" /> <!-- South of Enchanted Valley -->
<teleport id="412" x="116220" y="41380" z="-3880" price="3900" /> <!-- North of Enchanted Valley -->
<teleport id="413" x="-16730" y="209417" z="-3664" price="1650" /> <!-- Southern Entrance of Wasteland -->
<teleport id="415" x="-116686" y="46482" z="360" price="12000" /> <!-- Kamael Village -->
<teleport id="417" x="-119618" y="51994" z="-832" price="500" /> <!-- Hill of Hope -->
<teleport id="418" x="-109670" y="45283" z="-1344" price="500" /> <!-- Hills of Gold -->
<teleport id="422" x="107698" y="143854" z="-3440" price="1650" /> <!-- Giran Castle Siege Barracks -->
</list>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema 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:integer" name="id" use="required" />
<xs:attribute type="xs:integer" name="x" use="required" />
<xs:attribute type="xs:integer" name="y" use="required" />
<xs:attribute type="xs:integer" name="z" use="required" />
<xs:attribute type="xs:integer" name="price" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -96,6 +96,7 @@ import org.l2jmobius.gameserver.data.xml.impl.SkillData;
import org.l2jmobius.gameserver.data.xml.impl.SkillTreesData;
import org.l2jmobius.gameserver.data.xml.impl.SpawnsData;
import org.l2jmobius.gameserver.data.xml.impl.StaticObjectData;
import org.l2jmobius.gameserver.data.xml.impl.TeleportListData;
import org.l2jmobius.gameserver.data.xml.impl.TeleportersData;
import org.l2jmobius.gameserver.data.xml.impl.TransformData;
import org.l2jmobius.gameserver.data.xml.impl.VariationData;
@ -339,6 +340,7 @@ public class GameServer
printSection("Cache");
HtmCache.getInstance();
CrestTable.getInstance();
TeleportListData.getInstance();
TeleportersData.getInstance();
MatchingRoomManager.getInstance();
PetitionManager.getInstance();

View File

@ -0,0 +1,87 @@
/*
* 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.impl;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
/**
* @author NviX
*/
public class TeleportListData implements IXmlReader
{
private static Logger LOGGER = Logger.getLogger(TeleportListData.class.getName());
private final List<TeleportListHolder> _teleports = new ArrayList<>();
private int _teleportsCount = 0;
protected TeleportListData()
{
load();
}
@Override
public void load()
{
_teleports.clear();
parseDatapackFile("data/TeleportListData.xml");
_teleportsCount = _teleports.size();
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _teleportsCount + " teleports.");
}
@Override
public void parseDocument(Document doc, File f)
{
forEach(doc, "list", listNode -> forEach(listNode, "teleport", teleportNode ->
{
final StatsSet set = new StatsSet(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.add(new TeleportListHolder(tpId, x, y, z, tpPrice));
}));
}
public List<TeleportListHolder> getTeleports()
{
return _teleports;
}
public int getTeleportsCount()
{
return _teleportsCount;
}
public static TeleportListData getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final TeleportListData INSTANCE = new TeleportListData();
}
}

View File

@ -0,0 +1,63 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.holders;
/**
* @author NviX
*/
public class TeleportListHolder
{
private final int _locId;
private final int _x;
private final int _y;
private final int _z;
private final int _price;
public TeleportListHolder(int locId, int x, int y, int z, int price)
{
_locId = locId;
_x = x;
_y = y;
_z = z;
_price = price;
}
public int getLocId()
{
return _locId;
}
public int getX()
{
return _x;
}
public int getY()
{
return _y;
}
public int getZ()
{
return _z;
}
public int getPrice()
{
return _price;
}
}

View File

@ -456,7 +456,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
EX_OPEN_HTML(0x164, null, ConnectionState.IN_GAME), // 228
EX_REQUEST_CLASS_CHANGE(0x165, null, ConnectionState.IN_GAME), // 228
EX_REQUEST_CLASS_CHANGE_VERIFYING(0x166, null, ConnectionState.IN_GAME), // 228
EX_REQUEST_TELEPORT(0x167, null, ConnectionState.IN_GAME), // 228
EX_REQUEST_TELEPORT(0x167, ExRequestTeleport::new, ConnectionState.IN_GAME), // 228
EX_COSTUME_COLLECTION_SKILL_ACTIVE(0x16B, null, ConnectionState.IN_GAME), // 228
REQUEST_AUTO_USE_POTION(0x171, null, ConnectionState.IN_GAME), // 228
REQUEST_AUTO_USE(0x177, null, ConnectionState.IN_GAME), // 228

View File

@ -0,0 +1,74 @@
/*
* 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;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.impl.TeleportListData;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.holders.TeleportListHolder;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
/**
* @author NviX
*/
public class ExRequestTeleport implements IClientIncomingPacket
{
private int _locId;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_locId = packet.readD();
return true;
}
@Override
public void run(GameClient client)
{
final PlayerInstance player = client.getPlayer();
if (player == null)
{
return;
}
boolean success = false;
for (TeleportListHolder teleport : TeleportListData.getInstance().getTeleports())
{
if (teleport.getLocId() == _locId)
{
if (player.getAdena() < teleport.getPrice())
{
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
return;
}
player.reduceAdena("teleport", teleport.getPrice(), player, true);
player.teleToLocation(teleport.getX(), teleport.getY(), teleport.getZ());
success = true;
break;
}
}
if (!success)
{
LOGGER.info("No registered teleport location for id: " + _locId);
return;
}
}
}