Jump to content
  • 0

[Adapt] _init_.py G+ to IL


Question

Posted

Hello,

I have installed top npc but i took it from an Gracia+ share and i was wondering how to adapt it to Interlude.

Thanks in advance!

 

#Jython-based Top PvP Manger

import sys

from java.util                                  import Iterator

from net.sf.l2j.gameserver.model.quest          import State

from net.sf.l2j.gameserver.model.quest          import QuestState

from net.sf.l2j.gameserver.model.quest.jython    import QuestJython as JQuest

from net.sf.l2j.gameserver.network.serverpackets import CreatureSay

from net.sf.l2j                                  import L2DatabaseFactory

 

# ***************************************

# Info of custom quest                  *

# ***************************************

 

qn = "7206_CustomInfo"

 

NPCS = [7206]

Precio_ID  = 57

 

QuestId    = 7206

QuestName  = "CustomInfo"

QuestDesc  = "custom"

InitialHtml = "1.htm"

 

# ***************************************

# Jython Code                          *

# ***************************************

 

 

 

class Quest (JQuest) :

 

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

 

def onTalk (self,npc,player):

return InitialHtml

 

def onEvent(self,event,st):

htmltext = event

cantidad_pago = st.getQuestItemsCount(Precio_ID)

 

# *********

# PK info *

# *********

 

if event == "1" :

total_asesinados = 0

htmltext_ini = "<html><head><title>TOP PK</title></head><body><table width=300><tr><td><font color =\"FF0000\"><center>Pos.</center></td><td><center><font color =\"FF0000\">Player name</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 15")

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 =\"FFFFFF\">"

color = 2

htmltext_info = htmltext_info + "<tr><td><center><font color =\"FFFFFF\"><center>" + posstr + "</center></td><td><center>" + color_text + char_name +"</center></td><td><center>" + char_pkkills + "</center></td></tr>"

elif color == 2:

color_text = "<font color =\"23ADC2\">"

color = 1

htmltext_info = htmltext_info + "<tr><td><center><font color =\"23ADC2\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + char_pkkills + "</center></td></tr>"

htmltext_end = "</table></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" :

total_asesinados = 0

htmltext_ini = "<html><head><title>TOP PvP</title></head><body><table width=300><tr><td><font color =\"FF0000\"><center>Pos.</center></td><td><center><font color =\"FF0000\">Player name</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 15")

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 =\"FFFFFF\">"

color = 2

htmltext_info = htmltext_info + "<tr><td><center><font color =\"FFFFFF\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + char_pkkills + "</center></td></tr>"

elif color == 2:

color_text = "<font color =\"23ADC2\">"

color = 1

htmltext_info = htmltext_info + "<tr><td><center><font color =\"23ADC2\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + char_pkkills + "</center></td></tr>"

htmltext_end = "</table></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" :

total_cantidad = 0

htmltext_ini = "<html><head><title>Top Adena</title></head><body><table width=300><tr><td><font color =\"FF0000\"><center>Pos.</center></td><td><center><font color =\"FF0000\">Player 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 =\"FFFFFF\">"

color = 2

htmltext_info = htmltext_info + "<tr><td><center><font color =\"FFFFFF\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + cantidad + "</center></td></tr>"

elif color == 2:

color_text = "<font color =\"23ADC2\">"

color = 1

htmltext_info = htmltext_info + "<tr><td><center><font color =\"23ADC2\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + cantidad + "</center></td></tr>"

htmltext_end = "</table></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

 

 

# *************

# Nobless info *

# *************

 

if event == "4" :

total_asesinados = 0

htmltext_ini = "<html><head><title>Top Nobless order by PvP</title></head><body><table width=300><tr><td><center><font color =\"FF0000\">Pos.</td></center><td><center><font color =\"FF0000\">Player name</color></center></td></tr>"

htmltext_info =""

color = 1

pos = 0

con = L2DatabaseFactory.getInstance().getConnection()

pks = con.prepareStatement("SELECT char_name,pkkills,nobless FROM characters WHERE pkkills>0 and accesslevel=0 order by pkkills desc limit 10")

rs = pks.executeQuery()

while (rs.next()) :

char_name = rs.getString("char_name")

char_pkkills = rs.getString("nobless")

pos = pos + 1

posstr = str(pos)

if color == 1:

color_text = "<font color =\"FFFFFF\">"

color = 2

htmltext_info = htmltext_info + "<tr><td><center><font color =\"FFFFFF\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td></tr>"

elif color == 2:

color_text = "<font color =\"23ADC2\">"

color = 1

htmltext_info = htmltext_info + "<tr><td><center><font color =\"23ADC2\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td></tr>"

htmltext_end = "</table></body></html>"

htmltext_pklist = htmltext_ini + htmltext_info + htmltext_end

con.close()

return htmltext_pklist

elif event == "4" 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

 

# **********

# Clan Top *

# **********

 

if event == "5" :

total_asesinados = 0

htmltext_ini = "<html><head><title>TOP Clan</title></head><body><table width=300><tr><td><font color =\"FF0000\"><center>Pos.</center></td><td><center><font color =\"FF0000\">Clan name</color></center></td><td><center>Level</center></td></tr>"

htmltext_info =""

color = 1

pos = 0

con = L2DatabaseFactory.getInstance().getConnection()

pks = con.prepareStatement("SELECT clan_name,clan_level,reputation_score FROM clan_data WHERE clan_level>0 order by clan_level desc limit 10")

rs = pks.executeQuery()

while (rs.next()) :

char_name = rs.getString("clan_name")

char_pkkills = rs.getString("clan_level")

total_asesinados = total_asesinados + int(char_pkkills)

pos = pos + 1

posstr = str(pos)

if color == 1:

color_text = "<font color =\"FFFFFF\">"

color = 2

htmltext_info = htmltext_info + "<tr><td><center><font color =\"FFFFFF\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + char_pkkills + "</center></td></tr>"

elif color == 2:

color_text = "<font color =\"23ADC2\">"

color = 1

htmltext_info = htmltext_info + "<tr><td><center><font color =\"23ADC2\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + char_pkkills + "</center></td></tr>"

htmltext_end = "</table></body></html>"

htmltext_pklist = htmltext_ini + htmltext_info + htmltext_end

con.close()

return htmltext_pklist

elif event == "5" 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

 

 

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

 

for npcId in NPCS:

    QUEST.addStartNpc(npcId)

    QUEST.addTalkId(npcId)

 

2 answers to this question

Recommended Posts

  • 0
Posted

There isnt any "scheme" about how to addapt code.

 

Depending on chronicle, server files etc.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • You think you have good “l2j” files until you try running a low-rate server.   Saying “there’s not a single L2 server out there worth mentioning” just shows you probably only know the first 10 servers on voting sites, the same voting sites that owned by them. You call the forum dead, yet you’re here discussing your next projects… From my perspective, you don’t seem ready to run any L2 server in 2025. Around 70% of players are here for RMT or ask for payment just to bring their clan, and you really think the community cares about Premium or donations or files quality? The other 20% spend their time downloading and deleting servers all day, playing for one day, then quitting for whatever random reason. And finally, the last 10% are the only ones who actually play because they genuinely like your features, your server files, and your overall project. Good luck 🙂
    • I genuinely admire your bravery - in an age where AI can whip up something better in under a minute, you still stubbornly try to sell these "projects" of yours on a forum that’s been clinically dead for years. That’s no longer determination, that’s digital archaeology. I just can’t tell whether you’re actually trying to make money, or simply testing how much we can endure before we ask an AI to generate you some actual talent.   And ofc AI will make it for free, $220 saved.
    • I’m glad I’m not the only one who appreciates Maxthor’s involvement in group gay orgies, he can’t be bothered to reply to messages, but covering the entire forum in gay lights is absolutely no issue for him. As for the project - the forum is packed with feedback from the testers, the lads are spending every spare moment fixing even the tiniest typo in an NPC’s text. I’ll share the links as soon as I get the green light. Edit: I forgot to add that the GM recruitment will begin once the links are released. Three people will be accepted, and they’ll work in a three-shift rotation so that there’s always a GM available online.
    • Added: a brand-new default dashboard template. You can now add multiple game/login server builds. Full support for running both PTS & L2J servers simultaneously, with switching between them. Payment systems: added OmegaPay and Pally (new PayPal-style API). Account history now stores everything: donations, items delivered to characters, referrals, transfers between game accounts, and coin transfers to another master account. Personal Promo Code System: you can create a promo code and assign it to a user or promoter. When donating, a player can enter this promo code to receive bonus coins, and the promo code owner also receives a bonus — all fully configurable in the admin panel.     Look demo site: demo
    • One of best project i play last few years
  • 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