L2J Revision 4089:
L2JDP Revision 7284:
afther the 5.03.2010 core update server console started to show this error:
Code: Select all
03.05.2010 07:19:43 com.l2jserver.L2DatabaseFactory$ConnectionCloser runWARNING: Unclosed connection! Trace: sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)java.lang.RuntimeException at com.l2jserver.L2DatabaseFactory.getConnection(L2DatabaseFactory.java:223) at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.python.core.PyReflectedFunction.__call__(Unknown Source) at org.python.core.PyMethod.__call__(Unknown Source) at org.python.core.PyObject.__call__(Unknown Source) at org.python.core.PyInstance.invoke(Unknown Source) at org.python.pycode.serializable._pyx1272858857375.onAdvEvent$14(__init__.py:756) at org.python.pycode.serializable._pyx1272858857375.call_function(__init__.py) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyFunction.__call__(Unknown Source) at org.python.core.PyMethod.__call__(Unknown Source) at org.python.core.PyObject.__call__(Unknown Source) at org.python.core.PyObject._jcallexc(Unknown Source) at org.python.core.PyObject._jcall(Unknown Source) at org.python.proxies.main$Quest$415.onAdvEvent(Unknown Source) at com.l2jserver.gameserver.model.quest.Quest.notifyEvent(Quest.java:406) at com.l2jserver.gameserver.model.actor.instance.L2PcInstance.processQuestEvent(L2PcInstance.java:1717) at com.l2jserver.gameserver.network.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:218) at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:92) 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)
Code: Select all
import sysfrom java.lang import Systemfrom java.util import Iteratorfrom com.l2jserver import Configfrom com.l2jserver.gameserver.model.quest import Statefrom com.l2jserver.gameserver.model.quest import QuestStatefrom com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuestfrom com.l2jserver.gameserver.instancemanager import QuestManagerfrom com.l2jserver import L2DatabaseFactoryfrom com.l2jserver.gameserver.datatables import SkillTablefrom com.l2jserver.gameserver.datatables import ItemTablefrom com.l2jserver.gameserver.model.actor.instance import L2PcInstancefrom com.l2jserver.gameserver.model.actor.instance import L2PetInstancefrom com.l2jserver.gameserver.model.actor.instance import L2SummonInstancefrom com.l2jserver.gameserver.network.serverpackets import SetSummonRemainTimefrom com.l2jserver.gameserver.network.serverpackets import SetupGauge QUEST_ID = 555QUEST_NAME = "NPCBuffer"QUEST_DESCRIPTION = "custom"QUEST_LOADING_INFO = str(QUEST_ID)+"_"+QUEST_NAMENPC_ID = 555 TITLE_NAME = "Rin4a's Buffer"SCRIPT_RELOAD = True ENABLE_VIP_BUFFER = FalseVIP_ACCESS_LEVEL = 1 ENABLE_BUFF_SECTION = True ENABLE_SCHEME_SYSTEM = True ENABLE_HEAL = True ENABLE_BUFFS = True ENABLE_RESIST = True ENABLE_SONGS = True ENABLE_DANCES = True ENABLE_CHANTS = False ENABLE_OTHERS = True ENABLE_SPECIAL = True ENABLE_CUBIC = True ENABLE_BUFF_REMOVE = True ENABLE_BUFF_SET = TrueBUFF_WITH_KARMA = False FREE_BUFFS = False TIME_OUT = True TIME_OUT_TIME = 10 MIN_LEVEL = 20 BUFF_REMOVE_PRICE = 100000 HEAL_PRICE = 1000000 BUFF_PRICE = 100000 RESIST_PRICE = 100000 SONG_PRICE = 100000 DANCE_PRICE = 100000 CHANT_PRICE = 100000 OTHERS_PRICE = 1000000 SPECIAL_PRICE = 1000000 CUBIC_PRICE = 1000000 BUFF_SET_PRICE = 10000000 SCHEME_BUFF_PRICE = 10000000 SCHEMES_PER_PLAYER = 4 CONSUMABLE_ID = 57 MAX_SCHEME_BUFFS = Config.BUFFS_MAX_AMOUNTMAX_SCHEME_DANCES = Config.DANCES_MAX_AMOUNT def rebuildMainHtml(st) : MAIN_HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"; MESSAGE = "" bottonA="Auto Buff";bottonB="Heal Me";bottonC="Rem. Buffs";i=0;j=0;Temp="<tr><td> </td> <td> </td></tr>";TRS = Temp.split(" ") if st.getInt("Pet-On-Off") == 1: bottonA="Auto Buff Pet";bottonB="Heal My Pet";bottonC="Rem. Pet Buffs" MAIN_HTML_MESSAGE += "<button value=\"Pet Options\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " buffpet 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" else: MAIN_HTML_MESSAGE += "<button value=\"Char Options\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " buffpet 1 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" if ENABLE_BUFF_SECTION == True : if ENABLE_BUFFS == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_buffs 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_RESIST == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Resist\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_resists 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_SONGS == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Songs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_songs 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_DANCES == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Dances\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_dances 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_CHANTS == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Chants\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_chants 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_SPECIAL == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Special\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_special 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_OTHERS == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Others\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_others 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_CUBIC == True: if i>2:i=0 MESSAGE += TRS[i]+"<button value=\"Cubics\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_cubic 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_BUFF_SET == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\""+bottonA+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " castBuffSet 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_HEAL == True : if i>2:i=0 MESSAGE += TRS[i]+"<button value=\""+bottonB+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " heal 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if ENABLE_BUFF_REMOVE == True: if i>2:i=0 MESSAGE += TRS[i]+"<button value=\""+bottonC+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " removeBuffs 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1] i+=2;j+=1 if j == 1: MAIN_HTML_MESSAGE+= MESSAGE + "<br>" else: MAIN_HTML_MESSAGE+= "<table>" + MESSAGE + "</table><br>" if ENABLE_SCHEME_SYSTEM == True : MAIN_HTML_MESSAGE += generateScheme(st) if st.getPlayer().isGM() : MAIN_HTML_MESSAGE += "<br><button value=\"Manage Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect manage_buffs 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" MAIN_HTML_MESSAGE += "<br><font color=\"303030\">"+TITLE_NAME+"</font>" MAIN_HTML_MESSAGE += "</center></body></html>" return MAIN_HTML_MESSAGE def generateScheme(st) : schemeName = [] schemeId = [] HTML = "" conn=L2DatabaseFactory.getInstance().getConnection() rss = conn.prepareStatement("SELECT * FROM buffer_scheme_list WHERE player_id="+str(st.getPlayer().getObjectId())) action=rss.executeQuery() while (action.next()) : try : schemeName += [action.getString("scheme_name")] schemeId += [action.getString("id")] except : print "Query error!" try : conn.close() except : pass if len(schemeName) > 0: MESSAGE = "" i=0;j=0;Temp="<tr><td> </td> <td> </td></tr>";TRS = Temp.split(" ") while i <= len(schemeName) - 1: if j>2:j=0 MESSAGE += TRS[j]+"<button value=\""+schemeName[i]+"\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" cast "+schemeId[i]+" x x\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[j+1] i+=1;j+=2 if i == 1: HTML+= MESSAGE + "<br>" else: HTML+= "<table>" + MESSAGE + "</table><br>" if len(schemeName) < SCHEMES_PER_PLAYER : HTML += "<table><tr><td><button value=\"Create\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" create_1 x x x\" width=85 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" else : HTML += "<table width=100><tr>" if len(schemeName) > 0 : HTML += "<td><button value=\"Edit\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" edit_1 x x x\" width=85 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" HTML += "<td><button value=\"Delete\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" delete_1 x x x\" width=85 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table>" else : HTML += "</tr></table>" return HTML def reloadPanel(st) : HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>" HTML_MESSAGE += "<font color=\"303030\">"+TITLE_NAME+"</font><br>" HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>" HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>" HTML_MESSAGE += "<tr><td><br></td></tr>" HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FFFFFF\">This option can be seen by GMs only and it<br1>allow to update any changes made in the<br1>script. You can disable this option in<br1>the settings section within the Script.<br><font color=\"LEVEL\">Do you want to update the SCRIPT?</font></font></td></tr>" HTML_MESSAGE += "<tr><td></td></tr></table><br>" HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br><br>" HTML_MESSAGE += "<button value=\"Yes\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" reloadscript 1 0 0\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML_MESSAGE += "<button value=\"No\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" reloadscript 0 0 0\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" HTML_MESSAGE += "</center></body></html>" return HTML_MESSAGE def getitemname(st,itemval): conn=L2DatabaseFactory.getInstance().getConnection() itemidList = conn.prepareStatement("SELECT * FROM etcitem WHERE item_id="+str(itemval)) il=itemidList.executeQuery() val = "No Name" if il : il.next() try : val = il.getString("name") except : pass try : conn.close() except: pass return val def getBuffCount(scheme) : count = 0 conn=L2DatabaseFactory.getInstance().getConnection() rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id=\""+str(scheme)+"\"") action=rss.executeQuery() while (action.next()) : try : count += 1 except : count = 0 try : conn.close() except : pass return count def getBuffType(id) : conn=L2DatabaseFactory.getInstance().getConnection() act = conn.prepareStatement("SELECT buffType FROM buffer_buff_list WHERE buffId=? LIMIT 1") act.setInt(1, int(id)) rs=act.executeQuery() val = "none" if rs : rs.next() try : val = rs.getString("buffType") except : val = "none" try : conn.close() except: pass return val ----------------------------------------------------------------------- if event == "castBuffSet" : if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime") : if FREE_BUFFS == False : if st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_SET_PRICE : return showText(st,"Sorry","You don't have the enough items:<br>You need: <font color =\"LEVEL\">"+str(BUFF_SET_PRICE)+" "+str(getitemname(st,CONSUMABLE_ID))+"!","False",0,0) buff_sets=[]; i = 0; player_class = 3 if st.getPlayer().isMageClass() : player_class = 1 else : player_class = 0 if getpetbuff == 0 : conn=L2DatabaseFactory.getInstance().getConnection() getSimilarNameCount = conn.prepareStatement("SELECT buffId,buffLevel FROM buffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC") getSimilarNameCount.setString(1, str(player_class)) getSimilarNameCount.setString(2, "2") rss = getSimilarNameCount.executeQuery() while (rss.next()) : try : id = rss.getInt("buffId") lvl = rss.getInt("buffLevel") buff_sets += [id,lvl] except : buff_sets = [] try: conn.close() except: pass while i <= len(buff_sets)-2 : SkillTable.getInstance().getInfo(buff_sets[i],buff_sets[i+1]).getEffects(st.getPlayer(),st.getPlayer()) i += 2 else: if st.player.getPet() != None : i = 0 conn=L2DatabaseFactory.getInstance().getConnection() getSimilarNameCount = conn.prepareStatement("SELECT buffId,buffLevel FROM buffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC") getSimilarNameCount.setString(1, "0") getSimilarNameCount.setString(2, "2") rss = getSimilarNameCount.executeQuery() while (rss.next()) : try : id = rss.getInt("buffId") lvl = rss.getInt("buffLevel") buff_sets += [id,lvl] except : buff_sets = [] try: conn.close() except: pass while i <= len(buff_sets)-2 : SkillTable.getInstance().getInfo(buff_sets[i],buff_sets[i+1]).getEffects(st.getPlayer().getPet(),st.getPlayer().getPet()) i += 2 else: return showText(st,"Info","You can't use the Pet's options.<br>Summon your pet first!","False","Return","main") heal(getpetbuff) st.takeItems(CONSUMABLE_ID,BUFF_SET_PRICE) if TIME_OUT == True: addTimeout(3,TIME_OUT_TIME,600) return rebuildMainHtml(st) else : return rebuildMainHtml(st) return rebuildMainHtml(st) def onFirstTalk (self,npc,player): st = player.getQuestState(QUEST_LOADING_INFO) if not st : st = self.newQuestState(player) if player.isGM(): if SCRIPT_RELOAD == True: return reloadPanel(st) else: return rebuildMainHtml(st) elif int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime"): if ENABLE_VIP_BUFFER == False or player.getAccessLevel().getLevel() == VIP_ACCESS_LEVEL and ENABLE_VIP_BUFFER == True: if BUFF_WITH_KARMA == False and player.getKarma() > 0 : return showText(st,"Info","You have too much <font color=\"FF0000\">karma!</font><br>Come back,<br>when you don't have any karma!","False","Return","main") elif st.player.getLevel() < MIN_LEVEL : return showText(st,"Info","Your level is too low!<br>You have to be at least level <font color\"LEVEL\">"+str(MIN_LEVEL)+"</font>,<br>to use my services!","False","Return","main") elif st.player.getPvpFlag() > 0 : return showText(st,"Info","You can't buff while you are <font color=\"800080\">flagged!</font><br>Wait some time and try again!","False","Return","main") elif st.player.isInCombat() : return showText(st,"Info","You can't buff while you are attacking!<br>Stop your fight and try again!","False","Return","main") else: return rebuildMainHtml(st) else: return showText(st,"Sorry","This buffer is only for VIP's!<br>Contact the administrator for more info!","False","Return","main") else: return showText(st,"Sorry","You have to wait a while!<br>if you wish to use my services!","False","Return","main") QUEST = Quest(QUEST_ID,QUEST_LOADING_INFO,QUEST_DESCRIPTION)QUEST.addStartNpc(NPC_ID)QUEST.addFirstTalkId(NPC_ID)QUEST.addTalkId(NPC_ID)