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

    • @Vedi don't give up bro. We are waiting for this project to come back stronger.  
    • Welcome to L2EpicFail Server developed by gamers for gamers!  OBT - 7th March 2024 at 18:00 GMT+0 GRAND OPENING - 14th March 2025 at 18:00 GMT+0 Website : https://l2epic.fail/ Discord : https://discord.gg/6hwhrkrHBG     Server Features and Rates Xp – 15x Sp – 9x Adena – 6x Drop – 2x Spoil - 2x Seal Stones drop -  3x   Epic Raid Boss drop - 1x Regular RBs - EXP 5x, SP 5x, drop 4x   Quest drop - 1x (some quests customized to 3x) Quest reward - 1x, Adena 3x, EXP 3x, SP 3x     Premium Account Xp +20% Sp +20% Adena +20% Drop +20% Spoil +20% Quest reward +20%   get by vote or donate World chat 20 times/day use ">" in chat. Buff Book outside of town. Applies to all accounts.     Special Features Classic interface ActiveAnticheat Vote System Missions Attendance check And more in information below     Noblesse There are 3 ways how to make noblesse 1 - Retail Quest with killing barakiel 2 - Modifed Quest, choose killing mobs for 100 items instead of barakiel 3 - Can be bought for Epic Coins     Raid Rank Killing regular Raids gives points according to the level of the RB to the clan of the player who killed the boss. At the end of every month, there will be rewards for top clans. For more info, follow our Discord.   monthly period killing RB = points to clan according to RB level rewards up to Valakas Necklace (not the first month) current statistics can be checked online     Epic Bosses & Respawns   Queen Ant 20 - 30 hours respawn window 1 hour always displayed in .epic auto PvP zone (max 43 level) HP boosted drop chance 40% guards, nurses lvl 40   Orfen 20 - 30 hours respawn window 1 hour always displayed in .epic auto PvP zone (max 56 level) HP boosted drop chance 40% earring gives +1 WIT, +1 INT   Core 20 - 30 hours respawn window 1 hour always displayed in .epic auto PvP zone (max 56 level) HP boosted drop chance 40% ring gives +1 STR, +1 DEX   Zaken 44 - 54 hours respawn window 1 hour always displayed in .epic auto PvP zone (max A grade) doors opened only 5 mins HP boosted   Baium Every Sunday 20:30 - 21:30 window 1 hour always displayed in .epic auto PvP zone (13 - 14th ToI level) regular HP   Frintezza Every Monday, Wednesday, Friday 20:00 - 21:00 window 1 hour always displayed in .epic auto PvP zone (all IT entrance) max 5 parties to entry max 500 range from NPC   Antharas Every two weeks on Saturday 21:00 - 22:00 window 1 hour always displayed in .epic auto PvP zone (bridge to heart)   Valakas Every two weeks on Saturday 21:00 - 22:00 window 1 hour always displayed in .epic auto PvP zone (Klein to heart)   every Epic RB drops Epic Medals equal to RB level x 10     Regular Bosses all regular RBs HP boosted M. def boosted a bit to give advantage to fighters all regular RBs respawn 24 - 30 hours every RB drops Epic Medals equal to RB level     Added Skills Mass Sweep - All Bounty Hunters 40+ Block Buff - All Characters, toggle Escape: 20 seconds - All Characters, no more SoEs   Skills autolearn. Losing skills after 16 levels of delevel. Max buffs 24 + 4 with books (no autolearn)     Augments NoGrade - 4% chance MidGrade - 5% chance HighGrade - 7% chance TopGrade - 6% chance   GM shop weapon/armor/jwl (max C grade) shots/spiritshots (max C grade) mana potions (500 MP, 5s)     NPC buffer all buffs, songs, dances including 3rd prof + resists 1 hour duration all chars Buff Book in inventory     Global Gatekeeper all towns including cata/necro ToI 3/5/7/10th     Olympiad Thursday to Saturday 18:00 - 23:50 UTC+0 period 7 days no class participants min 5 base class participants min 10 max enchant +6     Class Transfer 1st class 50k adena 2nd class 500k adena 3rd class 20kk adena + 700 Halisha marks (tradeable)     Noblesse Quest Quest retail like. Moonstone Shards, Demons Blood etc. quest drop boosted     Subclass Quest To get the quest, you have to be 75+ on your main character (start Reorin in Giran) Bring item from Cabrio chest Bring items from Hallate, Kernon and Golkonda chests Bring this back to Reorin Bring 984 B-grade crystals and top B weapon to Reorin Get low A-grade weapon as reward Done , you can take subclass (up to 5) from any Master in town     Clans all clan members get clan skills (no need for titles) max clan slots 65, max ppl in PvP zone 63 leave/dismiss penalty 0 hours max clans in ally 3     Others   max 3 windows per HWID (only one in PvP zone) protection after teleport for 20 seconds arrows and spellbooks drop turned off weight limit 10x, stackable enchants and LS champions blue (5x HP) min level for trade = 40, chat = 20 BoM/MoM spawned in towns Edited November 1, 2024 by NevesOma
    • Im searching to developer to help me 🙂 pm me 🙂
    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchiha.sellpass.io/ Join our server for more products : https://discord.gg/uthciha-services https://campsite.bio/utchihaamkt  
    • DISCORD : utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchiha.sellpass.io/ Join our server for more products : https://discord.gg/uthciha-services https://campsite.bio/utchihaamkt  
  • Topics

×
×
  • Create New...