Jump to content

Recommended Posts

Posted

Simple share reduce the heap of the html cache(less memory usage)and adds html validation(find incorrect tags in html files which usually ingame end up in a html is too long text).

 

Patch for gracia epilogue L2J but simple to adapt to any chronicle(L2J only L2JFree have validation alredy since ages)

 

### Eclipse Workspace Patch 1.0
#P L2_GameServer
Index: java/com/l2jserver/gameserver/cache/HtmCache.java
===================================================================
--- java/com/l2jserver/gameserver/cache/HtmCache.java	(revision 4299)
+++ java/com/l2jserver/gameserver/cache/HtmCache.java	(working copy)
@@ -18,15 +18,16 @@
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.l2jserver.Config;
import com.l2jserver.gameserver.util.Util;

-import javolution.util.FastMap;
-
/**
  * @author Layane
  *
@@ -39,6 +40,16 @@

	private int _loadedFiles;
	private long _bytesBuffLen;
+	
+	private static final String[] VALID_TAGS = { "volumn", "unknown", "ul", "u", "tt", "tr", "title", "textcode", "textarea", "td", "table", "sup", "sub", "strike", "spin", "select", "right", "pre", "p", "option", "ol", "multiedit", "li", "left", "input", "img", "i", "html", "h7", "h6", "h5", "h4", "h3", "h2", "h1", "font", "extend", "edit", "comment", "combobox", "center", "button", "br", "br1",
+		"body", "bar", "address", "a", "sel", "list", "var", "fore", "readonl", "rows", "valign", "fixwidth", "bordercolorli", "bordercolorda", "bordercolor", "border", "bgcolor", "background", "align", "valu", "readonly", "multiple", "selected", "typ", "type", "maxlength", "checked", "src", "y", "x", "querydelay", "noscrollbar", "imgsrc", "b", "fg", "size", "face", "color", "deffon",
+		"deffixedfont", "width", "value", "tooltip", "name", "min", "max", "height", "disabled", "align", "msg", "link", "href", "action", "head", "tbody" };
+	private final static HashSet<String> VALID_TAGS_SET = new HashSet<String>(301);
+	static
+	{
+		for (String tag : VALID_TAGS)
+			VALID_TAGS_SET.add(tag);
+	}

	public static HtmCache getInstance()
	{
@@ -47,7 +58,7 @@

	private HtmCache()
	{
-		_cache = new FastMap<Integer, String>();
+		_cache = new HashMap<Integer, String>(16000);
		reload();
	}

@@ -62,6 +73,8 @@
		{
			_log.info("Html cache start...");
			parseDir(f);
+			_log.info("Validation starts...");
+			validate();
			_log.info("Cache[html]: " + String.format("%.3f", getMemoryUsage()) + " megabytes on " + getLoadedFiles() + " files loaded");
		}
		else
@@ -239,6 +252,32 @@

		return false;
	}
+	
+	private void validate()
+	{
+		for (Entry<Integer, String> entry : _cache.entrySet())
+		{
+			final String html = entry.getValue();
+			outer: for (int begin = 0; (begin = html.indexOf("<", begin)) != -1; begin++)
+			{
+				int end;
+				for (end = begin; end < html.length(); end++)
+				{
+					if (html.charAt(end) == '>' || html.charAt(end) == ' ')
+						break;
+					// some special quest-replaced tag
+					if (end == begin + 1 && html.charAt(end) == '?')
+						continue outer;
+				}
+				end++;
+				String tag = html.substring(begin + 1, end - 1).toLowerCase().replaceAll("/", "");
+				if (!VALID_TAGS_SET.contains(tag))
+				{
+					_log.info("Invalid tag used: '" + tag + "' at pos " + (begin + 1) + " " + entry.getKey());
+				}
+			}
+		}
+	}

	@SuppressWarnings("synthetic-access")
	private static class SingletonHolder

Posted

Just an advice for you and not only...

Stop losing your time with someone's else code. You, most developers in here, got a good start but you lost it on the way up because you never tried to do something different and harder. Take chalanges, code something that you consider you're not prepared for. Always work on stuff with one stage higher than the stage you are at.

 

L2j is a business and you can get pretty money out of it but you have to be prepared for anything, not just easy, normal stuff which anyone can do. That makes you a developer, the rest is wannabes.

 

Good luck to you, and not only.

Posted

Just an advice for you and not only...

Stop losing your time with someone's else code. You, most developers in here, got a good start but you lost it on the way up because you never tried to do something different and harder. Take chalanges, code something that you consider you're not prepared for. Always work on stuff with one stage higher than the stage you are at.

 

L2j is a business and you can get pretty money out of it but you have to be prepared for anything, not just easy, normal stuff which anyone can do. That makes you a developer, the rest is wannabes.

 

Good luck to you, and not only.

 

And who said i dont do that? :)

 

I think we can agree in 1 thing hard work never shared in public ;)

Posted

And who said i dont do that? :)

 

I think we can agree in 1 thing hard work never shared in public ;)

 

Another tip for you. You probably noticed I had no shares lately. And I mean NONE!

 

Oh well, I got awared of the fact that L2j, as most online things, became a business. Money are done on the internet now. Most of them!

 

L2J as a business and a market of sell means much. A single mistake can fuck up the whole market. One shared piece of code that shouldn't be shared can get a lot of money lost. That's why I'm not for sharing anymore. You want any code you can think of? You pay for it. You want to make a server and get money out of donations afterall, don't you? That's a business and as any other business out there you have to invest in it.

 

Make me understand the concept of me, as a developer, to code something from MY OWN and share it with every else. Most of the guys in here got no idea I'm learning this for a very, very long time. Most of the guys got no idea that at 13 years old I was coding flooders in Visual Basic for DC++ networks. I lost a lot and I gained a lot. Why should I use MY OWN lost years for someone else? Why should I share the code I MADE with someone else? I worked hard to be able to do it. Now I do it for myself, and selling it, is doing it for myself too. Give me just ONE SINGLE advantage of sharing something that I could get money out of. You cant. You will talk about fame. You get fame by sharing and that's right. Next, what you're going to do with that fame? Just nothing. I get fame and I get paid at the same time, I consider that WAY better.

 

Hope you all got the point Im going for and there will be no flames like "wtf u doing here if u'r not for sharing then?". Im here for the people who know me and Im here to SELL STUFF. Noone can forbid me that.

Posted

Another tip for you. You probably noticed I had no shares lately. And I mean NONE!

 

Oh well, I got awared of the fact that L2j, as most online things, became a business. Money are done on the internet now. Most of them!

 

L2J as a business and a market of sell means much. A single mistake can -beep- up the whole market. One shared piece of code that shouldn't be shared can get a lot of money lost. That's why I'm not for sharing anymore. You want any code you can think of? You pay for it. You want to make a server and get money out of donations afterall, don't you? That's a business and as any other business out there you have to invest in it.

 

Make me understand the concept of me, as a developer, to code something from MY OWN and share it with every else. Most of the guys in here got no idea I'm learning this for a very, very long time. Most of the guys got no idea that at 13 years old I was coding flooders in Visual Basic for DC++ networks. I lost a lot and I gained a lot. Why should I use MY OWN lost years for someone else? Why should I share the code I MADE with someone else? I worked hard to be able to do it. Now I do it for myself, and selling it, is doing it for myself too. Give me just ONE SINGLE advantage of sharing something that I could get money out of. You cant. You will talk about fame. You get fame by sharing and that's right. Next, what you're going to do with that fame? Just nothing. I get fame and I get paid at the same time, I consider that WAY better.

 

Hope you all got the point Im going for and there will be no flames like "wtf u doing here if u'r not for sharing then?". Im here for the people who know me and Im here to SELL STUFF. Noone can forbid me that.

 

you dont need to tell me that because i do the exact same but some hype to keep your name up never comes bad :)

Posted

you dont need to tell me that because i do the exact same but some hype to keep your name up never comes bad :)

 

I used the oportunity to explain this to anyone else, not just to you.

 

Keep up the good work. I hope Ill see you soon saying "Got no time to stay late for the drink guys, got some projects to do for good money".

Posted

I used the oportunity to explain this to anyone else, not just to you.

 

Keep up the good work. I hope Ill see you soon saying "Got no time to stay late for the drink guys, got some projects to do for good money".

We are talking about Intrepid you know...

 

Ty very much for this share mate...

Posted

I used the oportunity to explain this to anyone else, not just to you.

 

Keep up the good work. I hope Ill see you soon saying "Got no time to stay late for the drink guys, got some projects to do for good money".

 

friends  > all so thats not going to happen but thank you i make fine amount of money with l2j :)

Posted

The thing you forget Vago, it's some ppl makes L2J for free, and you use it to make money on it.

 

Without this teamwork, I don't think you would dev or make money. Just think a lil.

 

Anyway, ty for the -FREE- share. And death to this capitalist conception of coding (and no I'm not a Linux fan).

 

BTW, showing some codes sometimes just show he got talent, just show his programmer skill and make him publicity. You missed a marketing lesson...

 

I don't defend Intrepid, and I have nothing with you Vago. :).

 

----

 

Have you taken the idea from your old anti-L2W commit ? It looks the same :D.

Posted

The thing you forget Vago, it's some ppl makes L2J for free, and you use it to make money on it.

 

Without this teamwork, I don't think you would dev or make money. Just think a lil.

 

Anyway, ty for the -FREE- share. And death to this capitalist conception of coding (and no I'm not a Linux fan).

 

BTW, showing some codes sometimes just show he got talent, just show his programmer skill and make him publicity. You missed a marketing lesson...

 

I don't defend Intrepid, and I have nothing with you Vago. :).

 

----

 

Have you taken the idea from your old anti-L2W commit ? It looks the same :D.

 

Actually that was done way before my anti l2w try :D

Thats made back in l2emu nearly 9months old code :D

Posted

The thing you forget Vago, it's some ppl makes L2J for free, and you use it to make money on it.

 

Without this teamwork, I don't think you would dev or make money. Just think a lil.

 

Anyway, ty for the -FREE- share. And death to this capitalist conception of coding (and no I'm not a Linux fan).

 

BTW, showing some codes sometimes just show he got talent, just show his programmer skill and make him publicity. You missed a marketing lesson...

 

I don't defend Intrepid, and I have nothing with you Vago. :).

 

----

 

Have you taken the idea from your old anti-L2W commit ? It looks the same :D.

 

They could have made lots of money with a non-shared l2j but that's their work and they do whatever they want with it. Im just saying I wont share my considerable work ever again. :)

Posted

They could have made lots of money with a non-shared l2j but that's their work and they do whatever they want with it. Im just saying I wont share my considerable work ever again. :)

 

And you are right with that but as i said before some "hipe" never hurt. :)

Posted

Oh well, I got awared of the fact that L2j, as most online things, became a business. Money are done on the internet now. Most of them!

client modding is awarded the same way...

 

If you do something for free you end up with 99% of the people using it do nothing in return

 

Do realise that thanks to those who did spend their time sharing/making l2j allowed you to now make money from it; the same way I'm still infinitely thankful to those that shared the first guides/tools how to edit L2 client.

 

Thanks for sharing Interpid, it seems helpful

Posted

Actually that was done way before my anti l2w try :D

Thats made back in l2emu nearly 9months old code :D

 

Buhaha.

 

Btw, you should make the message more friendly, cause actually you know you got error in "x" files, but which exactly are them...

 

Or show only useful infos, like bad tags and the total numbers of files, cause if you got 150 bad tags, that shows 150 errors ? Not rly exploitable in a GS log:P.

 

And the big numbers I don't get the use :D. About the pos, it's the file which have been loaded ? So you know it's the 1849th loaded file which bugs ? Not rly exploitable ^^.

 

(Ok with notepad ++ you search for the bad tag in the folder, but still :p.)

 

Works fine on my Archid custom, you have to disable the Lazy cache.

 

plopa.jpg

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

    • This update resaves 25_25 from the original (with sounds) (without the cave below) Some emitter fixes (removed waterfalls with high-poly meshes) The geodata is old, but it works Everything else is unchanged Download P.S. The effect files are taken from the high client for Interlude, so if you're experiencing critical skills, use the default ones for your Version.  
    • GX-Ext Which file of the svn files should i edit to make blow skills to have 100% chance so i can add the settings in the IlExt.ini? because when im changing it from the skilldata.txt it just helps
    • 我们感谢您的 反馈 并希望让服务变得更加 优秀! 如果您使用过我们的服务并愿意分享您的体验(任何体验——积极或建设性),请在Trustpilot上留下评价,并获得$1作为感谢。 链接: https://www.trustpilot.com/review/socnet.pro 如何获得奖励: 1. 前往Trustpilot并留下您的评价 2. 向我们发送发布确认截图,以及带有与评价用户名一致的授权账户截图。 3. 指定哪个商店应收到这 $1 奖励。根据商店不同,可能需要您的用户名/电子邮箱。 您的反馈帮助我们成长,并让项目对社区中的每一位成员变得更好。感谢您与我们同行! 条款: 此活动仅适用于一个唯一用户。不允许多账号行为。 项目有效链接: 数字商品商店(网站): 前往 商店 Telegram 机器人: 前往 – 通过 Telegram 方便访问商店。 虚拟号码服务: 前往 用于购买 Telegram Stars 的 Telegram 机器人: 前往 – 在 Telegram 中快捷且优惠地购买 Stars。 SMM 面板: 前往 – 推广您的社交媒体账户。 我们想向您展示当前的 促销和特别优惠列表 用于购买我们提供的产品与服务: 1. 您可在首次购买时使用优惠码:SOCNET(15% 折扣) 2. 获得 $1 商店余额或 10–20% 折扣——只需在我们网站注册后,按照模板填写您的用户名:“SEND ME BONUS, MY USERNAME IS...”并在我们的论坛主题中发布! 3. 首次启动 SMM 面板可获得 $1:只需在我们的网站(Support)提交主题为 “Get Trial Bonus” 的工单。 4. 我们的 Telegram 频道以及 Stars 购买机器人中每周都有 Telegram Stars 抽奖! 新闻: ➡ Telegram 频道: https://t.me/accsforyou_shop ➡ WhatsApp 频道: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器: https://discord.gg/y9AStFFsrh 联系方式与支持: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • 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