Jump to content

[Updated][Share] Rin4a's Buffer v1.3 Edited with Pet Buffer


Recommended Posts

The reason for this post is to report a problem that can seriously affect the performance of your servers. Some of you maybe have not noticed, ought not to have many people using the buffer at the same time, but in my case 1 week ago, I had two total freezes when the whole server (500-700 players) attempted use the bufer after an event ;D. But I found something, a person is enough to knock over a server, with many people. Looks this code in script both original rin4a's buffer and my version have a problem, but is easy to fix.

 

as you can see in these lines of code, is open a connection to the database but is never closed, every time a user attempted to remove a buff of his scheme, open a new connection that was never closed causing a total server freeze.

 

                          if event == "remove_buff" :
                                      event = eventParam1.split("_")
                                      scheme = event[0]
                                      skill = event[1]
                                      level = event[2]
                                      con=L2DatabaseFactory.getInstance().getConnection()
                                      rem=con.prepareStatement("DELETE FROM buffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1")
                                      rem.setString(1, scheme)
                                      rem.setString(2, skill)
                                      rem.setString(3, level)
                                      try : rem.executeUpdate()
                                      except : pass

 

to fix the problem only adds to what I show below  :). thats all!

 

                          if event == "remove_buff" :
                                      event = eventParam1.split("_")
                                      scheme = event[0]
                                      skill = event[1]
                                      level = event[2]
                                      con=L2DatabaseFactory.getInstance().getConnection()
                                      rem=con.prepareStatement("DELETE FROM buffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1")
                                      rem.setString(1, scheme)
                                      rem.setString(2, skill)
                                      rem.setString(3, level)
                                      try :
                                                   rem.executeUpdate()
                                                   rem.close()         # <------------ADD----------
                                                   con.close()         # <------------ADD----------
                                      except : pass

 

After this modification, the performance of my server increase substantially (not more freezing, less lagg).

 

PD: I would recommend that only allow certain people to use the buffer for servers with more than 100 users (Use the VIP Option, i used and everything is fine).

 

I added that lines but when server try to load the script i got errors :

 

Failed executing script: C:\server\GameServer\data\scripts\custom\555_NPCBUFFER\

__init__.py. See __init__.py.error.log for details.

 

and in log is :

 

Error on: C:\server\GameServer\data\scripts\custom\555_NPCBUFFER\__init__.py.error.log

Line: -1 - Column: -1

 

Traceback (innermost last):

  (no code object) at line 0

SyntaxError: ('invalid syntax', ('__init__.py', 763, 25, '                        rem.close()'))

 

how it work at you ?

Link to comment
Share on other sites

Anyone know a way to pull the description of the buff for each buff then display it under the icon/button/text for the actual buff?

 

A lot of people have a hard time making schemes because they forget what each one does. I am trying to edit and implement this into the buffer.

Link to comment
Share on other sites

Well this information isn't embedded in the server's core, so you would have to make a new column in the buffers_buff_list table, add the description, and make the script to fetch that information. But there is a down side. You won't be able to list more than lets say 12 buffs per page. There are more than 130 buffs added, of course if you haven't added your own ones. So the script will have 10+ pages, and as far as I know, there can be some weird malfunctions in the HTML file.

Link to comment
Share on other sites

Yeah anything after 9 pages starts getting glitchey...Guess I'll have to do this another way.

Thanks for the quick response Rin4a, I've always loved your buffer.

 

PS: You are everywhere xD

Link to comment
Share on other sites

To be honest, I never took a look at the code of this buffer, that Allen modified. I just went with it, because it seemed to be working quite well. But performance wise - it's a mess. It's like every single script, that is out there, merged into a single file, and I'm not quite happy with that. But anyway - let's get back to my original script. I took some time out from L2j, but meanwhile I was studying pythons advanced features and I understood where I went wrong, while making this buffer. It was a total crap, if we judge it by it's performance. Features were OK. So what do I have in my mind. In this summer, I will try to rewrite this buffer completely. There won't be any stand alone functions, that are being called elsewhere, because I will be using classes. For tech geeks that are out there (yeah, I'm one of them lol) - I will be fully utilizing python's advanced OOP features and I will use string formatting feature, that is really cool.

To give a brief example:

# We will define a dummy variable, only to show, how to output it
dummy_var = "dog"

But for this example, we will output dog in double quotes. How did we do that earlier? Well..

print "I have a \"" + dummy_var + "\" and it's name is Rex"

So we had to concatenate dummy_var in the string and to output quotes, we had to use double double quotes and escape them and that might and will create a mess, but there is an other option, that works the same way, but is much clearer:

print "I have a \"%s\" and it's name is Rex" % dummy_var

We still had to escape double quotes, but if we had a bunch of variables that we would want to concatenate in the string, this method would work much much better.

Don't know why I wrote this, but someone might use it in their script.

Cheers.

Link to comment
Share on other sites

Thats right, and this is important too http://www.skymind.com/~ocrow/python_string/. i will use Method 5 for now in my scripts. Thanks for advice. By the way, I think this method and what you said, can greatly increase the concatenation speed of any code, but implementing it in this buffer, is almost the same :S, this code is based in data base queries for everything (and that's just i try to avoid lately), so the concatenation speed and performance will be bad anyway :).

Link to comment
Share on other sites

Queries ain't that bad, if you handle them correctly. In my old buffer, I used queries all the time, without thinking about the performance, but I will avoid that in my next release. I will fetch all the data from the database, when script will be initialized (when server will be starting) and store them in global arrays. So that way, the data will be there, when I need it, and I won't have to call any queries. In other words, I will be utilizing server's RAM more efficiently. I haven't thought about scheme system, because there might be more than 10k entries in the database, so I guess that I will have to use queries, despite everything, or I could make a dictionary, that will hold player's ID as a key and an array of skill ID's will be passed along. In total, 10k wouldn't be that much of a deal, but we will see..

Link to comment
Share on other sites

  • 1 month later...

Ok I had your buffer working fine but I updated the server to a newer revision and now I get an error.

 

On Gameserver and htm of npc I get this error:

 

C:\Users\Giovanni Amorim\Desktop\magg\gameserver\data\scripts\custom\555_NPCBUFF
ER\__init__.py
Traceback (innermost last):
 (no code object) at line 0
       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

       at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
       at java.lang.reflect.Constructor.newInstance(Unknown Source)
       at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
       at com.mysql.jdbc.Util.getInstance(Util.java:384)
       at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3562)
       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3494)
       at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1960)
       at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114)
       at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2696)
       at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.ja
va:2105)
       at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:
2264)
       at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewPr
oxyPreparedStatement.java:76)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: com.mysql.jdbc.except
ions.jdbc4.MySQLSyntaxErrorException: Table 'l2j_magg.buffer_scheme_list' doesn'
t exist

       at org.python.core.Py.JavaError(Unknown Source)
       at org.python.core.PyObject._jthrow(Unknown Source)
       at org.python.core.PyObject._jcall(Unknown Source)
       at org.python.proxies.main$Quest$437.onAdvEvent(Unknown Source)
       at com.l2jserver.gameserver.model.quest.Quest.notifyEvent(Quest.java:405
)
       at com.l2jserver.gameserver.model.actor.instance.L2PcInstance.processQue
stEvent(L2PcInstance.java:1838)
       at com.l2jserver.gameserver.network.clientpackets.RequestBypassToServer.
runImpl(RequestBypassToServer.java:259)
       at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run
(L2GameClientPacket.java:93)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
       at java.lang.Thread.run(Unknown Source)

 

 

 

 

EDIT: I FIXED THE PROBLEM< I FORGOT TO ADD THE TABLES ON THE DATABASE

 

 

 

 

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.



  • Posts

    • Evander Terminating Pills +27635536999 Top Abortion Pills For Sale In Evander Secunda  Winnie Mandela Tembisa Clayville IN Benoni +27635536999 Abortion pills FOR sale In Benoni Germiston Boksburg IN Germiston O635536999 Abortion pills In Germiston Boksburg Benoni IN Boksburg +27635536999 Abortion pills for sale In Boksburg Germiston Benoni IN Soweto 0635536999 Abortion pills for sale In Soweto Naledi Protea Glen IN Soweto O635536999 Abortion pills In Soweto Bara Jabulani Dube IN Bethal +27635536999 Abortion pills In Bethal Middelburg Embalenhle Standerton IN Middelburg O635536999 Abortion pills for sale In Middelburg Embalenhle Standerton IN Embalenhle +27635536999 Abortion pills Standerston In Embalenhle INhle Standerton +2 7635536999 Abortion pills for sale In Standerton Kinross Witbank IN Secunda +27635536999 Abortion pills In Secunda Kinross Witbank IN Witbank +27635536999 Abortion pills In Witbank Secunda Kinross IN Musina 0635536999 Abortion pills for Sale In Musina Sibasa Bela Bela Thohoyandou IN Sibasa +27635536999 Abortion pills for Sale In Sibasa Bela Bela Thohoyandou IN Bela Bela +27635536999 Abortion pills for Sale In Bela Bela Thohoyandou Sibasa Abortion Pills For Sale In Midrand ,Soweto, Germiston, Benoni, Daveyton,Boksburg,Abortion clinic in Brakpan we do help you with abortion services our clinic in Boksburg is one of the best clinics in East Rand we do use approved ******* pills and womb cleaning pills too plus all the instructions needed This Discrete women's Termination Clinic offers same day services that are safe and pain free, we use approved pills and we clean the womb so that no side effects are present. Our main goal is to prevent unintended pregnancies and unwanted births every day to enable more women to have children by choice, not chance. We offer Terminations by Pill and The Morning After Pill."Our Private VIP Abortion Service offers the ultimate in privacy, efficiency and discretion. We do safe and same day termination and we also do womb cleaning as well*Its done from 1 week up to 28 weeks. We do delivery of our services world wide SAFE ABORTION CLINICS/PILLS ON SALE WE DO DELIVERY OF PILLS ALSO....Abortion clinic at very low costs, 100% Guaranteed and it's safe, pain free and a same day service. It Is A 45 Minutes Procedure, we use tested abortion pills and we do womb cleaning as well. Alternatively the medical abortion pill and womb cleansing tablets for the termination can be delivered to you for home use. Abortion clinic in south Africa Private and sale of pills for home use Women health problems. Same day services:safe,legal & pain free Abortions/Terminations. From 1 week to 6 months..We use tested and / approved pills / Tablets. It's 100% guaranteed & safe. No side effects There are many ways to describe Medical Abortions. The different names used are Abortion by Pill, early non-surgical, chemical or instrument-free abortion. In this process a pill or set of pills is used to Terminate the Pregnancy.
    • Secunda Terminating Pills +27635536999 Top Abortion Pills For Sale In Secunda Hendrina  Abortion Clinic offering ultimate Services in abortion with an experience of 29 years. Our abortion centers are equipped with primary facilities hence creating a private environment with privacy, efficiency and discretion. You will be the only patient in the clinic. Our staff includes a gynecologist, registered nurse, and a counselor at your care. Our Abortion Prices are affordable to all South Africans hence preventing Unwanted Pregnancies. Deliveries are done to those who can’t come in due to work related issues at no cost. Medical Abortions What is a medical abortion? Medical abortion is when specific medication is administered to women for termination of pregnancy.We use GENUINE,SAFE,TRUSTED, ADVANCED,urgent,PAINFREE & SAME DAY Abortion Pill() in our clinic. This specific medication is approved by the South African Medicines Control Council and must be taken strictly as prescribed. We terminate pregnancy from one month up to six month using our trusted pills. We deliver abortion pills anywhere you are at your costs. We also provide the best care after abortion and free counseling. We do have experts in every field, for your service and care. Working hours Monday to Sunday 24 7, hours.we do deliveries of abortion pills worldwide.UAE,EUROPE,ASIA,AFRICA. Our staff includes a gynecologist, registered nurse, and a counselor at your care. Our Abortion Prices are affordable to all South Africans hence preventing Unwanted Pregnancies.Deliveries are done to those who can’t come in due to work related issues at no cost. Medical Abortions What is a medical abortion? Medical abortion is when specific medication is administered to women for termination of pregnancy. We use GENUINE,SAFE,TRUSTED
    • Hendrina Terminating Pills +27635536999 Top Abortion Pills For Sale In Hendrina Kinross  Abortion Clinic offering ultimate Services in abortion with an experience of 29 years. Our abortion centers are equipped with primary facilities hence creating a private environment with privacy, efficiency and discretion. You will be the only patient in the clinic. Our staff includes a gynecologist, registered nurse, and a counselor at your care. Our Abortion Prices are affordable to all South Africans hence preventing Unwanted Pregnancies. Deliveries are done to those who can’t come in due to work related issues at no cost. Medical Abortions What is a medical abortion? Medical abortion is when specific medication is administered to women for termination of pregnancy.We use GENUINE,SAFE,TRUSTED, ADVANCED,urgent,PAINFREE & SAME DAY Abortion Pill() in our clinic. This specific medication is approved by the South African Medicines Control Council and must be taken strictly as prescribed. We terminate pregnancy from one month up to six month using our trusted pills. We deliver abortion pills anywhere you are at your costs. We also provide the best care after abortion and free counseling. We do have experts in every field, for your service and care. Working hours Monday to Sunday 24 7, hours.we do deliveries of abortion pills worldwide.UAE,EUROPE,ASIA,AFRICA. Our staff includes a gynecologist, registered nurse, and a counselor at your care. Our Abortion Prices are affordable to all South Africans hence preventing Unwanted Pregnancies.Deliveries are done to those who can’t come in due to work related issues at no cost. Medical Abortions What is a medical abortion? Medical abortion is when specific medication is administered to women for termination of pregnancy. We use GENUINE,SAFE,TRUSTED
    • Kinross Terminating Pills +27635536999 Top Abortion Pills For Sale In Kinross Standerton  Abortion Clinic offering ultimate Services in abortion with an experience of 29 years. Our abortion centers are equipped with primary facilities hence creating a private environment with privacy, efficiency and discretion. You will be the only patient in the clinic. Our staff includes a gynecologist, registered nurse, and a counselor at your care. Our Abortion Prices are affordable to all South Africans hence preventing Unwanted Pregnancies. Deliveries are done to those who can’t come in due to work related issues at no cost. Medical Abortions What is a medical abortion? Medical abortion is when specific medication is administered to women for termination of pregnancy.We use GENUINE,SAFE,TRUSTED, ADVANCED,urgent,PAINFREE & SAME DAY Abortion Pill() in our clinic. This specific medication is approved by the South African Medicines Control Council and must be taken strictly as prescribed. We terminate pregnancy from one month up to six month using our trusted pills. We deliver abortion pills anywhere you are at your costs. We also provide the best care after abortion and free counseling. We do have experts in every field, for your service and care. Working hours Monday to Sunday 24 7, hours.we do deliveries of abortion pills worldwide.UAE,EUROPE,ASIA,AFRICA. Our staff includes a gynecologist, registered nurse, and a counselor at your care. Our Abortion Prices are affordable to all South Africans hence preventing Unwanted Pregnancies.Deliveries are done to those who can’t come in due to work related issues at no cost. Medical Abortions What is a medical abortion? Medical abortion is when specific medication is administered to women for termination of pregnancy. We use GENUINE,SAFE,TRUSTED
    • Standerton Terminating Pills +27635536999 Top Abortion Pills For Sale In Standerton Kriel  Abortion Clinic offering ultimate Services in abortion with an experience of 29 years. Our abortion centers are equipped with primary facilities hence creating a private environment with privacy, efficiency and discretion. You will be the only patient in the clinic. Our staff includes a gynecologist, registered nurse, and a counselor at your care. Our Abortion Prices are affordable to all South Africans hence preventing Unwanted Pregnancies. Deliveries are done to those who can’t come in due to work related issues at no cost. Medical Abortions What is a medical abortion? Medical abortion is when specific medication is administered to women for termination of pregnancy.We use GENUINE,SAFE,TRUSTED, ADVANCED,urgent,PAINFREE & SAME DAY Abortion Pill() in our clinic. This specific medication is approved by the South African Medicines Control Council and must be taken strictly as prescribed. We terminate pregnancy from one month up to six month using our trusted pills. We deliver abortion pills anywhere you are at your costs. We also provide the best care after abortion and free counseling. We do have experts in every field, for your service and care. Working hours Monday to Sunday 24 7, hours.we do deliveries of abortion pills worldwide.UAE,EUROPE,ASIA,AFRICA. Our staff includes a gynecologist, registered nurse, and a counselor at your care. Our Abortion Prices are affordable to all South Africans hence preventing Unwanted Pregnancies.Deliveries are done to those who can’t come in due to work related issues at no cost. Medical Abortions What is a medical abortion? Medical abortion is when specific medication is administered to women for termination of pregnancy. We use GENUINE,SAFE,TRUSTED
  • Topics

×
×
  • Create New...