Jump to content
  • 0

init_py from 50300 pk list


motili
 Share

Question

Can someone help me with this init_py file?is from the Top PvP and Pk quest and inside im have some errors and im cannot find it!Here is the code!

 

# *************************
# PKlist Online
# Por ->K<-
# Mi primer gran programa en Python, 4 de Julio del 2008
# Este Script es para mostrar Online y por orden, los PKs del server.
# El problema que viene luego es la longitud del HTML, uno demasiado grande crasheara al cliente.
# *************************

import sys
from java.util                                  import Iterator
from com.l2dot.util                             import Rnd
from com.l2dot.gameserver.model.quest           import State
from com.l2dot.gameserver.model.quest           import QuestState
from com.l2dot.gameserver.model.quest.jython    import QuestJython as JQuest
from com.l2dot.gameserver.network.serverpackets import CreatureSay
from com.l2dot                                  import L2DatabaseFactory

print "importing custom: 50300_PKlist"

# ***************************************
# Inicializacion de Variables del Quest *
# ***************************************

NPC=[50300]
Precio_ID   = 57

QuestId     = 50300
QuestName   = "PKlist"
QuestDesc   = "custom"
InitialHtml = "1.htm"

# ************************
# Creando la Clase Quest *
# ************************

class Quest (JQuest) :

def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)

# ***********************
# Si hablas con el NPC: *
# ***********************
def onTalk (self,npc,player):
	return InitialHtml
# ***********************

# *****************************************************
# Ahora gobernamos los eventos que vienen desde el HTML
# *****************************************************
def onEvent(self,event,st):
	htmltext = event
	cantidad_pago = st.getQuestItemsCount(Precio_ID)

	# *********
	# PK info *
	# *********

	if event == "1" and cantidad_pago >= 3000 :
		st.takeItems(Precio_ID,3000)
		total_asesinados = 0
		htmltext_ini = "<html><head><title>Pk Info Online</title></head><body><table width=300><tr><td><font color =\"FF00FF\">Pos.</td><td><center><font color =\"FFFF00\">*** Player ***</color></center></td><td><center>*** Kills ***</center></td></tr>"
		htmltext_info =""			
		color = 1
		pos = 0
		con = L2DatabaseFactory.getInstance().getConnection(None)
		pks = con.prepareStatement("SELECT char_name,pkkills FROM characters WHERE pkkills>0 and accesslevel=0 order by pkkills desc limit 50")
		rs = pks.executeQuery()
		while (rs.next()) :
			char_name = rs.getString("char_name")
			char_pkkills = rs.getString("pkkills")
			total_asesinados = total_asesinados + int(char_pkkills)
			pos = pos + 1
			posstr = str(pos)
			if color == 1:
				color_text = "<font color =\"00FFFF\">"
				color = 2
				htmltext_info = htmltext_info + "<tr><td><center><font color =\"FF00FF\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + char_pkkills + "</center></td></tr>"
			elif color == 2:
				color_text = "<font color =\"FF0000\">"
				color = 1
				htmltext_info = htmltext_info + "<tr><td><center><font color =\"FF00FF\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + char_pkkills + "</center></td></tr>"
		htmltext_end = "</table><center><font color=\"FFFFFF\">" + "A Total of " + str(total_asesinados) + " Pk's.</center></body></html>"
		htmltext_pklist = htmltext_ini + htmltext_info + htmltext_end
		con.close()
		return htmltext_pklist
	elif event == "1" and cantidad_pago < 3000 :
		htmltext = "<html><head><title>PK info Online</title></head><body><font color =\"FF0000\">Primero pagame...!! son 3000 adenas.</body></html>"
		return htmltext

	# **********
	# PvP info *
	# **********

	if event == "2" and cantidad_pago >= 3000 :
		st.takeItems(Precio_ID,3000)
		total_asesinados = 0
		htmltext_ini = "<html><head><title>PvP info Online</title></head><body><table width=300><tr><td><font color =\"FF00FF\">Pos.</td><td><center><font color =\"FFFF00\">*** Player ***</color></center></td><td><center>*** Kills ***</center></td></tr>"
		htmltext_info =""			
		color = 1
		pos = 0
		con = L2DatabaseFactory.getInstance().getConnection(None)
		pks = con.prepareStatement("SELECT char_name,pvpkills FROM characters WHERE pvpkills>0 and accesslevel=0 order by pvpkills desc limit 50")
		rs = pks.executeQuery()
		while (rs.next()) :
			char_name = rs.getString("char_name")
			char_pkkills = rs.getString("pvpkills")
			total_asesinados = total_asesinados + int(char_pkkills)
			pos = pos + 1
			posstr = str(pos)
			if color == 1:
				color_text = "<font color =\"00FFFF\">"
				color = 2
				htmltext_info = htmltext_info + "<tr><td><center><font color =\"FF00FF\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + char_pkkills + "</center></td></tr>"
			elif color == 2:
				color_text = "<font color =\"FF0000\">"
				color = 1
				htmltext_info = htmltext_info + "<tr><td><center><font color =\"FF00FF\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + char_pkkills + "</center></td></tr>"
		htmltext_end = "</table><center><font color=\"FFFFFF\">" + "A Total of " + str(total_asesinados) + " Kills.</center></body></html>"
		htmltext_pklist = htmltext_ini + htmltext_info + htmltext_end
		con.close()
		return htmltext_pklist
	elif event == "2" and cantidad_pago < 3000 :
		htmltext = "<html><head><title>PK info Online</title></head><body><font color =\"FF0000\">Primero pagame...!! son 3000 adenas.</body></html>"
		return htmltext

	# *************
	# Adenas info *
	# *************

	if event == "3" and cantidad_pago >= 100000 :
		st.takeItems(Precio_ID,100000)
		total_cantidad = 0
		htmltext_ini = "<html><head><title>Adena info Online</title></head><body><table width=300><tr><td><font color =\"FF00FF\">Pos.</td><td><center><font color =\"FFFF00\">*** Name ***</color></center></td><td><center>*** Adenas ***</center></td></tr>"
		htmltext_info =""			
		color = 1
		pos = 0
		con = L2DatabaseFactory.getInstance().getConnection(None)
		pks = con.prepareStatement("SELECT count,owner_id FROM items WHERE item_id=57 order by count desc limit 50")
		rs = pks.executeQuery()
		while (rs.next()) :
			cantidad = rs.getString("count")
			pj_id = rs.getString("owner_id")
			total_cantidad = total_cantidad + long(cantidad)
			pos = pos + 1
			posstr = str(pos)
			charname = con.prepareStatement("SELECT char_name FROM characters WHERE obj_Id=" + pj_id)
			rs2 = charname.executeQuery()
			while (rs2.next()) :
				char_name = rs2.getString("char_name")
			if color == 1:
				color_text = "<font color =\"00FFFF\">"
				color = 2
				htmltext_info = htmltext_info + "<tr><td><center><font color =\"FF00FF\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + cantidad + "</center></td></tr>"
			elif color == 2:
				color_text = "<font color =\"FF0000\">"
				color = 1
				htmltext_info = htmltext_info + "<tr><td><center><font color =\"FF00FF\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + cantidad + "</center></td></tr>"
		htmltext_end = "</table><center><font color=\"FFFFFF\">" + "Los TOPS suman " + str(total_cantidad) + " adenas.</center></body></html>"
		htmltext_pklist = htmltext_ini + htmltext_info + htmltext_end
		con.close()
		return htmltext_pklist
	elif event == "3" and cantidad_pago < 3000 :
		htmltext = "<html><head><title>Adenas info Online</title></head><body><font color =\"FF0000\">Primero pagame...!! son 100k adenas.</body></html>"
		return htmltext


# *************************************************
# Insertando Quest en la lista de Quest disponibles
# *************************************************

QUEST       = Quest(QuestId,str(QuestId) + "_" + QuestName,QuestDesc)


for npcId in NPC:
QUEST.addStartNpc(npcId)
QUEST.addTalkId(npcId)

 

Thx in advance!

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

I cant see any error on my notepad ++.  As i see u use l2dot pack or its a copy from l2dot pack? cuz if u are not using l2dot pack there is the problem

Link to comment
Share on other sites

  • 0

Yes!Here it is!

Aug 21, 2009 2:44:00 AM com.l2dot.gameserver.network.clientpackets.RequestBypassToServer runImpl
WARNING: Bad RequestBypassToServer: 
java.lang.NullPointerException
at com.l2dot.gameserver.model.quest.QuestState.getStateId(QuestState.java:182)
at com.l2dot.gameserver.model.quest.Quest.createQuestInDb(Quest.java:741)
at com.l2dot.gameserver.model.quest.Quest.newQuestState(Quest.java:183)
at com.l2dot.gameserver.model.actor.instance.L2NpcInstance.showQuestWindow(L2NpcInstance.java:1301)
at com.l2dot.gameserver.model.actor.instance.L2NpcInstance.onBypassFeedback(L2NpcInstance.java:939)
at com.l2dot.gameserver.network.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:136)
at com.l2dot.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:79)
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)
Aug 21, 2009 2:44:28 AM com.l2dot.gameserver.model.quest.Quest showError
WARNING: 
Traceback (innermost last):
  File "C:\server\gameserver\data\jscript\custom\50300_PKlist\__init__.py", line 65, in onEvent
TypeError: getConnection(): expected 0 args; got 1

at org.python.core.Py.TypeError(Unknown Source)
at org.python.core.PyReflectedFunction.throwError(Unknown Source)
at org.python.core.PyReflectedFunction.throwArgCountError(Unknown Source)
at org.python.core.PyReflectedFunction.throwError(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 data.jscript.custom.50300_PKlist$py.onEvent$4(C:\server\gameserver\data\jscript\custom\50300_PKlist\__init__.py:65)
at data.jscript.custom.50300_PKlist$py.call_function(C:\server\gameserver\data\jscript\custom\50300_PKlist\__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.data.jscript.custom.50300_PKlist$Quest$307.onEvent(Unknown Source)
at com.l2dot.gameserver.model.quest.Quest.onAdvEvent(Quest.java:354)
at com.l2dot.gameserver.model.quest.Quest.notifyEvent(Quest.java:306)
at com.l2dot.gameserver.model.actor.instance.L2PcInstance.processQuestEvent(L2PcInstance.java:1372)
at com.l2dot.gameserver.network.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:189)
at com.l2dot.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:79)
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)

Link to comment
Share on other sites

  • 0

i dont know l2dot source so i cant say anything you need to ask for support from the l2dot developers(if the pack is still alive ofc)

Link to comment
Share on other sites

  • 0

Ok im fix the first error the npc is working just show this in error log!

 

Aug 21, 2009 3:19:29 AM com.l2dot.gameserver.network.clientpackets.RequestBypassToServer runImpl
WARNING: Bad RequestBypassToServer: 
java.lang.NullPointerException
at com.l2dot.gameserver.model.quest.QuestState.getStateId(QuestState.java:182)
at com.l2dot.gameserver.model.quest.Quest.createQuestInDb(Quest.java:741)
at com.l2dot.gameserver.model.quest.Quest.newQuestState(Quest.java:183)
at com.l2dot.gameserver.model.actor.instance.L2NpcInstance.showQuestWindow(L2NpcInstance.java:1301)
at com.l2dot.gameserver.model.actor.instance.L2NpcInstance.onBypassFeedback(L2NpcInstance.java:939)
at com.l2dot.gameserver.network.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:136)
at com.l2dot.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:79)
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)

 

Can someone help me?Thx in advace!

Link to comment
Share on other sites

  • 0

I have same problem with l2jofficial pack.Is other error:

Error on: D:\L2jSever\datapack\gameserver\data\scripts\custom\50300_PKlist\__init__.py.error.log
Line: -1 - Column: -1

Traceback (innermost last):
 File "__init__.py", line 12, in ?
ImportError: no module named tools

Is there possible to fix this problem?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   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.

 Share



  • Posts

    • Dear friends!   Our Talking Island x3 server is up and running for 7 years. It was opened before official EU/NA Classic servers and kept growing all these years, outliving those official servers.  7 years - a long period of time, and no one but us managed to create such a long living project and connect players from all over the world. During this time we withstood a lot of difficulties, such as forced domain change, social network accounts and content bans, and many others. And here we are, still standing strong. But for a very long time, we kept being asked for a new server, a fresh start, a new journey And we feel, that now it's a time for a New Chapter of L2Classic.club story   New server Dion x3 Classic 1.5 is going Live on 14.01.2023!    How hard will it be: XP: x3 SP: x3 ADENA: x2 (amount) DROP: x1 (chance) SPOIL: x1 (chance) x1 (amount) QUEST: x2 (xp/adena) Raid Bosses: x1 (chance) Except: Queen Ant, Core, Orfen x2 (chance), Epic Jewels x1 (chance)   As our veteran players already know, we are not blindly following NCsoft updates, so there is a list of differences for Dion x3 from official servers   Full server description can be found HERE     Website: https://l2classic.club/ Forum: https://l2classic.club/forum/ Discord: https://discord.gg/yzhP2hz   Sincerely, Classic Team  
    • Hello everyone!   Account registrations are now available for everyone! We will not be deleting accounts after the Open Beta ends.  You will be able to use them on Live Server. Join our open beta which will launch today!   You can also download our Ertheia client from download section. Do not forget to join our discord, so you do not miss any news.   Best regards, L2Ertheia Team
    • Hello again! I found something that is bothering me a lot on this system. When i spawn the npc and no active winner to show his monument the heading on npc  is fine. When a winner exist and his monument spawn, heading is always to the east. i tryed to change is in the serverpacket and made it even static number to check and nothing happened. Any clue?
    • This article original appeared on MmoGah In Torchlight Infinite, there are so many options that you could feel overwhelmed to choose. To help you avoid mistakes, we shared some tips for beginners in our previous two articles. So, this is the third one. If you find it helpful, be sure to share it with your friends.     It Would Be Better If You Read Tooltips Carefully Sometimes you want to use a stick to beat enemies on the head, but you don't realize that it's a magic stick that is used to befuddle your enemies into tripping over their feet and falling off a cliff. It does not show the effects that you want enemies to be down at once because you don't read the weapon's purpose carefully and use the wrong weapon.   Although reading is boring, it's very important for providing multiplicative damage and outputting combat effectiveness. If you have checked your skills and talents, you can use what you have more efficiently.   So don't ignore information like tooltips.   It Would Be Better If You Cap All Your Resistances As Soon As Possible You often die when shooting at bosses or can't survive as you progress. This is always because you're either not building enough life or your resistances aren't capped. If you add the points of your resistance, your survival will greatly increase.   Torchlight Infinite has many resistances, such as fire, cold, lighting, and erosion. These can inspire greater gear availability in the game, especially when you beat enemies or defend territory. And they can be consumed fast when you use them.   You'll need to cap all resistances at 75 percent as soon as possible because getting high resistance for your process would be better. So, you must check your gear and fix your resistance after a big event.   It Would Be Better If You Accumulated Enough Energy Sometimes, your skills don't do as much damage as your gear support. Even if you have talents, you find them not doing anything as you expect. That's because you are lacking in energy and don't have enough support to improve your skills.   In Torchlight Infinite, there are five sections of support for each skill's improvement. You get the first section of support for free. Then on most skills, it costs 10, 15, 50, and 100 energy for other sections, respectively.   Your energy can be replenished by leveling up, progressing, and putting on your Torchlight Infinite items. If you want more energy from your gear, you'll need higher-level items, and you can roll energy via gear empowerment to make sure to get as much energy as possible for your skills to be as strong as they can be.   It Would Be Better If You Save Crafting Materials When you see dropping materials that include things like Flame Sand, you should save your Flame Sand until level 60, when you unlock the player market. Then you can use Flame Sand to buy some cheap legendaries or other items. That will boost your character beyond just crafting or enchanting your stuff at a low level.   You can do something similar with flame Elementium when you get to a higher level. Flame Elementium doesn't start dropping until you're progressing in the end game. You can often use it to go to the market and buy some legendaries that are boss drops, which might be a little bit more expensive but can be much more powerful. Some enabling build items only cost a single Flame Elementium. So Torchlight Infinite Flame Elementium is especially important.    
    • Interlude PVP server with good balance.     
  • 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