Advertisement
Guest User

Untitled

a guest
Apr 15th, 2012
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 54.26 KB | None | 0 0
  1. import sys
  2. from java.lang import System
  3. from java.util import Iterator
  4. from com.l2jserver import Config
  5. from com.l2jserver.gameserver.model.quest import State
  6. from com.l2jserver.gameserver.model.quest import QuestState
  7. from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest
  8. from com.l2jserver.gameserver.instancemanager import QuestManager
  9. from com.l2jserver import L2DatabaseFactory
  10. from com.l2jserver.gameserver.datatables import SkillTable
  11. from com.l2jserver.gameserver.datatables import ItemTable
  12. from com.l2jserver.gameserver.model.actor.instance import L2PcInstance
  13. from com.l2jserver.gameserver.model.actor.instance import L2PetInstance
  14. from com.l2jserver.gameserver.model.actor.instance import L2SummonInstance
  15. from com.l2jserver.gameserver.network.serverpackets import SetSummonRemainTime
  16. from com.l2jserver.gameserver.network.serverpackets import SetupGauge
  17.  
  18. QUEST_ID = 555
  19. QUEST_NAME = "NPCBuffer"
  20. QUEST_DESCRIPTION = "custom"
  21. QUEST_LOADING_INFO = str(QUEST_ID)+"_"+QUEST_NAME
  22. NPC_ID = 555
  23.  
  24. TITLE_NAME = "L2isignia's Buffer"
  25. SCRIPT_RELOAD = True
  26. ENABLE_VIP_BUFFER = False
  27. VIP_ACCESS_LEVEL = 1
  28. ENABLE_BUFF_SECTION = True
  29. ENABLE_SCHEME_SYSTEM = True
  30. ENABLE_HEAL = True
  31. ENABLE_BUFFS = True
  32. ENABLE_RESIST = True
  33. ENABLE_SONGS = True
  34. ENABLE_DANCES = True
  35. ENABLE_CHANTS = False
  36. ENABLE_OTHERS = True
  37. ENABLE_SPECIAL = True
  38. ENABLE_CUBIC = True
  39. ENABLE_BUFF_REMOVE = True
  40. ENABLE_BUFF_SET = True
  41. BUFF_WITH_KARMA = False
  42. FREE_BUFFS = False
  43. TIME_OUT = True
  44. TIME_OUT_TIME = 10
  45. MIN_LEVEL = 20
  46. BUFF_REMOVE_PRICE = 100000
  47. HEAL_PRICE = 1000000
  48. BUFF_PRICE = 100000
  49. RESIST_PRICE = 100000
  50. SONG_PRICE = 100000
  51. DANCE_PRICE = 100000
  52. CHANT_PRICE = 100000
  53. OTHERS_PRICE = 1000000
  54. SPECIAL_PRICE = 1000000
  55. CUBIC_PRICE = 1000000
  56. BUFF_SET_PRICE = 10000000
  57. SCHEME_BUFF_PRICE = 10000000
  58. SCHEMES_PER_PLAYER = 4
  59. CONSUMABLE_ID = 57
  60. MAX_SCHEME_BUFFS = Config.BUFFS_MAX_AMOUNT
  61. MAX_SCHEME_DANCES = Config.DANCES_MAX_AMOUNT
  62.  
  63. def rebuildMainHtml(st) :
  64. MAIN_HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"; MESSAGE = ""
  65. bottonA="Auto Buff";bottonB="Heal Me";bottonC="Rem. Buffs";i=0;j=0;Temp="<tr><td> </td> <td> </td></tr>";TRS = Temp.split(" ")
  66. if st.getInt("Pet-On-Off") == 1:
  67. bottonA="Auto Buff Pet";bottonB="Heal My Pet";bottonC="Rem. Pet Buffs"
  68. MAIN_HTML_MESSAGE += "<button value=\"Pet Options\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " buffpet 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  69. else: MAIN_HTML_MESSAGE += "<button value=\"Char Options\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " buffpet 1 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  70. if ENABLE_BUFF_SECTION == True :
  71. if ENABLE_BUFFS == True :
  72. if i>2:i=0
  73. MESSAGE += TRS[i]+"<button value=\"Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_buffs 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1]
  74. i+=2;j+=1
  75. if ENABLE_RESIST == True :
  76. if i>2:i=0
  77. MESSAGE += TRS[i]+"<button value=\"Resist\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_resists 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1]
  78. i+=2;j+=1
  79. if ENABLE_SONGS == True :
  80. if i>2:i=0
  81. MESSAGE += TRS[i]+"<button value=\"Songs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_songs 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1]
  82. i+=2;j+=1
  83. if ENABLE_DANCES == True :
  84. if i>2:i=0
  85. MESSAGE += TRS[i]+"<button value=\"Dances\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_dances 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1]
  86. i+=2;j+=1
  87. if ENABLE_CHANTS == True :
  88. if i>2:i=0
  89. MESSAGE += TRS[i]+"<button value=\"Chants\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_chants 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1]
  90. i+=2;j+=1
  91. if ENABLE_SPECIAL == True :
  92. if i>2:i=0
  93. MESSAGE += TRS[i]+"<button value=\"Special\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_special 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1]
  94. i+=2;j+=1
  95. if ENABLE_OTHERS == True :
  96. if i>2:i=0
  97. MESSAGE += TRS[i]+"<button value=\"Others\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_others 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1]
  98. i+=2;j+=1
  99. if ENABLE_CUBIC == True:
  100. if i>2:i=0
  101. MESSAGE += TRS[i]+"<button value=\"Cubics\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_cubic 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1]
  102. i+=2;j+=1
  103. if ENABLE_BUFF_SET == True :
  104. if i>2:i=0
  105. MESSAGE += TRS[i]+"<button value=\""+bottonA+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " castBuffSet 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1]
  106. i+=2;j+=1
  107. if ENABLE_HEAL == True :
  108. if i>2:i=0
  109. MESSAGE += TRS[i]+"<button value=\""+bottonB+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " heal 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1]
  110. i+=2;j+=1
  111. if ENABLE_BUFF_REMOVE == True:
  112. if i>2:i=0
  113. MESSAGE += TRS[i]+"<button value=\""+bottonC+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " removeBuffs 0 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[i+1]
  114. i+=2;j+=1
  115. if j == 1: MAIN_HTML_MESSAGE+= MESSAGE + "<br>"
  116. else: MAIN_HTML_MESSAGE+= "<table>" + MESSAGE + "</table><br>"
  117. if ENABLE_SCHEME_SYSTEM == True :
  118. MAIN_HTML_MESSAGE += generateScheme(st)
  119. if st.getPlayer().isGM() :
  120. MAIN_HTML_MESSAGE += "<br><button value=\"Manage Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect manage_buffs 0 0\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  121. MAIN_HTML_MESSAGE += "<br><font color=\"303030\">"+TITLE_NAME+"</font>"
  122. MAIN_HTML_MESSAGE += "</center></body></html>"
  123. return MAIN_HTML_MESSAGE
  124.  
  125. def generateScheme(st) :
  126. schemeName = []
  127. schemeId = []
  128. HTML = ""
  129. conn=L2DatabaseFactory.getInstance().getConnection()
  130. rss = conn.prepareStatement("SELECT * FROM buffer_scheme_list WHERE player_id="+str(st.getPlayer().getObjectId()))
  131. action=rss.executeQuery()
  132. while (action.next()) :
  133. try :
  134. schemeName += [action.getString("scheme_name")]
  135. schemeId += [action.getString("id")]
  136. except : print "Query error!"
  137. try : conn.close()
  138. except : pass
  139. if len(schemeName) > 0:
  140. MESSAGE = ""
  141. i=0;j=0;Temp="<tr><td> </td> <td> </td></tr>";TRS = Temp.split(" ")
  142. while i <= len(schemeName) - 1:
  143. if j>2:j=0
  144. MESSAGE += TRS[j]+"<button value=\""+schemeName[i]+"\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" cast "+schemeId[i]+" x x\" width=130 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"+TRS[j+1]
  145. i+=1;j+=2
  146. if i == 1: HTML+= MESSAGE + "<br>"
  147. else: HTML+= "<table>" + MESSAGE + "</table><br>"
  148. if len(schemeName) < SCHEMES_PER_PLAYER :
  149. HTML += "<table><tr><td><button value=\"Create\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" create_1 x x x\" width=85 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
  150. else : HTML += "<table width=100><tr>"
  151. if len(schemeName) > 0 :
  152. HTML += "<td><button value=\"Edit\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" edit_1 x x x\" width=85 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
  153. HTML += "<td><button value=\"Delete\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" delete_1 x x x\" width=85 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table>"
  154. else : HTML += "</tr></table>"
  155. return HTML
  156.  
  157. def reloadPanel(st) :
  158. HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
  159. HTML_MESSAGE += "<font color=\"303030\">"+TITLE_NAME+"</font><br>"
  160. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br>"
  161. HTML_MESSAGE += "<table width=260 border=0 bgcolor=444444>"
  162. HTML_MESSAGE += "<tr><td><br></td></tr>"
  163. HTML_MESSAGE += "<tr><td align=\"center\"><font color=\"FFFFFF\">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>"
  164. HTML_MESSAGE += "<tr><td></td></tr></table><br>"
  165. HTML_MESSAGE += "<img src=\"L2UI.SquareGray\" width=250 height=1><br><br>"
  166. HTML_MESSAGE += "<button value=\"Yes\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" reloadscript 1 0 0\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  167. HTML_MESSAGE += "<button value=\"No\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" reloadscript 0 0 0\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  168. HTML_MESSAGE += "</center></body></html>"
  169. return HTML_MESSAGE
  170.  
  171. def getitemname(st,itemval):
  172. conn=L2DatabaseFactory.getInstance().getConnection()
  173. itemidList = conn.prepareStatement("SELECT * FROM etcitem WHERE item_id="+str(itemval))
  174. il=itemidList.executeQuery()
  175. val = "No Name"
  176. if il :
  177. il.next()
  178. try : val = il.getString("name")
  179. except : pass
  180. try : conn.close()
  181. except: pass
  182. return val
  183.  
  184. def getBuffCount(scheme) :
  185. count = 0
  186. conn=L2DatabaseFactory.getInstance().getConnection()
  187. rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id=\""+str(scheme)+"\"")
  188. action=rss.executeQuery()
  189. while (action.next()) :
  190. try : count += 1
  191. except : count = 0
  192. try : conn.close()
  193. except : pass
  194. return count
  195.  
  196. def getBuffType(id) :
  197. conn=L2DatabaseFactory.getInstance().getConnection()
  198. act = conn.prepareStatement("SELECT buffType FROM buffer_buff_list WHERE buffId=? LIMIT 1")
  199. act.setInt(1, int(id))
  200. rs=act.executeQuery()
  201. val = "none"
  202. if rs :
  203. rs.next()
  204. try : val = rs.getString("buffType")
  205. except : val = "none"
  206. try : conn.close()
  207. except: pass
  208. return val
  209.  
  210. def isEnabled(id,level) :
  211. conn=L2DatabaseFactory.getInstance().getConnection()
  212. act = conn.prepareStatement("SELECT canUse FROM buffer_buff_list WHERE buffId=? AND buffLevel=? LIMIT 1")
  213. act.setInt(1, int(id))
  214. act.setInt(2, int(level))
  215. rs=act.executeQuery()
  216. val = "False"
  217. if rs :
  218. rs.next()
  219. try : num = rs.getString("canUse")
  220. except : pass
  221. try : conn.close()
  222. except: pass
  223. if num == "1" : val = "True"
  224. return val
  225.  
  226. def isUsed(scheme,id,level) :
  227. count = 0; used = False
  228. conn=L2DatabaseFactory.getInstance().getConnection()
  229. rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id=\""+str(scheme)+"\" AND skill_id=\""+str(id)+"\" AND skill_level=\""+str(level)+"\"")
  230. action=rss.executeQuery()
  231. used = False
  232. while (action.next()) :
  233. try : count += 1
  234. except : count = 0
  235. try : conn.close()
  236. except : pass
  237. if count > 0 : used = True
  238. return used
  239.  
  240. def getclassbuff(id):
  241. conn=L2DatabaseFactory.getInstance().getConnection()
  242. getTipo = conn.prepareStatement("SELECT * FROM buffer_buff_list WHERE buffId=\""+id+"\"")
  243. gt=getTipo.executeQuery()
  244. val = 0
  245. if gt :
  246. gt.next()
  247. try : val = gt.getInt("buff_class")
  248. except : pass
  249. try : conn.close()
  250. except : pass
  251. return val
  252.  
  253. def showText(st,type,text,buttonEnabled,buttonName,location) :
  254. MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
  255. MESSAGE += "<font color=\"LEVEL\">"+type+"</font><br>"+text+"<br>"
  256. if buttonEnabled == "True" :
  257. MESSAGE += "<button value=\""+buttonName+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect "+location+" 0 0\" width=100 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  258. MESSAGE += "<font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>"
  259. st.playSound("ItemSound3.sys_shortage")
  260. return MESSAGE
  261.  
  262. def ReloadConfig(st) :
  263. try:
  264. if QuestManager.getInstance().reload(QUEST_ID): st.player.sendMessage("The script and settings have been reloaded successfully.")
  265. else: st.player.sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server")
  266. except: st.player.sendMessage("Script Reloaded Failed. you edited something wrong! :P, fix it and restart the server")
  267. return rebuildMainHtml(st)
  268.  
  269. class Quest (JQuest) :
  270.  
  271. def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
  272.  
  273. def onAdvEvent (self,event,npc,player) :
  274. st = player.getQuestState(QUEST_LOADING_INFO)
  275. getpetbuff = 0
  276. if st.getInt("Pet-On-Off") == 1: getpetbuff = 1
  277.  
  278. def createScheme() :
  279. HTML = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>You MUST seprerate new words with a dot (.)<br><br>Scheme name: <edit var=\"name\" width=100><br><br>"
  280. HTML += "<button value=\"Create Scheme\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" create $name no_name x x\" width=200 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  281. HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  282. HTML += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>"
  283. return HTML
  284.  
  285. def deleteScheme() :
  286. HTML = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>Available schemes:<br><br>"
  287. conn=L2DatabaseFactory.getInstance().getConnection()
  288. rss = conn.prepareStatement("SELECT * FROM buffer_scheme_list WHERE player_id="+str(st.getPlayer().getObjectId()))
  289. action=rss.executeQuery()
  290. while (action.next()) :
  291. try : HTML += "<button value=\""+action.getString("scheme_name")+"\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" delete_c "+action.getString("id")+" "+action.getString("scheme_name")+" x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  292. except : print "Query error!"
  293. try : conn.close()
  294. except : pass
  295. HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  296. HTML += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>"
  297. return HTML
  298.  
  299. def editScheme() :
  300. name = ""; id = ""
  301. HTML = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>Select a scheme that you would like to manage:<br><br>"
  302. conn=L2DatabaseFactory.getInstance().getConnection()
  303. rss = conn.prepareStatement("SELECT * FROM buffer_scheme_list WHERE player_id="+str(st.getPlayer().getObjectId()))
  304. action=rss.executeQuery()
  305. while (action.next()) :
  306. try :
  307. name = action.getString("scheme_name")
  308. id = action.getString("id")
  309. HTML += "<button value=\""+name+"\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" manage_scheme_select "+id+" x x\" width=200 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  310. except : print "Query error!"
  311. try : conn.close()
  312. except : pass
  313. HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  314. HTML += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>"
  315. return HTML
  316.  
  317. def getOptionList(scheme) :
  318. Bcount = getBuffCount(scheme)
  319. HTML = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>There are <font color=\"LEVEL\">"+str(Bcount)+"</font> buffs in current scheme!<br><br>"
  320. if Bcount < MAX_SCHEME_BUFFS + MAX_SCHEME_DANCES:
  321. HTML += "<button value=\"Add buffs\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" manage_scheme_1 "+str(scheme)+" 1 x\" width=200 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  322. if Bcount > 0 :
  323. HTML += "<button value=\"Remove buffs\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" manage_scheme_2 "+str(scheme)+" 1 x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  324. HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_1 0 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  325. HTML += "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  326. HTML += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>"
  327. return HTML
  328.  
  329. def buildHtml(buffType):
  330. HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><br>"
  331. if FREE_BUFFS == True : HTML_MESSAGE += "All buffs are for <font color=\"LEVEL\">free</font>!"
  332. else :
  333. price = 0
  334. if buffType == "buff" : price = BUFF_PRICE
  335. if buffType == "resist" : price = RESIST_PRICE
  336. if buffType == "song" : price = SONG_PRICE
  337. if buffType == "dance" : price = DANCE_PRICE
  338. if buffType == "chant" : price = CHANT_PRICE
  339. if buffType == "others" : price = OTHERS_PRICE
  340. if buffType == "special" : price = SPECIAL_PRICE
  341. if buffType == "cubic" : price = CUBIC_PRICE
  342. HTML_MESSAGE += "All special buffs cost <font color=\"LEVEL\">"+str(price)+"</font> adena!"
  343. HTML_MESSAGE += "<table>"
  344. conn=L2DatabaseFactory.getInstance().getConnection()
  345. buffCount = 0; i = 0
  346. getList = conn.prepareStatement("SELECT * FROM buffer_buff_list WHERE buffType=\""+buffType+"\" AND canUse=1")
  347. rs=getList.executeQuery()
  348. while (rs.next()) :
  349. try : buffCount += 1
  350. except : buffCount = 0
  351. if buffCount == 0 : HTML_MESSAGE += "No buffs are available at this moment!<br>"
  352. else :
  353. availableBuffs = []
  354. getList = conn.prepareStatement("SELECT buffId,buffLevel FROM buffer_buff_list WHERE buffType=\""+buffType+"\" AND canUse=1 ORDER BY Buff_Class ASC, id")
  355. rs=getList.executeQuery()
  356. while (rs.next()) :
  357. try :
  358. bId = rs.getInt("buffId")
  359. bLevel = rs.getInt("buffLevel")
  360. bName = SkillTable.getInstance().getInfo(bId,bLevel).getName()
  361. bName = bName.replace(" ","+")
  362. availableBuffs += [bName+"_"+str(bId)+"_"+str(bLevel)]
  363. except: HTML_MESSAGE += "Error loading buff list...<br>"
  364. try : conn.close()
  365. except : pass
  366. avBuffs = len(availableBuffs)
  367. format = "0000"
  368. for avBuffs in availableBuffs :
  369. buff = avBuffs
  370. buff = buff.replace("_"," ")
  371. buffSplit = buff.split(" ")
  372. name = buffSplit[0]
  373. id = int(buffSplit[1])
  374. level = buffSplit[2]
  375. name = name.replace("+"," ")
  376. if id < 100 : format = "00"+str(id)
  377. elif id > 99 and id < 1000 : format = "0"+str(id)
  378. else :
  379. if id > 4698 and id < 4701 : format = "1331"
  380. elif id > 4701 and id < 4704 : format = "1332"
  381. else: format = str(id)
  382. i += 1
  383. HTML_MESSAGE += "<tr><td><img src=\"Icon.skill"+format+"\" width=32 height=32></td><td><button value=\""+name+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " giveBuffs "+str(id)+" "+str(level)+" "+buffType+"\" width=190 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
  384. HTML_MESSAGE += "</table><br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  385. HTML_MESSAGE += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>"
  386. return HTML_MESSAGE
  387.  
  388. def generateQuery(case,case2) :
  389. aa = 1; count = 0; qry = ""; buffTypes = []
  390. if ENABLE_BUFFS == True and case < MAX_SCHEME_BUFFS:
  391. count += 1
  392. buffTypes += ["\"buff\""]
  393. if ENABLE_RESIST == True and case < MAX_SCHEME_BUFFS:
  394. count += 1
  395. buffTypes += ["\"resist\""]
  396. if ENABLE_SONGS == True and case2 < MAX_SCHEME_DANCES:
  397. count += 1
  398. buffTypes += ["\"song\""]
  399. if ENABLE_DANCES == True and case2 < MAX_SCHEME_DANCES:
  400. count += 1
  401. buffTypes += ["\"dance\""]
  402. if ENABLE_CHANTS == True and case < MAX_SCHEME_BUFFS:
  403. count += 1
  404. buffTypes += ["\"chant\""]
  405. if ENABLE_OTHERS == True and case < MAX_SCHEME_BUFFS:
  406. count += 1
  407. buffTypes += ["\"others\""]
  408. if ENABLE_SPECIAL == True and case < MAX_SCHEME_BUFFS:
  409. count += 1
  410. buffTypes += ["\"special\""]
  411. while aa <= count :
  412. if aa == count : qry += buffTypes[aa-1]
  413. else : qry += buffTypes[aa-1]+","
  414. aa += 1
  415. return qry
  416.  
  417. def viewAllSchemeBuffs(scheme,page,action) :
  418. def getBuffCount(scheme) :
  419. count = 0; D_S_Count = 0; B_Count = 0
  420. conn=L2DatabaseFactory.getInstance().getConnection()
  421. rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id=\""+str(scheme)+"\"")
  422. action=rss.executeQuery()
  423. while (action.next()) :
  424. try :
  425. val = action.getInt("buff_class")
  426. count += 1
  427. if val == 1 or val == 2: D_S_Count += 1
  428. else: B_Count += 1
  429. except : count = 0; D_S_Count = 0 ; B_Count = 0
  430. res = str(count) + " " + str(B_Count) + " " + str(D_S_Count)
  431. try : conn.close()
  432. except : pass
  433. return res
  434. buffList = []
  435. conn=L2DatabaseFactory.getInstance().getConnection()
  436. count = 0; pc = 0; bll = 0; i = 0; buffsPerPage = 0; incPageCount = True; listOrder=""
  437. HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><br>"
  438. eventSplit = getBuffCount(scheme).split(" ")
  439. TOTAL_BUFF = int(eventSplit[0]); BUFF_COUNT = int(eventSplit[1]); DANCE_SONG = int(eventSplit[2])
  440. if action == "add" :
  441. HTML_MESSAGE += "You can add <font color=\"LEVEL\">"+str(MAX_SCHEME_BUFFS - BUFF_COUNT)+"</font> Buffs and <font color=\"LEVEL\">"+str(MAX_SCHEME_DANCES - DANCE_SONG)+"</font> Dances more!"
  442. QUERY = "SELECT * FROM buffer_buff_list WHERE buffType IN ("+ generateQuery(BUFF_COUNT,DANCE_SONG) + ") AND canUse=1 ORDER BY Buff_Class ASC, id"
  443. if action == "remove" :
  444. HTML_MESSAGE += "You have <font color=\"LEVEL\">"+str(BUFF_COUNT)+"</font> Buffs and <font color=\"LEVEL\">"+str(DANCE_SONG)+"</font> Dances"
  445. QUERY = "SELECT * FROM buffer_scheme_contents WHERE scheme_id="+str(scheme)+" ORDER BY Buff_Class ASC, id"
  446. getBuffCount = conn.prepareStatement(QUERY)
  447. rss = getBuffCount.executeQuery()
  448. while (rss.next()) :
  449. try :
  450. if action == "add" :
  451. name = SkillTable.getInstance().getInfo(rss.getInt("buffId"),rss.getInt("buffLevel")).getName()
  452. name = name.replace(" ","+")
  453. buffList += [name+"_"+str(rss.getInt("buffId"))+"_"+str(rss.getInt("buffLevel"))+"_"+str(page)]
  454. if action == "remove" :
  455. name = SkillTable.getInstance().getInfo(rss.getInt("skill_id"),rss.getInt("skill_level")).getName()
  456. name = name.replace(" ","+")
  457. buffList += [name+"_"+str(rss.getInt("skill_id"))+"_"+str(rss.getInt("skill_level"))+"_"+str(page)]
  458. count = count + 1
  459. except :
  460. buffList = []
  461. count = 0
  462. try : conn.close()
  463. except : pass
  464. HTML_MESSAGE += "<table border=\"0\"><tr>"
  465. buffsPerPage = 20
  466. while incPageCount == True: # generating page count
  467. if count < buffsPerPage : incPageCount = False
  468. else : count = count - buffsPerPage
  469. pc += 1
  470. ii = 1
  471. while ii <= pc :
  472. if pc > 5 :
  473. width = "25"
  474. pageName = "P"
  475. else :
  476. width = "50"
  477. pageName = "Page "
  478. if action == "add" : HTML_MESSAGE += "<td width=\""+width+"\"><button value=\""+pageName+""+str(ii)+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_1 "+str(scheme)+" "+str(ii)+" x\" width="+width+" height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
  479. if action == "remove" : HTML_MESSAGE += "<td width=\""+width+"\"><button value=\""+pageName+""+str(ii)+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " manage_scheme_2 "+str(scheme)+" "+str(ii)+" x\" width="+width+" height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
  480. ii += 1
  481. HTML_MESSAGE += "</tr></table>"
  482. value = ""; bll = len(buffList); j = 0; k=0
  483. if buffsPerPage*int(page) > bll : j = bll
  484. else : j = buffsPerPage*int(page)
  485. i = buffsPerPage*int(page)-buffsPerPage
  486. while i < j :
  487. value = buffList[i]
  488. value = value.replace("_"," ")
  489. extr = value.split(" ")
  490. name = extr[0]
  491. name = name.replace("+"," ")
  492. id = int(extr[1])
  493. level = extr[2]
  494. page = int(extr[3])
  495. if id < 100 : format = "00"+str(id)
  496. elif id > 99 and id < 1000 : format = "0"+str(id)
  497. else :
  498. if id > 4698 and id < 4701 : format = "1331"
  499. elif id > 4701 and id < 4704 : format = "1332"
  500. else: format = str(id)
  501. if action == "add":
  502. if isUsed(scheme,id,level) == False:
  503. if k % 2 != 0 : HTML_MESSAGE += "<table border=\"0\" bgcolor=333333>"
  504. else : HTML_MESSAGE += "<table border=\"0\" bgcolor=292929>"
  505. HTML_MESSAGE += "<tr><td width=\"35\"><img src=\"Icon.skill"+format+"\" width=32 height=32></td><td width=\"170\">"+name+"</td><td><button value=\"Add\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" add_buff "+str(scheme)+"_"+str(id)+"_"+str(level)+" "+str(page)+" "+str(TOTAL_BUFF)+"\" width=65 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
  506. HTML_MESSAGE += "</tr></table>"; k+=1
  507. if action == "remove":
  508. if k % 2 != 0 : HTML_MESSAGE += "<table border=\"0\" bgcolor=333333>"
  509. else : HTML_MESSAGE += "<table border=\"0\" bgcolor=292929>"
  510. HTML_MESSAGE += "<tr><td width=\"35\"><img src=\"Icon.skill"+format+"\" width=32 height=32></td><td width=\"170\">"+name+"</td><td><button value=\"Remove\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" remove_buff "+str(scheme)+"_"+str(id)+"_"+str(level)+" "+str(page)+" "+str(TOTAL_BUFF)+"\" width=65 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
  511. HTML_MESSAGE += "</table>"; k+=1
  512. i += 1
  513. HTML_MESSAGE += "<br><br><button value=\"Back\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" manage_scheme_select "+str(scheme)+" x x\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  514. HTML_MESSAGE += "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  515. HTML_MESSAGE += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>"
  516. return HTML_MESSAGE
  517.  
  518. def viewAllBuffTypes() :
  519. HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
  520. HTML_MESSAGE += "<font color=\"LEVEL\">[Buff management]</font><br>"
  521. if ENABLE_BUFFS == True :
  522. HTML_MESSAGE += "<button value=\"Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list buff Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  523. if ENABLE_RESIST == True :
  524. HTML_MESSAGE += "<button value=\"Resist Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list resist Resists 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  525. if ENABLE_SONGS == True :
  526. HTML_MESSAGE += "<button value=\"Songs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list song Songs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  527. if ENABLE_DANCES == True :
  528. HTML_MESSAGE += "<button value=\"Dances\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list dance Dances 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  529. if ENABLE_CHANTS == True :
  530. HTML_MESSAGE += "<button value=\"Chants\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list chant Chants 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  531. if ENABLE_SPECIAL == True :
  532. HTML_MESSAGE += "<button value=\"Special Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list special Special_Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  533. if ENABLE_OTHERS == True :
  534. HTML_MESSAGE += "<button value=\"Others Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list others Others_Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  535. if ENABLE_CUBIC == True :
  536. HTML_MESSAGE += "<button value=\"Cubics\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list cubic cubic_Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  537. if ENABLE_BUFF_SET == True :
  538. HTML_MESSAGE += "<button value=\"Buff Sets\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list set Buff_Sets 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>"
  539. HTML_MESSAGE += "<button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  540. HTML_MESSAGE += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>"
  541. return HTML_MESSAGE
  542.  
  543. def viewAllBuffs(type,typeName,page) :
  544. buffList = []
  545. conn=L2DatabaseFactory.getInstance().getConnection()
  546. count = 0; pc = 0; bll = 0; i = 0; buffsPerPage = 0; formula = 0 ; incPageCount = True ; listOrder=""
  547. HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
  548. typeName = typeName.replace("_"," ")
  549. if type == "set" : QUERY = "SELECT * FROM buffer_buff_list WHERE buffType IN ("+generateQuery(0,0)+") AND canUse=1"
  550. else : QUERY = "SELECT * FROM buffer_buff_list WHERE buffType=\""+type+"\""
  551. getBuffCount = conn.prepareStatement(QUERY)
  552. rss = getBuffCount.executeQuery()
  553. while (rss.next()) :
  554. try :
  555. name = SkillTable.getInstance().getInfo(rss.getInt("buffId"),rss.getInt("buffLevel")).getName()
  556. name = name.replace(" ","+")
  557. usable = rss.getString("canUse")
  558. forClass = rss.getString("forClass")
  559. skill_id = rss.getString("buffId")
  560. skill_level = rss.getString("buffLevel")
  561. buffList += [name+"_"+forClass+"_"+str(page)+"_"+usable+"_"+skill_id+"_"+skill_level]
  562. count = count + 1
  563. except :
  564. buffList = []
  565. count = 0
  566. try : conn.close()
  567. except : pass
  568. buffList.sort()
  569. HTML_MESSAGE += "<font color=\"LEVEL\">[Buff management - "+typeName+" - Page "+str(page)+"]</font><br><table border=\"0\"><tr>"
  570. if type == "set" : buffsPerPage = 12
  571. else : buffsPerPage = 20
  572. while incPageCount == True:
  573. if count < buffsPerPage : incPageCount = False
  574. else : count -= buffsPerPage
  575. pc += 1
  576. ii = 1
  577. typeName = typeName.replace(" ","_")
  578. while ii <= pc :
  579. if pc > 5 :
  580. width = "25"
  581. pageName = "P"
  582. else :
  583. width = "50"
  584. pageName = "Page "
  585. HTML_MESSAGE += "<td width=\""+width+"\"><button value=\""+pageName+""+str(ii)+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list "+type+" "+typeName+" "+str(ii)+"\" width="+width+" height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
  586. ii += 1
  587. HTML_MESSAGE += "</tr></table><br>"
  588. value = ""; bll = len(buffList); j = 0
  589. if buffsPerPage*int(page) > bll : j = bll
  590. else : j = buffsPerPage*int(page)
  591. i = buffsPerPage*int(page)-buffsPerPage
  592. while i < j :
  593. value = buffList[i]
  594. value = value.replace("_"," ")
  595. extr = value.split(" ")
  596. name = extr[0]
  597. name = name.replace("+"," ")
  598. forClass = int(extr[1])
  599. page = extr[2]
  600. usable = int(extr[3])
  601. skillPos = extr[4]+"_"+extr[5]
  602. if i % 2 != 0 : HTML_MESSAGE += "<table border=\"0\" bgcolor=333333>"
  603. else : HTML_MESSAGE += "<table border=\"0\" bgcolor=292929>"
  604. if type == "set" :
  605. if forClass == 0 :
  606. listOrder="List=\"Fighter;Mage;All;None;\""
  607. if forClass == 1 :
  608. listOrder="List=\"Mage;Fighter;All;None;\""
  609. if forClass == 2 :
  610. listOrder="List=\"All;Fighter;Mage;None;\""
  611. if forClass == 3 :
  612. listOrder="List=\"None;Fighter;Mage;All;\""
  613. HTML_MESSAGE += "<tr><td width=\"145\">"+name+"</td><td width=\"70\"><combobox var=\"newSet"+str(i)+"\" width=70 "+listOrder+"></td>"
  614. HTML_MESSAGE += "<td width=\"50\"><button value=\"Update\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " changeBuffSet "+str(skillPos)+" $newSet"+str(i)+" "+page+"\" width=50 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
  615. else :
  616. HTML_MESSAGE += "<tr><td width=\"170\">"+name+"</td><td width=\"80\">"
  617. if usable == 1 : HTML_MESSAGE += "<button value=\"Disable\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " editSelectedBuff "+skillPos+" 0-"+page+" "+type+"\" width=80 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
  618. elif usable == 0 : HTML_MESSAGE += "<button value=\"Enable\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " editSelectedBuff "+skillPos+" 1-"+page+" "+type+"\" width=80 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
  619. HTML_MESSAGE += "</table>"
  620. i += 1
  621. HTML_MESSAGE += "<br><br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect manage_buffs 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  622. HTML_MESSAGE += "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  623. HTML_MESSAGE += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>"
  624. return HTML_MESSAGE
  625.  
  626. def manageSelectedBuff(buffPosId,canUseBuff) :
  627. bpid = buffPosId.split("_")
  628. bId= bpid[0]
  629. bLvl= bpid[1]
  630. conn=L2DatabaseFactory.getInstance().getConnection()
  631. upd=conn.prepareStatement("UPDATE buffer_buff_list SET canUse=\""+canUseBuff+"\" WHERE buffId=\""+str(bId)+"\" AND buffLevel=\""+str(bLvl)+"\" LIMIT 1")
  632. try :
  633. upd.executeUpdate()
  634. upd.close()
  635. conn.close()
  636. except :
  637. try : conn.close()
  638. except : pass
  639.  
  640. def manageSelectedSet(id,newVal,opt3) :
  641. bpid = id.split("_")
  642. bId= bpid[0]
  643. bLvl= bpid[1]
  644. conn=L2DatabaseFactory.getInstance().getConnection()
  645. upd=conn.prepareStatement("UPDATE buffer_buff_list SET forClass=? WHERE buffId=? AND bufflevel=?")
  646. upd.setString(1, newVal)
  647. upd.setString(2, str(bId))
  648. upd.setString(3, str(bLvl))
  649. try :
  650. upd.executeUpdate()
  651. upd.close()
  652. conn.close()
  653. except :
  654. try : conn.close()
  655. except : pass
  656. return viewAllBuffs("set","Buff Sets",str(opt3))
  657.  
  658. def addTimeout(gaugeColor,amount,offset) :
  659. endtime = int((System.currentTimeMillis() + (amount * 1000))/1000)
  660. st.set("blockUntilTime",str(endtime))
  661. st.getPlayer().sendPacket(SetupGauge(gaugeColor, amount * 1000 + offset))
  662.  
  663. def heal(case) :
  664. if case == 0:
  665. st.getPlayer().getStatus().setCurrentHp(st.getPlayer().getStat().getMaxHp())
  666. st.getPlayer().getStatus().setCurrentMp(st.getPlayer().getStat().getMaxMp())
  667. st.getPlayer().getStatus().setCurrentCp(st.getPlayer().getStat().getMaxCp())
  668. if case == 1 and st.player.getPet() != None :
  669. st.player.getPet().getStatus().setCurrentHp(st.player.getPet().getStat().getMaxHp())
  670. st.player.getPet().getStatus().setCurrentMp(st.player.getPet().getStat().getMaxMp())
  671. try:
  672. st.player.getPet().setCurrentFed(st.player.getPet().getMaxFed())
  673. st.player.sendPacket(SetSummonRemainTime(st.player.getPet().getMaxFed(), st.player.getPet().getCurrentFed()))
  674. except:
  675. try:
  676. st.player.getPet().decTimeRemaining(st.player.getPet().getTimeRemaining() - st.player.getPet().getTotalLifeTime())
  677. st.player.sendPacket(SetSummonRemainTime(st.player.getPet().getTotalLifeTime(), st.player.getPet().getTimeRemaining()))
  678. except: pass
  679. eventSplit = event.split(" ")
  680. event = eventSplit[0]
  681. eventParam1 = eventSplit[1]
  682. eventParam2 = eventSplit[2]
  683. eventParam3 = eventSplit[3]
  684.  
  685. if event == "reloadscript":
  686. if eventParam1 == "1": return ReloadConfig(st)
  687. if eventParam1 == "0": return rebuildMainHtml(st)
  688.  
  689. if event == "redirect" :
  690. if eventParam1 == "main" : return rebuildMainHtml(st)
  691. if eventParam1 == "manage_buffs" : return viewAllBuffTypes()
  692.  
  693. if event == "buffpet" :
  694. if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime") :
  695. st.set("Pet-On-Off",eventParam1)
  696. if TIME_OUT == True: addTimeout(3,TIME_OUT_TIME/2,600)
  697. return rebuildMainHtml(st)
  698.  
  699. if event == "create" :
  700. con=L2DatabaseFactory.getInstance().getConnection()
  701. param = eventParam1.replace("."," ")
  702. if param == "no_name" :
  703. return showText(st,"Info","Please, enter the scheme name!","True","Return","main")
  704. else :
  705. ins = con.prepareStatement("INSERT INTO buffer_scheme_list (player_id,scheme_name) VALUES (?,?)")
  706. ins.setString(1, str(st.player.getObjectId()))
  707. ins.setString(2, param)
  708. try :
  709. ins.executeUpdate()
  710. ins.close()
  711. con.close()
  712. except : pass
  713. return rebuildMainHtml(st)
  714.  
  715. if event == "delete" :
  716. conn=L2DatabaseFactory.getInstance().getConnection()
  717. rem=conn.prepareStatement("DELETE FROM buffer_scheme_list WHERE id=? LIMIT 1")
  718. rem.setString(1, eventParam1)
  719. try : rem.executeUpdate()
  720. except : pass
  721. rem=conn.prepareStatement("DELETE FROM buffer_scheme_contents WHERE scheme_id=?")
  722. rem.setString(1, eventParam1)
  723. try :
  724. rem.executeUpdate()
  725. rem.close()
  726. conn.close()
  727. except :
  728. try : conn.close()
  729. except : pass
  730. return rebuildMainHtml(st)
  731.  
  732. if event == "delete_c" :
  733. HTML = HTML_MESSAGE = "<html><head><title>"+TITLE_NAME+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>Do you really want to delete '"+eventParam2+"' scheme?<br><br>"
  734. HTML += "<button value=\"Yes\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" delete "+eventParam1+" x x\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  735. HTML += "<button value=\"No\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" delete_1 x x x\" width=50 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  736. HTML += "<br><font color=\"303030\">"+TITLE_NAME+"</font></center></body></html>"
  737. return HTML
  738.  
  739. if event == "create_1" : return createScheme()
  740.  
  741. if event == "edit_1" : return editScheme()
  742.  
  743. if event == "delete_1" : return deleteScheme()
  744.  
  745. if event == "manage_scheme_1" : return viewAllSchemeBuffs(eventParam1,eventParam2,"add")
  746.  
  747. if event == "manage_scheme_2" : return viewAllSchemeBuffs(eventParam1,eventParam2,"remove")
  748.  
  749. if event == "manage_scheme_select" : return getOptionList(eventParam1)
  750.  
  751. if event == "remove_buff" :
  752. event = eventParam1.split("_")
  753. scheme = event[0]
  754. skill = event[1]
  755. level = event[2]
  756. con=L2DatabaseFactory.getInstance().getConnection()
  757. rem=con.prepareStatement("DELETE FROM buffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1")
  758. rem.setString(1, scheme)
  759. rem.setString(2, skill)
  760. rem.setString(3, level)
  761. try : rem.executeUpdate()
  762. except : pass
  763. temp=int(eventParam3) - 1
  764. if temp <= 0 : HTML = getOptionList(scheme)
  765. else : HTML = viewAllSchemeBuffs(scheme,eventParam2,"remove")
  766. return HTML
  767.  
  768. if event == "add_buff" :
  769. event = eventParam1.split("_")
  770. scheme = event[0]
  771. skill = event[1]
  772. level = event[2]
  773. idbuffclass = getclassbuff(skill)
  774. con=L2DatabaseFactory.getInstance().getConnection()
  775. ins = con.prepareStatement("INSERT INTO buffer_scheme_contents (scheme_id,skill_id,skill_level,buff_class) VALUES (?,?,?,?)")
  776. ins.setString(1, str(scheme))
  777. ins.setString(2, str(skill))
  778. ins.setString(3, str(level))
  779. ins.setString(4, str(idbuffclass))
  780. try :
  781. ins.executeUpdate()
  782. ins.close()
  783. con.close()
  784. except : pass
  785. temp = int(eventParam3) + 1
  786. if temp >= MAX_SCHEME_BUFFS + MAX_SCHEME_DANCES : HTML = getOptionList(scheme)
  787. else : HTML = viewAllSchemeBuffs(scheme,eventParam2,"add")
  788. return HTML
  789.  
  790. if event == "edit_buff_list" :
  791. return viewAllBuffs(eventParam1,eventParam2,eventParam3)
  792.  
  793. if event == "changeBuffSet" :
  794. eventParam2 = eventParam2.replace("Fighter","0")
  795. eventParam2 = eventParam2.replace("Mage","1")
  796. eventParam2 = eventParam2.replace("All","2")
  797. eventParam2 = eventParam2.replace("None","3")
  798. return manageSelectedSet(eventParam1,eventParam2,eventParam3)
  799.  
  800. if event == "editSelectedBuff" :
  801. eventParam2 = eventParam2.replace("-"," ")
  802. split = eventParam2.split(" ")
  803. action = split[0]
  804. page = split[1]
  805. manageSelectedBuff(eventParam1,action)
  806. if eventParam3 == "buff" : typeName = "Buffs"
  807. if eventParam3 == "resist" : typeName = "Resists"
  808. if eventParam3 == "song" : typeName = "Songs"
  809. if eventParam3 == "dance" : typeName = "Dances"
  810. if eventParam3 == "chant" : typeName = "Chants"
  811. if eventParam3 == "others" : typeName = "Others_Buffs"
  812. if eventParam3 == "special" : typeName = "Special_Buffs"
  813. if eventParam3 == "cubic" : typeName = "Cubics"
  814. return viewAllBuffs(eventParam3,typeName,page)
  815.  
  816. if event == "viewSelectedConfig" : return viewSelectedConfig(eventParam1,eventParam2)
  817.  
  818. if event == "changeConfig" : return updateConfigValue(eventParam1,eventParam2,eventParam3)
  819.  
  820. if event == "redirect" :
  821. if eventParam1 == "view_buffs" : return buildHtml("buff")
  822. if eventParam1 == "view_resists" : return buildHtml("resist")
  823. if eventParam1 == "view_songs" : return buildHtml("song")
  824. if eventParam1 == "view_dances" : return buildHtml("dance")
  825. if eventParam1 == "view_chants" : return buildHtml("chant")
  826. if eventParam1 == "view_others" : return buildHtml("others")
  827. if eventParam1 == "view_special" : return buildHtml("special")
  828. if eventParam1 == "view_cubic" : return buildHtml("cubic")
  829.  
  830. if event == "heal" :
  831. if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime"):
  832. if st.getQuestItemsCount(CONSUMABLE_ID) < HEAL_PRICE :
  833. return showText(st,"Sorry","You don't have the enough items:<br>You need: <font color =\"LEVEL\">"+str(HEAL_PRICE)+" "+str(getitemname(st,CONSUMABLE_ID))+"!","False",0,0)
  834. else :
  835. if getpetbuff == 1 :
  836. if st.player.getPet() != None : heal(getpetbuff)
  837. else: return showText(st,"Info","You can't use the Pet's options.<br>Summon your pet first!","False","Return","main")
  838. else : heal(getpetbuff)
  839. st.takeItems(CONSUMABLE_ID,HEAL_PRICE)
  840. if TIME_OUT == True: addTimeout(1,TIME_OUT_TIME/2,600)
  841. return rebuildMainHtml(st)
  842. return rebuildMainHtml(st)
  843.  
  844. if event == "removeBuffs" :
  845. if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime"):
  846. if st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_REMOVE_PRICE :
  847. return showText(st,"Sorry","You don't have the enough items:<br>You need: <font color =\"LEVEL\">"+str(BUFF_REMOVE_PRICE)+" "+str(getitemname(st,CONSUMABLE_ID))+"!","False",0,0)
  848. else :
  849. if getpetbuff == 1 :
  850. if st.player.getPet() != None : st.player.getPet().stopAllEffects()
  851. else: return showText(st,"Info","You can't use the Pet's options.<br>Summon your pet first!","False","Return","main")
  852. else :
  853. st.getPlayer().stopAllEffects()
  854. if st.player.getCubics() != None:
  855. for cubic in st.player.getCubics().values():
  856. cubic.stopAction()
  857. st.player.delCubic(cubic.getId())
  858. st.takeItems(CONSUMABLE_ID,BUFF_REMOVE_PRICE)
  859. if TIME_OUT == True: addTimeout(2,TIME_OUT_TIME/2,600)
  860. return rebuildMainHtml(st)
  861. return rebuildMainHtml(st)
  862.  
  863. if event == "cast" :
  864. if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime") :
  865. buffs = []; levels = []; id = 0; level = 0
  866. conn=L2DatabaseFactory.getInstance().getConnection()
  867. rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id="+eventParam1+" ORDER BY id")
  868. action=rss.executeQuery()
  869. while (action.next()) :
  870. try :
  871. enabled = 1
  872. id = int(action.getString("skill_id"))
  873. level = int(action.getString("skill_level"))
  874. skillType = getBuffType(id)
  875. if skillType == "buff" :
  876. if ENABLE_BUFFS == True :
  877. if isEnabled(id,level) == "True" :
  878. buffs += [id]
  879. levels += [level]
  880. if skillType == "resist" :
  881. if ENABLE_RESIST == True :
  882. if isEnabled(id,level) == "True" :
  883. buffs += [id]
  884. levels += [level]
  885. if skillType == "song" :
  886. if ENABLE_SONGS == True :
  887. if isEnabled(id,level) == "True" :
  888. buffs += [id]
  889. levels += [level]
  890. if skillType == "dance" :
  891. if ENABLE_DANCES == True :
  892. if isEnabled(id,level) == "True" :
  893. buffs += [id]
  894. levels += [level]
  895. if skillType == "chant" :
  896. if ENABLE_CHANTS == True :
  897. if isEnabled(id,level) == "True" :
  898. buffs += [id]
  899. levels += [level]
  900. if skillType == "others" :
  901. if ENABLE_OTHERS == True :
  902. if isEnabled(id,level) == "True" :
  903. buffs += [id]
  904. levels += [level]
  905. if skillType == "special" :
  906. if ENABLE_SPECIAL == True :
  907. if isEnabled(id,level) == "True" :
  908. buffs += [id]
  909. levels += [level]
  910. except : print "Query error!"
  911. try : conn.close()
  912. except : pass
  913.  
  914. if len(buffs) == 0 : return viewAllSchemeBuffs(eventParam1,1,"add")
  915. else :
  916. if FREE_BUFFS == False :
  917. if st.getQuestItemsCount(CONSUMABLE_ID) < SCHEME_BUFF_PRICE :
  918. return showText(st,"Sorry","You don't have the enough items:<br>You need: <font color =\"LEVEL\">"+str(SCHEME_BUFF_PRICE)+" "+str(getitemname(st,CONSUMABLE_ID))+"!","False",0,0)
  919. i = 0
  920. while i <= len(buffs) - 1 :
  921. if getpetbuff == 0 : SkillTable.getInstance().getInfo(buffs[i],levels[i]).getEffects(st.player,st.player)
  922. else:
  923. if st.player.getPet() != None : SkillTable.getInstance().getInfo(buffs[i],levels[i]).getEffects(st.getPlayer().getPet(),st.getPlayer().getPet())
  924. else: return showText(st,"Info","You can't use the Pet's options.<br>Summon your pet first!","False","Return","main")
  925. i += 1
  926. heal(getpetbuff)
  927. st.takeItems(CONSUMABLE_ID,SCHEME_BUFF_PRICE)
  928. if TIME_OUT == True: addTimeout(3,TIME_OUT_TIME,600)
  929. return rebuildMainHtml(st)
  930. else : return rebuildMainHtml(st)
  931.  
  932. if event == "giveBuffs" :
  933. if eventParam3 == "buff" : cost = BUFF_PRICE
  934. if eventParam3 == "resist" : cost = RESIST_PRICE
  935. if eventParam3 == "song" : cost = SONG_PRICE
  936. if eventParam3 == "dance" : cost = DANCE_PRICE
  937. if eventParam3 == "chant" : cost = CHANT_PRICE
  938. if eventParam3 == "others" : cost = OTHERS_PRICE
  939. if eventParam3 == "special" : cost = SPECIAL_PRICE
  940. if eventParam3 == "cubic" : cost = CUBIC_PRICE
  941. if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime") :
  942. if FREE_BUFFS == False :
  943. if st.getQuestItemsCount(CONSUMABLE_ID) < cost :
  944. return showText(st,"Sorry","You don't have the enough items:<br>You need: <font color =\"LEVEL\">"+str(cost)+" "+str(getitemname(st,CONSUMABLE_ID))+"!","False",0,0)
  945. skill=SkillTable.getInstance().getInfo(int(eventParam1),int(eventParam2))
  946. if str(skill.getSkillType()) == "SUMMON":
  947. if st.getQuestItemsCount(skill.getItemConsumeId()) < skill.getItemConsume():
  948. return showText(st,"Sorry","You don't have the enough items:<br>You need: <font color =\"LEVEL\">"+str(skill.getItemConsume())+" "+str(getitemname(st,skill.getItemConsumeId()))+"!","False",0,0)
  949. if getpetbuff == 0 :
  950. if eventParam3 == "cubic" :
  951. if st.player.getCubics() != None:
  952. for cubic in st.player.getCubics().values():
  953. cubic.stopAction()
  954. st.player.delCubic(cubic.getId())
  955. st.getPlayer().useMagic(SkillTable.getInstance().getInfo(int(eventParam1),int(eventParam2)),False,False)
  956. else: SkillTable.getInstance().getInfo(int(eventParam1),int(eventParam2)).getEffects(st.getPlayer(),st.getPlayer())
  957. else:
  958. if eventParam3 == "cubic":
  959. if st.player.getCubics() != None:
  960. for cubic in st.player.getCubics().values():
  961. cubic.stopAction()
  962. st.player.delCubic(cubic.getId())
  963. st.getPlayer().useMagic(SkillTable.getInstance().getInfo(int(eventParam1),int(eventParam2)),False,False)
  964. else:
  965. if st.player.getPet() != None : SkillTable.getInstance().getInfo(int(eventParam1),int(eventParam2)).getEffects(st.getPlayer().getPet(),st.getPlayer().getPet())
  966. else: return showText(st,"Info","You can't use the Pet's options.<br>Summon your pet first!","False","Return","main")
  967. st.takeItems(CONSUMABLE_ID,cost)
  968. if TIME_OUT == True: addTimeout(3,TIME_OUT_TIME/10,600)
  969. return buildHtml(eventParam3)
  970. else : return buildHtml(eventParam3)
  971.  
  972. if event == "castBuffSet" :
  973. if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime") :
  974. if FREE_BUFFS == False :
  975. if st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_SET_PRICE :
  976. return showText(st,"Sorry","You don't have the enough items:<br>You need: <font color =\"LEVEL\">"+str(BUFF_SET_PRICE)+" "+str(getitemname(st,CONSUMABLE_ID))+"!","False",0,0)
  977. buff_sets=[]; i = 0; player_class = 3
  978. if st.getPlayer().isMageClass() : player_class = 1
  979. else : player_class = 0
  980. if getpetbuff == 0 :
  981. conn=L2DatabaseFactory.getInstance().getConnection()
  982. getSimilarNameCount = conn.prepareStatement("SELECT buffId,buffLevel FROM buffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC")
  983. getSimilarNameCount.setString(1, str(player_class))
  984. getSimilarNameCount.setString(2, "2")
  985. rss = getSimilarNameCount.executeQuery()
  986. while (rss.next()) :
  987. try :
  988. id = rss.getInt("buffId")
  989. lvl = rss.getInt("buffLevel")
  990. buff_sets += [id,lvl]
  991. except : buff_sets = []
  992. try: conn.close()
  993. except: pass
  994. while i <= len(buff_sets)-2 :
  995. SkillTable.getInstance().getInfo(buff_sets[i],buff_sets[i+1]).getEffects(st.getPlayer(),st.getPlayer())
  996. i += 2
  997. else:
  998. if st.player.getPet() != None :
  999. i = 0
  1000. conn=L2DatabaseFactory.getInstance().getConnection()
  1001. getSimilarNameCount = conn.prepareStatement("SELECT buffId,buffLevel FROM buffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC")
  1002. getSimilarNameCount.setString(1, "0")
  1003. getSimilarNameCount.setString(2, "2")
  1004. rss = getSimilarNameCount.executeQuery()
  1005. while (rss.next()) :
  1006. try :
  1007. id = rss.getInt("buffId")
  1008. lvl = rss.getInt("buffLevel")
  1009. buff_sets += [id,lvl]
  1010. except : buff_sets = []
  1011. try: conn.close()
  1012. except: pass
  1013. while i <= len(buff_sets)-2 :
  1014. SkillTable.getInstance().getInfo(buff_sets[i],buff_sets[i+1]).getEffects(st.getPlayer().getPet(),st.getPlayer().getPet())
  1015. i += 2
  1016. else: return showText(st,"Info","You can't use the Pet's options.<br>Summon your pet first!","False","Return","main")
  1017. heal(getpetbuff)
  1018. st.takeItems(CONSUMABLE_ID,BUFF_SET_PRICE)
  1019. if TIME_OUT == True: addTimeout(3,TIME_OUT_TIME,600)
  1020. return rebuildMainHtml(st)
  1021. else : return rebuildMainHtml(st)
  1022. return rebuildMainHtml(st)
  1023.  
  1024. def onFirstTalk (self,npc,player):
  1025. st = player.getQuestState(QUEST_LOADING_INFO)
  1026. if not st : st = self.newQuestState(player)
  1027. if player.isGM():
  1028. if SCRIPT_RELOAD == True: return reloadPanel(st)
  1029. else: return rebuildMainHtml(st)
  1030. elif int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime"):
  1031.  
  1032. if ENABLE_VIP_BUFFER == False or player.getAccessLevel().getLevel() == VIP_ACCESS_LEVEL and ENABLE_VIP_BUFFER == True:
  1033.  
  1034. if BUFF_WITH_KARMA == False and player.getKarma() > 0 :
  1035. return showText(st,"Info","You have too much <font color=\"FF0000\">karma!</font><br>Come back,<br>when you don't have any karma!","False","Return","main")
  1036.  
  1037. elif st.player.getLevel() < MIN_LEVEL :
  1038. return showText(st,"Info","Your level is too low!<br>You have to be at least level <font color\"LEVEL\">"+str(MIN_LEVEL)+"</font>,<br>to use my services!","False","Return","main")
  1039.  
  1040. elif st.player.getPvpFlag() > 0 :
  1041. return showText(st,"Info","You can't buff while you are <font color=\"800080\">flagged!</font><br>Wait some time and try again!","False","Return","main")
  1042.  
  1043. elif st.player.isInCombat() :
  1044. return showText(st,"Info","You can't buff while you are attacking!<br>Stop your fight and try again!","False","Return","main")
  1045.  
  1046. else: return rebuildMainHtml(st)
  1047.  
  1048. else: return showText(st,"Sorry","This buffer is only for VIP's!<br>Contact the administrator for more info!","False","Return","main")
  1049. else: return showText(st,"Sorry","You have to wait a while!<br>if you wish to use my services!","False","Return","main")
  1050.  
  1051.  
  1052. QUEST = Quest(QUEST_ID,QUEST_LOADING_INFO,QUEST_DESCRIPTION)
  1053. QUEST.addStartNpc(NPC_ID)
  1054. QUEST.addFirstTalkId(NPC_ID)
  1055. QUEST.addTalkId(NPC_ID)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement