Guest User

Untitled

a guest
Dec 18th, 2013
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 77.12 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 import Quest 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 L2ServitorInstance
  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 = "L2server Buffer"
  25. SCRIPT_RELOAD = True
  26. ENABLE_VIP_BUFFER = False
  27. VIP_ACCESS_LEVEL = 50                
  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 = False                    
  39. ENABLE_BUFF_REMOVE = True                
  40. ENABLE_BUFF_SET = False
  41. BUFF_WITH_KARMA = False                  
  42. FREE_BUFFS = False                      
  43. TIME_OUT = True          
  44. TIME_OUT_TIME = 10                    
  45. MIN_LEVEL = 1                          
  46. BUFF_REMOVE_PRICE = 50000                
  47. HEAL_PRICE = 50000                    
  48. BUFF_PRICE = 50000                    
  49. RESIST_PRICE = 50000                    
  50. SONG_PRICE = 50000                      
  51. DANCE_PRICE = 50000                      
  52. CHANT_PRICE = 10000                      
  53. OTHERS_PRICE = 50000                    
  54. SPECIAL_PRICE = 50000                  
  55. CUBIC_PRICE = 10000                    
  56. BUFF_SET_PRICE = 10000                
  57. SCHEME_BUFF_PRICE = 1250000            
  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\">Edited by Grind3R</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.         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.                 getSummonbuff = 0
  275.                 if st.getInt("Pet-On-Off") == 1: getSummonbuff = 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>You MUST seprerate new words with a dot (.)<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=200 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  280.                         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\">"
  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=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  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=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"                      
  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>Select a scheme that you would like to manage:<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=200 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  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=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  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>There are <font color=\"LEVEL\">"+str(Bcount)+"</font> buffs in current 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=200 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  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=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"                            
  323.                         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\">"
  324.                         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\">"
  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><br>"
  330.                         if FREE_BUFFS == True : HTML_MESSAGE += "<center>All buffs are for <font color=\"LEVEL\">free</font>!</center>"                
  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 += "<center>All special buffs cost <font color=\"LEVEL\">"+str(price)+"</font> adena!</center>"
  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 += "<center>No buffs are available at this moment!</center><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=235 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
  383.                                 HTML_MESSAGE += "</table><br><center><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\"></center>"
  384.                         HTML_MESSAGE += "<br><font color=\"303030\">"+TITLE_NAME+"</font></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><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 += "<center>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!</center>"
  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 += "<center>You have <font color=\"LEVEL\">"+str(BUFF_COUNT)+"</font> Buffs and <font color=\"LEVEL\">"+str(DANCE_SONG)+"</font> Dances</center>"
  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="+width+" height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></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="+width+" height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"                                
  479.                                 ii += 1
  480.                         HTML_MESSAGE += "</tr></center></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=333333>"
  503.                                                 else : HTML_MESSAGE += "<table border=\"0\" bgcolor=292929>"
  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=65 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
  505.                                                 HTML_MESSAGE += "</tr></table>"; k+=1
  506.                                 if action == "remove":
  507.                                         if k % 2 != 0 : HTML_MESSAGE += "<table border=\"0\" bgcolor=333333>"
  508.                                         else : HTML_MESSAGE += "<table border=\"0\" bgcolor=292929>"
  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=65 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
  510.                                         HTML_MESSAGE += "</table>"; k+=1
  511.                                 i += 1
  512.                         HTML_MESSAGE += "<br><br><center><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\"></center>"
  513.                         HTML_MESSAGE += "<center><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\"></center>"                        
  514.                         HTML_MESSAGE += "<br><center><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=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  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=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  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=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  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=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  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=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  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=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  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=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  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=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  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=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>"                    
  538.                         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\">"
  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=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></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=333333>"
  602.                                 else : HTML_MESSAGE += "<table border=\"0\" bgcolor=292929>"
  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=50 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></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=80 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
  617.                                         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>"
  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=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  621.                         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\">"                          
  622.                         HTML_MESSAGE += "<br><font color=\"303030\">"+TITLE_NAME+"</font></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.getSummon() != None :
  668.                                 st.player.getSummon().getStatus().setCurrentHp(st.player.getSummon().getStat().getMaxHp())
  669.                                 st.player.getSummon().getStatus().setCurrentMp(st.player.getSummon().getStat().getMaxMp())
  670.                                 try:
  671.                                         st.player.getSummon().setCurrentFed(st.player.getSummon().getMaxFed())
  672.                                         st.player.sendPacket(SetSummonRemainTime(st.player.getSummon().getMaxFed(), st.player.getSummon().getCurrentFed()))
  673.                                 except:
  674.                                         try:
  675.                                                 st.player.getSummon().decTimeRemaining(st.player.getSummon().getTimeRemaining() - st.player.getSummon().getTotalLifeTime())
  676.                                                 st.player.sendPacket(SetSummonRemainTime(st.player.getSummon().getTotalLifeTime(), st.player.getSummon().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","Please, enter the scheme name!","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>Do you really want to delete '"+eventParam2+"' scheme?<br><br>"
  733.                         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\">"
  734.                         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\">"                            
  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 :
  761.                                 rem.executeUpdate()
  762.                                 rem.close()
  763.                                 con.close()
  764.                         except : pass
  765.                         temp=int(eventParam3) - 1
  766.                         if temp <= 0 : HTML = getOptionList(scheme)
  767.                         else : HTML = viewAllSchemeBuffs(scheme,eventParam2,"remove")
  768.                         return HTML
  769.                        
  770.                 if event == "add_buff" :
  771.                         event = eventParam1.split("_")
  772.                         scheme = event[0]
  773.                         skill = event[1]
  774.                         level = event[2]
  775.                         idbuffclass = getclassbuff(skill)
  776.                         con=L2DatabaseFactory.getInstance().getConnection()
  777.                         ins = con.prepareStatement("INSERT INTO buffer_scheme_contents (scheme_id,skill_id,skill_level,buff_class) VALUES (?,?,?,?)")
  778.                         ins.setString(1, str(scheme))
  779.                         ins.setString(2, str(skill))
  780.                         ins.setString(3, str(level))
  781.                         ins.setString(4, str(idbuffclass))
  782.                         try :
  783.                                 ins.executeUpdate()
  784.                                 ins.close()
  785.                                 con.close()
  786.                         except : pass
  787.                         temp = int(eventParam3) + 1    
  788.                         if temp >= MAX_SCHEME_BUFFS + MAX_SCHEME_DANCES : HTML = getOptionList(scheme)
  789.                         else : HTML = viewAllSchemeBuffs(scheme,eventParam2,"add")
  790.                         return HTML
  791.                
  792.                 if event == "edit_buff_list" :
  793.                         return viewAllBuffs(eventParam1,eventParam2,eventParam3)
  794.                
  795.                 if event == "changeBuffSet" :
  796.                         eventParam2 = eventParam2.replace("Fighter","0")
  797.                         eventParam2 = eventParam2.replace("Mage","1")
  798.                         eventParam2 = eventParam2.replace("All","2")
  799.                         eventParam2 = eventParam2.replace("None","3")
  800.                         return manageSelectedSet(eventParam1,eventParam2,eventParam3)
  801.                                
  802.                 if event == "editSelectedBuff" :
  803.                         eventParam2 = eventParam2.replace("-"," ")
  804.                         split = eventParam2.split(" ")
  805.                         action = split[0]
  806.                         page = split[1]        
  807.                         manageSelectedBuff(eventParam1,action)
  808.                         if eventParam3 == "buff" : typeName = "Buffs"
  809.                         if eventParam3 == "resist" : typeName = "Resists"
  810.                         if eventParam3 == "song" : typeName = "Songs"
  811.                         if eventParam3 == "dance" : typeName = "Dances"
  812.                         if eventParam3 == "chant" : typeName = "Chants"
  813.                         if eventParam3 == "others" : typeName = "Others_Buffs"
  814.                         if eventParam3 == "special" : typeName = "Special_Buffs"
  815.                         if eventParam3 == "cubic" : typeName = "Cubics"
  816.                         return viewAllBuffs(eventParam3,typeName,page)
  817.                                
  818.                 if event == "viewSelectedConfig" : return viewSelectedConfig(eventParam1,eventParam2)
  819.                                        
  820.                 if event == "changeConfig" : return updateConfigValue(eventParam1,eventParam2,eventParam3)
  821.                
  822.                 if event == "redirect" :
  823.                         if eventParam1 == "view_buffs" : return buildHtml("buff")
  824.                         if eventParam1 == "view_resists" : return buildHtml("resist")
  825.                         if eventParam1 == "view_songs" : return buildHtml("song")
  826.                         if eventParam1 == "view_dances" : return buildHtml("dance")
  827.                         if eventParam1 == "view_chants" : return buildHtml("chant")
  828.                         if eventParam1 == "view_others" : return buildHtml("others")
  829.                         if eventParam1 == "view_special" : return buildHtml("special")
  830.                         if eventParam1 == "view_cubic" : return buildHtml("cubic")
  831.  
  832.                 if event == "heal" :
  833.                         if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime"):
  834.                                 if st.getQuestItemsCount(CONSUMABLE_ID) < HEAL_PRICE  :
  835.                                         return showText(st,"Sorry","You don't have the enough adena"+"!","False",0,0)
  836.                                 else :
  837.                                         if getSummonbuff == 1 :
  838.                                                 if st.player.getSummon() != None : heal(getSummonbuff)
  839.                                                 else: return showText(st,"Info","You can't use the Pet's options.<br>Summon your pet first!","False","Return","main")
  840.                                         else : heal(getSummonbuff)                            
  841.                                         st.takeItems(CONSUMABLE_ID,HEAL_PRICE)                                
  842.                                         if TIME_OUT == True: addTimeout(1,TIME_OUT_TIME/2,600)
  843.                                         return rebuildMainHtml(st)
  844.                         return rebuildMainHtml(st)
  845.                        
  846.                 if event == "removeBuffs" :
  847.                         if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime"):                                        
  848.                                 if st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_REMOVE_PRICE :
  849.                                         return showText(st,"Sorry","You don't have the enough adena"+"!","False",0,0)
  850.                                 else :
  851.                                         if getSummonbuff == 1 :
  852.                                                 if st.player.getSummon() != None : st.player.getSummon().stopAllEffects()
  853.                                                 else: return showText(st,"Info","You can't use the Pet's options.<br>Summon your pet first!","False","Return","main")
  854.                                         else :
  855.                                                 st.getPlayer().stopAllEffects()
  856.                                                 if st.player.getCubics() != None:
  857.                                                         for cubic in st.player.getCubics().values():  
  858.                                                                 cubic.stopAction()
  859.                                                                 st.player.delCubic(cubic.getId())  
  860.                                         st.takeItems(CONSUMABLE_ID,BUFF_REMOVE_PRICE)
  861.                                         if TIME_OUT == True: addTimeout(2,TIME_OUT_TIME/2,600)
  862.                                         return rebuildMainHtml(st)
  863.                         return rebuildMainHtml(st)
  864.  
  865.                 if event == "cast" :
  866.                         if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime") :
  867.                                 buffs = []; levels = []; id = 0; level = 0
  868.                                 conn=L2DatabaseFactory.getInstance().getConnection()
  869.                                 rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id="+eventParam1+" ORDER BY id")
  870.                                 action=rss.executeQuery()
  871.                                 while (action.next()) :
  872.                                         try :
  873.                                                 enabled = 1
  874.                                                 id = int(action.getString("skill_id"))
  875.                                                 level = int(action.getString("skill_level"))
  876.                                                 skillType = getBuffType(id)
  877.                                                 if skillType == "buff" :
  878.                                                         if ENABLE_BUFFS == True :
  879.                                                                 if isEnabled(id,level) == "True" :
  880.                                                                         buffs += [id]
  881.                                                                         levels += [level]
  882.                                                 if skillType == "resist" :
  883.                                                         if ENABLE_RESIST == True :
  884.                                                                 if isEnabled(id,level) == "True" :
  885.                                                                         buffs += [id]
  886.                                                                         levels += [level]
  887.                                                 if skillType == "song" :
  888.                                                         if ENABLE_SONGS == True :
  889.                                                                 if isEnabled(id,level) == "True" :
  890.                                                                         buffs += [id]
  891.                                                                         levels += [level]
  892.                                                 if skillType == "dance" :
  893.                                                         if ENABLE_DANCES == True :
  894.                                                                 if isEnabled(id,level) == "True" :
  895.                                                                         buffs += [id]
  896.                                                                         levels += [level]
  897.                                                 if skillType == "chant" :
  898.                                                         if ENABLE_CHANTS == True :
  899.                                                                 if isEnabled(id,level) == "True" :
  900.                                                                         buffs += [id]
  901.                                                                         levels += [level]
  902.                                                 if skillType == "others" :
  903.                                                         if ENABLE_OTHERS == True :
  904.                                                                 if isEnabled(id,level) == "True" :
  905.                                                                         buffs += [id]
  906.                                                                         levels += [level]
  907.                                                 if skillType == "special" :
  908.                                                         if ENABLE_SPECIAL == True :
  909.                                                                 if isEnabled(id,level) == "True" :
  910.                                                                         buffs += [id]
  911.                                                                         levels += [level]
  912.                                         except : print "Query error!"
  913.                                 try : conn.close()
  914.                                 except : pass
  915.                                        
  916.                                 if len(buffs) == 0 : return viewAllSchemeBuffs(eventParam1,1,"add")
  917.                                 else :
  918.                                         if FREE_BUFFS == False :
  919.                                                 if st.getQuestItemsCount(CONSUMABLE_ID) < SCHEME_BUFF_PRICE :
  920.                                                         return showText(st,"Sorry","You don't have the enough adena"+"!","False",0,0)
  921.                                         i = 0
  922.                                         while i <= len(buffs) - 1 :
  923.                                                 if getSummonbuff == 0 : SkillTable.getInstance().getInfo(buffs[i],levels[i]).getEffects(st.player,st.player)
  924.                                                 else:
  925.                                                         if st.player.getSummon() != None : SkillTable.getInstance().getInfo(buffs[i],levels[i]).getEffects(st.getPlayer().getSummon(),st.getPlayer().getSummon())
  926.                                                         else: return showText(st,"Info","You can't use the Pet's options.<br>Summon your pet first!","False","Return","main")
  927.                                                 i += 1
  928.                                         heal(getSummonbuff)
  929.                                         st.takeItems(CONSUMABLE_ID,SCHEME_BUFF_PRICE)
  930.                                         if TIME_OUT == True: addTimeout(3,TIME_OUT_TIME,600)
  931.                                         return rebuildMainHtml(st)
  932.                         else : return rebuildMainHtml(st)
  933.  
  934.                 if event == "giveBuffs" :
  935.                         if eventParam3 == "buff" : cost = BUFF_PRICE
  936.                         if eventParam3 == "resist" : cost = RESIST_PRICE
  937.                         if eventParam3 == "song" : cost = SONG_PRICE
  938.                         if eventParam3 == "dance" : cost = DANCE_PRICE
  939.                         if eventParam3 == "chant" : cost = CHANT_PRICE
  940.                         if eventParam3 == "others" : cost = OTHERS_PRICE
  941.                         if eventParam3 == "special" : cost = SPECIAL_PRICE    
  942.                         if eventParam3 == "cubic" : cost = CUBIC_PRICE                
  943.                         if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime") :
  944.                                 if FREE_BUFFS == False :
  945.                                         if st.getQuestItemsCount(CONSUMABLE_ID) < cost :
  946.                                                 return showText(st,"Sorry","You don't have the enough adena"+"!","False",0,0)
  947.                                 skill=SkillTable.getInstance().getInfo(int(eventParam1),int(eventParam2))
  948.                                 if str(skill.getSkillType()) == "SUMMON":
  949.                                         if st.getQuestItemsCount(skill.getItemConsumeId()) < skill.getItemConsume():
  950.                                                 return showText(st,"Sorry","You don't have the enough adena"+"!","False",0,0)
  951.                                 if getSummonbuff == 0 :
  952.                                         if eventParam3 == "cubic" :
  953.                                                 if st.player.getCubics() != None:
  954.                                                         for cubic in st.player.getCubics().values():  
  955.                                                                 cubic.stopAction()
  956.                                                                 st.player.delCubic(cubic.getId())
  957.                                                 st.getPlayer().useMagic(SkillTable.getInstance().getInfo(int(eventParam1),int(eventParam2)),False,False)
  958.                                         else: SkillTable.getInstance().getInfo(int(eventParam1),int(eventParam2)).getEffects(st.getPlayer(),st.getPlayer())
  959.                                 else:
  960.                                         if eventParam3 == "cubic":
  961.                                                 if st.player.getCubics() != None:
  962.                                                         for cubic in st.player.getCubics().values():  
  963.                                                                 cubic.stopAction()
  964.                                                                 st.player.delCubic(cubic.getId())
  965.                                                 st.getPlayer().useMagic(SkillTable.getInstance().getInfo(int(eventParam1),int(eventParam2)),False,False)
  966.                                         else:
  967.                                                 if st.player.getSummon() != None : SkillTable.getInstance().getInfo(int(eventParam1),int(eventParam2)).getEffects(st.getPlayer().getSummon(),st.getPlayer().getSummon())
  968.                                                 else: return showText(st,"Info","You can't use the Pet's options.<br>Summon your pet first!","False","Return","main")
  969.                                 st.takeItems(CONSUMABLE_ID,cost)
  970.                                 if TIME_OUT == True: addTimeout(3,TIME_OUT_TIME/10,600)
  971.                                 return buildHtml(eventParam3)
  972.                         else : return buildHtml(eventParam3)
  973.                                
  974.                 if event == "castBuffSet" :
  975.                         if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime") :
  976.                                 if FREE_BUFFS == False :
  977.                                         if st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_SET_PRICE :
  978.                                                 return showText(st,"Sorry","You don't have the enough adena"+"!","False",0,0)
  979.                                 buff_sets=[]; i = 0; player_class = 3
  980.                                 if st.getPlayer().isMageClass() : player_class = 1
  981.                                 else : player_class = 0
  982.                                 if getSummonbuff == 0 :
  983.                                         conn=L2DatabaseFactory.getInstance().getConnection()
  984.                                         getSimilarNameCount = conn.prepareStatement("SELECT buffId,buffLevel FROM buffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC")
  985.                                         getSimilarNameCount.setString(1, str(player_class))
  986.                                         getSimilarNameCount.setString(2, "2")
  987.                                         rss = getSimilarNameCount.executeQuery()
  988.                                         while (rss.next()) :
  989.                                                 try :
  990.                                                         id = rss.getInt("buffId")
  991.                                                         lvl = rss.getInt("buffLevel")
  992.                                                         buff_sets += [id,lvl]
  993.                                                 except : buff_sets = []
  994.                                         try: conn.close()
  995.                                         except: pass
  996.                                         while i <= len(buff_sets)-2 :
  997.                                                 SkillTable.getInstance().getInfo(buff_sets[i],buff_sets[i+1]).getEffects(st.getPlayer(),st.getPlayer())
  998.                                                 i += 2
  999.                                 else:
  1000.                                         if st.player.getSummon() != None :
  1001.                                                 i = 0
  1002.                                                 conn=L2DatabaseFactory.getInstance().getConnection()
  1003.                                                 getSimilarNameCount = conn.prepareStatement("SELECT buffId,buffLevel FROM buffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC")
  1004.                                                 getSimilarNameCount.setString(1, "0")
  1005.                                                 getSimilarNameCount.setString(2, "2")
  1006.                                                 rss = getSimilarNameCount.executeQuery()
  1007.                                                 while (rss.next()) :
  1008.                                                         try :
  1009.                                                                 id = rss.getInt("buffId")
  1010.                                                                 lvl = rss.getInt("buffLevel")
  1011.                                                                 buff_sets += [id,lvl]
  1012.                                                         except : buff_sets = []
  1013.                                                 try: conn.close()
  1014.                                                 except: pass
  1015.                                                 while i <= len(buff_sets)-2 :
  1016.                                                         SkillTable.getInstance().getInfo(buff_sets[i],buff_sets[i+1]).getEffects(st.getPlayer().getSummon(),st.getPlayer().getSummon())
  1017.                                                         i += 2
  1018.                                         else: return showText(st,"Info","You can't use the Pet's options.<br>Summon your pet first!","False","Return","main")
  1019.                                 heal(getSummonbuff)
  1020.                                 st.takeItems(CONSUMABLE_ID,BUFF_SET_PRICE)
  1021.                                 if TIME_OUT == True: addTimeout(3,TIME_OUT_TIME,600)
  1022.                                 return rebuildMainHtml(st)
  1023.                         else : return rebuildMainHtml(st)
  1024.                 return rebuildMainHtml(st)
  1025.  
  1026.         def onFirstTalk (self,npc,player):
  1027.                 st = player.getQuestState(QUEST_LOADING_INFO)
  1028.                 if not st : st = self.newQuestState(player)
  1029.                 if player.isGM():
  1030.                         if SCRIPT_RELOAD == True: return reloadPanel(st)
  1031.                         else: return rebuildMainHtml(st)
  1032.                 elif int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime"):
  1033.  
  1034.                         if ENABLE_VIP_BUFFER == False or player.getAccessLevel().getLevel() == VIP_ACCESS_LEVEL and ENABLE_VIP_BUFFER == True:
  1035.  
  1036.                                 if BUFF_WITH_KARMA == False and player.getKarma() > 0 :
  1037.                                         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")
  1038.  
  1039.                                 elif st.player.getLevel() < MIN_LEVEL :
  1040.                                         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")
  1041.  
  1042.                                 elif st.player.isInCombat() :
  1043.                                         return showText(st,"Info","You can't buff while you are attacking!<br>Stop your fight and try again!","False","Return","main")
  1044.  
  1045.                                 else: return rebuildMainHtml(st)
  1046.  
  1047.                         else: return showText(st,"Sorry","This buffer is only for VIP's!<br>Contact the administrator for more info!","False","Return","main")
  1048.                 else: return showText(st,"Sorry","You have to wait a while!<br>if you wish to use my services!","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