Replaced armor set SQL data with aCis free version XML data.
This commit is contained in:
@@ -646,8 +646,6 @@ public class Config
|
||||
public static boolean SAVE_GMSPAWN_ON_CUSTOM;
|
||||
public static boolean DELETE_GMSPAWN_ON_CUSTOM;
|
||||
public static boolean CUSTOM_NPC_TABLE = true;
|
||||
public static boolean CUSTOM_ITEM_TABLES = true;
|
||||
public static boolean CUSTOM_ARMORSETS_TABLE = true;
|
||||
public static boolean CUSTOM_TELEPORT_TABLE = true;
|
||||
public static boolean CUSTOM_DROPLIST_TABLE = true;
|
||||
public static boolean CUSTOM_MERCHANT_TABLES = true;
|
||||
|
@@ -50,11 +50,9 @@ 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.sql.ArmorSetsTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.CharNameTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.CharTemplateTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.CustomArmorSetsTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.HelperBuffTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.LevelUpData;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
@@ -64,6 +62,7 @@ import org.l2jmobius.gameserver.datatables.sql.SkillTreeTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.SpawnTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.TeleportLocationTable;
|
||||
import org.l2jmobius.gameserver.datatables.xml.AdminData;
|
||||
import org.l2jmobius.gameserver.datatables.xml.ArmorSetData;
|
||||
import org.l2jmobius.gameserver.datatables.xml.AugmentationData;
|
||||
import org.l2jmobius.gameserver.datatables.xml.DoorData;
|
||||
import org.l2jmobius.gameserver.datatables.xml.ExperienceData;
|
||||
@@ -243,11 +242,7 @@ public class GameServer
|
||||
|
||||
Util.printSection("Items");
|
||||
ItemTable.getInstance();
|
||||
ArmorSetsTable.getInstance();
|
||||
if (Config.CUSTOM_ARMORSETS_TABLE)
|
||||
{
|
||||
CustomArmorSetsTable.getInstance();
|
||||
}
|
||||
ArmorSetData.getInstance();
|
||||
ExtractableItemsData.getInstance();
|
||||
SummonItemData.getInstance();
|
||||
if (Config.ALLOWFISHING)
|
||||
|
@@ -125,7 +125,7 @@ public class ItemTable
|
||||
private void buildFastLookupTable(int size)
|
||||
{
|
||||
// Create a FastLookUp Table called _allTemplates of size : value of the highest item ID
|
||||
LOGGER.info("Highest item id used:" + size);
|
||||
LOGGER.info("Highest item id used: " + size);
|
||||
_allTemplates = new Item[size + 1];
|
||||
|
||||
// Insert armor item in Fast Look Up Table
|
||||
|
@@ -1,164 +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.sql;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.model.ArmorSet;
|
||||
|
||||
public class ArmorSetsTable
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(ArmorSetsTable.class.getName());
|
||||
|
||||
public Map<Integer, ArmorSet> armorSets;
|
||||
private final Map<Integer, ArmorDummy> cusArmorSets;
|
||||
|
||||
private ArmorSetsTable()
|
||||
{
|
||||
armorSets = new HashMap<>();
|
||||
cusArmorSets = new HashMap<>();
|
||||
loadData();
|
||||
}
|
||||
|
||||
private void loadData()
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getConnection())
|
||||
{
|
||||
final PreparedStatement statement = con.prepareStatement("SELECT id, chest, legs, head, gloves, feet, skill_id, shield, shield_skill_id, enchant6skill FROM armorsets");
|
||||
final ResultSet rset = statement.executeQuery();
|
||||
|
||||
while (rset.next())
|
||||
{
|
||||
final int id = rset.getInt("id");
|
||||
final int chest = rset.getInt("chest");
|
||||
final int legs = rset.getInt("legs");
|
||||
final int head = rset.getInt("head");
|
||||
final int gloves = rset.getInt("gloves");
|
||||
final int feet = rset.getInt("feet");
|
||||
final int skill_id = rset.getInt("skill_id");
|
||||
final int shield = rset.getInt("shield");
|
||||
final int shield_skill_id = rset.getInt("shield_skill_id");
|
||||
final int enchant6skill = rset.getInt("enchant6skill");
|
||||
|
||||
armorSets.put(chest, new ArmorSet(chest, legs, head, gloves, feet, skill_id, shield, shield_skill_id, enchant6skill));
|
||||
cusArmorSets.put(id, new ArmorDummy(chest, legs, head, gloves, feet, skill_id, shield));
|
||||
}
|
||||
|
||||
LOGGER.info("Loaded: " + armorSets.size() + " armor sets.");
|
||||
|
||||
rset.close();
|
||||
statement.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("Error while loading armor sets data " + e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setExists(int chestId)
|
||||
{
|
||||
return armorSets.containsKey(chestId);
|
||||
}
|
||||
|
||||
public ArmorSet getSet(int chestId)
|
||||
{
|
||||
return armorSets.get(chestId);
|
||||
}
|
||||
|
||||
public void addObj(int v, ArmorSet s)
|
||||
{
|
||||
armorSets.put(v, s);
|
||||
}
|
||||
|
||||
public ArmorDummy getCusArmorSets(int id)
|
||||
{
|
||||
return cusArmorSets.get(id);
|
||||
}
|
||||
|
||||
public class ArmorDummy
|
||||
{
|
||||
private final int _chest;
|
||||
private final int _legs;
|
||||
private final int _head;
|
||||
private final int _gloves;
|
||||
private final int _feet;
|
||||
private final int _skill_id;
|
||||
private final int _shield;
|
||||
|
||||
public ArmorDummy(int chest, int legs, int head, int gloves, int feet, int skillId, int shield)
|
||||
{
|
||||
_chest = chest;
|
||||
_legs = legs;
|
||||
_head = head;
|
||||
_gloves = gloves;
|
||||
_feet = feet;
|
||||
_skill_id = skillId;
|
||||
_shield = shield;
|
||||
}
|
||||
|
||||
public int getChest()
|
||||
{
|
||||
return _chest;
|
||||
}
|
||||
|
||||
public int getLegs()
|
||||
{
|
||||
return _legs;
|
||||
}
|
||||
|
||||
public int getHead()
|
||||
{
|
||||
return _head;
|
||||
}
|
||||
|
||||
public int getGloves()
|
||||
{
|
||||
return _gloves;
|
||||
}
|
||||
|
||||
public int getFeet()
|
||||
{
|
||||
return _feet;
|
||||
}
|
||||
|
||||
public int getSkill_id()
|
||||
{
|
||||
return _skill_id;
|
||||
}
|
||||
|
||||
public int getShield()
|
||||
{
|
||||
return _shield;
|
||||
}
|
||||
}
|
||||
|
||||
public static ArmorSetsTable getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final ArmorSetsTable INSTANCE = new ArmorSetsTable();
|
||||
}
|
||||
}
|
@@ -1,74 +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.sql;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.model.ArmorSet;
|
||||
|
||||
/**
|
||||
* @author ProGramMoS
|
||||
*/
|
||||
public class CustomArmorSetsTable
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(CustomArmorSetsTable.class.getName());
|
||||
|
||||
public CustomArmorSetsTable()
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getConnection())
|
||||
{
|
||||
final PreparedStatement statement = con.prepareStatement("SELECT chest, legs, head, gloves, feet, skill_id, shield, shield_skill_id, enchant6skill FROM custom_armorsets");
|
||||
final ResultSet rset = statement.executeQuery();
|
||||
|
||||
while (rset.next())
|
||||
{
|
||||
final int chest = rset.getInt("chest");
|
||||
final int legs = rset.getInt("legs");
|
||||
final int head = rset.getInt("head");
|
||||
final int gloves = rset.getInt("gloves");
|
||||
final int feet = rset.getInt("feet");
|
||||
final int skill_id = rset.getInt("skill_id");
|
||||
final int shield = rset.getInt("shield");
|
||||
final int shield_skill_id = rset.getInt("shield_skill_id");
|
||||
final int enchant6skill = rset.getInt("enchant6skill");
|
||||
ArmorSetsTable.getInstance().addObj(chest, new ArmorSet(chest, legs, head, gloves, feet, skill_id, shield, shield_skill_id, enchant6skill));
|
||||
}
|
||||
LOGGER.info("ArmorSetsTable: Loaded custom armor sets.");
|
||||
|
||||
statement.close();
|
||||
rset.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("ArmorSetsTable: Error reading Custom ArmorSets table " + e);
|
||||
}
|
||||
}
|
||||
|
||||
public static CustomArmorSetsTable getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final CustomArmorSetsTable INSTANCE = new CustomArmorSetsTable();
|
||||
}
|
||||
}
|
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* 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 java.util.logging.Logger;
|
||||
|
||||
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.ArmorSet;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
|
||||
/**
|
||||
* This class loads and stores {@link ArmorSet}s, the key being the chest item id.
|
||||
*/
|
||||
public class ArmorSetData implements IXmlReader
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(ArmorSetData.class.getName());
|
||||
|
||||
public Map<Integer, ArmorSet> _armorSets = new HashMap<>();
|
||||
|
||||
private ArmorSetData()
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
{
|
||||
parseDatapackFile("data/ArmorSets.xml");
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _armorSets.size() + " armor sets.");
|
||||
}
|
||||
|
||||
@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 (!"armorset".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());
|
||||
}
|
||||
|
||||
// Feed the map with new data.
|
||||
final int chestId = set.getInt("chest");
|
||||
_armorSets.put(chestId, new ArmorSet(chestId, set.getInt("legs"), set.getInt("head"), set.getInt("gloves"), set.getInt("feet"), set.getInt("skillId"), set.getInt("shield"), set.getInt("shieldSkillId"), set.getInt("enchant6Skill")));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setExists(int chestId)
|
||||
{
|
||||
return _armorSets.containsKey(chestId);
|
||||
}
|
||||
|
||||
public ArmorSet getSet(int chestId)
|
||||
{
|
||||
return _armorSets.get(chestId);
|
||||
}
|
||||
|
||||
public static ArmorSetData getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final ArmorSetData INSTANCE = new ArmorSetData();
|
||||
}
|
||||
}
|
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import org.l2jmobius.gameserver.datatables.SkillTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.ArmorSetsTable;
|
||||
import org.l2jmobius.gameserver.datatables.xml.ArmorSetData;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.items.Armor;
|
||||
import org.l2jmobius.gameserver.model.items.EtcItem;
|
||||
@@ -396,7 +396,7 @@ public abstract class Inventory extends ItemContainer
|
||||
}
|
||||
|
||||
// checks if there is armorset for chest item that player worns
|
||||
final ArmorSet armorSet = ArmorSetsTable.getInstance().getSet(chestItem.getItemId());
|
||||
final ArmorSet armorSet = ArmorSetData.getInstance().getSet(chestItem.getItemId());
|
||||
if (armorSet == null)
|
||||
{
|
||||
return;
|
||||
@@ -491,7 +491,7 @@ public abstract class Inventory extends ItemContainer
|
||||
|
||||
if (slot == PAPERDOLL_CHEST)
|
||||
{
|
||||
final ArmorSet armorSet = ArmorSetsTable.getInstance().getSet(item.getItemId());
|
||||
final ArmorSet armorSet = ArmorSetData.getInstance().getSet(item.getItemId());
|
||||
if (armorSet == null)
|
||||
{
|
||||
return;
|
||||
@@ -510,7 +510,7 @@ public abstract class Inventory extends ItemContainer
|
||||
return;
|
||||
}
|
||||
|
||||
final ArmorSet armorSet = ArmorSetsTable.getInstance().getSet(chestItem.getItemId());
|
||||
final ArmorSet armorSet = ArmorSetData.getInstance().getSet(chestItem.getItemId());
|
||||
if (armorSet == null)
|
||||
{
|
||||
return;
|
||||
|
Reference in New Issue
Block a user