Guest User

Untitled

a guest
May 31st, 2020
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 49.28 KB | None | 0 0
  1. import sys
  2. from java.lang import System
  3. from java.util import Iterator
  4. from com.l2jfrozen.util.database import L2DatabaseFactory
  5. from com.l2jfrozen.gameserver.model.quest import State
  6. from com.l2jfrozen.gameserver.model.quest import QuestState
  7. from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest
  8. from com.l2jfrozen.gameserver.network.serverpackets import CharInfo
  9. from com.l2jfrozen.gameserver.network.serverpackets import UserInfo
  10. from com.l2jfrozen.gameserver.network.serverpackets import SetupGauge
  11. from com.l2jfrozen.gameserver.model.base import ClassId
  12. from com.l2jfrozen.gameserver.model.base import Experience
  13. from com.l2jfrozen.gameserver.managers import QuestManager
  14. from com.l2jfrozen.gameserver.model.actor.instance import L2PcInstance
  15. from com.l2jfrozen.gameserver.datatables import SkillTable
  16. from com.l2jfrozen.gameserver.datatables.sql import SkillTreeTable
  17. from com.l2jfrozen.gameserver.model import L2Skill
  18.  
  19. NPC = [8000]
  20. QuestId = 855
  21. QuestName = "SubclassNpc"
  22. QuestDesc = "custom"
  23. QUEST_INFO = str(QuestId)+"_"+QuestName
  24.  
  25. print "INFO Loaded ClassMaster NPC"
  26.  
  27. #-------------------------------------------------------------------------------------------------------------------------------------
  28. # SETTINGS
  29. #-------------------------------------------------------------------------------------------------------------------------------------
  30.  
  31. #For more than 3 subclasses, you must increase the variable number into the SQL and add to the database.
  32. #inside the sql you will find some variables named SubclassidX. Just change the "X" increasing the number.
  33. #This value shouldn't be changed if you don't want to increase the subclasses number beyond 3.
  34. #Increase or decrease the "maxsubsindb" value without make these changes, will cause errors. Be carefull!.
  35. maxsubsindb = 1
  36.  
  37. #True, allows reloading the configuration script from the game, without restarting the server (for GMs only). False, disables it.
  38. ShowReloadScriptPanel = True
  39.  
  40. # Subclasses number that can be added. Must be less than or equal to "maxsubsindb".
  41. SubsNumber = 1
  42.  
  43. # True, allows add stackable subclasses in every original game subclass (Mainclass and every retails).
  44. # False, allows add stackable subclasses in only one original game subclass
  45. AllowMultiSubs = False
  46.  
  47. # True, allows any stackable subclass. False, allows add your own race's subclasses only.
  48. AllowAllSubs = True
  49.  
  50. #This option work if "AllowAllSubs = False", Also you need to be using a original game subclass (Retail) to get available this.
  51. #True, allow add a subclass with the same main class's race. False, allow add a subclass with the same Retail's race.
  52. AllowMutantRetail = True
  53.  
  54. #The next two options work if "AllowAllSubs = True" only.
  55. #True, allows everybody add Kamael subclass. False otherwise.
  56. AllowKamaelSubs = False
  57.  
  58. #True, allows Kamaels add any subclass. False, allows Kamaels to add their own race only.
  59. AllowAllSubsToKamael = False
  60.  
  61. #True, allows delete the main class or any subclass added. False, allow to delete added subclasses only. Default: False
  62. AllowDelMainClass = False
  63.  
  64. # Minimum Level to add a subclass. Default: 76
  65. MinLevel = 76
  66.  
  67. #True, allows add subsclasses if the character is a Noblesse only. False, otherwise. Default: False
  68. AllowOnlyNobles = True
  69.  
  70. #True, allow to add subclass or any other actions if you have the required items only. False, otherwise
  71. ReqItems = True
  72.  
  73. #Required Item to switch between the subclasses. Default: 57 (Adena)
  74. #Required items number.
  75. Item1_Req = 57
  76. Item1_Num = 1000000
  77.  
  78. #Required Item to add a subclass.
  79. #Required items number.
  80. Item2_Req = 9997
  81. Item2_Num = 3
  82.  
  83. #Required Item to delete subclasses.
  84. #Required items number.
  85. Item3_Req = 57
  86. Item3_Num = 50000000
  87.  
  88. # True: Change level after add a subclass
  89. # False: Not to change level after add a subclass. Default: True
  90. DecLevel= False
  91.  
  92. # True: HTML will show 3rd Class trasfer to choose, also it disallow add subclasses if the characters haven't added 3rd job.
  93. # False: HTML Will show 2nd Class trasfer to choose, also it disallow add subclasses if the characters haven't added 2nd or 3rd job.
  94. AllowThirdJob = True
  95.  
  96. #Level at which the character will be changed after add a subclass. Default: 40
  97. NewLevel= 40
  98.  
  99. # True: The user must wait a while before take any action. Default: True
  100. # False: The user can do any action without time constraints. Not recommended
  101. Block = True
  102.  
  103. #Blocking time in seconds before take any action.
  104. BlockTime = 20
  105.  
  106. #-------------------------------------------------------------------------------------------------------------------------------------
  107.  
  108. def MainHtml(st) :
  109. xsubsamount=getsubsammount(st)
  110. if xsubsamount >= 0 :
  111. HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
  112. HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font>"
  113. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
  114. HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
  115. HTML_MESSAGE += "<tr><td></td></tr>"
  116. HTML_MESSAGE += "<tr><td align=\"left\"><font color=\"0088EE\"> Antes de tomar qualquer atitude, certifique-se</font></td></tr>"
  117. HTML_MESSAGE += "<tr><td align=\"left\"><font color=\"0088EE\"> esta usando a classe principal ou o bom</font></td></tr>"
  118. HTML_MESSAGE += "<tr><td align=\"left\"><font color=\"0088EE\"> Subclasse, que solicitou as alteracoes.</font></td></tr>"
  119. if ReqItems == True:
  120. HTML_MESSAGE += "<tr><td align=\"left\"><font color=\"0088EE\"> Besides you need the required items.</font></td></tr>"
  121. HTML_MESSAGE += "<tr><td><br></td></tr>"
  122. 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>"
  123. 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>"
  124. 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>"
  125. HTML_MESSAGE += "<tr><td></td></tr></table><br>"
  126. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
  127. 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>"
  128. if xsubsamount < SubsNumber :
  129. 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>"
  130. 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>"
  131. 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>"
  132. HTML_MESSAGE += "</table></td></tr></table></td></tr>"
  133. HTML_MESSAGE += "</center></body></html>"
  134. return HTML_MESSAGE
  135. else:
  136. if st.getQuestItemsCount(Item2_Req) < Item2_Num and ReqItems == True: return comunerrors(st,"0")
  137. if getVarcharacters(st,"race") == "5" and AllowAllSubsToKamael == False : return MainHtmlIV(st,"5")
  138. if AllowAllSubs == False :
  139. if AllowMutantRetail == False and st.player.isSubClassActive(): return MainHtmlIV(st,getclassname(st,str(st.player.getClassId().getId()),"RaceId"))
  140. else: return MainHtmlIV(st,getVarcharacters(st,"race"))
  141. else: return MainHtmlI(st)
  142.  
  143. def MainHtmlI(st) :
  144. HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
  145. HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font>"
  146. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
  147. HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
  148. HTML_MESSAGE += "<tr><td></td></tr>"
  149. HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">Choose a Race</font></td></tr>"
  150. HTML_MESSAGE += "<tr><td></td></tr></table><br>"
  151. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br><br>"
  152. 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>"
  153. 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>"
  154. 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>"
  155. 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>"
  156. 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>"
  157. 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>"
  158. if AllowKamaelSubs == True or getVarcharacters(st,"race") == "5":
  159. 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>"
  160. HTML_MESSAGE += "</table></td></tr></table></td></tr>"
  161. HTML_MESSAGE += "</center></body></html>"
  162. return HTML_MESSAGE
  163.  
  164. def MainHtmlII(st) :
  165. HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
  166. HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font>"
  167. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
  168. HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
  169. HTML_MESSAGE += "<tr><td></td></tr>"
  170. HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">Choose a subclass to Switch</font></td></tr>"
  171. HTML_MESSAGE += "<tr><td></td></tr></table><br>"
  172. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br><br>"
  173. 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>"
  174. temp = getVar(st,"currentsub"); j=-1
  175. for i in range(maxsubsindb + 1):
  176. var = getVar(st,"subclassid"+str(i))
  177. if int(var) >= 0 and int(var) <= 136:
  178. j+=1
  179. if temp != str(i) and SubsNumber >= j:
  180. 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>"
  181. HTML_MESSAGE += "</table></td></tr></table></td></tr>"
  182. HTML_MESSAGE += "</center></body></html>"
  183. return HTML_MESSAGE
  184.  
  185. def MainHtmlIII(st) :
  186. HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
  187. HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font>"
  188. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
  189. HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
  190. HTML_MESSAGE += "<tr><td></td></tr>"
  191. HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">Choose the class you want to delete</font></td></tr>"
  192. HTML_MESSAGE += "<tr><td></td></tr></table><br>"
  193. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br><br>"
  194. 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>"
  195. j=-1
  196. for i in range(maxsubsindb + 1):
  197. var = getVar(st,"subclassid"+str(i))
  198. if int(var) >= 0 and int(var) <= 136:
  199. if i == 0 and AllowDelMainClass == False: pass
  200. else:
  201. j+=1
  202. if SubsNumber >= j:
  203. 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>"
  204. HTML_MESSAGE += "</table></td></tr></table></td></tr>"
  205. HTML_MESSAGE += "</center></body></html>"
  206. return HTML_MESSAGE
  207.  
  208. def MainHtmlIV(st,case) :
  209. HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
  210. HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font>"
  211. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
  212. HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
  213. HTML_MESSAGE += "<tr><td></td></tr>"
  214. HTML_MESSAGE += generateRace(st,case)
  215. HTML_MESSAGE += "</center></body></html>"
  216. return HTML_MESSAGE
  217.  
  218. def MainHtmlV(st) :
  219. HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
  220. HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font><br>"
  221. HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
  222. HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"LEVEL\">Confirmation</font></td></tr></table><br>"
  223. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
  224. HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
  225. HTML_MESSAGE += "<tr><td><br></td></tr>"
  226. 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>"
  227. HTML_MESSAGE += "<tr><td></td></tr></table><br>"
  228. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br><br>"
  229. 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\">"
  230. 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\">"
  231. HTML_MESSAGE += "</center></body></html>"
  232. return HTML_MESSAGE
  233.  
  234. def generateRace(st,raceclass) :
  235. if raceclass == "0": HTML = "<tr><td align=\"center\"><font color=\"0088EE\">HUMAN</font></td></tr>"
  236. if raceclass == "1": HTML = "<tr><td align=\"center\"><font color=\"0088EE\">ELF</font></td></tr>"
  237. if raceclass == "2": HTML = "<tr><td align=\"center\"><font color=\"0088EE\">DARK ELF</font></td></tr>"
  238. if raceclass == "3": HTML = "<tr><td align=\"center\"><font color=\"0088EE\">ORC</font></td></tr>"
  239. if raceclass == "4": HTML = "<tr><td align=\"center\"><font color=\"0088EE\">DWARF</font></td></tr>"
  240. if raceclass == "5": HTML = "<tr><td align=\"center\"><font color=\"0088EE\">KAMAEL</font></td></tr>"
  241. HTML += "<tr><td></td></tr></table><br><img src=\"L2UI.SquareGray\" width=250 height=1><br>"
  242. if raceclass == "5": HTML += "<tr><td align=\"center\"><font color=\"0088EE\">Man Woman</font></td></tr>"
  243. elif raceclass == "4": HTML += "<tr><td align=\"center\"><font color=\"0088EE\">Figther</font></td></tr>"
  244. else: HTML += "<tr><td align=\"center\"><font color=\"0088EE\">Figther Mage</font></td></tr>"
  245. 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>"
  246.  
  247. if raceclass == "0":
  248. 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>"
  249. 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>"
  250. 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>"
  251. 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>"
  252. 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>"
  253. 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>"
  254. 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>"
  255. 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>"
  256. 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>"
  257. 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>"
  258. 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>"
  259. if raceclass == "1":
  260. 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>"
  261. 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>"
  262. 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>"
  263. 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>"
  264. 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>"
  265. 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>"
  266. 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>"
  267. if raceclass == "2":
  268. 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>"
  269. 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>"
  270. 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>"
  271. 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>"
  272. 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>"
  273. 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>"
  274. 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>"
  275. if raceclass == "3":
  276. 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>"
  277. 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>"
  278. 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>"
  279. 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>"
  280. if raceclass == "4":
  281. 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>"
  282. 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>"
  283. if raceclass == "5":
  284. 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>"
  285. 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>"
  286. 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>"
  287. 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>"
  288. 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>"
  289. HTML += "</table></td></tr></table></td></tr>"
  290. return HTML
  291.  
  292. def Confirmation(st,case,case1,case2):
  293. HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
  294. HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font><br>"
  295. HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
  296. HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"LEVEL\">Confirmation</font></td></tr></table><br>"
  297. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
  298. HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
  299. HTML_MESSAGE += "<tr><td><br><br></td></tr>"
  300. if int(case) == 1 :
  301. 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>"
  302. if int(case) == 3 :
  303. 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>"
  304. HTML_MESSAGE += "<tr><td></td></tr></table><br>"
  305. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br><br>"
  306. 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\">"
  307. 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\">"
  308. HTML_MESSAGE += "</center></body></html>"
  309. return HTML_MESSAGE
  310.  
  311. def complete(st) :
  312. HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
  313. HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font>"
  314. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
  315. HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
  316. HTML_MESSAGE += "<tr><td><br><br></td></tr>"
  317. HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">Parabens</font></td></tr>"
  318. HTML_MESSAGE += "<tr><td></td></tr>"
  319. HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">Classe alterada com sucesso</font></td></tr>"
  320. HTML_MESSAGE += "<tr><td><br><br></td></tr></table><br>"
  321. HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
  322. 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>"
  323. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1>"
  324. HTML_MESSAGE += "</center></body></html>"
  325. if getblocktime(st) == True : pass
  326. return HTML_MESSAGE
  327.  
  328. def errasecomplete(st) :
  329. HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
  330. HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font>"
  331. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
  332. HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
  333. HTML_MESSAGE += "<tr><td><br><br></td></tr>"
  334. HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"0088EE\">A classe que você escolheu foi Excluida</font></td></tr>"
  335. HTML_MESSAGE += "<tr><td><br><br></td></tr></table><br>"
  336. HTML_MESSAGE += "<table width=250 border=0 bgcolor=444444>"
  337. HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"00FF00\">É aconselhável reiniciar o jogo</font></td></tr></table><br>"
  338. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1>"
  339. HTML_MESSAGE += "</center></body></html>"
  340. if getblocktime(st) == True : pass
  341. return HTML_MESSAGE
  342.  
  343. def errordeclasse(st,case,case2) :
  344. HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
  345. HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font><br>"
  346. HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
  347. HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF5500\">Error</font></td></tr></table><br>"
  348. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
  349. HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
  350. HTML_MESSAGE += "<tr><td><br><br></td></tr>"
  351. if int(case) >= 88 :
  352. 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>"
  353. else:
  354. 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>"
  355. HTML_MESSAGE += "<tr><td><br><br></td></tr></table><br>"
  356. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1>"
  357. HTML_MESSAGE += "</center></body></html>"
  358. if getblocktime(st) == True : pass
  359. return HTML_MESSAGE
  360.  
  361. def errordeduplicado(st,numero) :
  362. HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
  363. HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font><br>"
  364. HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
  365. HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF5500\">Error</font></td></tr></table><br>"
  366. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
  367. HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
  368. HTML_MESSAGE += "<tr><td><br><br></td></tr>"
  369. 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>"
  370. HTML_MESSAGE += "<tr><td><br><br></td></tr></table><br>"
  371. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1>"
  372. HTML_MESSAGE += "</center></body></html>"
  373. if getblocktime(st) == True : pass
  374. return HTML_MESSAGE
  375.  
  376. def comunerrors(st,case) :
  377. HTML_MESSAGE = "<html><head><title>Subclass Master</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"
  378. HTML_MESSAGE += "<font color=\"303030\">"+getmaster(st)+"</font><br>"
  379. HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
  380. HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FF5500\">Error</font></td></tr></table><br>"
  381. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=220 height=1><br>"
  382. HTML_MESSAGE += "<table width=220 border=0 bgcolor=444444>"
  383. HTML_MESSAGE += "<tr><td><br><br></td></tr>"
  384. 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>"
  385. 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>"
  386. 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>"
  387. 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>"
  388. 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>"
  389. if case == "5":
  390. 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>"
  391. 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>"
  392. 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>"
  393. HTML_MESSAGE += "<tr><td><br><br></td></tr></table><br>"
  394. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=220 height=1>"
  395. HTML_MESSAGE += "</center></body></html>"
  396. if getblocktime(st) == True : pass
  397. return HTML_MESSAGE
  398.  
  399. def ReloadConfig(st) :
  400. try:
  401. if QuestManager.getInstance().reload(QuestId): st.player.sendMessage("The script and settings have been reloaded successfully.")
  402. else: st.player.sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server")
  403. except: st.player.sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server")
  404. return MainHtml(st)
  405.  
  406. def getblocktime(st):
  407. if Block == True and not st.player.isGM() :
  408. endtime = int(System.currentTimeMillis()/1000) + BlockTime
  409. st.set("blockUntilTime",str(endtime))
  410. st.getPlayer().sendPacket(SetupGauge(3, BlockTime * 1000 + 300))
  411. val = True
  412. return val
  413.  
  414. def getVar(st,const):
  415. conn=L2DatabaseFactory.getInstance().getConnection()
  416. act = conn.prepareStatement("SELECT * FROM subclass_list WHERE player_id="+getmultisubs(st))
  417. rs=act.executeQuery()
  418. val = "-1"
  419. if rs :
  420. rs.next()
  421. try :
  422. val = rs.getString(const)
  423. conn.close()
  424. except :
  425. try : conn.close()
  426. except: pass
  427. return val
  428.  
  429. def getsubsammount(st):
  430. j=-1
  431. for i in range(maxsubsindb + 1):
  432. var = getVar(st,"subclassid"+str(i))
  433. if int(var) >= 0 and int(var) <= 136:
  434. j+=1
  435. return j
  436.  
  437. def getVarcharacters(st,const):
  438. conn=L2DatabaseFactory.getInstance().getConnection()
  439. act = conn.prepareStatement("SELECT * FROM characters WHERE obj_Id="+str(st.getPlayer().getObjectId()))
  440. rs=act.executeQuery()
  441. val = "0"
  442. if rs :
  443. rs.next()
  444. try :
  445. val = rs.getString(const)
  446. conn.close()
  447. except :
  448. try : conn.close()
  449. except: pass
  450. return val
  451.  
  452. def getVarcharactersubs(st):
  453. conn=L2DatabaseFactory.getInstance().getConnection()
  454. act = conn.prepareStatement("SELECT * FROM subclass_list WHERE player_id="+getmultisubs(st))
  455. rs=act.executeQuery()
  456. val = ""
  457. if rs :
  458. rs.next()
  459. for i in range(maxsubsindb + 1):
  460. try : val += rs.getString("subclassid"+str(i)) + " "
  461. except : val += str(st.player.getClassId().getId()) + " "
  462. try : conn.close()
  463. except: pass
  464. val+= "-1"
  465. return val
  466.  
  467. def getclassname(st,case1,case2):
  468. conn=L2DatabaseFactory.getInstance().getConnection()
  469. act = conn.prepareStatement("SELECT * FROM char_templates WHERE ClassId="+case1)
  470. rs=act.executeQuery()
  471. if rs :
  472. rs.next()
  473. try :
  474. val = rs.getString(case2)
  475. conn.close()
  476. except :
  477. val = "0"
  478. try : conn.close()
  479. except: pass
  480. else : val = "0"
  481. return val
  482.  
  483. def getitemname(st,itemval):
  484. conn=L2DatabaseFactory.getInstance().getConnection()
  485. itemidList = conn.prepareStatement("SELECT * FROM custom_etcitem WHERE item_id="+str(itemval))
  486. il=itemidList.executeQuery()
  487. if il :
  488. il.next()
  489. try :
  490. val = il.getString("name")
  491. conn.close()
  492. except :
  493. val = "0"
  494. try : conn.close()
  495. except: pass
  496. else : val = "0"
  497. return val
  498.  
  499. def getparentclass(st,case):
  500. val=case
  501. if AllowThirdJob == False:
  502. conn=L2DatabaseFactory.getInstance().getConnection()
  503. parentid = conn.prepareStatement("SELECT * FROM class_list WHERE id = \""+case+"\"")
  504. pi=parentid.executeQuery()
  505. if pi :
  506. pi.next()
  507. try : val = pi.getString("parent_id")
  508. except : pass
  509. try : conn.close()
  510. except: pass
  511. return val
  512.  
  513. def getmaxskilllevel(st,case):
  514. val= 0
  515. com=L2DatabaseFactory.getInstance().getConnection()
  516. lvlskillid = com.prepareStatement("SELECT * FROM skill_trees WHERE skill_id = \""+case+"\" AND min_level <= \"85\" ORDER BY level DESC LIMIT 1")
  517. lvl=lvlskillid.executeQuery()
  518. if lvl :
  519. lvl.next()
  520. try :
  521. val = lvl.getInt("level")
  522. com.close()
  523. except :
  524. try : com.close()
  525. except: pass
  526. return val
  527.  
  528. def getmultisubs(st):
  529. val= str(st.getPlayer().getObjectId()) + " LIMIT 1"
  530. if AllowMultiSubs == True:
  531. val= str(st.getPlayer().getObjectId()) +" AND sub_index=" + str(st.player.getClassIndex()) +" LIMIT 1"
  532. return val
  533.  
  534. def getmaster(st):
  535. 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
  536. #val="Change Title here :P"
  537. return val
  538.  
  539. def resetskills(st):
  540. parametros = "\"-1\""; j=-1
  541. subs=getVarcharactersubs(st)
  542. SubSplit = subs.split(" ")
  543. for k in range(maxsubsindb + 1):
  544. conn=L2DatabaseFactory.getInstance().getConnection()
  545. if int(SubSplit[int(k)]) >= 0 and int(SubSplit[int(k)]) <= 136: j+=1
  546. if int(SubSplit[int(k)]) >= 0 and int(SubSplit[int(k)]) <= 136 and SubsNumber >= j:
  547. xclassid = int(SubSplit[int(k)])
  548. skillidList = conn.prepareStatement("SELECT * FROM class_list WHERE id = \""+str(xclassid)+"\"")
  549. sil=skillidList.executeQuery()
  550. while (sil.next()) :
  551. try :
  552. parametros+=",\"" +str(xclassid)+ "\""
  553. xclassid = sil.getInt("parent_id")
  554. skillidList = conn.prepareStatement("SELECT * FROM class_list WHERE id = \""+str(xclassid)+"\"")
  555. sil=skillidList.executeQuery()
  556. except : pass
  557. try : conn.close()
  558. except : pass
  559. conn=L2DatabaseFactory.getInstance().getConnection()
  560. listskillid = conn.prepareStatement("SELECT * FROM skill_trees WHERE class_id IN ("+parametros+") AND min_level <= \"85\" ORDER BY skill_id DESC, level DESC")
  561. lis=listskillid.executeQuery()
  562. xskill = 0; cskill = 0; i=0
  563. availableSkillsB = ""
  564. while (lis.next()) :
  565. try :
  566. xskill = lis.getInt("skill_id")
  567. if xskill != cskill :
  568. xlevel = lis.getInt("level")
  569. cskill = xskill
  570. i=i+1
  571. availableSkillsB += str(xskill)+"_"+str(xlevel)+" "
  572. except : pass
  573.  
  574. skills_exceptions = conn.prepareStatement("SELECT * FROM subclass_skill_exceptions WHERE class_id IN ("+parametros+") ORDER BY skill_id DESC, level DESC")
  575. se=skills_exceptions.executeQuery()
  576. while (se.next()) :
  577. try :
  578. xskill = se.getInt("skill_id")
  579. if xskill != cskill :
  580. xlevel = se.getInt("level")
  581. cskill = xskill
  582. i=i+1
  583. availableSkillsB += str(xskill)+"_"+str(xlevel)+" "
  584. except : pass
  585.  
  586. availableSkillsB+= "0_0"
  587. xvar="AND skill_id NOT BETWEEN \"1312\" AND \"1315\" AND skill_id NOT BETWEEN \"1368\" AND \"1372\""
  588. if st.player.isGM(): xvar+=" AND skill_id NOT BETWEEN \"7029\" AND \"7064\""
  589. listallskill = conn.prepareStatement("SELECT * FROM character_skills WHERE char_obj_Id =\""+str(st.player.getObjectId())+"\" AND class_index =\""+str(st.player.getClassIndex())+"\" "+xvar+"")
  590. las=listallskill.executeQuery()
  591. availableSkillsA = []
  592. while (las.next()) :
  593. try :
  594. xskill = las.getInt("skill_id")
  595. xlevel = las.getInt("skill_level")
  596. availableSkillsA += [str(xskill)+"_"+str(xlevel)]
  597. except : pass
  598. try : conn.close()
  599. except : pass
  600. try:
  601. skillSplit = availableSkillsB.split(" ")
  602. for avSkillsA in availableSkillsA :
  603. j=0; temp=0
  604. while j <= i:
  605. j=j+1
  606. parametro = skillSplit[j-1].replace("_"," ")
  607. skillSplitB = parametro.split(" ")
  608. avSkillsA = avSkillsA.replace("_"," ")
  609. skillSplitA = avSkillsA.split(" ")
  610. if int(skillSplitB[0]) == int(skillSplitA[0]):
  611. temp=1
  612. if int(skillSplitA[1]) < 100 :
  613. if int(skillSplitB[1]) < int(skillSplitA[1]):
  614. re = SkillTable.getInstance().getInfo(int(skillSplitA[0]), int(skillSplitA[1]))
  615. st.player.removeSkill(re)
  616. sk = SkillTable.getInstance().getInfo(int(skillSplitB[0]), int(skillSplitB[1]))
  617. st.player.addSkill(sk, True)
  618. st.player.sendMessage("You got fixed "+sk.getName()+" Skill.")
  619. else:
  620. if int(skillSplitB[1]) < getmaxskilllevel(st,skillSplitB[0]):
  621. re = SkillTable.getInstance().getInfo(int(skillSplitA[0]), int(skillSplitA[1]))
  622. st.player.removeSkill(re)
  623. sk = SkillTable.getInstance().getInfo(int(skillSplitB[0]), int(skillSplitB[1]))
  624. st.player.addSkill(sk, True)
  625. st.player.sendMessage("You got fixed "+sk.getName()+" Skill.")
  626. if temp == 0 :
  627. sk = SkillTable.getInstance().getInfo(int(skillSplitA[0]), int(skillSplitA[1]))
  628. st.player.removeSkill(sk)
  629. st.player.sendMessage("You got removed "+sk.getName()+" Skill.")
  630. except : st.player.sendMessage("You dont have skills to remove")
  631. st.player.sendSkillList()
  632. if st.player.isNoble(): st.player.setNoble(True)
  633. if st.player.isHero(): st.player.setHero(True)
  634.  
  635. val=0
  636. return val
  637.  
  638. class Quest (JQuest) :
  639.  
  640. def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
  641.  
  642. def onEvent(self,event,st):
  643. st.player.getStat().addExp(0)
  644. eventSplit = event.split(" ")
  645. event = eventSplit[0]
  646. eventParam1 = eventSplit[1]
  647.  
  648. if event == "reloadscript":
  649. if eventParam1 == "1": return ReloadConfig(st)
  650. if eventParam1 == "0": return MainHtml(st)
  651. if event == "escraza": return MainHtmlIV(st,eventParam1)
  652. if event == "confirm":
  653. if int(eventParam1) >= 88: return Confirmation(st,"1",getparentclass(st,eventParam1),eventParam1)
  654. else: return Confirmation(st,"3","deletesub",eventParam1)
  655. if event == "gethtml":
  656. if eventParam1 == "1":
  657. if getVarcharacters(st,"race") == "5" and AllowAllSubsToKamael == False : return MainHtmlIV(st,"5")
  658. if AllowAllSubs == False :
  659. if AllowMutantRetail == False and st.player.isSubClassActive(): return MainHtmlIV(st,getclassname(st,str(st.player.getClassId().getId()),"RaceId"))
  660. else: return MainHtmlIV(st,getVarcharacters(st,"race"))
  661. else: return MainHtmlI(st)
  662. if eventParam1 == "2": return MainHtmlII(st)
  663. if eventParam1 == "3": return MainHtmlIII(st)
  664. return
  665.  
  666. temp = getVar(st,"currentsub")
  667. temp2 = getVar(st,"sub_index")
  668. temp3 = str(st.player.getClassIndex())
  669. temp4 = str(st.player.getClassId().getId())
  670.  
  671. if event == "camb":
  672. if temp2!=temp3: return errordeclasse(st,eventParam1,"switch to")
  673. elif st.getPlayer().getClassId().level() < 2 and AllowThirdJob == False or st.getPlayer().getClassId().level() < 3 and AllowThirdJob == True : return comunerrors(st,"5")
  674. elif st.getQuestItemsCount(Item1_Req) < Item1_Num and ReqItems == True: return comunerrors(st,"1")
  675. else:
  676. conn=L2DatabaseFactory.getInstance().getConnection()
  677. upd=conn.prepareStatement("UPDATE subclass_list SET subclassid"+temp+"="+temp4+", currentsub="+eventParam1+" WHERE player_id="+getmultisubs(st))
  678. try :
  679. upd.executeUpdate()
  680. upd.close()
  681. conn.close()
  682. except :
  683. try : conn.close()
  684. except : pass
  685. if resetskills(st) == 1: pass
  686. st.player.setClassId(int(getVar(st,"subclassid"+eventParam1)))
  687. if not st.player.isSubClassActive(): st.player.setBaseClass(int(getVar(st,"subclassid"+eventParam1)))
  688. if ReqItems == True and not st.player.isGM(): st.takeItems(Item1_Req,Item1_Num)
  689. st.player.store()
  690. st.player.broadcastUserInfo()
  691. return complete(st)
  692. st.exitQuest(1)
  693.  
  694. if event == "deletesub":
  695.  
  696. if temp2!=temp3: return errordeclasse(st,eventParam1,"delete the")
  697. elif st.getPlayer().getClassId().level() < 2 and AllowThirdJob == False or st.getPlayer().getClassId().level() < 3 and AllowThirdJob == True : return comunerrors(st,"5")
  698. elif st.getQuestItemsCount(Item3_Req) < Item3_Num and ReqItems == True and not st.player.isGM() : return comunerrors(st,"3")
  699. else:
  700. conn=L2DatabaseFactory.getInstance().getConnection()
  701. upd=conn.prepareStatement("UPDATE subclass_list SET subclassid"+temp+"="+temp4+", currentsub="+temp+" WHERE player_id="+getmultisubs(st))
  702. try :
  703. upd.executeUpdate()
  704. upd.close()
  705. conn.close()
  706. except :
  707. try : conn.close()
  708. except : pass
  709.  
  710. if eventParam1 == temp and getsubsammount(st) > 0:
  711. j=0
  712. for i in range(maxsubsindb + 1):
  713. var = getVar(st,"subclassid"+str(i))
  714. if int(var) >= 0 and int(var) <= 136 and j == 0 and str(i) != temp:
  715. j+=1; idsubclass = var; temp=str(i)
  716. st.player.setClassId(int(idsubclass))
  717. if not st.player.isSubClassActive(): st.player.setBaseClass(int(idsubclass))
  718. con=L2DatabaseFactory.getInstance().getConnection()
  719. if getsubsammount(st) <= 1: rem=con.prepareStatement("DELETE FROM subclass_list WHERE player_id="+getmultisubs(st))
  720. else: rem = con.prepareStatement("UPDATE subclass_list SET subclassid"+eventParam1+"=-1 ,currentsub="+temp+" WHERE player_id="+getmultisubs(st))
  721. try : rem.executeUpdate()
  722. except : pass
  723. try : con.close()
  724. except : pass
  725. if resetskills(st) == 1: pass
  726. if ReqItems == True and not st.player.isGM(): st.takeItems(Item3_Req,Item3_Num)
  727. st.player.store()
  728. st.player.broadcastUserInfo()
  729. return errasecomplete(st)
  730. st.exitQuest(1)
  731.  
  732. else:
  733. if temp2!=temp3 and getsubsammount(st) >= 0 : return errordeclasse(st,eventParam1,event)
  734. elif AllowOnlyNobles == True and not st.player.isGM() :
  735. if not st.player.isNoble() : return comunerrors(st,"6")
  736. elif st.getQuestItemsCount(Item2_Req) < Item2_Num and ReqItems == True and not st.player.isGM() : return comunerrors(st,"2")
  737. elif st.getPlayer().getLevel() < MinLevel and not st.player.isGM() : return comunerrors(st,"4")
  738. elif st.getPlayer().getClassId().level() < 2 and AllowThirdJob == False or st.getPlayer().getClassId().level() < 3 and AllowThirdJob == True : return comunerrors(st,"5")
  739. else:
  740. if temp4 == eventParam1 or temp4 == event: return errordeduplicado(st,event)
  741. else:
  742. con=L2DatabaseFactory.getInstance().getConnection()
  743. if getsubsammount(st) == -1 :
  744. ins = con.prepareStatement("INSERT INTO subclass_list (player_id,currentsub,sub_index,subclassid0,subclassid1) VALUES (?,?,?,?,?)")
  745. ins.setString(1, str(st.player.getObjectId()))
  746. ins.setString(2, "1")
  747. ins.setString(3, str(st.player.getClassIndex()))
  748. ins.setString(4, temp4)
  749. ins.setString(5, event)
  750. else:
  751. temp6 = "-1"; j=0
  752. for i in range(maxsubsindb + 1):
  753. var = getVar(st,"subclassid"+str(i))
  754. if var == eventParam1 or var == event: return errordeduplicado(st,event)
  755. if int(var) < 0 or int(var) > 136:
  756. if temp6 == "-1" and j==0:
  757. j+=1
  758. temp6 = str(i)
  759. ins = con.prepareStatement("UPDATE subclass_list SET subclassid"+temp6+"="+event+", subclassid"+temp+"="+temp4+", currentsub="+temp6+" WHERE player_id="+getmultisubs(st))
  760. try :
  761. ins.executeUpdate()
  762. ins.close()
  763. con.close()
  764. except : pass
  765. if resetskills(st) == 1: pass
  766. if ReqItems == True and not st.player.isGM() : st.takeItems(Item2_Req,Item2_Num)
  767. if DecLevel == True and not st.player.isGM() :
  768. pXp = st.player.getExp()
  769. tXp = Experience.LEVEL[NewLevel]
  770. if pXp > tXp: st.player.removeExpAndSp(pXp - tXp, 0)
  771. st.player.setClassId(int(event))
  772. if not st.player.isSubClassActive(): st.player.setBaseClass(int(event))
  773. st.player.store()
  774. st.player.broadcastUserInfo()
  775. return complete(st)
  776. st.exitQuest(1)
  777.  
  778. def onFirstTalk (self,npc,player):
  779. st = player.getQuestState(QUEST_INFO)
  780. if not st : st = self.newQuestState(player)
  781. if player.isGM():
  782. if ShowReloadScriptPanel == True: return MainHtmlV(st)
  783. else: return MainHtml(st)
  784. elif int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime"):return MainHtml(st)
  785. else: return
  786.  
  787. QUEST = Quest(QuestId,QUEST_INFO,QuestDesc)
  788.  
  789. for npcId in NPC:
  790. QUEST.addStartNpc(npcId)
  791. QUEST.addFirstTalkId(npcId)
  792. QUEST.addTalkId(npcId)
Add Comment
Please, Sign In to add comment