Jump to content
  • 0

init_py from 50300 pk list


Question

Posted

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!

10 answers to this question

Recommended Posts

  • 0
Posted

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)

  • 0
Posted

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!

  • 0
Posted

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?

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



×
×
  • Create New...