Jump to content

Recommended Posts

Posted (edited)

Hi all, i created server on windows, i wen to ubuntu server, i upload all files thru FTP..
It works with no problem on windows, but on linux half of npc are not spawned...

 

here is console:

---------------------------------------------------------------------=[ NPCs ]
BufferTable: Loaded 1 players schemes.
HerbDropTable: Loaded 2 herbs groups.
NpcTable: Error parsing NPC templates : 
File: /home/admin/Desktop/Arena/gs/./data/xml/npcs/custom doesn't exist and/or is not a file.
NpcTable: Loaded 4459 NPC templates.
WalkerRoutesTable: Loaded 12 NpcWalker routes.
DoorTable: Loaded 547 doors templates.
StaticObject: Loaded 29 templates.
L2Spawn: Random respawn delay for NPC id=21399 is higher than respawn delay.
L2Spawn: Random respawn delay for NPC id=21399 is higher than respawn delay.
L2Spawn: Random respawn delay for NPC id=21399 is higher than respawn delay.
L2Spawn: Random respawn delay for NPC id=21399 is higher than respawn delay.
L2Spawn: Random respawn delay for NPC id=21403 is higher than respawn delay.
L2Spawn: Random respawn delay for NPC id=21403 is higher than respawn delay.
L2Spawn: Random respawn delay for NPC id=21403 is higher than respawn delay.
L2Spawn: Random respawn delay for NPC id=21403 is higher than respawn delay.
L2Spawn: Random respawn delay for NPC id=21403 is higher than respawn delay.

i checked npc xml files, theese are in.. btw this list is very long i coppied only few lines.

 

WINDOWS SERVER CONSOLE :

---------------------------------------------------------------------=[ NPCs ]
BufferTable: Loaded 1 players schemes.
HerbDropTable: Loaded 2 herbs groups.
SevenSignsFestival: Reinitialized engine for next competition period.
SevenSigns: The Quest Event Initialization period has begun!
SevenSigns: Next period change set to Fri Jan 05 12:58:36 GMT 2018
NpcTable: Error parsing NPC templates :
File: C:\Users\Home\Desktop\Arena\gameserver\.\data\xml\npcs\custom doesn't exist and/or is not a file.
NpcTable: Loaded 6474 NPC templates.
WalkerRoutesTable: Loaded 12 NpcWalker routes.
DoorTable: Loaded 547 doors templates.
StaticObject: Loaded 29 templates.

 

 

P.S. I was not able install fresh database so i have EXPORT my sql database and then import into Ubuntu...

 

I have found topic like mine but there was no answer just "use fresh original acis pack from i-live.eu.... but the problem is that i use fresh.. i only created 1 npc, teleporter...

Anyway database spawntabe and spawntable_4s has same rows like in windows.. i tried everything, checkout svn again, build, upload into UBUNTU SERVER and same story... no npc like gk or shop, just mobs and ch managers etc.

 

Please any help.

Edited by Devolskis
Posted
1 minute ago, Reborn12 said:

.xml is missing

no is not have add read folders and can read only file like npc/123.xml can't read npc/folder/folder/123.xml

Posted
Just now, Reborn12 said:

.xml is missing

 

Well as i said xml files are same in both servers.. i updated it 10 times.. i changed mod 777 for all folders subfolders and files..

As well I checked first missing ID and there code in xml file, aswell i tried to check xml syntax error on ID above that missing but its good.. :/

Posted
1 minute ago, tazerman2 said:

no is not have add read folders and can read only file like npc/123.xml can't read npc/folder/folder/123.xml

 

As I wrote the post with both ubuntu and windows console, in both there is that error but on windows all good, ubuntu not..

Posted (edited)
/*
 * 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 net.sf.l2j.gameserver.datatables;

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;

import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.MinionData;
import net.sf.l2j.gameserver.model.PetDataEntry;
import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
import net.sf.l2j.gameserver.model.actor.template.PetTemplate;
import net.sf.l2j.gameserver.model.item.DropCategory;
import net.sf.l2j.gameserver.model.item.DropData;
import net.sf.l2j.gameserver.templates.StatsSet;
import net.sf.l2j.gameserver.xmlfactory.XMLDocumentFactory;

import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class NpcTable
{
	private static final Logger _log = Logger.getLogger(NpcTable.class.getName());
	
	private final Map<Integer, NpcTemplate> _npcs = new HashMap<>();
	
	protected NpcTable()
	{
		load();
	}
	
	public void reloadAllNpc()
	{
		_npcs.clear();
		load();
	}
	
	private void load()
	{
		try
		{
			final File dir = new File("./data/xml/npcs");
			final StatsSet set = new StatsSet();
			final StatsSet petSet = new StatsSet();
			
			for (File file : dir.listFiles())
			{
				final Document doc = XMLDocumentFactory.getInstance().loadDocument(file);
				
				Node list = doc.getFirstChild();
				for (Node npc = list.getFirstChild(); npc != null; npc = npc.getNextSibling())
				{
					if ("npc".equalsIgnoreCase(npc.getNodeName()))
					{
						NamedNodeMap attrs = npc.getAttributes();
						
						boolean mustUsePetTemplate = false; // Used to define template type.
						
						final int npcId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
						final int templateId = attrs.getNamedItem("idTemplate") == null ? npcId : Integer.parseInt(attrs.getNamedItem("idTemplate").getNodeValue());
						
						set.set("id", npcId);
						set.set("idTemplate", templateId);
						set.set("name", attrs.getNamedItem("name").getNodeValue());
						set.set("title", attrs.getNamedItem("title").getNodeValue());
						
						for (Node cat = npc.getFirstChild(); cat != null; cat = cat.getNextSibling())
						{
							if ("ai".equalsIgnoreCase(cat.getNodeName()))
							{
								attrs = cat.getAttributes();
								
								set.set("aiType", attrs.getNamedItem("type").getNodeValue());
								set.set("ssCount", Integer.parseInt(attrs.getNamedItem("ssCount").getNodeValue()));
								set.set("ssRate", Integer.parseInt(attrs.getNamedItem("ssRate").getNodeValue()));
								set.set("spsCount", Integer.parseInt(attrs.getNamedItem("spsCount").getNodeValue()));
								set.set("spsRate", Integer.parseInt(attrs.getNamedItem("spsRate").getNodeValue()));
								set.set("aggro", Integer.parseInt(attrs.getNamedItem("aggro").getNodeValue()));
								
								// Verify if the parameter exists.
								if (attrs.getNamedItem("clan") != null)
								{
									set.set("clan", attrs.getNamedItem("clan").getNodeValue().split(";"));
									set.set("clanRange", Integer.parseInt(attrs.getNamedItem("clanRange").getNodeValue()));
									
									// Verify if the parameter exists.
									if (attrs.getNamedItem("ignoredIds") != null)
										set.set("ignoredIds", attrs.getNamedItem("ignoredIds").getNodeValue());
								}
								
								set.set("canMove", Boolean.parseBoolean(attrs.getNamedItem("canMove").getNodeValue()));
								set.set("seedable", Boolean.parseBoolean(attrs.getNamedItem("seedable").getNodeValue()));
							}
							else if ("drops".equalsIgnoreCase(cat.getNodeName()))
							{
								final String type = set.getString("type");
								final boolean isRaid = type.equalsIgnoreCase("L2RaidBoss") || type.equalsIgnoreCase("L2GrandBoss");
								
								final List<DropCategory> drops = new ArrayList<>();
								
								for (Node dropCat = cat.getFirstChild(); dropCat != null; dropCat = dropCat.getNextSibling())
								{
									if ("category".equalsIgnoreCase(dropCat.getNodeName()))
									{
										attrs = dropCat.getAttributes();
										
										final DropCategory category = new DropCategory(Integer.parseInt(attrs.getNamedItem("id").getNodeValue()));
										
										for (Node item = dropCat.getFirstChild(); item != null; item = item.getNextSibling())
										{
											if ("drop".equalsIgnoreCase(item.getNodeName()))
											{
												attrs = item.getAttributes();
												
												final DropData data = new DropData();
												data.setItemId(Integer.parseInt(attrs.getNamedItem("itemid").getNodeValue()));
												data.setMinDrop(Integer.parseInt(attrs.getNamedItem("min").getNodeValue()));
												data.setMaxDrop(Integer.parseInt(attrs.getNamedItem("max").getNodeValue()));
												data.setChance(Integer.parseInt(attrs.getNamedItem("chance").getNodeValue()));
												
												if (ItemTable.getInstance().getTemplate(data.getItemId()) == null)
												{
													_log.warning("Droplist data for undefined itemId: " + data.getItemId());
													continue;
												}
												category.addDropData(data, isRaid);
											}
										}
										drops.add(category);
									}
								}
								set.set("drops", drops);
							}
							else if ("minions".equalsIgnoreCase(cat.getNodeName()))
							{
								final List<MinionData> minions = new ArrayList<>();
								
								for (Node minion = cat.getFirstChild(); minion != null; minion = minion.getNextSibling())
								{
									if ("minion".equalsIgnoreCase(minion.getNodeName()))
									{
										attrs = minion.getAttributes();
										
										final MinionData data = new MinionData();
										data.setMinionId(Integer.parseInt(attrs.getNamedItem("id").getNodeValue()));
										data.setAmountMin(Integer.parseInt(attrs.getNamedItem("min").getNodeValue()));
										data.setAmountMax(Integer.parseInt(attrs.getNamedItem("max").getNodeValue()));
										
										minions.add(data);
									}
								}
								set.set("minions", minions);
							}
							else if ("petdata".equalsIgnoreCase(cat.getNodeName()))
							{
								mustUsePetTemplate = true;
								
								attrs = cat.getAttributes();
								
								set.set("food1", Integer.parseInt(attrs.getNamedItem("food1").getNodeValue()));
								set.set("food2", Integer.parseInt(attrs.getNamedItem("food2").getNodeValue()));
								
								set.set("autoFeedLimit", Double.parseDouble(attrs.getNamedItem("autoFeedLimit").getNodeValue()));
								set.set("hungryLimit", Double.parseDouble(attrs.getNamedItem("hungryLimit").getNodeValue()));
								set.set("unsummonLimit", Double.parseDouble(attrs.getNamedItem("unsummonLimit").getNodeValue()));
								
								final Map<Integer, PetDataEntry> entries = new HashMap<>();
								
								for (Node petCat = cat.getFirstChild(); petCat != null; petCat = petCat.getNextSibling())
								{
									if ("stat".equalsIgnoreCase(petCat.getNodeName()))
									{
										attrs = petCat.getAttributes();
										
										// Get all nodes.
										for (int i = 0; i < attrs.getLength(); i++)
										{
											// Add them to stats by node name and node value.
											Node node = attrs.item(i);
											petSet.set(node.getNodeName(), node.getNodeValue());
										}
										
										entries.put(petSet.getInteger("level"), new PetDataEntry(petSet));
										petSet.clear();
									}
								}
								set.set("petData", entries);
							}
							else if ("set".equalsIgnoreCase(cat.getNodeName()))
							{
								attrs = cat.getAttributes();
								
								set.set(attrs.getNamedItem("name").getNodeValue(), attrs.getNamedItem("val").getNodeValue());
							}
							else if ("skills".equalsIgnoreCase(cat.getNodeName()))
							{
								final List<L2Skill> skills = new ArrayList<>();
								
								for (Node skillCat = cat.getFirstChild(); skillCat != null; skillCat = skillCat.getNextSibling())
								{
									if ("skill".equalsIgnoreCase(skillCat.getNodeName()))
									{
										attrs = skillCat.getAttributes();
										
										final int skillId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
										final int level = Integer.parseInt(attrs.getNamedItem("level").getNodeValue());
										
										// Setup the npc's race. Don't register the skill.
										if (skillId == L2Skill.SKILL_NPC_RACE)
										{
											set.set("raceId", level);
											continue;
										}
										
										final L2Skill data = SkillTable.getInstance().getInfo(skillId, level);
										if (data == null)
											continue;
										
										skills.add(data);
									}
								}
								set.set("skills", skills);
							}
							else if ("teachTo".equalsIgnoreCase(cat.getNodeName()))
								set.set("teachTo", cat.getAttributes().getNamedItem("classes").getNodeValue());
						}
						
						_npcs.put(npcId, (mustUsePetTemplate) ? new PetTemplate(set) : new NpcTemplate(set));
					}
					set.clear();
				}
			}
		}
		catch (Exception e)
		{
			_log.log(Level.SEVERE, "NpcTable: Error parsing NPC templates : ", e);
		}
		_log.info("NpcTable: Loaded " + _npcs.size() + " NPC templates.");
	}
	
	public NpcTemplate getTemplate(int id)
	{
		return _npcs.get(id);
	}
	
	/**
	 * @param name to search.
	 * @return the template list of NPCs for a given name.
	 */
	public NpcTemplate getTemplateByName(String name)
	{
		for (NpcTemplate npcTemplate : _npcs.values())
		{
			if (npcTemplate.getName().equalsIgnoreCase(name))
				return npcTemplate;
		}
		return null;
	}
	
	/**
	 * Gets all templates matching the filter.
	 * @param filter
	 * @return the template list for the given filter
	 */
	public List<NpcTemplate> getTemplates(Predicate<NpcTemplate> filter)
	{
		return _npcs.values().stream().filter(filter).collect(Collectors.toList());
	}
	
	public Collection<NpcTemplate> getAllNpcs()
	{
		return _npcs.values();
	}
	
	public static NpcTable getInstance()
	{
		return SingletonHolder._instance;
	}
	
	private static class SingletonHolder
	{
		protected static final NpcTable _instance = new NpcTable();
	}
}

P.S. I didint touch this file. i update original acis libs to my server.. still not working

Edited by Devolskis
Posted

with this you can't read folders try add this

 

package net.sf.l2j.gameserver.data;

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
import java.util.logging.Logger;
import java.util.stream.Collectors;

import net.sf.l2j.commons.data.xml.XMLDocument;

import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.MinionData;
import net.sf.l2j.gameserver.model.PetDataEntry;
import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
import net.sf.l2j.gameserver.model.actor.template.PetTemplate;
import net.sf.l2j.gameserver.model.item.DropCategory;
import net.sf.l2j.gameserver.model.item.DropData;
import net.sf.l2j.gameserver.templates.StatsSet;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class NpcTable extends XMLDocument
{
	private static final Logger _log = Logger.getLogger(NpcTable.class.getName());
	
	private final Map<Integer, NpcTemplate> _npcs = new HashMap<>();
	
	protected NpcTable()
	{
		load();
	}
	
	public void reloadAllNpc()
	{
		_npcs.clear();
		load();
	}
	
	@Override
	protected void load()
	{
		loadDocument("./data/xml/npcs/");

		_log.info("NpcTable: Loaded " + _npcs.size() + " NPC templates.");
	}
	
	@Override
	protected void parseDocument(Document doc, File file)
	{
		final StatsSet set = new StatsSet();
		final StatsSet petSet = new StatsSet();
		
		final Node d = doc.getFirstChild();
		
		for (Node npc = d.getFirstChild(); npc != null; npc = npc.getNextSibling())
		{
			if ("npc".equalsIgnoreCase(npc.getNodeName()))
			{
				NamedNodeMap attrs = npc.getAttributes();
				
				boolean mustUsePetTemplate = false; // Used to define template type.
				
				final int npcId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
				final int templateId = attrs.getNamedItem("idTemplate") == null ? npcId : Integer.parseInt(attrs.getNamedItem("idTemplate").getNodeValue());
				
				set.set("id", npcId);
				set.set("idTemplate", templateId);
				set.set("name", attrs.getNamedItem("name").getNodeValue());
				set.set("title", attrs.getNamedItem("title").getNodeValue());
				
				for (Node cat = npc.getFirstChild(); cat != null; cat = cat.getNextSibling())
				{
					if ("ai".equalsIgnoreCase(cat.getNodeName()))
					{
						attrs = cat.getAttributes();
						
						set.set("aiType", attrs.getNamedItem("type").getNodeValue());
						set.set("ssCount", Integer.parseInt(attrs.getNamedItem("ssCount").getNodeValue()));
						set.set("ssRate", Integer.parseInt(attrs.getNamedItem("ssRate").getNodeValue()));
						set.set("spsCount", Integer.parseInt(attrs.getNamedItem("spsCount").getNodeValue()));
						set.set("spsRate", Integer.parseInt(attrs.getNamedItem("spsRate").getNodeValue()));
						set.set("aggro", Integer.parseInt(attrs.getNamedItem("aggro").getNodeValue()));
						
						// Verify if the parameter exists.
						if (attrs.getNamedItem("clan") != null)
						{
							set.set("clan", attrs.getNamedItem("clan").getNodeValue().split(";"));
							set.set("clanRange", Integer.parseInt(attrs.getNamedItem("clanRange").getNodeValue()));
							
							// Verify if the parameter exists.
							if (attrs.getNamedItem("ignoredIds") != null)
								set.set("ignoredIds", attrs.getNamedItem("ignoredIds").getNodeValue());
						}
						
						set.set("canMove", Boolean.parseBoolean(attrs.getNamedItem("canMove").getNodeValue()));
						set.set("seedable", Boolean.parseBoolean(attrs.getNamedItem("seedable").getNodeValue()));
					}
					else if ("drops".equalsIgnoreCase(cat.getNodeName()))
					{
						final String type = set.getString("type");
						final boolean isRaid = type.equalsIgnoreCase("L2RaidBoss") || type.equalsIgnoreCase("L2GrandBoss");
						
						final List<DropCategory> drops = new ArrayList<>();
						
						for (Node dropCat = cat.getFirstChild(); dropCat != null; dropCat = dropCat.getNextSibling())
						{
							if ("category".equalsIgnoreCase(dropCat.getNodeName()))
							{
								attrs = dropCat.getAttributes();
								
								final DropCategory category = new DropCategory(Integer.parseInt(attrs.getNamedItem("id").getNodeValue()));
								
								for (Node item = dropCat.getFirstChild(); item != null; item = item.getNextSibling())
								{
									if ("drop".equalsIgnoreCase(item.getNodeName()))
									{
										attrs = item.getAttributes();
										
										final DropData data = new DropData();
										data.setItemId(Integer.parseInt(attrs.getNamedItem("itemid").getNodeValue()));
										data.setMinDrop(Integer.parseInt(attrs.getNamedItem("min").getNodeValue()));
										data.setMaxDrop(Integer.parseInt(attrs.getNamedItem("max").getNodeValue()));
										data.setChance(Integer.parseInt(attrs.getNamedItem("chance").getNodeValue()));
										
										if (ItemTable.getInstance().getTemplate(data.getItemId()) == null)
										{
											_log.warning("Droplist data for undefined itemId: " + data.getItemId());
											continue;
										}
										category.addDropData(data, isRaid);
									}
								}
								drops.add(category);
							}
						}
						set.set("drops", drops);
					}
					else if ("minions".equalsIgnoreCase(cat.getNodeName()))
					{
						final List<MinionData> minions = new ArrayList<>();
						
						for (Node minion = cat.getFirstChild(); minion != null; minion = minion.getNextSibling())
						{
							if ("minion".equalsIgnoreCase(minion.getNodeName()))
							{
								attrs = minion.getAttributes();
								
								final MinionData data = new MinionData();
								data.setMinionId(Integer.parseInt(attrs.getNamedItem("id").getNodeValue()));
								data.setAmountMin(Integer.parseInt(attrs.getNamedItem("min").getNodeValue()));
								data.setAmountMax(Integer.parseInt(attrs.getNamedItem("max").getNodeValue()));
								
								minions.add(data);
							}
						}
						set.set("minions", minions);
					}
					else if ("petdata".equalsIgnoreCase(cat.getNodeName()))
					{
						mustUsePetTemplate = true;
						
						attrs = cat.getAttributes();
						
						set.set("food1", Integer.parseInt(attrs.getNamedItem("food1").getNodeValue()));
						set.set("food2", Integer.parseInt(attrs.getNamedItem("food2").getNodeValue()));
						
						set.set("autoFeedLimit", Double.parseDouble(attrs.getNamedItem("autoFeedLimit").getNodeValue()));
						set.set("hungryLimit", Double.parseDouble(attrs.getNamedItem("hungryLimit").getNodeValue()));
						set.set("unsummonLimit", Double.parseDouble(attrs.getNamedItem("unsummonLimit").getNodeValue()));
						
						final Map<Integer, PetDataEntry> entries = new HashMap<>();
						
						for (Node petCat = cat.getFirstChild(); petCat != null; petCat = petCat.getNextSibling())
						{
							if ("stat".equalsIgnoreCase(petCat.getNodeName()))
							{
								attrs = petCat.getAttributes();
								
								// Get all nodes.
								for (int i = 0; i < attrs.getLength(); i++)
								{
									// Add them to stats by node name and node value.
									Node node = attrs.item(i);
									petSet.set(node.getNodeName(), node.getNodeValue());
								}
								
								entries.put(petSet.getInteger("level"), new PetDataEntry(petSet));
								petSet.clear();
							}
						}
						set.set("petData", entries);
					}
					else if ("set".equalsIgnoreCase(cat.getNodeName()))
					{
						attrs = cat.getAttributes();
						
						set.set(attrs.getNamedItem("name").getNodeValue(), attrs.getNamedItem("val").getNodeValue());
					}
					else if ("skills".equalsIgnoreCase(cat.getNodeName()))
					{
						final List<L2Skill> skills = new ArrayList<>();
						
						for (Node skillCat = cat.getFirstChild(); skillCat != null; skillCat = skillCat.getNextSibling())
						{
							if ("skill".equalsIgnoreCase(skillCat.getNodeName()))
							{
								attrs = skillCat.getAttributes();
								
								final int skillId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
								final int level = Integer.parseInt(attrs.getNamedItem("level").getNodeValue());
								
								// Setup the npc's race. Don't register the skill.
								if (skillId == L2Skill.SKILL_NPC_RACE)
								{
									set.set("raceId", level);
									continue;
								}
								
								final L2Skill data = SkillTable.getInstance().getInfo(skillId, level);
								if (data == null)
									continue;
								
								skills.add(data);
							}
						}
						set.set("skills", skills);
					}
					else if ("teachTo".equalsIgnoreCase(cat.getNodeName()))
						set.set("teachTo", cat.getAttributes().getNamedItem("classes").getNodeValue());
				}
				
				_npcs.put(npcId, (mustUsePetTemplate) ? new PetTemplate(set) : new NpcTemplate(set));
			}
			set.clear();
		}
	}
	
	public NpcTemplate getTemplate(int id)
	{
		return _npcs.get(id);
	}
	
	/**
	 * @param name to search.
	 * @return the template list of NPCs for a given name.
	 */
	public NpcTemplate getTemplateByName(String name)
	{
		for (NpcTemplate npcTemplate : _npcs.values())
		{
			if (npcTemplate.getName().equalsIgnoreCase(name))
				return npcTemplate;
		}
		return null;
	}
	
	/**
	 * Gets all templates matching the filter.
	 * @param filter
	 * @return the template list for the given filter
	 */
	public List<NpcTemplate> getTemplates(Predicate<NpcTemplate> filter)
	{
		return _npcs.values().stream().filter(filter).collect(Collectors.toList());
	}
	
	public Collection<NpcTemplate> getAllNpcs()
	{
		return _npcs.values();
	}
	
	public static NpcTable getInstance()
	{
		return SingletonHolder._instance;
	}
	
	private static class SingletonHolder
	{
		protected static final NpcTable _instance = new NpcTable();
	}
}

 

Posted
11 minutes ago, tazerman2 said:

with this you can't read folders try add this

 


package net.sf.l2j.gameserver.data;

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
import java.util.logging.Logger;
import java.util.stream.Collectors;

import net.sf.l2j.commons.data.xml.XMLDocument;

import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.MinionData;
import net.sf.l2j.gameserver.model.PetDataEntry;
import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
import net.sf.l2j.gameserver.model.actor.template.PetTemplate;
import net.sf.l2j.gameserver.model.item.DropCategory;
import net.sf.l2j.gameserver.model.item.DropData;
import net.sf.l2j.gameserver.templates.StatsSet;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class NpcTable extends XMLDocument
{
	private static final Logger _log = Logger.getLogger(NpcTable.class.getName());
	
	private final Map<Integer, NpcTemplate> _npcs = new HashMap<>();
	
	protected NpcTable()
	{
		load();
	}
	
	public void reloadAllNpc()
	{
		_npcs.clear();
		load();
	}
	
	@Override
	protected void load()
	{
		loadDocument("./data/xml/npcs/");

		_log.info("NpcTable: Loaded " + _npcs.size() + " NPC templates.");
	}
	
	@Override
	protected void parseDocument(Document doc, File file)
	{
		final StatsSet set = new StatsSet();
		final StatsSet petSet = new StatsSet();
		
		final Node d = doc.getFirstChild();
		
		for (Node npc = d.getFirstChild(); npc != null; npc = npc.getNextSibling())
		{
			if ("npc".equalsIgnoreCase(npc.getNodeName()))
			{
				NamedNodeMap attrs = npc.getAttributes();
				
				boolean mustUsePetTemplate = false; // Used to define template type.
				
				final int npcId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
				final int templateId = attrs.getNamedItem("idTemplate") == null ? npcId : Integer.parseInt(attrs.getNamedItem("idTemplate").getNodeValue());
				
				set.set("id", npcId);
				set.set("idTemplate", templateId);
				set.set("name", attrs.getNamedItem("name").getNodeValue());
				set.set("title", attrs.getNamedItem("title").getNodeValue());
				
				for (Node cat = npc.getFirstChild(); cat != null; cat = cat.getNextSibling())
				{
					if ("ai".equalsIgnoreCase(cat.getNodeName()))
					{
						attrs = cat.getAttributes();
						
						set.set("aiType", attrs.getNamedItem("type").getNodeValue());
						set.set("ssCount", Integer.parseInt(attrs.getNamedItem("ssCount").getNodeValue()));
						set.set("ssRate", Integer.parseInt(attrs.getNamedItem("ssRate").getNodeValue()));
						set.set("spsCount", Integer.parseInt(attrs.getNamedItem("spsCount").getNodeValue()));
						set.set("spsRate", Integer.parseInt(attrs.getNamedItem("spsRate").getNodeValue()));
						set.set("aggro", Integer.parseInt(attrs.getNamedItem("aggro").getNodeValue()));
						
						// Verify if the parameter exists.
						if (attrs.getNamedItem("clan") != null)
						{
							set.set("clan", attrs.getNamedItem("clan").getNodeValue().split(";"));
							set.set("clanRange", Integer.parseInt(attrs.getNamedItem("clanRange").getNodeValue()));
							
							// Verify if the parameter exists.
							if (attrs.getNamedItem("ignoredIds") != null)
								set.set("ignoredIds", attrs.getNamedItem("ignoredIds").getNodeValue());
						}
						
						set.set("canMove", Boolean.parseBoolean(attrs.getNamedItem("canMove").getNodeValue()));
						set.set("seedable", Boolean.parseBoolean(attrs.getNamedItem("seedable").getNodeValue()));
					}
					else if ("drops".equalsIgnoreCase(cat.getNodeName()))
					{
						final String type = set.getString("type");
						final boolean isRaid = type.equalsIgnoreCase("L2RaidBoss") || type.equalsIgnoreCase("L2GrandBoss");
						
						final List<DropCategory> drops = new ArrayList<>();
						
						for (Node dropCat = cat.getFirstChild(); dropCat != null; dropCat = dropCat.getNextSibling())
						{
							if ("category".equalsIgnoreCase(dropCat.getNodeName()))
							{
								attrs = dropCat.getAttributes();
								
								final DropCategory category = new DropCategory(Integer.parseInt(attrs.getNamedItem("id").getNodeValue()));
								
								for (Node item = dropCat.getFirstChild(); item != null; item = item.getNextSibling())
								{
									if ("drop".equalsIgnoreCase(item.getNodeName()))
									{
										attrs = item.getAttributes();
										
										final DropData data = new DropData();
										data.setItemId(Integer.parseInt(attrs.getNamedItem("itemid").getNodeValue()));
										data.setMinDrop(Integer.parseInt(attrs.getNamedItem("min").getNodeValue()));
										data.setMaxDrop(Integer.parseInt(attrs.getNamedItem("max").getNodeValue()));
										data.setChance(Integer.parseInt(attrs.getNamedItem("chance").getNodeValue()));
										
										if (ItemTable.getInstance().getTemplate(data.getItemId()) == null)
										{
											_log.warning("Droplist data for undefined itemId: " + data.getItemId());
											continue;
										}
										category.addDropData(data, isRaid);
									}
								}
								drops.add(category);
							}
						}
						set.set("drops", drops);
					}
					else if ("minions".equalsIgnoreCase(cat.getNodeName()))
					{
						final List<MinionData> minions = new ArrayList<>();
						
						for (Node minion = cat.getFirstChild(); minion != null; minion = minion.getNextSibling())
						{
							if ("minion".equalsIgnoreCase(minion.getNodeName()))
							{
								attrs = minion.getAttributes();
								
								final MinionData data = new MinionData();
								data.setMinionId(Integer.parseInt(attrs.getNamedItem("id").getNodeValue()));
								data.setAmountMin(Integer.parseInt(attrs.getNamedItem("min").getNodeValue()));
								data.setAmountMax(Integer.parseInt(attrs.getNamedItem("max").getNodeValue()));
								
								minions.add(data);
							}
						}
						set.set("minions", minions);
					}
					else if ("petdata".equalsIgnoreCase(cat.getNodeName()))
					{
						mustUsePetTemplate = true;
						
						attrs = cat.getAttributes();
						
						set.set("food1", Integer.parseInt(attrs.getNamedItem("food1").getNodeValue()));
						set.set("food2", Integer.parseInt(attrs.getNamedItem("food2").getNodeValue()));
						
						set.set("autoFeedLimit", Double.parseDouble(attrs.getNamedItem("autoFeedLimit").getNodeValue()));
						set.set("hungryLimit", Double.parseDouble(attrs.getNamedItem("hungryLimit").getNodeValue()));
						set.set("unsummonLimit", Double.parseDouble(attrs.getNamedItem("unsummonLimit").getNodeValue()));
						
						final Map<Integer, PetDataEntry> entries = new HashMap<>();
						
						for (Node petCat = cat.getFirstChild(); petCat != null; petCat = petCat.getNextSibling())
						{
							if ("stat".equalsIgnoreCase(petCat.getNodeName()))
							{
								attrs = petCat.getAttributes();
								
								// Get all nodes.
								for (int i = 0; i < attrs.getLength(); i++)
								{
									// Add them to stats by node name and node value.
									Node node = attrs.item(i);
									petSet.set(node.getNodeName(), node.getNodeValue());
								}
								
								entries.put(petSet.getInteger("level"), new PetDataEntry(petSet));
								petSet.clear();
							}
						}
						set.set("petData", entries);
					}
					else if ("set".equalsIgnoreCase(cat.getNodeName()))
					{
						attrs = cat.getAttributes();
						
						set.set(attrs.getNamedItem("name").getNodeValue(), attrs.getNamedItem("val").getNodeValue());
					}
					else if ("skills".equalsIgnoreCase(cat.getNodeName()))
					{
						final List<L2Skill> skills = new ArrayList<>();
						
						for (Node skillCat = cat.getFirstChild(); skillCat != null; skillCat = skillCat.getNextSibling())
						{
							if ("skill".equalsIgnoreCase(skillCat.getNodeName()))
							{
								attrs = skillCat.getAttributes();
								
								final int skillId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
								final int level = Integer.parseInt(attrs.getNamedItem("level").getNodeValue());
								
								// Setup the npc's race. Don't register the skill.
								if (skillId == L2Skill.SKILL_NPC_RACE)
								{
									set.set("raceId", level);
									continue;
								}
								
								final L2Skill data = SkillTable.getInstance().getInfo(skillId, level);
								if (data == null)
									continue;
								
								skills.add(data);
							}
						}
						set.set("skills", skills);
					}
					else if ("teachTo".equalsIgnoreCase(cat.getNodeName()))
						set.set("teachTo", cat.getAttributes().getNamedItem("classes").getNodeValue());
				}
				
				_npcs.put(npcId, (mustUsePetTemplate) ? new PetTemplate(set) : new NpcTemplate(set));
			}
			set.clear();
		}
	}
	
	public NpcTemplate getTemplate(int id)
	{
		return _npcs.get(id);
	}
	
	/**
	 * @param name to search.
	 * @return the template list of NPCs for a given name.
	 */
	public NpcTemplate getTemplateByName(String name)
	{
		for (NpcTemplate npcTemplate : _npcs.values())
		{
			if (npcTemplate.getName().equalsIgnoreCase(name))
				return npcTemplate;
		}
		return null;
	}
	
	/**
	 * Gets all templates matching the filter.
	 * @param filter
	 * @return the template list for the given filter
	 */
	public List<NpcTemplate> getTemplates(Predicate<NpcTemplate> filter)
	{
		return _npcs.values().stream().filter(filter).collect(Collectors.toList());
	}
	
	public Collection<NpcTemplate> getAllNpcs()
	{
		return _npcs.values();
	}
	
	public static NpcTable getInstance()
	{
		return SingletonHolder._instance;
	}
	
	private static class SingletonHolder
	{
		protected static final NpcTable _instance = new NpcTable();
	}
}

import net.sf.l2j.commons.data.xml.XMLDocument;

 

this doesnt exist in my files.

 

Posted (edited)

If you can find which files are blocked, that could give you a begin of answer (maybe encoding or they aren't considered XML ?).

 

I suppose you speak about "vanilla" templates and not custom ones. There is clearly no reason 1/3 templates aren't load, and the leftover is ok. About your custom folder, put all XMLs from this directory on the root level of data/xml/npcs folder in order they're loaded.

 

XMLDocument has been added recently, the previous layer was XmlDocumentFactory. Until I missed a point, it probably won't solve your problem.

 

You should track which file is correctly loaded, and which isn't. And try to figure why those files aren't loaded (if you edited them, if they got a special encoding, etc).

Edited by Tryskell
Posted
1 hour ago, Reborn12 said:

npcs\custom

make a file like customnpcs.xml in you data/xml/npcs folded and all will be fine no reason to change any java or create a new folder

http://prntscr.com/hwg3oy

There is file with 2 npc wedding manager and buffer. Original by ACIS

Posted
1 hour ago, Tryskell said:

If you can find which files are blocked, that could give you a begin of answer (maybe encoding or they aren't considered XML ?).

 

 

How? in gs/log?

I think first corrupted file should be 27000-27999 because first missing template is 27002.

 

p.s. i dont know what vanilla is or what it means.

 

1 hour ago, Tryskell said:

You should track which file is correctly loaded, and which isn't. And try to figure why those files aren't loaded (if you edited them, if they got a special encoding, etc).

 

What if i will re-save all files with special xml editor? 

 

Posted

Vanilla != custom. Vanilla is the sources as shared by project owner, custom is sources either edited by you or another dude you downloaded from.

 

About which file or id is loaded, you can put a log on the loading process see which file is loaded.

 

			for (File file : dir.listFiles())
			{

just here, put a log using "file" to identify which xml is loaded.

 

A "special XML editor" is nothing more than a notepad++ specialized at reading xml. It won't change anything, until you edited those files yourself or they are, somehow, corrupted.

Guest
This topic is now closed to further replies.


  • Posts

    • Продам комплекты (Custom Colour) Apella Сеты. Контакт со мной/Contact with me  Telegram. Custom Colour Apella Light YouTube Video
    • haha, I don't say it, chatgpt says it. discuss it with him if you have problems 😉 or sue chatgpt for lying, for example when he tells you that you are an idiot and tells you that I do things that are light years ahead of you.
    • hey i make enough to live comfortably you, on the other hand... doubt that'd be the case if you were as competent as you claim to be
    • all your doubts ask chatgpt, also ask what you could do yourself hahaha
    • This post originally appeared on MmoGah. Odin: Valhalla Rising is an ambitious open-world MMORPG developed with Unreal Engine 4, offering breathtaking visuals and immersive gameplay. I will share everything you need to know before starting it.     Re-rolling In Odin, re-rolling isn't a practical strategy. Unlike most gacha games, where it's common to reset for better initial pulls, Odin focuses heavily on long-term growth. The earlier you begin playing and developing your character, the more advantages you'll gain over time. Instead of spending your efforts on re-rolling for ideal equipment, it's better to dive in and start progressing right away.   Server Selection Before starting your character, selecting a server is a crucial step. Since Odin doesn't support cross-server gameplay, coordinating with your friends, family, or guildmates is essential to ensure everyone creates their characters on the same server. Take the time to plan with your group beforehand. After deciding on a server, your next major choice will be picking a class.   Class Breakdown Odin features four primary starting classes: Warrior, Sorceress, Rogue, and Priest. Each class comes with its own distinct playstyle and unique strengths, so choose wisely, as your selection is permanent. However, even free-to-play players can create up to three characters on one server, giving you the flexibility to try different options and find the one that matches your preferences.   Quest and Leveling Once your character is created, your initial objective is to work through the main questline. This acts as both a tutorial and a method for early leveling. Odin simplifies the process with a convenient quest button that handles navigation, starts dialogues, and even enables auto-combat. This user-friendly feature allows beginners to grasp the basics of the game without feeling overloaded.   Auto Combat and No Kill-steal Mode Auto combat is an essential feature in Odin, enabling your character to battle monsters autonomously. This system allows you to effortlessly gain experience and loot, even while you're busy studying, cooking, or unwinding. To optimize its use, activate the no-kill-steal mode. This setting prevents your character from targeting monsters already engaged by other players, helping you avoid conflicts or potential PvP situations. However, if a quest becomes difficult to complete due to overcrowded areas, you can temporarily disable this mode to overcome the obstacle and move forward.   Item Management and Potions Don't overlook the importance of consumable items, especially health potions. These can be purchased, along with buffs, from general merchants in villages, and they play a crucial role in improving your combat efficiency and ensuring your survival. Always aim to keep a full stock of HP potions and carry buffs that boost attack, defense, or regeneration in batches of 5-10 for convenience.   Once you've acquired your consumables, assign them to your quick slots located at the bottom center of the screen. Swiping down activates these slots, and items like potions will automatically be used when necessary, so you don't need to worry about them mid-battle. Keep a close eye on your potion reserves, as running out during a tough fight could leave you vulnerable before reaching a safe area. In the early stages of the game, it's better to return to town for a restock if supplies are low rather than risking unnecessary defeats. You can also enable notifications to alert you when your health or potion count drops too low—a handy feature for staying prepared if your attention is elsewhere.   Leveling and AFK Farming Once you've mastered the fundamentals, the next step is to focus on leveling up and enhancing your character. Gaining levels is your primary source of progression early on, as it not only improves your stats but also unlocks crucial game features and new abilities. At this stage, simply sticking to the main questline provides a reliable and efficient way to gain experience.   Additionally, Odin includes a highly convenient idle feature called AFK mode. This allows your character to keep farming for resources and experience even when the game is closed, with a maximum duration of 8 hours per day. It's an excellent option for making progress while you're asleep, commuting, or otherwise occupied.   Gear Upgrades When the time comes to improve your gear, the initial focus should be on upgrading from normal-grade equipment to high-grade items. These provide significantly better stats and can be enhanced further to increase their effectiveness. Enhancing requires enhancement stones and gold, but it's important to stay within the safe enhancement limit. Attempting upgrades beyond this limit carries the risk of destroying your gear if the enhancement fails. Stick to safe enhancements until you've gained more experience and accumulated spare equipment to mitigate potential losses.   Skill Purchases When you've accumulated enough gold, it's time to invest in skills. These are crucial for enhancing your combat abilities and provide key benefits tailored to your class, whether it's increasing damage output, improving healing capabilities, or adding valuable utility. Before purchasing, ensure your character meets the level prerequisites for each skill. Your ultimate goal will be progressing through and completing the main questline in Midgard as you continue to develop your character.   Unlocking Jotenheim Finishing this milestone grants you access to the next region, Jetunheim, unlocking a variety of new content and challenges. This marks your first significant achievement in the game and is an essential early objective to strive for as you progress.   Joining a Guild Joining a guild is a highly beneficial step in Odin. Guilds not only provide opportunities for social interaction and group activities but also offer passive bonuses that can significantly enhance your gameplay. Even if you're not particularly active socially, being part of any guild is advantageous. The guild feature becomes accessible after completing Chapter 4, Quest 19 of the main story.   Guilds provide various perks, including buffs that scale with the guild's level. Additionally, you can earn guild coins by contributing through donations, quest completions, or regular logins. These coins can be exchanged for valuable rewards, such as epic-grade armor. The more you actively contribute to your guild, the greater the overall benefits for both you and the guild itself. Joining early and staying involved will undoubtedly strengthen your progression in the game.   Conclusion Here is the end of this beginners' guide. I hope these tips will help you level fast in Odin.
  • Topics

×
×
  • Create New...