A Project for Chronicle 4 based on L2JServer.


    python scripts

    Share

    hellyah

    Posts : 4
    Join date : 2012-12-22

    python scripts

    Post  hellyah on 28th December 2012, 03:17

    hi DnR!
    can help me? i cant find bug in this script.

    Code:
    import sys
    from java.lang import System
    from java.util import Iterator
    from net.sf.l2j L2DatabaseFactory
    from net.sf.l2j.gameserver.model.quest import State
    from net.sf.l2j.gameserver.model.quest import QuestState
    from net.sf.l2jgameserver.model.quest.jython import QuestJython as JQuest
    from net.sf.l2j.gameserver.network.serverpackets import CharInfo
    from net.sf.l2j.gameserver.network.serverpackets import UserInfo
    from net.sf.l2j.gameserver.network.serverpackets import SetupGauge
    from net.sf.l2j.gameserver.model.base import ClassId
    from net.sf.l2j.gameserver.model.base import Experience
    from net.sf.l2j.gameserver.model.actor.instance import L2PcInstance
    from net.sf.l2j.gameserver.datatables import SkillTable
    from net.sf.l2j.gameserver.datatables import SkillTreeTable
    from net.sf.l2j.gameserver.model import L2Skill


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

    print "INFO Loaded ClassMaster NPC"
    #---------------------------------------------------------------------------------------------------------------------------------------------------
    # SETTINGS
    #---------------------------------------------------------------------------------------------------------------------------------------------------
    #if st.player.isHero(): st.player.setHero(True)
    #FONTOS 576 os sorban a heronal lehet gond!


    #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

    # 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 or main class
    AllowMultiSubs = True

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

    #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 = 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 = False

    #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 = 57
    Item2_Num = 1

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

    # 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 = 2

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

    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\">Cassiopeia server</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\">          Before taking any action, make sure you</font></td></tr>"
          HTML_MESSAGE += "<tr><td align=\"left\"><font color=\"0088EE\">          are using the Main Class or the proper</font></td></tr>"
          HTML_MESSAGE += "<tr><td align=\"left\"><font color=\"0088EE\">          Subclass, which requested the changes.</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\">                Elegir Sub:  <font color=\"LEVEL\">"+str(Item2_Num)+" "+str(getitemname(st,Item2_Req))+"</font></font></td></tr>"
             if Item1_Num >= 1: HTML_MESSAGE += "<tr><td align=\"left\"><font color=\"0088EE\">                Switch Sub: <font color=\"LEVEL\">"+str(Item1_Num)+" "+str(getitemname(st,Item1_Req))+"</font></font></td></tr>"
             if Item3_Num >= 1: HTML_MESSAGE += "<tr><td align=\"left\"><font color=\"0088EE\">                Delete Sub:  <font color=\"LEVEL\">"+str(Item3_Num)+" "+str(getitemname(st,Item3_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><tr><td width=90 align=\"center\"><table width=85 border=0>"
          if xsubsamount < SubsNumber :
             HTML_MESSAGE += "<tr><td><button value=\"Elegir Sub\" action=\"bypass -h Quest " +QUEST_INFO + " gethtml 1\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr><br1>"
          HTML_MESSAGE += "<tr><td><button value=\"Switch Sub\" action=\"bypass -h Quest " +QUEST_INFO + " gethtml 2\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr><br1>"
          HTML_MESSAGE += "<tr><td><button value=\"Delete Sub\" action=\"bypass -h Quest " +QUEST_INFO + " gethtml 3\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></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 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\">Cassiopeia server</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\">Elige una Raza</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><tr><td width=110 align=\"center\"><table width=105 border=0>"
       HTML_MESSAGE += "<tr><td><button value=\"Human\" action=\"bypass -h Quest " +QUEST_INFO + " escraza 0\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr><br>"
       HTML_MESSAGE += "<tr><td><button value=\"Elf\" action=\"bypass -h Quest " +QUEST_INFO + " escraza 1\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr><br>"
       HTML_MESSAGE += "<tr><td><button value=\"Dark Elf\" action=\"bypass -h Quest " +QUEST_INFO + " escraza 2\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr><br>"
       HTML_MESSAGE += "<tr><td><button value=\"Orc\" action=\"bypass -h Quest " +QUEST_INFO + " escraza 3\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr><br>"
       HTML_MESSAGE += "<tr><td><button value=\"Dwarf\" action=\"bypass -h Quest " +QUEST_INFO + " escraza 4\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></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\">Cassiopeia server</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=110 align=\"center\"><table width=110 border=0><tr><td width=110 align=\"center\"><table width=105 border=0>"
       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=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></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\">Cassiopeia server</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=110 align=\"center\"><table width=110 border=0><tr><td width=110 align=\"center\"><table width=105 border=0>"
       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=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></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\">Cassiopeia server</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 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>"
       HTML += "<tr><td></td></tr></table><br><img src=\"L2UI.SquareGray\" width=250 height=1><br>"
       if raceclass == "4": HTML += "<tr><td align=\"center\"><font color=\"0088EE\">Fighter</font></td></tr>"
       else: HTML += "<tr><td align=\"left\"><font color=\"0088EE\">Fighter                        Mage</font></td></tr>"
       HTML += "<tr><td width=250 align=\"center\"><table width=240 border=0><tr><td width=240 align=\"center\"><table width=235 border=0><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=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
                    HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"98"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 98\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>"
                    HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"93"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 93\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
                    HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"97"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 97\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>"
                    HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"88"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 88\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
                    HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"96"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 96\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>"
                    HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"89"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 89\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
                    HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"95"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 95\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>"
                    HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"90"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 90\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
                    HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"94"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 94\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>"
                     HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"91"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 91\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></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=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
                    HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"105"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 105\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>"
                    HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"101"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 101\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
                    HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"103"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 103\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>"
                    HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"100"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 100\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
                    HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"104"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 104\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>"
                    HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"99"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 99\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></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=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
                    HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"112"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 112\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>"
                    HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"108"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 108\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
                    HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"110"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 110\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>"
                    HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"107"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 107\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
                    HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"111"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 111\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>"
                    HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"106"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 106\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></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=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
                    HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"116"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 116\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>"
                    HTML += "<tr><td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"113"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 113\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
                    HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"115"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 115\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></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=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>"
                    HTML += "<td align=\"center\"><button value=\""+getclassname(st,getparentclass(st,"117"),"ClassName")+"\" action=\"bypass -h Quest " + QUEST_INFO + " confirm 117\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></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\">Cassiopeia server</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>  subclass?<font color=\"LEVEL\">"+getclassname(st,case1,"ClassName")+"</font>?</td></tr>"
       if int(case) == 3 :
          HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">Do you really want to delete the<br1> subclass?<font color=\"LEVEL\">"+getclassname(st,getVar(st,"subclassid"+case2),"ClassName")+"</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+" "+case1+" "+case2+"\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\">"
       HTML_MESSAGE += "<button value=\"No\" action=\"bypass -h Quest "+QUEST_INFO+" gethtml "+case+"\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\">"            
       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\">Cassiopeia server</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\">Congratulations</font></td></tr>"
       HTML_MESSAGE += "<tr><td></td></tr>"
       HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">Class changed successfully</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\">Please restart the game.</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\">Cassiopeia server</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\">The class that you chose has been deleted</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\">Please restart the game.</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\">Cassiopeia server</font><br>"
       HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
       HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF5500\">Warning</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 subclass Talk to a Grand Master and switch to the proper class first.<br1><font color=\"LEVEL\">"+getclassname(st,case2,"ClassName")+"</font>. Habla a un Grand<br1>Master y cambia de subclase antes.</td></tr>"
       else:
          HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">You can't %s "+case2+"subclass. Talk to a Grand Master and switch to the proper class first.<br1><font color=\"LEVEL\">"+getclassname(st,getVar(st,"subclassid"+case),"ClassName")+"</font>. Habla a un Grand<br1>Master y cambia de subclase antes.</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\">Cassiopeia server</font><br>"
       HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
       HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF5500\">Warning</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 subclass. You already have this class.<br1><font color=\"LEVEL\">"+getclassname(st,numero,"ClassName")+"</font>.</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\">Cassiopeia server</font><br>"
       HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
       HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF5500\">Warning</font></td></tr></table><br>"
       HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=240 height=1><br>"
       HTML_MESSAGE += "<table width=240 border=0 bgcolor=444444>"
       HTML_MESSAGE += "<tr><td><br><br></td></tr>"
       if case == "0": HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">In order to add a subclass you <br1>need to be level 76 or above<br1><font color=\"LEVEL\">"+str(Item2_Num)+" "+str(getitemname(st,Item2_Req))+".</font></td></tr>"
       if case == "1": HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">You don't have the required items.<br1>You need <font color=\"LEVEL\">"+str(Item1_Num)+" "+str(getitemname(st,Item1_Req))+"</font></td></tr>"
       if case == "2": HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">You don't have the required items.<br1>Necesitas <font color=\"LEVEL\">"+str(Item2_Num)+" "+str(getitemname(st,Item2_Req))+"</font></td></tr>"
       if case == "3": HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF7700\">You don't have the required items.<br1>Necesitas <font color=\"LEVEL\">"+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 be <font color=\"LEVEL\">"+str(MinLevel)+" o Superior.</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=\"LEVEL\">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=\"LEVEL\">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=\"LEVEL\">Noblesse</font> primero.</td></tr>"
       HTML_MESSAGE += "<tr><td><br><br></td></tr></table><br>"
       HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=240 height=1>"
       HTML_MESSAGE += "</center></body></html>"
       if getblocktime(st) == True : pass
       return HTML_MESSAGE

    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 character_subclasses WHERE char_obj_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%s" % 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 character_subclasses 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 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="titulo"
       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
       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("The skill "+sk.getName()+" is repair.")
                   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("The skill "+sk.getName()+" is repair.")
             
             if temp == 0 :
                sk = SkillTable.getInstance().getInfo(int(skillSplitA[0]), int(skillSplitA[1]))
                st.player.removeSkill(sk)
                st.player.sendMessage("The skill "+sk.getName()+" was removed.")
       except : st.player.sendMessage("You don't have skills which should be removed")
       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):
          eventSplit = event.split(" ")
          event = eventSplit[0]
          eventParam1 = eventSplit[1]
          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 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 a")
             if st.getPlayer().getClassId().level() < 2 and AllowThirdJob == False or st.getPlayer().getClassId().level() < 3 and AllowThirdJob == True : return comunerrors(st,"5")
             if st.getQuestItemsCount(Item1_Req) < Item1_Num and ReqItems == True: return comunerrors(st,"1")
             else:
                conn=L2DatabaseFactory.getInstance().getConnection()
                upd=conn.prepareStatement("UPDATE character_subclasses 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,"borrar")
             if st.getPlayer().getClassId().level() < 2 and AllowThirdJob == False or st.getPlayer().getClassId().level() < 3 and AllowThirdJob == True : return comunerrors(st,"5")
             if 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 character_subclasses 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 character_subclasses WHERE player_id="+getmultisubs(st))
                else: rem = con.prepareStatement("UPDATE character_subclasses 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)
             if AllowOnlyNobles == True and not st.player.isGM() :
                if not st.player.isNoble() : return comunerrors(st,"6")
             if st.getQuestItemsCount(Item2_Req) < Item2_Num and ReqItems == True and not st.player.isGM() : return comunerrors(st,"2")
             if st.getPlayer().getLevel() < MinLevel and not st.player.isGM() : return comunerrors(st,"4")
             if 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 character_subclasses (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 character_subclasses 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 = ExperienceData.getInstance().getExpForLevel(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(): return MainHtml(st)
          if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime"): return MainHtml(st)

          
    QUEST      = Quest(QuestId,QUEST_INFO,QuestDesc)


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

    dragos73

    Posts : 14
    Join date : 2012-12-21

    Re: python scripts

    Post  dragos73 on 28th December 2012, 11:48

    When i get back home i will try and adapt it . but from what can i see you have 1. soem wrong imports with network.serverpackets(no need of network) 2. the html code i dont think it will work for c4.

    avatar
    DnR
    Admin
    Admin

    Posts : 1027
    Join date : 2012-12-03

    Re: python scripts

    Post  DnR on 28th December 2012, 12:52

    dragos73 wrote:When i get back home i will try and adapt it . but from what can i see you have 1. soem wrong imports with network.serverpackets(no need of network) 2. the html code i dont think it will work for c4.


    +1, and a dot is also missing between l2j and gameserver directories.

    from net.sf.l2jgameserver.model.quest.jython import QuestJython as JQuest

    Method onFirstTalk does not exist, try onTalk with few checks.
    But from what i can see, some custom methods are being used, which don' t even exist in latest l2j files.
    Have you adapted the core as well?

    Sponsored content

    Re: python scripts

    Post  Sponsored content


      Current date/time is 19th November 2017, 18:14