Advertisement
Guest User

Untitled

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