Replaced summon item CSV data with aCis free version XML data.
This commit is contained in:
parent
a6a0c0fd06
commit
afa6bac3aa
17
L2J_Mobius_C6_Interlude/dist/game/data/SummonItems.xml
vendored
Normal file
17
L2J_Mobius_C6_Interlude/dist/game/data/SummonItems.xml
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/SummonItems.xsd">
|
||||
<item id="5560" npcId="13006" summonType="0" /> <!-- Christmas Tree -->
|
||||
<item id="5561" npcId="13007" summonType="0" /> <!-- Special Christmas Tree -->
|
||||
<item id="2375" npcId="12077" summonType="1" /> <!-- Wolf -->
|
||||
<item id="3500" npcId="12311" summonType="1" /> <!-- Hatchling of Wind -->
|
||||
<item id="3501" npcId="12312" summonType="1" /> <!-- Hatchling of Star -->
|
||||
<item id="3502" npcId="12313" summonType="1" /> <!-- Hatchling of Twilight -->
|
||||
<item id="4422" npcId="12526" summonType="1" /> <!-- Wind Strider -->
|
||||
<item id="4423" npcId="12527" summonType="1" /> <!-- Star Strider -->
|
||||
<item id="4424" npcId="12528" summonType="1" /> <!-- Twilight Strider -->
|
||||
<item id="4425" npcId="12564" summonType="1" /> <!-- Sin Eater -->
|
||||
<item id="6648" npcId="12780" summonType="1" /> <!-- Baby Buffalo -->
|
||||
<item id="6649" npcId="12782" summonType="1" /> <!-- Baby Cougar -->
|
||||
<item id="6650" npcId="12781" summonType="1" /> <!-- Baby Kookaburra -->
|
||||
<item id="8663" npcId="12621" summonType="2" /> <!-- Wyvern -->
|
||||
</list>
|
@ -1,38 +0,0 @@
|
||||
#Syntax:
|
||||
# itemID;npcID;summonType
|
||||
#
|
||||
# summonType: 0 = static, 1 = pet, 2 = wyvern
|
||||
#
|
||||
|
||||
#Static
|
||||
# Christmas Tree
|
||||
# 5560;13006;0
|
||||
# Special Cristmas Tree
|
||||
# 5561;13007;0
|
||||
|
||||
#Pets
|
||||
# Wolf
|
||||
2375;12077;1
|
||||
# Hatchling of Wind
|
||||
3500;12311;1
|
||||
# Hatchling of Star
|
||||
3501;12312;1
|
||||
# Hatchling of Twilight
|
||||
3502;12313;1
|
||||
# Wind Strider
|
||||
4422;12526;1
|
||||
# Star Strider
|
||||
4423;12527;1
|
||||
# Twilight Strider
|
||||
4424;12528;1
|
||||
# Sin Eater
|
||||
4425;12564;1
|
||||
# Baby Bufallo
|
||||
6648;12780;1
|
||||
# Baby Cougar
|
||||
6649;12782;1
|
||||
# Baby Kookaburra
|
||||
6650;12781;1
|
||||
|
||||
#Wyvern
|
||||
8663;12621;2
|
|
19
L2J_Mobius_C6_Interlude/dist/game/data/xsd/SummonItems.xsd
vendored
Normal file
19
L2J_Mobius_C6_Interlude/dist/game/data/xsd/SummonItems.xsd
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
<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="item" 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:short" name="npcId" use="required"/>
|
||||
<xs:attribute type="xs:byte" name="summonType" use="required"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
@ -50,7 +50,6 @@ import org.l2jmobius.gameserver.datatables.SkillTable;
|
||||
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.SummonItemsData;
|
||||
import org.l2jmobius.gameserver.datatables.sql.ArmorSetsTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.CharNameTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.CharTemplateTable;
|
||||
@ -73,6 +72,7 @@ import org.l2jmobius.gameserver.datatables.xml.FishData;
|
||||
import org.l2jmobius.gameserver.datatables.xml.HennaData;
|
||||
import org.l2jmobius.gameserver.datatables.xml.RecipeData;
|
||||
import org.l2jmobius.gameserver.datatables.xml.StaticObjectData;
|
||||
import org.l2jmobius.gameserver.datatables.xml.SummonItemData;
|
||||
import org.l2jmobius.gameserver.datatables.xml.ZoneData;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.handler.AdminCommandHandler;
|
||||
@ -249,7 +249,7 @@ public class GameServer
|
||||
CustomArmorSetsTable.getInstance();
|
||||
}
|
||||
ExtractableItemsData.getInstance();
|
||||
SummonItemsData.getInstance();
|
||||
SummonItemData.getInstance();
|
||||
if (Config.ALLOWFISHING)
|
||||
{
|
||||
FishData.getInstance();
|
||||
|
@ -1,133 +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.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Scanner;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.model.SummonItem;
|
||||
|
||||
public class SummonItemsData
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(SummonItemsData.class.getName());
|
||||
|
||||
private final Map<Integer, SummonItem> _summonitems;
|
||||
|
||||
public SummonItemsData()
|
||||
{
|
||||
_summonitems = new HashMap<>();
|
||||
|
||||
Scanner s = null;
|
||||
|
||||
try
|
||||
{
|
||||
s = new Scanner(new File(Config.DATAPACK_ROOT + "/data/csv/summon_items.csv"));
|
||||
|
||||
int lineCount = 0;
|
||||
|
||||
while (s.hasNextLine())
|
||||
{
|
||||
lineCount++;
|
||||
|
||||
final String line = s.nextLine();
|
||||
|
||||
if (line.startsWith("#"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (line.equals(""))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final String[] lineSplit = line.split(";");
|
||||
|
||||
boolean ok = true;
|
||||
int itemID = 0;
|
||||
int npcID = 0;
|
||||
byte summonType = 0;
|
||||
|
||||
try
|
||||
{
|
||||
itemID = Integer.parseInt(lineSplit[0]);
|
||||
npcID = Integer.parseInt(lineSplit[1]);
|
||||
summonType = Byte.parseByte(lineSplit[2]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.info("Summon items data: Error in line " + lineCount + " -> incomplete/invalid data or wrong seperator!");
|
||||
LOGGER.info(" " + line);
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final SummonItem summonitem = new SummonItem(itemID, npcID, summonType);
|
||||
_summonitems.put(itemID, summonitem);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.info("Summon items data: Can not find './data/csv/summon_items.csv'");
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (s != null)
|
||||
{
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
|
||||
LOGGER.info("Summon items data: Loaded " + _summonitems.size() + " summon items.");
|
||||
}
|
||||
|
||||
public SummonItem getSummonItem(int itemId)
|
||||
{
|
||||
return _summonitems.get(itemId);
|
||||
}
|
||||
|
||||
public int[] itemIDs()
|
||||
{
|
||||
final int size = _summonitems.size();
|
||||
final int[] result = new int[size];
|
||||
int i = 0;
|
||||
|
||||
for (SummonItem si : _summonitems.values())
|
||||
{
|
||||
result[i] = si.getItemId();
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static SummonItemsData getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final SummonItemsData INSTANCE = new SummonItemsData();
|
||||
}
|
||||
}
|
@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.datatables.xml;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -137,9 +136,9 @@ public class RecipeData extends RecipeController implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<RecipeList> getAllRecipes()
|
||||
public RecipeList getRecipe(int recipeId)
|
||||
{
|
||||
return _lists.values();
|
||||
return _lists.get(recipeId);
|
||||
}
|
||||
|
||||
public RecipeList getRecipeByItemId(int itemId)
|
||||
@ -154,9 +153,15 @@ public class RecipeData extends RecipeController implements IXmlReader
|
||||
return null;
|
||||
}
|
||||
|
||||
public RecipeList getRecipe(int recId)
|
||||
public int[] getAllItemIds()
|
||||
{
|
||||
return _lists.get(recId);
|
||||
int index = 0;
|
||||
final int[] ids = new int[_lists.size()];
|
||||
for (RecipeList recipe : _lists.values())
|
||||
{
|
||||
ids[index++] = recipe.getRecipeId();
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
public static RecipeData getInstance()
|
||||
|
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* 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.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.model.SummonItem;
|
||||
|
||||
/**
|
||||
* This class loads and stores summon items.
|
||||
*/
|
||||
public class SummonItemData implements IXmlReader
|
||||
{
|
||||
private final Map<Integer, SummonItem> _items = new HashMap<>();
|
||||
|
||||
protected SummonItemData()
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
{
|
||||
parseDatapackFile("data/SummonItems.xml");
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _items.size() + " summon items.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parseDocument(Document doc, File f)
|
||||
{
|
||||
// First element is never read.
|
||||
final Node n = doc.getFirstChild();
|
||||
|
||||
for (Node node = n.getFirstChild(); node != null; node = node.getNextSibling())
|
||||
{
|
||||
if (!"item".equalsIgnoreCase(node.getNodeName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final NamedNodeMap attrs = node.getAttributes();
|
||||
|
||||
final int itemId = Integer.valueOf(attrs.getNamedItem("id").getNodeValue());
|
||||
final int npcId = Integer.valueOf(attrs.getNamedItem("npcId").getNodeValue());
|
||||
final byte summonType = Byte.valueOf(attrs.getNamedItem("summonType").getNodeValue());
|
||||
|
||||
_items.put(itemId, new SummonItem(itemId, npcId, summonType));
|
||||
}
|
||||
}
|
||||
|
||||
public SummonItem getSummonItem(int itemId)
|
||||
{
|
||||
return _items.get(itemId);
|
||||
}
|
||||
|
||||
public int[] getAllItemIds()
|
||||
{
|
||||
int index = 0;
|
||||
final int[] ids = new int[_items.size()];
|
||||
for (Integer id : _items.keySet())
|
||||
{
|
||||
ids[index++] = id;
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
public static SummonItemData getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final SummonItemData INSTANCE = new SummonItemData();
|
||||
}
|
||||
}
|
@ -28,17 +28,7 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
|
||||
public class Recipes implements IItemHandler
|
||||
{
|
||||
private final int[] ITEM_IDS;
|
||||
|
||||
public Recipes()
|
||||
{
|
||||
int index = 0;
|
||||
ITEM_IDS = new int[RecipeData.getInstance().getAllRecipes().size()];
|
||||
for (RecipeList recipe : RecipeData.getInstance().getAllRecipes())
|
||||
{
|
||||
ITEM_IDS[index++] = recipe.getRecipeId();
|
||||
}
|
||||
}
|
||||
private static final int[] ITEM_IDS = RecipeData.getInstance().getAllItemIds();
|
||||
|
||||
@Override
|
||||
public void useItem(Playable playable, ItemInstance item)
|
||||
|
@ -19,8 +19,8 @@ package org.l2jmobius.gameserver.handler.itemhandlers;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.gameserver.datatables.SkillTable;
|
||||
import org.l2jmobius.gameserver.datatables.csv.SummonItemsData;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.datatables.xml.SummonItemData;
|
||||
import org.l2jmobius.gameserver.handler.IItemHandler;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
@ -44,6 +44,8 @@ import org.l2jmobius.gameserver.network.serverpackets.Ride;
|
||||
|
||||
public class SummonItems implements IItemHandler
|
||||
{
|
||||
private static final int[] ITEM_IDS = SummonItemData.getInstance().getAllItemIds();
|
||||
|
||||
@Override
|
||||
public void useItem(Playable playable, ItemInstance item)
|
||||
{
|
||||
@ -105,8 +107,7 @@ public class SummonItems implements IItemHandler
|
||||
return;
|
||||
}
|
||||
|
||||
final SummonItem sitem = SummonItemsData.getInstance().getSummonItem(item.getItemId());
|
||||
|
||||
final SummonItem sitem = SummonItemData.getInstance().getSummonItem(item.getItemId());
|
||||
if (((player.getPet() != null) || player.isMounted()) && sitem.isPetSummon())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_ALREADY_HAVE_A_PET);
|
||||
@ -304,6 +305,6 @@ public class SummonItems implements IItemHandler
|
||||
@Override
|
||||
public int[] getItemIds()
|
||||
{
|
||||
return SummonItemsData.getInstance().itemIDs();
|
||||
return ITEM_IDS;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user