Jump to content
  • 0

[Request]Import error py [Solved]


Question

Posted

Hello to all, well I trying inject this in my server, but when load consoles give error saying it.

 

Error on: C:\Users\joel\Desktop\Copia de L2DoMMo\GameServer\Data\scripts\custom\80300_rank\__init__.py.error.log
Line: -1 - Column: -1

Traceback (innermost last):
  File "__init__.py", line 7, in ?
ImportError: cannot import name L2DatabaseFactory

 

#Jython-based miss queen implementation v0.1
#written by DrLecter, based in Eduu, biti and Newbie contributions.

import sys
from com.l2jinn.gameserver.model.quest import State
from com.l2jinn.gameserver.model.quest import QuestState
from com.l2jinn.gameserver.model.quest.jython import QuestJython as JQuest

print "importing custom: NPC Ranking By NeferTiti"

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

NPC=[80300]
Precio_ID   = 57

QuestId     = 80300
QuestName   = "rank"
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()
		pks = con.prepareStatement("SELECT char_name,pkkills FROM characters WHERE pkkills>0 and accesslevel=0 order by pkkills desc limit 30")
		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()
		pks = con.prepareStatement("SELECT char_name,pvpkills FROM characters WHERE pvpkills>0 and accesslevel=0 order by pvpkills desc limit 30")
		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()
		pks = con.prepareStatement("SELECT count,owner_id FROM items WHERE item_id=57 order by count desc limit 20")
		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 charId=" + 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)

5 answers to this question

Recommended Posts

  • 0
Posted

You didn't import l2databasefactory at the begin.

 

Find where is the path of l2databasefactory from your sources and add it.

yes I do, here I post original code of where I get, but anyway adding l2databasefactory still same x_X anyway thanks for your answer.
  • 0
Posted

yes I do, here I post original code of where I get, but anyway adding l2databasefactory still same x_X anyway thanks for your answer.

 

It would be nice if you could give us the import code you are using.. and please remember in some packs folders are different, so maybe this is the problem... probably you got source so you could check it.

Guest
This topic is now closed to further replies.


  • Posts

    • ➡ Discount for your purchase: APRIL (10% discount) ➡ Our Online Shop: https://socnet.store ✅ ➡ Our SMM-Boosting Panel: https://socnet.pro ✅ ➡ Telegram Shop Bot: https://socnet.shop ✅ ➡ Telegram Support: https://t.me/solomon_bog ✅ ➡ Telegram Channel: https://t.me/accsforyou_shop ✅ ➡ Discord Support: @AllSocialNetworksShop ✅ ➡ Discord Server: https://discord.gg/y9AStFFsrh ✅ ➡ WhatsApp Support: https://wa.me/79051904467✅ ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n ✅ ➡ Email Support: solomonbog@socnet.store ✅
    • ➡ Discount for your purchase: APRIL (10% discount) ➡ Our Online Shop: https://socnet.store ✅ ➡ Our SMM-Boosting Panel: https://socnet.pro ✅ ➡ Telegram Shop Bot: https://socnet.shop ✅ ➡ Telegram Support: https://t.me/solomon_bog ✅ ➡ Telegram Channel: https://t.me/accsforyou_shop ✅ ➡ Discord Support: @AllSocialNetworksShop ✅ ➡ Discord Server: https://discord.gg/y9AStFFsrh ✅ ➡ WhatsApp Support: https://wa.me/79051904467✅ ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n ✅ ➡ Email Support: solomonbog@socnet.store ✅
    • Hey. I've been looking all over the internet about this but not being able to find anything about it. I have edited systemmsg using MSG editor changing colors etc. But now I want to change and add some of the sounds as well. But I need the sound IDs for each audiofile and I dont know how to find them. Ive found all the audio files but I cant use the filename as someone said in a thread here, it only seem to take numbers. I have looked into every guide about systemmsg on this website and no one mention anything about the sound, just that its possible to add sound but nothing more. So, do anyone know how to find these sound IDs? Preferably together with the soundname of the audio file that it plays so I know which ID to use for each soundfile. Thanks in advance!
    • We are certainly not an ambulance, but we will definitely cure you of blacklists and empty pockets. Live freely with SX! Each of you will receive a trial version of SX to familiarize yourself with the product, all you have to do is post in this thread
  • Topics

×
×
  • Create New...