Jump to content

Recommended Posts

Posted

o.O I'm surprised that you use greek words to your posts.

lol?

 

I liked json since you first mentioned it Seth, because it's easier to use and you can simply save a whole .json file to a list(you can do it in jaxb too, but it's kinda complicated).

Posted

JSON is a very good alternative to static XML datapack and I think it can outperform XML loading in L2j, we need benchmark tests anyway

 

Tutorial: http://www.mkyong.com/java/json-simple-example-read-and-write-json/

 

XML to JSON: http://www.utilities-online.info/xmltojson

Posted

JSON is a very good alternative to static XML datapack and I think it can outperform XML loading in L2j, we need benchmark tests anyway

 

Tutorial: http://www.mkyong.com/java/json-simple-example-read-and-write-json/

 

XML to JSON: http://www.utilities-online.info/xmltojson

its all about managing json. Take a look at jackson @ codehouse

Posted

Look at this:

 

http://pastebin.com/JHT4ACBi

 

And how it's loaded:

 

public void load()
{
	File f = new File("./data/json/teleports.json");
	if (!f.exists())
	{
		_log.severe("TeleportLocationTable: teleports.json could not be loaded: file not found");
		return;
	}

	List<L2TeleportLocation> temp = JSONParser.getInstance().loadList("data/json/teleports.json", L2TeleportLocation.class);

	for (L2TeleportLocation tl : temp)
	{
		_teleports.put(tl.getTeleId(), tl);
	}

	_log.info("TeleportLocationTable: Loaded " + _teleports.size() + " templates.");
}

 

While in xml(without using jaxb):

 

public void load()
{
	try
	{
		File f = new File("./data/xml/teleports.xml");
		Document doc = XMLDocumentFactory.getInstance().loadDocument(f);

		Node n = doc.getFirstChild();
		for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
		{
			if (d.getNodeName().equalsIgnoreCase("teleport"))
			{
				NamedNodeMap node = d.getAttributes();

				L2TeleportLocation teleport = new L2TeleportLocation();
				teleport.setTeleId(Integer.valueOf(node.getNamedItem("id").getNodeValue()));
				teleport.setLocX(Integer.valueOf(node.getNamedItem("loc_x").getNodeValue()));
				teleport.setLocY(Integer.valueOf(node.getNamedItem("loc_y").getNodeValue()));
				teleport.setLocZ(Integer.valueOf(node.getNamedItem("loc_z").getNodeValue()));
				teleport.setPrice(Integer.valueOf(node.getNamedItem("price").getNodeValue()));
				teleport.setIsForNoble(Integer.valueOf(node.getNamedItem("fornoble").getNodeValue()) == 1);

				_teleports.put(teleport.getTeleId(), teleport);
			}
		}
	}
	catch (Exception e)
	{
		_log.severe("TeleportLocationTable: Error while creating table" + e);
	}
	_log.info("TeleportLocationTable: Loaded " + _teleports.size() + " templates.");
}

 

 

Also when teleports.xml rewriten to teleports.json it was like half size.

Posted

Also when teleports.xml rewriten to teleports.json it was like half size.

 

Of course.

 

HelperBuffTable using json.

 

private void load()
{
	JsonService service = JsonService.getInstance();
	_helperBuff = service.loadList("data/json/helper_buffs.json", L2HelperBuff.class);

	for (L2HelperBuff buff : _helperBuff)
	{
		// Calulate the range level in wich player must be to obtain buff from Newbie Helper
		if (!buff.isMagicClassBuff())
		{
			if (buff.getLowerLevel() < _physicClassLowestLevel)
			{
				_physicClassLowestLevel = buff.getLowerLevel();
			}

			if (buff.getUpperLevel() > _physicClassHighestLevel)
			{
				_physicClassHighestLevel = buff.getUpperLevel();
			}
		}
		else
		{
			if (buff.getLowerLevel() < _magicClassLowestLevel)
			{
				_magicClassLowestLevel = buff.getLowerLevel();
			}

			if (buff.getUpperLevel() > _magicClassHighestLevel)
			{
				_magicClassHighestLevel = buff.getUpperLevel();
			}
		}
	}

	_log.info("Helper Buff Table: Loaded " + _helperBuff.size() + " Templates.");
}

Posted

yet json is hard to edit, hard to read and just a nightmare to edit when it involves big stuff, json is a web language in general and should be used on the web only

Posted

yet json is hard to edit, hard to read and just a nightmare to edit when it involves big stuff, json is a web language in general and should be used on the web only

Well, it's not that bad. Actually you can't say it should only be used on web apps, since it is created in order to make a faster xml service(even the package in jackson lib is com.fasterxml lol). It's just kinda complicated, but really efficient too.

Posted

Well, it's not that bad. Actually you can't say it should only be used on web apps, since it is created in order to make a faster xml service(even the package in jackson lib is com.fasterxml lol). It's just kinda complicated, but really efficient too.

 

The creators of json said themselfs that json was implemented to replace XML on the web nowhere else, in l2j you need validation you need clear understanding of every element and you also need structure which json doesnt have.

 

XML maybe harder to parse but when you check on the outcome it provides a better result for gameserver usage than json ever could.

Posted

The creators of json said themselfs that json was implemented to replace XML on the web nowhere else, in l2j you need validation you need clear understanding of every element and you also need structure which json doesnt have.

 

XML maybe harder to parse but when you check on the outcome it provides a better result for gameserver usage than json ever could.

Xml though is useful only if you use jaxb(which is kinda difficult too when you are trying to unmarshal/marshal a list).

Posted

Xml though is useful only if you use jaxb(which is kinda difficult too when you are trying to unmarshal/marshal a list).

jaxb made xml easy actually, its just a matter of understanding the annotations, tho its kind of annoying making so many classes to use them as protocols just to pass the data to another holder.

 

Also XML was done by  W3C, who wanna guess what they do in particular?

The only downfall of json is that they dont have time stamps.

And its easy to read, in fact easyest to read and write, basically there are thousands of editors.

 

Posted

Guys, good alternative to xml can be yaml, but not shit json.

hahahaha its the same thing, im crying right nou of laughter hahahaha

 

Also ill tell you why YAML should be always left as a config. Indent dependency.

Posted

Guys, good alternative to xml can be yaml, but not shit json.

You are not even using jaxb to load xml in aCis and you tell us about replacing it?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • Posts

    • Added FloodProtector utility to prevent packet flooding for actions like item use and dice rolling. Integrated flood protection checks in relevant client packet handlers and registered/removal hooks in player lifecycle. Updated movement logic in L2PcInstance for improved position synchronization and geodata handling. Minor fixes and refactoring in attack logic, private store handling, and admin NPC editing. Refactored AI classes to enhance movement, attack, and skill usage logic for characters and mobs. Improved distance checks, attack range calculations, and skill casting conditions. Removed unused intention command logic from L2CharacterAI. Updated configuration to enable CellPathFinding. Minor code cleanups and bug fixes for more reliable AI behavior. Enhanced GeoPathFinding with detailed debug and error messages for region loading, including success/failure counts and file checks. Refactored L2AttackableAI and L2CharacterAI to improve attack range tolerance, immediate attack behavior, and added safety checks for missing targets. Updated configuration to disable CellPathFinding by default and added a new ShowRedName option for aggressive mobs. Minor config and log updates included. Applied TCP socket optimizations (e.g., TCP_NODELAY, buffer sizes, keepalive) in ClientThread, Connection, and SelectorThread to reduce latency and improve throughput. Enhanced L2AttackableAI with better random walk, aggro, and attack logic, including silent move checks, quest monster handling, and improved faction/raid/minion behavior. Added silent move support to L2PlayableInstance and quest monster flag to L2NpcTemplate/L2NpcInstance. These changes aim to improve server responsiveness, AI realism, and overall stability.
    • I’ve been using this Escape from Tarkov Hack for about a week now with no issues at all. ESP works great without any lag, and the aimbot is smooth and doesn't feel obvious. Had a quick setup with the loader, and support answered my questions right away. The HWID spoofer also did its job without messing with my system. So far, the cheat's staying undetected on my side.
    • Hello everyone, this is ADENA L2REBORN / LU4 / MASTERWORK We also have items, epics, etc. discord - adver745645 Our prices are reasonable, so have a nice shopping and a nice day.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock