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?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




  • Posts

    • I wouldn't expect something less, since you work with Psadek (or I maybe mistake you with NightW0lf from itopz, in that case soz) Let's throw rocks at Java Golds and elevate "original L2OFF Golds", no?
    • We are delighted to announce our partnership with the leading resource, Active Anticheat, specializing in protection against bot programs, clickers, and additional modules for the game client that enhance the experience for both you and the players!   When you purchase Active Anticheat for our product, you will also receive a $50 discount.   Here's a brief overview of the features of Active Anticheat: Best protection against bots, including private and premium versions. Window limitation. HWID spoofing protection. Virtual machine protection. File hash protection for client files, preventing players from modifying them (e.g., interface files). Encryption of any game files. Integration with Discord to attract new players! Additional plugins: - Window with saved player logins/passwords. Players no longer need to enter them every time! - HWID sending to the game server. - Game window optimizer for quick switching. - Background FPS adjustment. - Window name customization in the format "%character_name% - %server_name%". - Ctrl+C/V permission. - Login and password saving (for Interlude -> High Five). - Launching the browser via server packets. - Launching interface events via server packets. - Interlude: fixing a known game bug (History: UpdateAnimation <- AActor::Tick <- TickAllActors <- ULevel::Tick <- (NetMode=0) <- TickLevel <- UGameEngine::Tick <- UpdateWorld <- MainLoop). - Interlude: debuff feature. 9) All of this is available without modifying the game server code (some plugins may require minor changes). Take note of newest plugin, which is highly useful: Guides section
    • The Lucera2 Multiprotocol is an advanced server branch for Lineage 2 that enables seamless support for multiple client versions on a single server instance. This allows players to connect and play using either the legacy (old) client or the newer Classic client simultaneously, without any compatibility issues or loss of functionality. Key Benefits Dual Client Support: Both the old Interlude client and Classic: Secret of Empire 2.6 client can run concurrently on the same server. All features from the Classic client (e.g., enhanced UI, new mechanics) remain fully available, while the old client retains its alternative features (e.g., simplified interfaces for lower-end hardware). Expanded Player Base: Ideal for regions with limited access to modern gaming setups, as it accommodates a wider range of devices and preferences, merging Legacy and Classic communities into one forum section for unified discussions. No Functionality Gaps: Extensive testing ensures zero disruptions—players on either client experience complete game integrity, including quests, PvP, raids, and custom Lucera2 subsystems. You can fully test and explore all aspects of Multiprotocol on the dedicated Test Server. Supported Protocols C6 (Old Client): Protocol versions 740–770. Classic Client (Secret of Empire 2.6): Protocol versions 166–192.
    • Connect to the server you need to >>>download<<< game client launch from /system_en/. Login server setup on auto registration, admin rights in game by default . Or you can use a patch specifying the l2.ini Connect to address classic.lucera2.com if you already have a game client Download updated patch All major/minor subsystems operate in a proper view. Absolutely ready to combat the server.
  • 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