Jump to content
  • 0

help npc subclass acumulative by Allen


Question

Posted

hi! i loaded the npc in my pack frozen rev 1132 and the NPC is working, but I have a problem. When player takes stucksub, he don't get subclass, but access player gets subclass. Please for reply. Sorry for my english.

 

this npc 

 

this is the code of .py

import sys
from java.lang import System
from java.util import Iterator
from com.l2jfrozen.util.database import L2DatabaseFactory
from com.l2jfrozen.gameserver.model.quest import State
from com.l2jfrozen.gameserver.model.quest import QuestState
from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jfrozen.gameserver.network.serverpackets import CharInfo
from com.l2jfrozen.gameserver.network.serverpackets import UserInfo
from com.l2jfrozen.gameserver.network.serverpackets import SetupGauge
from com.l2jfrozen.gameserver.model.base import ClassId
from com.l2jfrozen.gameserver.managers import QuestManager
from com.l2jfrozen.gameserver.model.actor.instance import L2PcInstance
from com.l2jfrozen.gameserver.datatables import SkillTable
from com.l2jfrozen.gameserver.datatables.sql import SkillTreeTable
from com.l2jfrozen.gameserver.model import L2Skill

NPC         = [8000]
QuestId     = 855
QuestName   = "SubclassNpc"
QuestDesc   = "custom"
QUEST_INFO = str(QuestId)+"_"+QuestName

print "INFO Loaded ClassMaster NPC"

#-------------------------------------------------------------------------------------------------------------------------------------
# SETTINGS
#-------------------------------------------------------------------------------------------------------------------------------------

#For more than 3 subclasses, you must increase the variable number into the SQL and add to the database. 
#inside the sql you will find some variables named SubclassidX. Just change the "X" increasing the number. 
#This value shouldn't be changed if you don't want to increase the subclasses number beyond 3. 
#Increase or decrease the "maxsubsindb" value without make these changes, will cause errors. Be carefull!.
maxsubsindb = 1

#True, allows reloading the configuration script from the game, without restarting the server (for GMs only). False, disables it.
ShowReloadScriptPanel = True

# Subclasses number that can be added. Must be less than or equal to "maxsubsindb".
SubsNumber = 1

# True, allows add stackable subclasses in every original game subclass (Mainclass and every retails).
# False, allows add stackable subclasses in only one original game subclass
AllowMultiSubs = False

# True, allows any stackable subclass. False, allows add your own race's subclasses only.
AllowAllSubs = True

#This option work if "AllowAllSubs = False", Also you need to be using a original game subclass (Retail) to get available this.
#True, allow add a subclass with the same main class's race. False, allow add a subclass with the same Retail's race.
AllowMutantRetail = True

#The next two options work if "AllowAllSubs = True" only.
#True, allows everybody add Kamael subclass. False otherwise.
AllowKamaelSubs = False

#True, allows Kamaels add any subclass. False, allows Kamaels to add their own race only.
AllowAllSubsToKamael = False

#True, allows delete the main class or any subclass added. False, allow to delete added subclasses only. Default: False
AllowDelMainClass = False

# Minimum Level to add a subclass. Default: 76
MinLevel = 76

#True, allows add subsclasses if the character is a Noblesse only. False, otherwise. Default: False
AllowOnlyNobles = True

#True, allow to add subclass or any other actions if you have the required items only. False, otherwise
ReqItems = True

#Required Item to switch between the subclasses. Default: 57 (Adena)
#Required items number.
Item1_Req = 57
Item1_Num = 1000000

#Required Item to add a subclass.
#Required items number.
Item2_Req = 9997
Item2_Num = 3

#Required Item to delete subclasses.
#Required items number.
Item3_Req = 57
Item3_Num = 50000000

# True: Change level after add a subclass
# False: Not to change level after add a subclass. Default: True
DecLevel= False

# True:  HTML will show 3rd Class trasfer to choose, also it disallow add subclasses if the characters haven't added 3rd job.
# False: HTML Will show 2nd Class trasfer to choose, also it disallow add subclasses if the characters haven't added 2nd or 3rd job.
AllowThirdJob = True

#Level at which the character will be changed after add a subclass. Default: 40
NewLevel= 40

# True: The user must wait a while before take any action. Default: True
# False: The user can do any action without time constraints. Not recommended
Block = True

#Blocking time in seconds before take any action.
BlockTime = 20

#-------------------------------------------------------------------------------------------------------------------------------------

def MainHtml(st) : 
	xsubsamount=getsubsammount(st)
	if xsubsamount >= 0 :
       		HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
		HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font>"
		HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
		HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
		HTML_MESSAGE += "<tr><td></td></tr>"
		HTML_MESSAGE += "<tr><td align=\"left\"><font color=\"0088EE\">   Antes de tomar qualquer atitude, certifique-se</font></td></tr>"
		HTML_MESSAGE += "<tr><td align=\"left\"><font color=\"0088EE\">   esta usando a classe principal ou o bom</font></td></tr>"
		HTML_MESSAGE += "<tr><td align=\"left\"><font color=\"0088EE\">   Subclasse, que solicitou as alteracoes.</font></td></tr>"
		if ReqItems == True:
			HTML_MESSAGE += "<tr><td align=\"left\"><font color=\"0088EE\">   Besides you need the required items.</font></td></tr>"
			HTML_MESSAGE += "<tr><td><br></td></tr>"
			if xsubsamount < SubsNumber and Item2_Num >= 1: HTML_MESSAGE += "<tr><td align=\"left\"><font color=\"0088EE\">          Choose Sub: <font color=\"FFFF00\">"+str(Item2_Num)+" "+str(getitemname(st,Item2_Req))+"</font></font></td></tr>"
			if Item3_Num >= 1: HTML_MESSAGE += "<tr><td align=\"left\"><font color=\"0088EE\">          Deletar Sub:  <font color=\"FFFF00\">"+str(Item3_Num)+" "+str(getitemname(st,Item3_Req))+"</font></font></td></tr>"
			if Item1_Num >= 1: HTML_MESSAGE += "<tr><td align=\"left\"><font color=\"0088EE\">          Trocar Sub:  <font color=\"FFFF00\">"+str(Item1_Num)+" "+str(getitemname(st,Item1_Req))+"</font></font></td></tr>"
		HTML_MESSAGE += "<tr><td></td></tr></table><br>"
		HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
		HTML_MESSAGE += "<tr><td width=90 align=\"center\"><table width=90 border=0 bgcolor=444444><tr><td width=90 align=\"center\"><table width=85 border=0 bgcolor=444444>"
		if xsubsamount < SubsNumber :
			HTML_MESSAGE += "<tr><td><button value=\"Choose Sub\" action=\"bypass -h Quest " +QUEST_INFO + " gethtml 1\" width=80 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><br1>"
		HTML_MESSAGE += "<tr><td><button value=\"Delete Sub\" action=\"bypass -h Quest " +QUEST_INFO + " gethtml 3\" width=80 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><br1>"
		HTML_MESSAGE += "<tr><td><button value=\"Switch Sub\" action=\"bypass -h Quest " +QUEST_INFO + " gethtml 2\" width=80 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><br1>"
		HTML_MESSAGE += "</table></td></tr></table></td></tr>"
		HTML_MESSAGE += "</center></body></html>"
		return HTML_MESSAGE
	else:
		if st.getQuestItemsCount(Item2_Req) < Item2_Num and ReqItems == True: return comunerrors(st,"0")
		if getVarcharacters(st,"race") == "5" and AllowAllSubsToKamael == False : return MainHtmlIV(st,"5")
		if AllowAllSubs == False : 
			if AllowMutantRetail == False and st.player.isSubClassActive(): return MainHtmlIV(st,getclassname(st,str(st.player.getClassId().getId()),"RaceId"))
			else: return MainHtmlIV(st,getVarcharacters(st,"race"))
		else: return MainHtmlI(st)

def MainHtmlI(st) : 
       	HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
	HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font>"
	HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
	HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
	HTML_MESSAGE += "<tr><td></td></tr>"
	HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">Choose a Race</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 += "<tr><td width=110 align=\"center\"><table width=110 border=0 bgcolor=444444><tr><td width=110 align=\"center\"><table width=105 border=0 bgcolor=444444>"
	HTML_MESSAGE += "<tr><td><button value=\"Human\" action=\"bypass -h Quest " +QUEST_INFO + " escraza 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><br>"
	HTML_MESSAGE += "<tr><td><button value=\"Elf\" action=\"bypass -h Quest " +QUEST_INFO + " escraza 1\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><br>"
	HTML_MESSAGE += "<tr><td><button value=\"Dark Elf\" action=\"bypass -h Quest " +QUEST_INFO + " escraza 2\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><br>"
	HTML_MESSAGE += "<tr><td><button value=\"Orc\" action=\"bypass -h Quest " +QUEST_INFO + " escraza 3\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><br>"
	HTML_MESSAGE += "<tr><td><button value=\"Dwarf\" action=\"bypass -h Quest " +QUEST_INFO + " escraza 4\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><br>"
	if AllowKamaelSubs == True or getVarcharacters(st,"race") == "5":
		HTML_MESSAGE += "<tr><td><button value=\"Kamael\" action=\"bypass -h Quest " +QUEST_INFO + " escraza 5\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><br>"
	HTML_MESSAGE += "</table></td></tr></table></td></tr>"
	HTML_MESSAGE += "</center></body></html>"
	return HTML_MESSAGE

def MainHtmlII(st) : 
       	HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
	HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font>"
	HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
	HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
	HTML_MESSAGE += "<tr><td></td></tr>"
	HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">Choose a subclass to Switch</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 += "<tr><td width=140 align=\"center\"><table width=140 border=0 bgcolor=444444><tr><td width=140 align=\"center\"><table width=135 border=0 bgcolor=444444>"
	temp = getVar(st,"currentsub"); j=-1
	for i in range(maxsubsindb + 1):
		var = getVar(st,"subclassid"+str(i))
		if int(var) >= 0 and int(var) <= 136: 
			j+=1
			if temp != str(i) and SubsNumber >= j:
				HTML_MESSAGE += "<tr><td><button value=\""+getclassname(st,var,"ClassName")+"\" action=\"bypass -h Quest " +QUEST_INFO + " camb "+str(i)+"\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><br>"
	HTML_MESSAGE += "</table></td></tr></table></td></tr>"
	HTML_MESSAGE += "</center></body></html>"
	return HTML_MESSAGE

def MainHtmlIII(st) : 
       	HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
	HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font>"
	HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
	HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
	HTML_MESSAGE += "<tr><td></td></tr>"
	HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">Choose the class you want to delete</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 += "<tr><td width=140 align=\"center\"><table width=140 border=0 bgcolor=444444><tr><td width=130 align=\"center\"><table width=135 border=0 bgcolor=444444>"
	j=-1
	for i in range(maxsubsindb + 1):
		var = getVar(st,"subclassid"+str(i))
		if int(var) >= 0 and int(var) <= 136: 
			if i == 0 and AllowDelMainClass == False: pass
			else:
				j+=1
				if SubsNumber >= j:
					HTML_MESSAGE += "<tr><td><button value=\""+getclassname(st,var,"ClassName")+"\" action=\"bypass -h Quest " +QUEST_INFO + " confirm "+str(i)+"\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><br>"
	HTML_MESSAGE += "</table></td></tr></table></td></tr>"
	HTML_MESSAGE += "</center></body></html>"
	return HTML_MESSAGE

def MainHtmlIV(st,case) : 
       	HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
	HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font>"
	HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
	HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
	HTML_MESSAGE += "<tr><td></td></tr>"
	HTML_MESSAGE += generateRace(st,case) 
	HTML_MESSAGE += "</center></body></html>"
	return HTML_MESSAGE

def MainHtmlV(st) :
	HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
	HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font><br>"
	HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
	HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"LEVEL\">Confirmation</font></td></tr></table><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=\"FF0000\">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_INFO+" reloadscript 1\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
	HTML_MESSAGE += "<button value=\"No\" action=\"bypass -h Quest "+QUEST_INFO+" reloadscript 0\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"				
	HTML_MESSAGE += "</center></body></html>"
	return HTML_MESSAGE

def generateRace(st,raceclass) : 
	if raceclass == "0": HTML = "<tr><td align=\"center\"><font color=\"0088EE\">HUMAN</font></td></tr>"
	if raceclass == "1": HTML = "<tr><td align=\"center\"><font color=\"0088EE\">ELF</font></td></tr>"
	if raceclass == "2": HTML = "<tr><td align=\"center\"><font color=\"0088EE\">DARK ELF</font></td></tr>"
	if raceclass == "3": HTML = "<tr><td align=\"center\"><font color=\"0088EE\">ORC</font></td></tr>"
	if raceclass == "4": HTML = "<tr><td align=\"center\"><font color=\"0088EE\">DWARF</font></td></tr>"
	if raceclass == "5": HTML = "<tr><td align=\"center\"><font color=\"0088EE\">KAMAEL</font></td></tr>"
	HTML += "<tr><td></td></tr></table><br><img src=\"L2UI.SquareGray\" width=250 height=1><br>"
	if raceclass == "5": HTML += "<tr><td align=\"center\"><font color=\"0088EE\">Man                      Woman</font></td></tr>"
	elif raceclass == "4": HTML += "<tr><td align=\"center\"><font color=\"0088EE\">Figther</font></td></tr>"
	else: HTML += "<tr><td align=\"center\"><font color=\"0088EE\">Figther                       Mage</font></td></tr>"
	HTML += "<tr><td width=250 align=\"center\"><table width=240 border=0 bgcolor=444444><tr><td width=240 align=\"center\"><table width=235 border=0 bgcolor=444444><tr>"
	
	if raceclass == "0":
            	HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"92"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 92\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"98"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 98\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
                HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"93"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 93\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"97"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 97\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
                HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"88"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 88\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"96"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 96\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
                HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"89"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 89\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"95"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 95\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
                HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"90"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 90\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"94"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 94\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
               	HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"91"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 91\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
	if raceclass == "1":
            	HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"102"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 102\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"105"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 105\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
                HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"101"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 101\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"103"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 103\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
                HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"100"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 100\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"104"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 104\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
                HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"99"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 99\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
	if raceclass == "2":
            	HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"109"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 109\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"112"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 112\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
                HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"108"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 108\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"110"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 110\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
                HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"107"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 107\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"111"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 111\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
                HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"106"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 106\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
	if raceclass == "3":
            	HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"114"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 114\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"116"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 116\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
                HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"113"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 113\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"115"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 115\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
	if raceclass == "4":
            	HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"118"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 118\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"117"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 117\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
	if raceclass == "5":
            	HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"131"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 131\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"134"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 134\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
                HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"132"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 132\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
                HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"133"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 133\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
                HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"136"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 136\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
	HTML += "</table></td></tr></table></td></tr>"
	return HTML

def Confirmation(st,case,case1,case2):
	HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
	HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font><br>"
	HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
	HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"LEVEL\">Confirmation</font></td></tr></table><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><br></td></tr>"
	if int(case) == 1 :
		HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">Do you really want to add the<br1><font color=\"FFFF00\">"+getclassname(st,case1,"ClassName")+"</font>  subclass?</td></tr>"
	if int(case) == 3 :
		HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">Do you really want to delete the<br1><font color=\"FFFF00\">"+getclassname(st,getVar(st,"subclassid"+case2),"ClassName")+"</font> subclass?</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_INFO+" "+case1+" "+case2+"\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
	HTML_MESSAGE += "<button value=\"No\" action=\"bypass -h Quest "+QUEST_INFO+" gethtml "+case+"\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"				
	HTML_MESSAGE += "</center></body></html>"
	return HTML_MESSAGE

def complete(st) : 
       	HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
	HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font>"
	HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
	HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
	HTML_MESSAGE += "<tr><td><br><br></td></tr>"
	HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">Parabens</font></td></tr>"
	HTML_MESSAGE += "<tr><td></td></tr>"
	HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">Classe alterada com sucesso</font></td></tr>"
	HTML_MESSAGE += "<tr><td><br><br></td></tr></table><br>"
	HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
	HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0000FF\">Para completar sua Class<br1>voce tem que dar RESTART no jogo.</font></td></tr></table><br>"
	HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1>"
	HTML_MESSAGE += "</center></body></html>"
	if getblocktime(st) == True : pass
	return HTML_MESSAGE

def errasecomplete(st) : 
       	HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
	HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font>"
	HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
	HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
	HTML_MESSAGE += "<tr><td><br><br></td></tr>"
	HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">A classe que você escolheu foi Excluida</font></td></tr>"
	HTML_MESSAGE += "<tr><td><br><br></td></tr></table><br>"
	HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
	HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"00FF00\">É aconselhável reiniciar o jogo</font></td></tr></table><br>"
	HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1>"
	HTML_MESSAGE += "</center></body></html>"
	if getblocktime(st) == True : pass
	return HTML_MESSAGE

def errordeclasse(st,case,case2) : 
       	HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
	HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font><br>"
	HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
	HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF5500\">Error</font></td></tr></table><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><br></td></tr>"
	if int(case) >= 88 :
		HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">You can't add <font color=\"FFFF00\">"+getclassname(st,case2,"ClassName")+"</font> subclass.<br1>Talk to a Grand Master and switch<br1>to the proper class first.</td></tr>"
	else:
		HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">You can't "+case2+" <font color=\"FFFF00\">"+getclassname(st,getVar(st,"subclassid"+case),"ClassName")+"</font><br1>subclass. Talk to a Grand Master and<br1>switch to the proper class first.</td></tr>"
	HTML_MESSAGE += "<tr><td><br><br></td></tr></table><br>"
	HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1>"
	HTML_MESSAGE += "</center></body></html>"
	if getblocktime(st) == True : pass
	return HTML_MESSAGE

def errordeduplicado(st,numero) : 
       	HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
	HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font><br>"
	HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
	HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF5500\">Error</font></td></tr></table><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><br></td></tr>"
	HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">You can't add <font color=\"FFFF00\">"+getclassname(st,numero,"ClassName")+"</font><br1>subclass. You already have this class.</td></tr>"
	HTML_MESSAGE += "<tr><td><br><br></td></tr></table><br>"
	HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1>"
	HTML_MESSAGE += "</center></body></html>"
	if getblocktime(st) == True : pass
	return HTML_MESSAGE

def comunerrors(st,case) : 
       	HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
	HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font><br>"
	HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
	HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF5500\">Error</font></td></tr></table><br>"
	HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=220 height=1><br>"
	HTML_MESSAGE += "<table width=220 border=0 bgcolor=444444>"
	HTML_MESSAGE += "<tr><td><br><br></td></tr>"
	if case == "0": HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">Voce nao tem os itens necessarios<br1>Consiga os Itens. e volte aqui novamente<br1>Este item : <font color=\"FFFF00\">"+str(Item2_Num)+" "+str(getitemname(st,Item2_Req))+".</font></td></tr>"
	if case == "1": HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">Você não tem os itens necessarios.<br1>You need <font color=\"FFFF00\">"+str(Item1_Num)+" "+str(getitemname(st,Item1_Req))+"</font></td></tr>"
	if case == "2": HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">Você não tem os itens necessarios<br1>You need <font color=\"FFFF00\">"+str(Item2_Num)+" "+str(getitemname(st,Item2_Req))+"</font></td></tr>"
	if case == "3": HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">Você não tem os itens necessarios<br1>You need <font color=\"FFFF00\">"+str(Item3_Num)+" "+str(getitemname(st,Item3_Req))+"</font></td></tr>"
	if case == "4": HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">You aren't eligible to add a<br1>subclass at this time.<br1>Your level must have <font color=\"FFFF00\">"+str(MinLevel)+" or above.</font></td></tr>"
	if case == "5": 
		if AllowThirdJob == True: HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">You aren't eligible to do any action<br1>at this time. Your current ocupation<br1>must have <font color=\"FFFF00\">3rd Job</font></td></tr>"
		else: HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">You aren't eligible to do any action<br1>at this time. Your current ocupation<br1>must be <font color=\"FFFF00\">2nd or 3rd Job</font></td></tr>"
	if case == "6": HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">You aren't eligible to add a<br1>subclass at this time.<br1>You must be a <font color=\"FFFF00\">Noblesse</font></td></tr>"
	HTML_MESSAGE += "<tr><td><br><br></td></tr></table><br>"
	HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=220 height=1>"
	HTML_MESSAGE += "</center></body></html>"
	if getblocktime(st) == True : pass
	return HTML_MESSAGE

def ReloadConfig(st) :
	try:
		if QuestManager.getInstance().reload(QuestId): st.player.sendMessage("The script and settings have been reloaded successfully.")
		else: st.player.sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server")
	except: st.player.sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server")
	return MainHtml(st)

def getblocktime(st):
	if Block == True and not st.player.isGM() :
		endtime = int(System.currentTimeMillis()/1000) + BlockTime
		st.set("blockUntilTime",str(endtime))
		st.getPlayer().sendPacket(SetupGauge(3, BlockTime * 1000 + 300))
	val = True
	return val

def getVar(st,const):
	conn=L2DatabaseFactory.getInstance().getConnection()
	act = conn.prepareStatement("SELECT * FROM subclass_list WHERE player_id="+getmultisubs(st))
	rs=act.executeQuery()
	val = "-1"
	if rs :
		rs.next()
		try :
			val = rs.getString(const)
			conn.close()					
		except :
			try : conn.close()
			except: pass
	return val

def getsubsammount(st):
	j=-1
	for i in range(maxsubsindb + 1):
		var = getVar(st,"subclassid"+str(i))
		if int(var) >= 0 and int(var) <= 136: 
			j+=1
	return j

def getVarcharacters(st,const):
	conn=L2DatabaseFactory.getInstance().getConnection()
	act = conn.prepareStatement("SELECT * FROM characters WHERE obj_Id="+str(st.getPlayer().getObjectId()))
	rs=act.executeQuery()
	val = "0"
	if rs :
		rs.next()
		try :
			val = rs.getString(const)
			conn.close()					
		except :
			try : conn.close()
			except: pass
	return val

def getVarcharactersubs(st):
	conn=L2DatabaseFactory.getInstance().getConnection()
	act = conn.prepareStatement("SELECT * FROM subclass_list WHERE player_id="+getmultisubs(st))
	rs=act.executeQuery()
	val = ""
	if rs :
		rs.next()
		for i in range(maxsubsindb + 1):
			try : val += rs.getString("subclassid"+str(i)) + " "				
			except : val += str(st.player.getClassId().getId()) + " "	
	try : conn.close()
	except: pass
	val+= "-1"
	return val

def getclassname(st,case1,case2):
	conn=L2DatabaseFactory.getInstance().getConnection()
	act = conn.prepareStatement("SELECT * FROM char_templates WHERE ClassId="+case1)
	rs=act.executeQuery()
	if rs :
		rs.next()
		try :
			val = rs.getString(case2)
			conn.close()					
		except :
			val = "0"
			try : conn.close()
			except: pass
	else : val = "0"
	return val

def getitemname(st,itemval):
	conn=L2DatabaseFactory.getInstance().getConnection()
	itemidList = conn.prepareStatement("SELECT * FROM custom_etcitem WHERE item_id="+str(itemval))
	il=itemidList.executeQuery()
	if il :
		il.next()
		try :
			val = il.getString("name")
			conn.close()					
		except :
			val = "0"
			try : conn.close()
			except: pass
	else : val = "0"
	return val

def getparentclass(st,case):
	val=case
	if AllowThirdJob == False: 
		conn=L2DatabaseFactory.getInstance().getConnection()
		parentid = conn.prepareStatement("SELECT * FROM class_list WHERE id = \""+case+"\"")
		pi=parentid.executeQuery()
		if pi :
			pi.next()
			try : val = pi.getString("parent_id")				
			except : pass
		try : conn.close()
		except: pass
	return val

def getmaxskilllevel(st,case):
	val= 0
	com=L2DatabaseFactory.getInstance().getConnection()		
	lvlskillid = com.prepareStatement("SELECT * FROM skill_trees WHERE skill_id = \""+case+"\" AND min_level <= \"85\" ORDER BY level DESC LIMIT 1")
	lvl=lvlskillid.executeQuery()
	if lvl :
		lvl.next()
		try :
			val = lvl.getInt("level")
			com.close()					
		except :
			try : com.close()
			except: pass
	return val

def getmultisubs(st):
	val= str(st.getPlayer().getObjectId()) + " LIMIT 1"
	if AllowMultiSubs == True:
		val= str(st.getPlayer().getObjectId()) +" AND sub_index=" + str(st.player.getClassIndex()) +" LIMIT 1"
	return val

def getmaster(st):
	xi="class";xe="l";xf="e";xg="n";xa="B";xb="y";xc=" ";xd="A";xk="ter";xh="Sub";xj="Mas";val=xh+xi+xc+xj+xk+xc+xa+xb+xc+xd+xe+xe+xf+xg
	#val="Change Title here :P"
	return val

def resetskills(st):
	parametros = "\"-1\""; j=-1
	subs=getVarcharactersubs(st)
	SubSplit = subs.split(" ")
	for k in range(maxsubsindb + 1):
		conn=L2DatabaseFactory.getInstance().getConnection()
		if int(SubSplit[int(k)]) >= 0 and int(SubSplit[int(k)]) <= 136: j+=1
		if int(SubSplit[int(k)]) >= 0 and int(SubSplit[int(k)]) <= 136 and SubsNumber >= j:
			xclassid = int(SubSplit[int(k)])
			skillidList = conn.prepareStatement("SELECT * FROM class_list WHERE id = \""+str(xclassid)+"\"")
			sil=skillidList.executeQuery()
			while (sil.next()) :
				try :
					parametros+=",\"" +str(xclassid)+ "\""
					xclassid = sil.getInt("parent_id")
					skillidList = conn.prepareStatement("SELECT * FROM class_list WHERE id = \""+str(xclassid)+"\"")
					sil=skillidList.executeQuery()
				except : pass
			try : conn.close() 
			except : pass	
	conn=L2DatabaseFactory.getInstance().getConnection()		
	listskillid = conn.prepareStatement("SELECT * FROM skill_trees WHERE class_id IN ("+parametros+") AND min_level <= \"85\" ORDER BY skill_id DESC, level DESC")
	lis=listskillid.executeQuery()
	xskill = 0; cskill = 0; i=0 
	availableSkillsB = ""
	while (lis.next()) :
		try :
			xskill = lis.getInt("skill_id")
			if xskill != cskill :
				xlevel = lis.getInt("level")
				cskill = xskill
				i=i+1
				availableSkillsB += str(xskill)+"_"+str(xlevel)+" "
		except : pass

	skills_exceptions = conn.prepareStatement("SELECT * FROM subclass_skill_exceptions WHERE class_id IN ("+parametros+") ORDER BY skill_id DESC, level DESC")
	se=skills_exceptions.executeQuery()
	while (se.next()) :
		try :
			xskill = se.getInt("skill_id")
			if xskill != cskill :
				xlevel = se.getInt("level")
				cskill = xskill
				i=i+1
				availableSkillsB += str(xskill)+"_"+str(xlevel)+" "
		except : pass

	availableSkillsB+= "0_0"
	xvar="AND skill_id NOT BETWEEN \"1312\" AND \"1315\" AND skill_id NOT BETWEEN \"1368\" AND \"1372\""
	if st.player.isGM(): xvar+=" AND skill_id NOT BETWEEN \"7029\" AND \"7064\""
	listallskill = conn.prepareStatement("SELECT * FROM character_skills WHERE char_obj_Id =\""+str(st.player.getObjectId())+"\" AND class_index =\""+str(st.player.getClassIndex())+"\" "+xvar+"")
	las=listallskill.executeQuery()
	availableSkillsA = []
	while (las.next()) :
		try :
			xskill = las.getInt("skill_id")
			xlevel = las.getInt("skill_level")
			availableSkillsA += [str(xskill)+"_"+str(xlevel)]
		except : pass
	try : conn.close() 
	except : pass
	try:
		skillSplit = availableSkillsB.split(" ")
		for avSkillsA in availableSkillsA :
			j=0; temp=0
			while j <= i:
				j=j+1
				parametro = skillSplit[j-1].replace("_"," ")
				skillSplitB = parametro.split(" ")
				avSkillsA = avSkillsA.replace("_"," ")
				skillSplitA = avSkillsA.split(" ")
				if int(skillSplitB[0]) == int(skillSplitA[0]):
					temp=1
					if  int(skillSplitA[1]) < 100 : 
						if int(skillSplitB[1]) < int(skillSplitA[1]): 
							re = SkillTable.getInstance().getInfo(int(skillSplitA[0]), int(skillSplitA[1]))
							st.player.removeSkill(re)
							sk = SkillTable.getInstance().getInfo(int(skillSplitB[0]), int(skillSplitB[1]))
							st.player.addSkill(sk, True)
							st.player.sendMessage("You got fixed "+sk.getName()+" Skill.")
					else:
						if int(skillSplitB[1]) < getmaxskilllevel(st,skillSplitB[0]): 
							re = SkillTable.getInstance().getInfo(int(skillSplitA[0]), int(skillSplitA[1]))
							st.player.removeSkill(re)
							sk = SkillTable.getInstance().getInfo(int(skillSplitB[0]), int(skillSplitB[1]))
							st.player.addSkill(sk, True)
							st.player.sendMessage("You got fixed "+sk.getName()+" Skill.")
			if temp == 0 :
				sk = SkillTable.getInstance().getInfo(int(skillSplitA[0]), int(skillSplitA[1]))
				st.player.removeSkill(sk)
				st.player.sendMessage("You got removed "+sk.getName()+" Skill.")
	except : st.player.sendMessage("You dont have skills to remove")
	st.player.sendSkillList()
	if st.player.isNoble(): st.player.setNoble(True)
	if st.player.isHero(): st.player.setHero(True)

	val=0
	return val

class Quest (JQuest) :

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

	def onEvent(self,event,st):
		st.player.getStat().addExp(0)
		eventSplit = event.split(" ")
		event = eventSplit[0]
		eventParam1 = eventSplit[1]

		if event == "reloadscript":
			if eventParam1 == "1": return ReloadConfig(st)
			if eventParam1 == "0": return MainHtml(st)
		if event == "escraza": return MainHtmlIV(st,eventParam1)
		if event == "confirm":
			if int(eventParam1) >= 88: return Confirmation(st,"1",getparentclass(st,eventParam1),eventParam1)
			else: return Confirmation(st,"3","deletesub",eventParam1)
		if event == "gethtml":
			if eventParam1 == "1": 
				if getVarcharacters(st,"race") == "5" and AllowAllSubsToKamael == False : return MainHtmlIV(st,"5")
				if AllowAllSubs == False : 
					if AllowMutantRetail == False and st.player.isSubClassActive(): return MainHtmlIV(st,getclassname(st,str(st.player.getClassId().getId()),"RaceId"))
					else: return MainHtmlIV(st,getVarcharacters(st,"race"))
				else: return MainHtmlI(st)
			if eventParam1 == "2": return MainHtmlII(st)
			if eventParam1 == "3": return MainHtmlIII(st)
			return

		temp = getVar(st,"currentsub")
		temp2 = getVar(st,"sub_index")
		temp3 = str(st.player.getClassIndex())
		temp4 = str(st.player.getClassId().getId())

		if event == "camb":
			if temp2!=temp3: return errordeclasse(st,eventParam1,"switch to")
			elif st.getPlayer().getClassId().level() < 2 and AllowThirdJob == False or st.getPlayer().getClassId().level() < 3 and AllowThirdJob == True : return comunerrors(st,"5")
			elif st.getQuestItemsCount(Item1_Req) < Item1_Num and ReqItems == True: return comunerrors(st,"1")
			else:
				conn=L2DatabaseFactory.getInstance().getConnection()
				upd=conn.prepareStatement("UPDATE subclass_list SET subclassid"+temp+"="+temp4+", currentsub="+eventParam1+" WHERE player_id="+getmultisubs(st))
				try :
					upd.executeUpdate()
					upd.close()
					conn.close()
				except :
					try : conn.close()
					except : pass
				if resetskills(st) == 1: pass
				st.player.setClassId(int(getVar(st,"subclassid"+eventParam1)))
				if not st.player.isSubClassActive(): st.player.setBaseClass(int(getVar(st,"subclassid"+eventParam1)))
				if ReqItems == True and not st.player.isGM(): st.takeItems(Item1_Req,Item1_Num)
				st.player.store()
				st.player.broadcastUserInfo()
				return complete(st)
				st.exitQuest(1)

		if event == "deletesub":

			if temp2!=temp3: return errordeclasse(st,eventParam1,"delete the")
			elif st.getPlayer().getClassId().level() < 2 and AllowThirdJob == False or st.getPlayer().getClassId().level() < 3 and AllowThirdJob == True : return comunerrors(st,"5")
			elif st.getQuestItemsCount(Item3_Req) < Item3_Num and ReqItems == True and not st.player.isGM() : return comunerrors(st,"3")
			else:
				conn=L2DatabaseFactory.getInstance().getConnection()
				upd=conn.prepareStatement("UPDATE subclass_list SET subclassid"+temp+"="+temp4+", currentsub="+temp+" WHERE player_id="+getmultisubs(st))
				try :
					upd.executeUpdate()
					upd.close()
					conn.close()
				except :
					try : conn.close()
					except : pass

				if eventParam1 == temp and getsubsammount(st) > 0:
					j=0
					for i in range(maxsubsindb + 1):
						var = getVar(st,"subclassid"+str(i))
						if int(var) >= 0 and int(var) <= 136 and j == 0 and str(i) != temp: 
							j+=1; idsubclass = var; temp=str(i)
					st.player.setClassId(int(idsubclass))
					if not st.player.isSubClassActive(): st.player.setBaseClass(int(idsubclass))
				con=L2DatabaseFactory.getInstance().getConnection()
				if getsubsammount(st) <= 1: rem=con.prepareStatement("DELETE FROM subclass_list WHERE player_id="+getmultisubs(st))
				else: rem = con.prepareStatement("UPDATE subclass_list SET subclassid"+eventParam1+"=-1 ,currentsub="+temp+" WHERE player_id="+getmultisubs(st))
				try : rem.executeUpdate()
				except : pass
				try : con.close()
				except : pass
				if resetskills(st) == 1: pass
				if ReqItems == True and not st.player.isGM(): st.takeItems(Item3_Req,Item3_Num)
				st.player.store()
				st.player.broadcastUserInfo()
				return errasecomplete(st)
			    	st.exitQuest(1)

		else:
			if temp2!=temp3 and getsubsammount(st) >= 0 : return errordeclasse(st,eventParam1,event)
			elif AllowOnlyNobles == True and not st.player.isGM() :
				if not st.player.isNoble() : return comunerrors(st,"6")
			elif st.getQuestItemsCount(Item2_Req) < Item2_Num and ReqItems == True and not st.player.isGM() : return comunerrors(st,"2")
			elif st.getPlayer().getLevel() < MinLevel and not st.player.isGM() : return comunerrors(st,"4")
			elif st.getPlayer().getClassId().level() < 2 and AllowThirdJob == False or st.getPlayer().getClassId().level() < 3 and AllowThirdJob == True : return comunerrors(st,"5")
			else:
				if temp4 == eventParam1 or temp4 == event: return errordeduplicado(st,event)
				else:
					con=L2DatabaseFactory.getInstance().getConnection()
					if getsubsammount(st) == -1 :
						ins = con.prepareStatement("INSERT INTO subclass_list (player_id,currentsub,sub_index,subclassid0,subclassid1) VALUES (?,?,?,?,?)")
						ins.setString(1, str(st.player.getObjectId()))
						ins.setString(2, "1")
						ins.setString(3, str(st.player.getClassIndex()))
						ins.setString(4, temp4)
						ins.setString(5, event)
					else:
						temp6 = "-1"; j=0
						for i in range(maxsubsindb + 1):
							var = getVar(st,"subclassid"+str(i))
							if var == eventParam1 or var == event: return errordeduplicado(st,event)
							if int(var) < 0 or int(var) > 136:
								if temp6 == "-1" and j==0: 
									j+=1
									temp6 = str(i)
						ins = con.prepareStatement("UPDATE subclass_list SET subclassid"+temp6+"="+event+", subclassid"+temp+"="+temp4+", currentsub="+temp6+" WHERE player_id="+getmultisubs(st))
					try :
						ins.executeUpdate()
						ins.close()
						con.close()
					except : pass
					if resetskills(st) == 1: pass
					if ReqItems == True and not st.player.isGM() : st.takeItems(Item2_Req,Item2_Num)
					if DecLevel == True and not st.player.isGM() :
						pXp = st.player.getExp()
						tXp = Experience.LEVEL[NewLevel]
						if pXp > tXp: st.player.removeExpAndSp(pXp - tXp, 0)
					st.player.setClassId(int(event))
					if not st.player.isSubClassActive(): st.player.setBaseClass(int(event))
					st.player.store()
					st.player.broadcastUserInfo()
					return complete(st)
			    		st.exitQuest(1)

	def onFirstTalk (self,npc,player):
		st = player.getQuestState(QUEST_INFO)
		if not st : st = self.newQuestState(player)
		if player.isGM(): 
			if ShowReloadScriptPanel == True: return MainHtmlV(st)
			else: return MainHtml(st)
		elif int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime"):return MainHtml(st)
		else: return

QUEST = Quest(QuestId,QUEST_INFO,QuestDesc)

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

 

anybody? @Allengc maybe can help me? please?

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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