Replaced static object CSV data with aCis free version XML data.

This commit is contained in:
MobiusDevelopment 2020-01-26 19:25:27 +00:00
parent e1f4230ed2
commit f1f8ccfc2b
7 changed files with 163 additions and 186 deletions

View File

@ -0,0 +1,32 @@
<?xml version='1.0' encoding='utf-8'?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/StaticObjects.xsd">
<object id="20180001" x="15258" y="15631" z="-4366" type="0" texture="town_map_darkelf_t00" mapX="339" mapY="170"/><!-- darkelf_village_001 -->
<object id="20180002" x="7557" y="18055" z="-4366" type="0" texture="town_map_darkelf_t00" mapX="54" mapY="315"/><!-- darkelf_village_002 -->
<object id="23120001" x="115462" y="-177295" z="-880" type="0" texture="town_map_dwarf_t00" mapX="165" mapY="386"/><!-- dwarven_village_001 -->
<object id="23120002" x="117450" y="-182299" z="-1488" type="0" texture="town_map_dwarf_t00" mapX="350" mapY="190"/><!-- dwarven_village_002 -->
<object id="23120003" x="116657" y="-183997" z="-1550" type="0" texture="town_map_dwarf_t00" mapX="319" mapY="110"/><!-- dwarven_village_003 -->
<object id="21190001" x="47616" y="51349" z="-2968" type="0" texture="town_map_elf_t00" mapX="430" mapY="285"/><!-- elf_village_001 -->
<object id="21190002" x="45915" y="46695" z="-2969" type="0" texture="town_map_elf_t00" mapX="248" mapY="80"/><!-- elf_village_002 -->
<object id="21190003" x="43175" y="51424" z="-2968" type="0" texture="town_map_elf_t00" mapX="110" mapY="345"/><!-- elf_village_003 -->
<object id="17250001" x="-82873" y="244808" z="-3717" type="0" texture="town_map_talking_t00" mapX="365" mapY="152"/><!-- human_village_001 -->
<object id="17250002" x="-82765" y="241439" z="-3718" type="0" texture="town_map_talking_t00" mapX="164" mapY="154"/><!-- human_village_002 -->
<object id="17250003" x="-86121" y="241452" z="-3719" type="0" texture="town_map_talking_t00" mapX="146" mapY="358"/><!-- human_village_003 -->
<object id="18140001" x="-45824" y="-116764" z="-219" type="0" texture="town_map_orc_t00" mapX="265" mapY="120"/><!-- orc_village_001 -->
<object id="18140002" x="-46504" y="-110394" z="-220" type="0" texture="town_map_orc_t00" mapX="108" mapY="383"/><!-- orc_village_002 -->
<object id="18140003" x="-47332" y="-113246" z="-220" type="0" texture="town_map_orc_t00" mapX="141" mapY="235"/><!-- orc_village_003 -->
<object id="24180017" x="147456" y="3272" z="-42" type="1" texture="none" mapX="0" mapY="0"/><!-- aden_castle_throne -->
<object id="22190010" x="83237" y="37192" z="-2286" type="1" texture="none" mapX="0" mapY="0"/><!-- oren_castle_throne -->
<object id="20220010" x="22073" y="160989" z="-2686" type="1" texture="none" mapX="0" mapY="0"/><!-- dion_castle_throne -->
<object id="23220010" x="117161" y="145097" z="-2559" type="1" texture="none" mapX="0" mapY="0"/><!-- giran_castle_throne -->
<object id="19210010" x="-18112" y="108761" z="-2492" type="1" texture="none" mapX="0" mapY="0"/><!-- gludio_castle_throne -->
<object id="23250010" x="116024" y="249768" z="-782" type="1" texture="none" mapX="0" mapY="0"/><!-- innadril_castle_throne -->
<object id="24160024" x="147459" y="-49363" z="-2132" type="1" texture="none" mapX="0" mapY="0"/><!-- goddard_castle_throne -->
<object id="22130016" x="77555" y="-153420" z="-405" type="1" texture="none" mapX="0" mapY="0"/><!-- schuttgart_castle_throne -->
<object id="20160010" x="10128" y="-49162" z="-280" type="1" texture="none" mapX="0" mapY="0"/><!-- rune_castle_throne -->
<object id="20230001" x="12110" y="182771" z="-3538" type="2" texture="none" mapX="0" mapY="0"/><!-- floran_arena_001 -->
<object id="20230002" x="12979" y="183365" z="-3538" type="2" texture="none" mapX="0" mapY="0"/><!-- floran_arena_002 -->
<object id="22220001" x="73766" y="142489" z="-3748" type="2" texture="none" mapX="0" mapY="0"/><!-- giran_arena_001 -->
<object id="22220002" x="72200" y="143102" z="-3748" type="2" texture="none" mapX="0" mapY="0"/><!-- giran_arena_002 -->
<object id="17220015" x="-88697" y="142316" z="-3621" type="2" texture="none" mapX="0" mapY="0"/><!-- gludin_arena_001 -->
<object id="17220016" x="-87136" y="142491" z="-3623" type="2" texture="none" mapX="0" mapY="0"/><!-- gludin_arena_002 -->
</list>

View File

@ -1,30 +0,0 @@
darkelf_village_001;20180001;15258;15631;-4366;0;town_map_darkelf_t00;1;1
darkelf_village_002;20180002;7557;18055;-4366;0;town_map_darkelf_t00;1;1
dwarven_village_001;23120001;115462;-177295;-880;0;town_map_dwarf_t00;1;1
dwarven_village_002;23120002;117450;-182299;-1488;0;town_map_dwarf_t00;1;1
dwarven_village_003;23120003;116657;-183997;-1550;0;town_map_dwarf_t00;1;1
elf_village_001;21190001;47616;51349;-2968;0;town_map_elf_t00;1;1
elf_village_002;21190002;45915;46695;-2969;0;town_map_elf_t00;1;1
elf_village_003;21190003;43175;51424;-2968;0;town_map_elf_t00;1;1
human_village_001;17250001;-82873;244808;-3717;0;town_map_talking_t00;1;1
human_village_002;17250002;-82765;241439;-3718;0;town_map_talking_t00;1;1
human_village_003;17250003;-86121;241452;-3719;0;town_map_talking_t00;1;1
orc_village_001;18140001;-45824;-116764;-219;0;town_map_orc_t00;1;1
orc_village_002;18140002;-46504;-110394;-220;0;town_map_orc_t00;1;1
orc_village_003;18140003;-47332;-113246;-220;0;town_map_orc_t00;1;1
aden_castle_throne;24180017;147456;3272;-42;1;none;0;0
oren_castle_throne;22190010;83237;37192;-2286;1;none;0;0
dion_castle_throne;20220010;22073;160989;-2686;1;none;0;0
giran_castle_throne;23220010;117161;145097;-2559;1;none;0;0
gludio_castle_throne;19210010;-18112;108761;-2492;1;none;0;0
innadril_castle_throne;23250010;116024;249768;-782;1;none;0;0
goddard_castle_throne;24160024;147464;-49339;-2123;1;none;0;0
schuttgart_castle_throne;22130016;77551;-153410;-389;1;none;0;0
rune_castle_throne;20160010;10103;-49153;-272;1;none;0;0
floran_arena_001;20230001;12110;182771;-3538;2;none;0;0
floran_arena_002;20230002;12979;183365;-3538;2;none;0;0
giran_arena_001;22220001;73766;142489;-3748;2;none;0;0
giran_arena_002;22220002;72200;143102;-3748;2;none;0;0
gludin_arena_001;17220015;-88697;142316;-3621;2;none;0;0
gludin_arena_002;17220016;-87136;142491;-3623;2;none;0;0
Dragonspine_flagpole;20200500;11546;95030;-2498;3;none;0;0
1 darkelf_village_001 20180001 15258 15631 -4366 0 town_map_darkelf_t00 1 1
2 darkelf_village_002 20180002 7557 18055 -4366 0 town_map_darkelf_t00 1 1
3 dwarven_village_001 23120001 115462 -177295 -880 0 town_map_dwarf_t00 1 1
4 dwarven_village_002 23120002 117450 -182299 -1488 0 town_map_dwarf_t00 1 1
5 dwarven_village_003 23120003 116657 -183997 -1550 0 town_map_dwarf_t00 1 1
6 elf_village_001 21190001 47616 51349 -2968 0 town_map_elf_t00 1 1
7 elf_village_002 21190002 45915 46695 -2969 0 town_map_elf_t00 1 1
8 elf_village_003 21190003 43175 51424 -2968 0 town_map_elf_t00 1 1
9 human_village_001 17250001 -82873 244808 -3717 0 town_map_talking_t00 1 1
10 human_village_002 17250002 -82765 241439 -3718 0 town_map_talking_t00 1 1
11 human_village_003 17250003 -86121 241452 -3719 0 town_map_talking_t00 1 1
12 orc_village_001 18140001 -45824 -116764 -219 0 town_map_orc_t00 1 1
13 orc_village_002 18140002 -46504 -110394 -220 0 town_map_orc_t00 1 1
14 orc_village_003 18140003 -47332 -113246 -220 0 town_map_orc_t00 1 1
15 aden_castle_throne 24180017 147456 3272 -42 1 none 0 0
16 oren_castle_throne 22190010 83237 37192 -2286 1 none 0 0
17 dion_castle_throne 20220010 22073 160989 -2686 1 none 0 0
18 giran_castle_throne 23220010 117161 145097 -2559 1 none 0 0
19 gludio_castle_throne 19210010 -18112 108761 -2492 1 none 0 0
20 innadril_castle_throne 23250010 116024 249768 -782 1 none 0 0
21 goddard_castle_throne 24160024 147464 -49339 -2123 1 none 0 0
22 schuttgart_castle_throne 22130016 77551 -153410 -389 1 none 0 0
23 rune_castle_throne 20160010 10103 -49153 -272 1 none 0 0
24 floran_arena_001 20230001 12110 182771 -3538 2 none 0 0
25 floran_arena_002 20230002 12979 183365 -3538 2 none 0 0
26 giran_arena_001 22220001 73766 142489 -3748 2 none 0 0
27 giran_arena_002 22220002 72200 143102 -3748 2 none 0 0
28 gludin_arena_001 17220015 -88697 142316 -3621 2 none 0 0
29 gludin_arena_002 17220016 -87136 142491 -3623 2 none 0 0
30 Dragonspine_flagpole 20200500 11546 95030 -2498 3 none 0 0

View File

@ -0,0 +1,24 @@
<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="object" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:int" 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="type" use="required"/>
<xs:attribute type="xs:string" name="texture" use="required"/>
<xs:attribute type="xs:short" name="mapX" use="required"/>
<xs:attribute type="xs:short" name="mapY" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@ -51,7 +51,6 @@ import org.l2jmobius.gameserver.datatables.csv.ExtractableItemsData;
import org.l2jmobius.gameserver.datatables.csv.MapRegionTable;
import org.l2jmobius.gameserver.datatables.csv.NpcWalkerRoutesTable;
import org.l2jmobius.gameserver.datatables.csv.RecipeTable;
import org.l2jmobius.gameserver.datatables.csv.StaticObjects;
import org.l2jmobius.gameserver.datatables.csv.SummonItemsData;
import org.l2jmobius.gameserver.datatables.sql.ArmorSetsTable;
import org.l2jmobius.gameserver.datatables.sql.CharNameTable;
@ -73,6 +72,7 @@ import org.l2jmobius.gameserver.datatables.xml.ExperienceData;
import org.l2jmobius.gameserver.datatables.xml.FenceData;
import org.l2jmobius.gameserver.datatables.xml.FishData;
import org.l2jmobius.gameserver.datatables.xml.HennaData;
import org.l2jmobius.gameserver.datatables.xml.StaticObjectData;
import org.l2jmobius.gameserver.datatables.xml.ZoneData;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.AdminCommandHandler;
@ -210,7 +210,7 @@ public class GameServer
Announcements.getInstance();
AutoAnnouncementHandler.getInstance();
GlobalVariablesManager.getInstance();
StaticObjects.getInstance();
StaticObjectData.getInstance();
TeleportLocationTable.getInstance();
PartyMatchWaitingList.getInstance();
PartyMatchRoomList.getInstance();

View File

@ -1,154 +0,0 @@
/*
* 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.datatables.csv;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.LineNumberReader;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.idfactory.IdFactory;
import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance;
public class StaticObjects
{
private static final Logger LOGGER = Logger.getLogger(StaticObjects.class.getName());
private final Map<Integer, StaticObjectInstance> _staticObjects;
public StaticObjects()
{
_staticObjects = new HashMap<>();
parseData();
LOGGER.info("StaticObject: Loaded " + _staticObjects.size() + " StaticObject Templates.");
}
private void parseData()
{
FileReader reader = null;
BufferedReader buff = null;
LineNumberReader lnr = null;
try
{
final File doorData = new File(Config.DATAPACK_ROOT, "data/csv/staticobjects.csv");
reader = new FileReader(doorData);
buff = new BufferedReader(reader);
lnr = new LineNumberReader(buff);
String line = null;
while ((line = lnr.readLine()) != null)
{
if ((line.trim().length() == 0) || line.startsWith("#"))
{
continue;
}
final StaticObjectInstance obj = parse(line);
_staticObjects.put(obj.getStaticObjectId(), obj);
}
}
catch (FileNotFoundException e)
{
LOGGER.warning("staticobjects.csv is missing in data csv folder");
}
catch (Exception e)
{
LOGGER.warning("Error while creating StaticObjects table " + e);
}
finally
{
if (lnr != null)
{
try
{
lnr.close();
}
catch (Exception e1)
{
LOGGER.warning("Problem with StaticObjects: " + e1.getMessage());
}
}
if (buff != null)
{
try
{
buff.close();
}
catch (Exception e1)
{
LOGGER.warning("Problem with StaticObjects: " + e1.getMessage());
}
}
if (reader != null)
{
try
{
reader.close();
}
catch (Exception e1)
{
LOGGER.warning("Problem with StaticObjects: " + e1.getMessage());
}
}
}
}
public static StaticObjectInstance parse(String line)
{
final StringTokenizer st = new StringTokenizer(line, ";");
st.nextToken(); // Pass over static object name (not used in server)
final int id = Integer.parseInt(st.nextToken());
final int x = Integer.parseInt(st.nextToken());
final int y = Integer.parseInt(st.nextToken());
final int z = Integer.parseInt(st.nextToken());
final int type = Integer.parseInt(st.nextToken());
final String texture = st.nextToken();
final int map_x = Integer.parseInt(st.nextToken());
final int map_y = Integer.parseInt(st.nextToken());
final StaticObjectInstance obj = new StaticObjectInstance(IdFactory.getInstance().getNextId());
obj.setType(type);
obj.setStaticObjectId(id);
obj.setXYZ(x, y, z);
obj.setMap(texture, map_x, map_y);
obj.spawnMe();
return obj;
}
public static StaticObjects getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final StaticObjects INSTANCE = new StaticObjects();
}
}

View File

@ -57,6 +57,7 @@ public class FishData implements IXmlReader
// First element is never read.
final Node n = doc.getFirstChild();
for (Node node = n.getFirstChild(); node != null; node = node.getNextSibling())
{
if (!"fish".equalsIgnoreCase(node.getNodeName()))

View File

@ -0,0 +1,104 @@
/*
* 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.datatables.xml;
import java.io.File;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.idfactory.IdFactory;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance;
import org.l2jmobius.gameserver.network.serverpackets.StaticObject;
/**
* This class loads, stores and spawns {@link StaticObject}s.
*/
public class StaticObjectData implements IXmlReader
{
private final Map<Integer, StaticObjectInstance> _objects = new HashMap<>();
protected StaticObjectData()
{
load();
}
@Override
public void load()
{
parseDatapackFile("data/StaticObjects.xml");
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _objects.size() + " static objects.");
}
@Override
public void parseDocument(Document doc, File f)
{
// StatsSet used to feed informations. Cleaned on every entry.
final StatSet set = new StatSet();
// First element is never read.
final Node n = doc.getFirstChild();
for (Node node = n.getFirstChild(); node != null; node = node.getNextSibling())
{
if (!"object".equalsIgnoreCase(node.getNodeName()))
{
continue;
}
// Parse and feed content.
final NamedNodeMap attrs = node.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
{
final Node attr = attrs.item(i);
set.set(attr.getNodeName(), attr.getNodeValue());
}
// Create and spawn the StaticObject instance.
final StaticObjectInstance obj = new StaticObjectInstance(IdFactory.getInstance().getNextId());
obj.setType(set.getInt("type"));
obj.setStaticObjectId(set.getInt("id"));
obj.setXYZ(set.getInt("x"), set.getInt("y"), set.getInt("z"));
obj.setMap(set.getString("texture"), set.getInt("mapX"), set.getInt("mapY"));
obj.spawnMe();
// Feed the map with new data.
_objects.put(obj.getObjectId(), obj);
}
}
public Collection<StaticObjectInstance> getStaticObjects()
{
return _objects.values();
}
public static StaticObjectData getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final StaticObjectData INSTANCE = new StaticObjectData();
}
}