Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 57.15 KB | None | 0 0
  1. import sys
  2. from com.l2jserver import Config
  3. from com.l2jserver import L2DatabaseFactory
  4. from com.l2jserver.gameserver.datatables import ItemTable
  5. from com.l2jserver.gameserver.datatables import SkillTable
  6. from com.l2jserver.gameserver.model.actor.instance import L2PcInstance
  7. from com.l2jserver.gameserver.model.olympiad import Olympiad
  8. from com.l2jserver.gameserver.model.quest import QuestState
  9. from com.l2jserver.gameserver.model.quest import State
  10. from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest
  11. from com.l2jserver.gameserver.model.zone import L2ZoneType
  12. from com.l2jserver.gameserver.network.serverpackets import SetupGauge
  13. from java.lang import System
  14. from java.util import Iterator
  15.  
  16. QUEST_ID = 55555
  17. QUEST_NAME = "NPCBuffer"
  18. QUEST_DESCRIPTION = "custom"
  19. QUEST_LOADING_INFO = str(QUEST_ID)+"_"+QUEST_NAME
  20. NPC_ID = 65003
  21.  
  22. # ============================================================ #
  23. # GLOBAL FUNCTIONS #
  24.  
  25. def getBuffType(id) : # gets buff type (depends of the ID)
  26. conn=L2DatabaseFactory.getInstance().getConnection()
  27. act = conn.prepareStatement("SELECT buffType FROM buffer_buff_list WHERE buffId=? LIMIT 1")
  28. act.setInt(1, int(id))
  29. rs=act.executeQuery()
  30. if rs :
  31. rs.next()
  32. try :
  33. val = rs.getString("buffType")
  34. conn.close()
  35. except :
  36. val = "none"
  37. try :
  38. conn.close()
  39. except:
  40. pass
  41. else :
  42. val = "none"
  43. return val
  44.  
  45. def isEnabled(id,level) : # check if buff is enabled
  46. val = ""
  47. conn=L2DatabaseFactory.getInstance().getConnection()
  48. act = conn.prepareStatement("SELECT canUse FROM buffer_buff_list WHERE buffId=? AND buffLevel=? LIMIT 1")
  49. act.setInt(1, int(id))
  50. act.setInt(2, int(level))
  51. rs=act.executeQuery()
  52. if rs :
  53. rs.next()
  54. try :
  55. val = rs.getString("canUse")
  56. conn.close()
  57. except :
  58. val = "0"
  59. try :
  60. conn.close()
  61. except:
  62. pass
  63. else :
  64. val = "0"
  65.  
  66. if val == "1" :
  67. val = "True"
  68. if val == "0" :
  69. val = "False"
  70. return val
  71.  
  72. def isUsed(scheme,id,level) : # check if skill is already in the scheme list
  73. count = 0
  74. used = False
  75. conn=L2DatabaseFactory.getInstance().getConnection()
  76. rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id=\""+str(scheme)+"\" AND skill_id=\""+str(id)+"\" AND skill_level=\""+str(level)+"\"")
  77. action=rss.executeQuery()
  78. while (action.next()) :
  79. try :
  80. count = count + 1
  81. except :
  82. count = 0
  83. try :
  84. conn.close()
  85. except :
  86. pass
  87. if count > 0 :
  88. used = True
  89. else :
  90. used = False
  91. return used
  92.  
  93. def getVar(optionName): # gets variable from the database
  94. conn=L2DatabaseFactory.getInstance().getConnection()
  95. act = conn.prepareStatement("SELECT configValue FROM buffer_configuration WHERE configName=\""+optionName+"\" LIMIT 1")
  96. rs=act.executeQuery()
  97. if rs :
  98. rs.next()
  99. try :
  100. val = rs.getString("configValue")
  101. conn.close()
  102. except :
  103. val = "0"
  104. try :
  105. conn.close()
  106. except:
  107. pass
  108. else :
  109. val = "0"
  110. return val
  111.  
  112. # #
  113. # ============================================================ #
  114.  
  115. def showText(type,text,buttonEnabled,buttonName,location) :
  116. MESSAGE = "<html><head><title>"+getVar("title")+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
  117. MESSAGE += "<font color=\"LEVEL\">"+type+"</font><br>"+text+"<br>"
  118. if buttonEnabled == "True" :
  119. 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\">"
  120. MESSAGE += "<font color=\"303030\">Rin4a's buffer v1.2</font></center></body></html>"
  121. return MESSAGE
  122.  
  123. def generateScheme(st) : # generates scheme list HTML: available schemes, scheme management
  124. schemeName = []
  125. schemeId = []
  126. HTML = ""
  127. conn=L2DatabaseFactory.getInstance().getConnection()
  128. rss = conn.prepareStatement("SELECT * FROM buffer_scheme_list WHERE player_id="+str(st.getPlayer().getObjectId()))
  129. action=rss.executeQuery()
  130. while (action.next()) :
  131. try :
  132. schemeName += [action.getString("scheme_name")]
  133. schemeId += [action.getString("id")]
  134. except :
  135. print "Query error!"
  136. try :
  137. conn.close()
  138. except :
  139. pass
  140. if len(schemeName) > 0:
  141. HTML += "[ Available Schemes ]<br>"
  142. i = 0
  143. while i <= len(schemeName) - 1 :
  144. HTML += "<button value=\""+schemeName[i]+"\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" cast "+schemeId[i]+" x x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  145. i = i + 1
  146. HTML += "<br>[ Scheme Management ]<br>"
  147. if len(schemeName) < int(getVar("schemeCount")) :
  148. HTML += "<button value=\"Create Scheme\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" create_1 x x x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  149. if len(schemeName) > 0 :
  150. HTML += "<button value=\"Edit Scheme\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" edit_1 x x x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  151. HTML += "<button value=\"Delete Scheme\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" delete_1 x x x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  152. return HTML
  153.  
  154. def rebuildMainHtml(st) : # generating main HMTL file
  155. MAIN_HTML_MESSAGE = "<html><head><title>"+getVar("title")+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
  156. available = True
  157. if getVar("vipBuffer") == "True" :
  158. if st.getPlayer().getAccessLevel() < int(getVar("vipBufferMinAccessLevel")) :
  159. available = False
  160. if available == True :
  161. if st.getPlayer().isInsideZone(0) :
  162. if int(getVar("pvpMultiplier")) == 1 :
  163. MAIN_HTML_MESSAGE += "Zone price multiplier: <font color=\"LEVEL\">OFF</font><br>"
  164. else :
  165. MAIN_HTML_MESSAGE += "Zone price multiplier: <font color=\"LEVEL\">"+getVar("pvpMultiplier")+"</font><br>"
  166. else :
  167. MAIN_HTML_MESSAGE += "Zone price multiplier: <font color=\"LEVEL\">OFF</font><br>"
  168. if getVar("schemeSystem") == "Enabled" :
  169. MAIN_HTML_MESSAGE += generateScheme(st) # generate the new scheme system
  170. if getVar("schemeSystem") == "Disabled" :
  171. if getVar("enableBuffs") == "True" :
  172. MAIN_HTML_MESSAGE += "<button value=\"Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_buffs 0 0\" width=130 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  173. if getVar("enableSongs") == "True" :
  174. MAIN_HTML_MESSAGE += "<button value=\"Songs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_songs 0 0\" width=130 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  175. if getVar("enableDances") == "True" :
  176. MAIN_HTML_MESSAGE += "<button value=\"Dances\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_dances 0 0\" width=130 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  177. if getVar("enableChants") == "True" :
  178. MAIN_HTML_MESSAGE += "<button value=\"Chants\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_chants 0 0\" width=130 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  179. if getVar("enableKamael") == "True" :
  180. MAIN_HTML_MESSAGE += "<button value=\"Kamael\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_kamael 0 0\" width=130 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  181. if getVar("enableSpecial") == "True" :
  182. MAIN_HTML_MESSAGE += "<button value=\"Special\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_special 0 0\" width=130 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  183. if getVar("enableBuffSet") == "True" :
  184. MAIN_HTML_MESSAGE += "<br>[ Newbie Buff Sets ]<br>"
  185. MAIN_HTML_MESSAGE += "<button value=\"Buff Set\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " castBuffSet 0 0 0\" width=130 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  186. if getVar("enableHeal") == "True" or getVar("enableBuffRemove") == "True" :
  187. MAIN_HTML_MESSAGE += "<br>[ Miscellaneous ]<br>"
  188. if getVar("enableHeal") == "True" :
  189. MAIN_HTML_MESSAGE += "<button value=\"Heal\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " heal 0 0 0\" width=130 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  190. if getVar("enableBuffRemove") == "True":
  191. MAIN_HTML_MESSAGE += "<button value=\"Remove buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " removeBuffs 0 0 0\" width=130 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  192. if st.getPlayer().isGM() :
  193. MAIN_HTML_MESSAGE += "<br>[ Administration panel ]<br>"
  194. MAIN_HTML_MESSAGE += "<button value=\"Change Configuration\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect selectConfigSections 0 0\" width=160 height=28 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  195. MAIN_HTML_MESSAGE += "<button value=\"Manage Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect manage_buffs 0 0\" width=160 height=28 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  196. else :
  197. MAIN_HTML_MESSAGE += "This buffer is only for VIP's!<br>Contact the administrator for more info!<br>"
  198. MAIN_HTML_MESSAGE += "<font color=\"303030\">Rin4a's buffer v1.2</font></center></body></html>"
  199. return MAIN_HTML_MESSAGE
  200.  
  201. class Quest (JQuest) :
  202.  
  203. def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
  204.  
  205. def onAdvEvent (self,event,npc,player) :
  206. st = player.getQuestState(QUEST_LOADING_INFO)
  207. htmltext = event
  208. currentTime = int(System.currentTimeMillis()/1000) # get current game time ( FOR TIME OUT SYSTEM )
  209. HEADER = "<html><head><title>"+getVar("title")+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
  210. FOOTER = "<br><font color=\"303030\">Rin4a's buffer v1.2</font></center></body></html>"
  211. STYLE = getVar("style")
  212. CONSUMABLE_ID = int(getVar("consumableId"))
  213. BUFF_WITH_KARMA = getVar("buffWithKarma")
  214. TIME_OUT = getVar("timeOut")
  215. TIME_OUT_TIME = int(getVar("timeOutTime"))
  216. FREE_BUFFS = getVar("freeBuffs")
  217. HEAL_PRICE = int(getVar("healPrice"))
  218. BUFF_PRICE = int(getVar("buffPrice"))
  219. SONG_PRICE = int(getVar("songPrice"))
  220. DANCE_PRICE = int(getVar("dancePrice"))
  221. CHANT_PRICE = int(getVar("chantPrice"))
  222. KAMAEL_PRICE = int(getVar("kamaelPrice"))
  223. SPECIAL_PRICE = int(getVar("specialPrice"))
  224. BUFF_REMOVE_PRICE = int(getVar("buffRemovePrice"))
  225. ENABLE_HEAL = getVar("enableHeal")
  226. ENABLE_BUFFS = getVar("enableBuffs")
  227. ENABLE_SONGS = getVar("enableSongs")
  228. ENABLE_DANCES = getVar("enableDances")
  229. ENABLE_CHANTS = getVar("enableChants")
  230. ENABLE_KAMAEL = getVar("enableKamael")
  231. ENABLE_SPECIAL = getVar("enableSpecial")
  232. ENABLE_BUFF_REMOVE = getVar("enableBuffRemove")
  233. MIN_ACCESS_LEVEL = int(getVar("gmAccessLevel"))
  234. ENABLE_BUFF_SET = getVar("enableBuffSet")
  235. BUFF_SET_PRICE = int(getVar("buffSetPrice"))
  236. ENABLE_BUFF_SORT = getVar("sortBuffs")
  237. MAX_BUFFS_PER_SCHEME = Config.BUFFS_MAX_AMOUNT # generated in altsettings.properties
  238. SCHEME_BUFF_PRICE = int(getVar("schemeBuffPrice"))
  239. SCHEMES_PER_PLAYER = getVar("schemeCount")
  240. PVP_ZONE_PRICE_MULTIPLIER = int(getVar("pvpMultiplier"))
  241. VIP_ENABLED = getVar("vipBuffer")
  242. VIP_MIN_ACCESS = int(getVar("vipBufferMinAccessLevel"))
  243.  
  244. # ====================================================== #
  245. # HTML GENERATION - SCHEME SYSTEM #
  246.  
  247. def createScheme() : # just a HTML file: scheme creation
  248. HTML = HEADER+"<br>You MUST seprerate new words with a dot (.)<br><br>Scheme name: <edit var=\"name\" width=100><br><br>"
  249. HTML += "<button value=\"Create\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" create $name no_name x x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  250. HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=150 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  251. HTML += FOOTER
  252. return HTML
  253.  
  254. def deleteScheme() : # delete the scheme
  255. HTML = HEADER+"Available schemes:<br><br>"
  256. conn=L2DatabaseFactory.getInstance().getConnection()
  257. rss = conn.prepareStatement("SELECT * FROM buffer_scheme_list WHERE player_id="+str(st.getPlayer().getObjectId()))
  258. action=rss.executeQuery()
  259. while (action.next()) :
  260. try :
  261. 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\">"
  262. except :
  263. print "Query error!"
  264. try :
  265. conn.close()
  266. except :
  267. pass
  268. HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=150 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  269. HTML += FOOTER
  270. return HTML
  271.  
  272. def editScheme() : # Scheme editing
  273. name = ""
  274. id = ""
  275. HTML = HEADER+"Select a scheme that you would like to manage:<br><br>"
  276. conn=L2DatabaseFactory.getInstance().getConnection()
  277. rss = conn.prepareStatement("SELECT * FROM buffer_scheme_list WHERE player_id="+str(st.getPlayer().getObjectId()))
  278. action=rss.executeQuery()
  279. while (action.next()) :
  280. try :
  281. name = action.getString("scheme_name")
  282. id = action.getString("id")
  283. HTML += "<button value=\""+name+"\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" manage_scheme_select "+id+" x x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  284. except :
  285. print "Query error!"
  286. try :
  287. conn.close()
  288. except :
  289. pass
  290. HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=150 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  291. HTML += FOOTER
  292. return HTML
  293.  
  294. def getOptionList(scheme) : # Option list, when editing a scheme
  295. HTML = HEADER+"There are <font color=\"LEVEL\">"+str(getBuffCount(scheme))+"</font> buffs in current scheme!<br><br>"
  296. if getBuffCount(scheme) < MAX_BUFFS_PER_SCHEME : # if scheme still has some space
  297. HTML += "<button value=\"Add buffs\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" manage_scheme_1 "+str(scheme)+" 1 x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  298. if getBuffCount(scheme) > 0 :
  299. 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\">"
  300. HTML += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_1 0 0 0\" width=150 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  301. HTML += "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=150 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  302. HTML += FOOTER
  303. return HTML
  304.  
  305. # #
  306. # ====================================================== #
  307.  
  308. def getBuffCount(scheme) : # get buff count in the current scheme
  309. count = 0
  310. conn=L2DatabaseFactory.getInstance().getConnection()
  311. rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id=\""+str(scheme)+"\"")
  312. action=rss.executeQuery()
  313. while (action.next()) :
  314. try :
  315. count = count + 1
  316. except :
  317. count = 0
  318. try :
  319. conn.close()
  320. except :
  321. pass
  322. return count
  323.  
  324. def generateQuery(buff,song,dance,chant,kamael,special) :
  325. count = 0
  326. query = ""
  327. buffTypes = []
  328. if buff == "True" :
  329. count = count + 1
  330. buffTypes += ['buff']
  331. if song == "True" :
  332. count = count + 1
  333. buffTypes += ['song']
  334. if dance == "True" :
  335. count = count + 1
  336. buffTypes += ['dance']
  337. if chant == "True" :
  338. count = count + 1
  339. buffTypes += ['chant']
  340. if kamael == "True" :
  341. count = count + 1
  342. buffTypes += ['kamael']
  343. if special == "True" :
  344. count = count + 1
  345. buffTypes += ['special']
  346. i = 1
  347. count = count
  348. while i <= count :
  349. if i == count :
  350. query += buffTypes[i-1]
  351. else :
  352. query += buffTypes[i-1]+","
  353. i = i + 1
  354. return query
  355.  
  356. def buildHtml(buffType): # building HTML where all buffs are shown
  357. HTML_MESSAGE = HEADER
  358. if getVar("freeBuffs") == "True" :
  359. HTML_MESSAGE += "All buffs are for <font color=\"LEVEL\">free</font>!<br>"
  360. else :
  361. price = 0
  362. if buffType == "buff" : price = int(getVar("buffPrice"))
  363. if buffType == "song" : price = int(getVar("songPrice"))
  364. if buffType == "dance" : price = int(getVar("dancePrice"))
  365. if buffType == "chant" : price = int(getVar("chantPrice"))
  366. if buffType == "kamael" : price = int(getVar("kamaelPrice"))
  367. if buffType == "special" : price = int(getVar("specialPrice"))
  368. if player.isInsideZone(0) :
  369. price = price * PVP_ZONE_PRICE_MULTIPLIER
  370. HTML_MESSAGE += "All special buffs cost <font color=\"LEVEL\">"+str(price)+"</font> adena!<br>"
  371. HTML_MESSAGE += "<table>"
  372. conn=L2DatabaseFactory.getInstance().getConnection()
  373. buffCount = 0
  374. i = 0
  375. getList = conn.prepareStatement("SELECT* FROM buffer_buff_list WHERE buffType=\""+buffType+"\" AND canUse=1")
  376. rs=getList.executeQuery()
  377. while (rs.next()) :
  378. try :
  379. buffCount = buffCount + 1
  380. except :
  381. buffCount = 0
  382. if buffCount == 0 :
  383. HTML_MESSAGE += "No buffs are available at this moment!<br>"
  384. else :
  385. availableBuffs = []
  386. getList = conn.prepareStatement("SELECT buffId,buffLevel FROM buffer_buff_list WHERE buffType=\""+buffType+"\" AND canUse=1")
  387. rs=getList.executeQuery()
  388. while (rs.next()) :
  389. try :
  390. bId = rs.getInt("buffId")
  391. bLevel = rs.getInt("buffLevel")
  392. bName = SkillTable.getInstance().getInfo(bId,bLevel).getName()
  393. bName = bName.replace(" ","+")
  394. availableBuffs += [bName+"_"+str(bId)+"_"+str(bLevel)]
  395. except :
  396. HTML_MESSAGE += "Error loading buff list...<br>"
  397. try :
  398. conn.close()
  399. except :
  400. pass
  401. availableBuffs.sort() # sorting all buffs in alphabetical order
  402. avBuffs = len(availableBuffs)
  403. format = "0000"
  404. for avBuffs in availableBuffs :
  405. buff = avBuffs
  406. buff = buff.replace("_"," ")
  407. buffSplit = buff.split(" ")
  408. name = buffSplit[0]
  409. id = int(buffSplit[1])
  410. level = buffSplit[2]
  411. name = name.replace("+"," ")
  412. if id < 100 :
  413. format = "00"+str(id)
  414. elif id > 99 and id < 1000 :
  415. format = "0"+str(id)
  416. else :
  417. format = str(id)
  418. i = i + 1
  419. if STYLE == "Icons+Buttons" :
  420. 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=150 height=32 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
  421. if STYLE == "Buttons" :
  422. HTML_MESSAGE += "<tr><td><button value=\""+name+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " giveBuffs "+str(id)+" "+str(level)+" "+buffType+"\" width=150 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
  423. if STYLE == "Text" :
  424. HTML_MESSAGE += "<tr><td width=150><center><a action=\"bypass -h Quest " + QUEST_LOADING_INFO + " giveBuffs "+str(id)+" "+str(level)+" "+buffType+"\">"+name+"</a></center></td></tr>"
  425. if STYLE == "DualButtons" :
  426. if buffType == "dance" :
  427. name = name.replace("Concentration","Concentrat.")
  428. if i == 1 :
  429. HTML_MESSAGE +="<tr><td width=\"136\"><button value=\""+name+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " giveBuffs "+str(id)+" "+str(level)+" "+buffType+"\" width=136 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
  430. else :
  431. HTML_MESSAGE +="<td width=\"136\"><button value=\""+name+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " giveBuffs "+str(id)+" "+str(level)+" "+buffType+"\" width=136 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr>"
  432. i = 0
  433. if STYLE == "DualText" :
  434. if i == 1 :
  435. HTML_MESSAGE +="<tr><td width=\"142\"><a action=\"bypass -h Quest " + QUEST_LOADING_INFO + " giveBuffs "+str(id)+" "+str(level)+" "+buffType+"\">"+name+"</a></td>"
  436. else :
  437. HTML_MESSAGE +="<td width=\"136\"><a action=\"bypass -h Quest " + QUEST_LOADING_INFO + " giveBuffs "+str(id)+" "+str(level)+" "+buffType+"\">"+name+"</a></td></tr>"
  438. i = 0
  439. HTML_MESSAGE += "</table><br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=150 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  440. HTML_MESSAGE += FOOTER
  441. return HTML_MESSAGE
  442.  
  443. def generateQuery() :
  444. count = 0
  445. qry = ""
  446. buffTypes = []
  447. if ENABLE_BUFFS == "True" :
  448. count = count + 1
  449. buffTypes += ["\"buff\""]
  450. if ENABLE_SONGS == "True" :
  451. count = count + 1
  452. buffTypes += ["\"song\""]
  453. if ENABLE_DANCES == "True" :
  454. count = count + 1
  455. buffTypes += ["\"dance\""]
  456. if ENABLE_CHANTS == "True" :
  457. count = count + 1
  458. buffTypes += ["\"chant\""]
  459. if ENABLE_KAMAEL == "True" :
  460. count = count + 1
  461. buffTypes += ["\"kamael\""]
  462. if ENABLE_SPECIAL == "True" :
  463. count = count + 1
  464. buffTypes += ["\"special\""]
  465. aa = 1
  466. count = count
  467. while aa <= count :
  468. if aa == count :
  469. qry += buffTypes[aa-1]
  470. else :
  471. qry += buffTypes[aa-1]+","
  472. aa = aa + 1
  473. return qry
  474.  
  475. def viewAllSchemeBuffs(scheme,page,action) : # buff editing
  476. def getBuffCount(scheme) : # get buff count in the current scheme
  477. count = 0
  478. conn=L2DatabaseFactory.getInstance().getConnection()
  479. rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id=\""+str(scheme)+"\"")
  480. action=rss.executeQuery()
  481. while (action.next()) :
  482. try :
  483. count = count + 1
  484. except :
  485. count = 0
  486. try :
  487. conn.close()
  488. except :
  489. pass
  490. return count
  491. buffList = []
  492. conn=L2DatabaseFactory.getInstance().getConnection()
  493. count = 0 # buff count tracker
  494. pc = 0 # page count
  495. bll = 0
  496. i = 0
  497. buffsPerPage = 0
  498. incPageCount = True
  499. listOrder=""
  500. HTML_MESSAGE = HEADER
  501. if action == "add" :
  502. HTML_MESSAGE += "You can add <font color=\"LEVEL\">"+str(MAX_BUFFS_PER_SCHEME - getBuffCount(scheme))+"</font> more buffs!<br>"
  503. QUERY = "SELECT * FROM buffer_buff_list WHERE buffType IN ("+ generateQuery() + ") AND canUse=1"
  504. if action == "remove" :
  505. HTML_MESSAGE += "You have <font color=\"LEVEL\">"+str(getBuffCount(scheme))+"</font> buffs in this scheme!<br>"
  506. QUERY = "SELECT * FROM buffer_scheme_contents WHERE scheme_id="+str(scheme)
  507. getBuffCount = conn.prepareStatement(QUERY)
  508. rss = getBuffCount.executeQuery()
  509. while (rss.next()) :
  510. try :
  511. if action == "add" :
  512. name = SkillTable.getInstance().getInfo(rss.getInt("buffId"),rss.getInt("buffLevel")).getName()
  513. name = name.replace(" ","+")
  514. buffList += [name+"_"+str(rss.getInt("buffId"))+"_"+str(rss.getInt("buffLevel"))+"_"+str(page)]
  515. if action == "remove" :
  516. name = SkillTable.getInstance().getInfo(rss.getInt("skill_id"),rss.getInt("skill_level")).getName()
  517. name = name.replace(" ","+")
  518. buffList += [name+"_"+str(rss.getInt("skill_id"))+"_"+str(rss.getInt("skill_level"))+"_"+str(page)]
  519. count = count + 1
  520. except :
  521. buffList = []
  522. count = 0
  523. try :
  524. conn.close()
  525. except :
  526. pass
  527.  
  528. buffList.sort() # sorting the buffs
  529. HTML_MESSAGE += "<font color=\"LEVEL\">[Scheme management - Page "+str(page)+"]</font><br><table border=\"0\"><tr>"
  530. buffsPerPage = 25
  531. while incPageCount == True: # generating page count
  532. if count < buffsPerPage :
  533. incPageCount = False
  534. else :
  535. count = count - buffsPerPage
  536. pc = pc + 1
  537. ii = 1
  538. while ii <= pc :
  539. if pc > 5 :
  540. width = "25"
  541. pageName = "P"
  542. else :
  543. width = "50"
  544. pageName = "Page "
  545. if action == "add" :
  546. 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>"
  547. if action == "remove" :
  548. 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>"
  549. ii = ii + 1
  550. HTML_MESSAGE += "</tr></table><br>"
  551. value = ""
  552. bll = len(buffList) # getting buff count
  553. j = 0
  554. if buffsPerPage*int(page) > bll :
  555. j = bll
  556. else :
  557. j = buffsPerPage*int(page)
  558. i = buffsPerPage*int(page)-buffsPerPage
  559. while i < j :
  560. # name_id_level_page
  561. value = buffList[i]
  562. value = value.replace("_"," ")
  563. extr = value.split(" ")
  564. name = extr[0]
  565. name = name.replace("+"," ")
  566. id = int(extr[1])
  567. level = extr[2]
  568. page = int(extr[3])
  569. if action == "add" :
  570. if isUsed(scheme,id,level) == False:
  571. if i % 2 != 0 :
  572. HTML_MESSAGE += "<table border=\"0\" bgcolor=333333>"
  573. else :
  574. HTML_MESSAGE += "<table border=\"0\" bgcolor=292929>"
  575. HTML_MESSAGE += "<tr><td width=\"145\">"+name+"</td><td><button value=\"Add\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" add_buff "+str(scheme)+"_"+str(id)+"_"+str(level)+" "+str(page)+" x\" width=115 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
  576. HTML_MESSAGE += "</table>"
  577. if action == "remove" :
  578. if i % 2 != 0 :
  579. HTML_MESSAGE += "<table border=\"0\" bgcolor=333333>"
  580. else :
  581. HTML_MESSAGE += "<table border=\"0\" bgcolor=292929>"
  582. HTML_MESSAGE += "<tr><td width=\"145\">"+name+"</td><td><button value=\"Remove\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" remove_buff "+str(scheme)+"_"+str(id)+"_"+str(level)+" "+str(page)+" x\" width=115 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>"
  583. HTML_MESSAGE += "</table>"
  584. i = i + 1 # table background tracker
  585. HTML_MESSAGE += "<br><br><button value=\"Back\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" manage_scheme_select "+str(scheme)+" x x\" width=115 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  586. HTML_MESSAGE += "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=150 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  587. HTML_MESSAGE += FOOTER
  588. return HTML_MESSAGE
  589.  
  590. def getAvailableSections() :
  591. HTML_MESSAGE = HEADER
  592. HTML_MESSAGE += "Select one of the sections:<br>"
  593. conn=L2DatabaseFactory.getInstance().getConnection()
  594. getList = conn.prepareStatement("SELECT * FROM buffer_config_sections ORDER BY section_id ASC")
  595. getConfigList = getList.executeQuery()
  596. while (getConfigList.next()) :
  597. try :
  598. name = getConfigList.getString("section_name")
  599. id = getConfigList.getString("section_id")
  600. HTML_MESSAGE += "<button value=\""+name+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_configs "+id+" 0\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  601. except :
  602. HTML_MESSAGE += "Error loading configuration list...<br>"
  603. conn.close()
  604. try :
  605. conn.close()
  606. except :
  607. pass
  608. HTML_MESSAGE += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=150 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  609. HTML_MESSAGE += FOOTER
  610. return HTML_MESSAGE
  611.  
  612. def buildConfigList(section): # getting all available configs
  613. HTML_MESSAGE = HEADER
  614. conn=L2DatabaseFactory.getInstance().getConnection()
  615. getCount = conn.prepareStatement("SELECT COUNT(*) FROM buffer_configuration WHERE section_id=?")
  616. getCount.setString(1,str(section))
  617. act=getCount.executeQuery()
  618. if act :
  619. act.next()
  620. try :
  621. configCount = act.getString("COUNT(*)")
  622. except :
  623. configCount = "0"
  624. else :
  625. configCount = "0"
  626. getName = conn.prepareStatement("SELECT section_name FROM buffer_config_sections WHERE section_id=?")
  627. getName.setString(1,str(section))
  628. act=getName.executeQuery()
  629. if act :
  630. act.next()
  631. try :
  632. sectionName = act.getString("section_name")
  633. except :
  634. sectionName = "0"
  635. else :
  636. sectionName = "0"
  637. HTML_MESSAGE += sectionName + " Configuration - <font color=\"LEVEL\">"+configCount+"</font> configs<br>"
  638. getList = conn.prepareStatement("SELECT configDesc,configName,configValue FROM buffer_configuration WHERE section_id=? ORDER BY configDesc ASC")
  639. getList.setString(1,str(section))
  640. getConfigList = getList.executeQuery()
  641. while (getConfigList.next()) :
  642. try :
  643. desc = getConfigList.getString("configDesc")
  644. name = getConfigList.getString("configName")
  645. HTML_MESSAGE += "<button value=\""+desc+"\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " viewSelectedConfig "+name+" "+str(section)+" 0\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  646. except :
  647. HTML_MESSAGE += "Error loading configuration list...<br>"
  648. conn.close()
  649. try :
  650. conn.close()
  651. except :
  652. pass
  653. HTML_MESSAGE += "<br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect selectConfigSections 0 0\" width=150 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  654. HTML_MESSAGE += FOOTER
  655. return HTML_MESSAGE
  656.  
  657. def viewSelectedConfig(cfgName,sectionId) : # editing selected configuration file
  658. HTML_MESSAGE = HEADER
  659. conn=L2DatabaseFactory.getInstance().getConnection()
  660. getVal = conn.prepareStatement("SELECT * FROM buffer_configuration WHERE configName=\""+cfgName+"\"")
  661. act=getVal.executeQuery()
  662. if act :
  663. act.next()
  664. try :
  665. desc = act.getString("configDesc")
  666. value = act.getString("configValue")
  667. info = act.getString("configInfo")
  668. usable = act.getString("usableValues")
  669. conn.close()
  670. except :
  671. usable = "none,none,none"
  672. try :
  673. conn.close()
  674. except :
  675. pass
  676. else :
  677. desc = "---No description---"
  678. usable = usable.replace(","," ")
  679. extr = usable.split(" ")
  680. valType = extr[0]
  681. minVal = extr[1]
  682. maxVal = extr[2]
  683. HTML_MESSAGE += "Description:<br><font color=\"LEVEL\">" + desc + "</font><br>"
  684. HTML_MESSAGE += "Usage:<br><font color=\"LEVEL\">" + info + "</font><br>"
  685. HTML_MESSAGE += "Old value:<br><font color=\"LEVEL\">"
  686. if cfgName == "consumableId" :
  687. HTML_MESSAGE += ItemTable.getInstance().getTemplate(int(value)).getName() + " (ID : "+str(value)+")" # v1.2 - to make everything clear (about item ID's)
  688. else :
  689. HTML_MESSAGE += str(value)
  690. HTML_MESSAGE += "</font><br>New value: "
  691. if valType == "bool" :
  692. HTML_MESSAGE += "<combobox var=\""+cfgName+"\" width=100 List=\"True;False;\">"
  693. elif valType == "custom" :
  694. HTML_MESSAGE += "<combobox var=\""+cfgName+"\" width=110 List=\"Text;Buttons;Icons+Buttons;DualButtons;DualText\">"
  695. elif valType == "custom2" :
  696. HTML_MESSAGE += "<combobox var=\""+cfgName+"\" width=110 List=\"Disabled;Enabled\">"
  697. elif valType == "string" :
  698. HTML_MESSAGE += "<br><multiedit var=\""+cfgName+"\" width=250 height=15>"
  699. else :
  700. HTML_MESSAGE += "<edit var=\""+cfgName+"\" width=100>"
  701. HTML_MESSAGE += "<br><br><button value=\"Update\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " changeConfig "+cfgName+" $"+str(cfgName)+" "+str(sectionId)+"\" width=80 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  702. HTML_MESSAGE += "<button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_configs "+str(sectionId)+" 0\" width=150 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  703. HTML_MESSAGE += FOOTER
  704. return HTML_MESSAGE
  705.  
  706. def viewAllBuffTypes() : # all available buffs
  707. HTML_MESSAGE = HEADER
  708. HTML_MESSAGE += "<font color=\"LEVEL\">[Buff management]</font><br><br>"
  709. if ENABLE_BUFFS == "True" :
  710. 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\">"
  711. if ENABLE_SONGS == "True" :
  712. 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\">"
  713. if ENABLE_DANCES == "True" :
  714. 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\">"
  715. if ENABLE_CHANTS == "True" :
  716. 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\">"
  717. if ENABLE_KAMAEL == "True" :
  718. HTML_MESSAGE += "<button value=\"Kamael Buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " edit_buff_list kamael Kamael_Buffs 1\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  719. if ENABLE_SPECIAL == "True" :
  720. 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\"><br>"
  721. if ENABLE_BUFF_SET == "True" :
  722. 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>"
  723. HTML_MESSAGE += "<button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=200 height=22 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  724. HTML_MESSAGE += FOOTER
  725. return HTML_MESSAGE
  726.  
  727. def viewAllBuffs(type,typeName,page) : # buff editing
  728. buffList = []
  729. conn=L2DatabaseFactory.getInstance().getConnection()
  730. count = 0
  731. pc = 0
  732. bll = 0
  733. i = 0
  734. buffsPerPage = 0
  735. formula = 0
  736. incPageCount = True
  737. listOrder=""
  738. HTML_MESSAGE = HEADER
  739. typeName = typeName.replace("_"," ")
  740. if type == "set" :
  741. QUERY = "SELECT * FROM buffer_buff_list WHERE buffType IN ("+generateQuery()+") AND canUse=1"
  742. else :
  743. QUERY = "SELECT * FROM buffer_buff_list WHERE buffType=\""+type+"\""
  744. getBuffCount = conn.prepareStatement(QUERY)
  745. rss = getBuffCount.executeQuery()
  746. while (rss.next()) :
  747. try :
  748. name = SkillTable.getInstance().getInfo(rss.getInt("buffId"),rss.getInt("buffLevel")).getName()
  749. name = name.replace(" ","+")
  750. usable = rss.getString("canUse")
  751. forClass = rss.getString("forClass")
  752. skill_id = rss.getString("buffId")
  753. skill_level = rss.getString("buffLevel")
  754. buffList += [name+"_"+forClass+"_"+str(page)+"_"+usable+"_"+skill_id+"_"+skill_level]
  755. count = count + 1
  756. except :
  757. buffList = []
  758. count = 0
  759. try :
  760. conn.close()
  761. except :
  762. pass
  763. buffList.sort()
  764. HTML_MESSAGE += "<font color=\"LEVEL\">[Buff management - "+typeName+" - Page "+str(page)+"]</font><br><table border=\"0\"><tr>"
  765. if type == "set" :
  766. buffsPerPage = 12
  767. else :
  768. buffsPerPage = 20
  769. while incPageCount == True:
  770. if count < buffsPerPage :
  771. incPageCount = False
  772. else :
  773. count = count - buffsPerPage
  774. pc = pc + 1
  775. ii = 1
  776. typeName = typeName.replace(" ","_")
  777. while ii <= pc :
  778. if pc > 5 :
  779. width = "25"
  780. pageName = "P"
  781. else :
  782. width = "50"
  783. pageName = "Page "
  784. 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>"
  785. ii = ii + 1
  786. HTML_MESSAGE += "</tr></table><br>"
  787. value = ""
  788. bll = len(buffList)
  789. j = 0
  790. if buffsPerPage*int(page) > bll :
  791. j = bll
  792. else :
  793. j = buffsPerPage*int(page)
  794. i = buffsPerPage*int(page)-buffsPerPage
  795. while i < j :
  796. value = buffList[i]
  797. value = value.replace("_"," ")
  798. extr = value.split(" ")
  799. name = extr[0]
  800. name = name.replace("+"," ")
  801. forClass = int(extr[1])
  802. page = extr[2]
  803. usable = int(extr[3])
  804. skillPos = extr[4]+"_"+extr[5]
  805. if i % 2 != 0 :
  806. HTML_MESSAGE += "<table border=\"0\" bgcolor=333333>"
  807. else :
  808. HTML_MESSAGE += "<table border=\"0\" bgcolor=292929>"
  809. if type == "set" :
  810. if forClass == 0 :
  811. listOrder="List=\"Fighter;Mage;All;None;\""
  812. if forClass == 1 :
  813. listOrder="List=\"Mage;Fighter;All;None;\""
  814. if forClass == 2 :
  815. listOrder="List=\"All;Fighter;Mage;None;\""
  816. if forClass == 3 :
  817. listOrder="List=\"None;Fighter;Mage;All;\""
  818. HTML_MESSAGE += "<tr><td width=\"145\">"+name+"</td><td width=\"70\"><combobox var=\"newSet"+str(i)+"\" width=70 "+listOrder+"></td>"
  819. 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>"
  820. else :
  821. HTML_MESSAGE += "<tr><td width=\"170\">"+name+"</td><td width=\"80\">"
  822. if usable == 1 :
  823. 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>"
  824. elif usable == 0 :
  825. 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>"
  826. HTML_MESSAGE += "</table>"
  827. i = i + 1
  828. HTML_MESSAGE += "<br><br><button value=\"Back\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect manage_buffs 0 0\" width=150 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  829. HTML_MESSAGE += "<button value=\"Home\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect main 0 0\" width=150 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  830. HTML_MESSAGE += FOOTER
  831. return HTML_MESSAGE
  832.  
  833. def manageSelectedBuff(buffPosId,canUseBuff) :
  834. bpid = buffPosId.split("_")
  835. bId= bpid[0]
  836. bLvl= bpid[1]
  837. conn=L2DatabaseFactory.getInstance().getConnection()
  838. upd=conn.prepareStatement("UPDATE buffer_buff_list SET canUse=\""+canUseBuff+"\" WHERE buffId=\""+str(bId)+"\" AND buffLevel=\""+str(bLvl)+"\" LIMIT 1")
  839. try :
  840. upd.executeUpdate()
  841. upd.close()
  842. conn.close()
  843. except :
  844. try : conn.close()
  845. except : pass
  846.  
  847. def manageSelectedSet(id,newVal,opt3) : # Buff set management...
  848. bpid = id.split("_")
  849. bId= bpid[0]
  850. bLvl= bpid[1]
  851. conn=L2DatabaseFactory.getInstance().getConnection()
  852. upd=conn.prepareStatement("UPDATE buffer_buff_list SET forClass=? WHERE buffId=? AND bufflevel=?")
  853. upd.setString(1, newVal)
  854. upd.setString(2, str(bId))
  855. upd.setString(3, str(bLvl))
  856. try :
  857. upd.executeUpdate()
  858. upd.close()
  859. conn.close()
  860. except :
  861. try : conn.close()
  862. except : pass
  863. return viewAllBuffs("set","Buff Sets",str(opt3))
  864.  
  865. # v1.1 update:
  866. # added security check of the new value, so the player can't mess up the database
  867. def updateConfigValue(configName,newValue,sectionId) :
  868. conn=L2DatabaseFactory.getInstance().getConnection()
  869. getVal = conn.prepareStatement("SELECT usableValues FROM buffer_configuration WHERE configName=\""+configName+"\"")
  870. act=getVal.executeQuery()
  871. if act :
  872. act.next()
  873. try :
  874. usable = act.getString("usableValues")
  875. except :
  876. usable = "none,none,none"
  877. usable = usable.replace(","," ")
  878. extr = usable.split(" ")
  879. valType = extr[0]
  880. minVal = extr[1]
  881. maxVal = extr[2]
  882. if newValue == "" :
  883. return showText("Info","You must enter a new value!","True","Return","view_configs "+str(sectionId))
  884. else :
  885. if valType == "bool" :
  886. upd=conn.prepareStatement("UPDATE buffer_configuration SET configValue=\""+newValue+"\" WHERE configName=\""+configName+"\"")
  887. try :
  888. upd.executeUpdate()
  889. upd.close()
  890. conn.close()
  891. configs = ["enableBuffs","enableSongs","enableDances","enableChants","enableKamael","enableSpecial"]
  892.  
  893. if configName in configs :
  894. upd2=conn.prepareStatement("UPDATE buffer_scheme_list SET mod_accepted=1")
  895. try :
  896. upd2.executeUpdate()
  897. upd2.close()
  898. except:
  899. pass
  900.  
  901. return showText("Info","Value has been changed successfully!","True","Return","view_configs "+str(sectionId))
  902. except:
  903. try :
  904. conn.close()
  905. except :
  906. pass
  907. else :
  908. if valType == "range" :
  909. if newValue.isdigit() and int(newValue) >= int(minVal) and int(newValue) <= int(maxVal) :
  910. upd=conn.prepareStatement("UPDATE buffer_configuration SET configValue=\""+newValue+"\" WHERE configName=\""+configName+"\"")
  911. try :
  912. upd.executeUpdate()
  913. upd.close()
  914. return showText("Info","Value has been changed successfully!","True","Return","view_configs "+str(sectionId))
  915. conn.close()
  916. except:
  917. try :
  918. conn.close()
  919. except :
  920. pass
  921. else :
  922. return showText("Info","You must enter an integer from "+minVal+" to "+maxVal+"!","True","Return","view_configs "+str(sectionId))
  923. else :
  924. if valType == "string" :
  925. newValue = newValue.replace(","," ")
  926. if len(newValue) < int(minVal) or len(newValue) > int(maxVal) :
  927. return showText("Info","You must enter a value that:<br> 1) Isn't shorter than 3 characters!<br> 2) Isn't longer than 36 characters!","True","Return","view_configs")
  928. else :
  929. upd=conn.prepareStatement("UPDATE buffer_configuration SET configValue=? WHERE configName=\""+configName+"\"")
  930. upd.setString(1, newValue)
  931. try :
  932. upd.executeUpdate()
  933. upd.close()
  934. return showText("Info","Value has been changed successfully!","True","Return","view_configs "+str(sectionId))
  935. conn.close()
  936. except:
  937. try :
  938. conn.close()
  939. except :
  940. pass
  941. else :
  942. if valType == "custom" :
  943. upd=conn.prepareStatement("UPDATE buffer_configuration SET configValue=? WHERE configName=\""+configName+"\"")
  944. upd.setString(1, newValue)
  945. try :
  946. upd.executeUpdate()
  947. upd.close()
  948. return showText("Info","Value has been changed successfully!","True","Return","view_configs "+str(sectionId))
  949. conn.close()
  950. except:
  951. try :
  952. conn.close()
  953. except :
  954. pass
  955. if valType == "custom2" :
  956. upd=conn.prepareStatement("UPDATE buffer_configuration SET configValue=? WHERE configName=\""+configName+"\"")
  957. upd.setString(1, newValue)
  958. try :
  959. upd.executeUpdate()
  960. upd.close()
  961. return showText("Info","Value has been changed successfully!","True","Return","view_configs "+str(sectionId))
  962. conn.close()
  963. except:
  964. try :
  965. conn.close()
  966. except :
  967. pass
  968.  
  969. def addTimeout(gaugeColor,amount,offset) :
  970. endtime = currentTime + amount
  971. st.set("blockUntilTime",str(endtime))
  972. st.getPlayer().sendPacket(SetupGauge(gaugeColor, amount * 1000 + offset))
  973.  
  974. def heal() :
  975. st.getPlayer().getStatus().setCurrentHp(st.getPlayer().getStat().getMaxHp())
  976. st.getPlayer().getStatus().setCurrentMp(st.getPlayer().getStat().getMaxMp())
  977. st.getPlayer().getStatus().setCurrentCp(st.getPlayer().getStat().getMaxCp())
  978.  
  979. # HTML HANDLING, BUFF USING, CONFIGURATION MODIFYING
  980. # splitting all values from HTML
  981. eventSplit = event.split(" ")
  982. event = eventSplit[0]
  983. eventParam1 = eventSplit[1]
  984. eventParam2 = eventSplit[2]
  985. eventParam3 = eventSplit[3]
  986.  
  987. if event == "redirect" :
  988. if eventParam1 == "main" :
  989. return rebuildMainHtml(st)
  990. if eventParam1 == "view_configs" :
  991. return buildConfigList(eventParam2)
  992. if eventParam1 == "manage_buffs" :
  993. return viewAllBuffTypes()
  994. if eventParam1 == "selectConfigSections" :
  995. return getAvailableSections()
  996.  
  997. # SCHEME SYSTEM
  998.  
  999. if event == "create" :
  1000. con=L2DatabaseFactory.getInstance().getConnection()
  1001. param = eventParam1.replace("."," ")
  1002. if param == "no_name" :
  1003. return showText("Info","Please, enter the scheme name!","True","Return","main")
  1004. else :
  1005. ins = con.prepareStatement("INSERT INTO buffer_scheme_list (player_id,scheme_name) VALUES (?,?)")
  1006. ins.setString(1, str(player.getObjectId()))
  1007. ins.setString(2, param)
  1008. try :
  1009. ins.executeUpdate()
  1010. ins.close()
  1011. con.close()
  1012. L2Databasefactory.close(con)
  1013. except :
  1014. pass
  1015. return rebuildMainHtml(st)
  1016.  
  1017. if event == "delete" :
  1018. conn=L2DatabaseFactory.getInstance().getConnection()
  1019. rem=conn.prepareStatement("DELETE FROM buffer_scheme_list WHERE id=? LIMIT 1")
  1020. rem.setString(1, eventParam1)
  1021. try :
  1022. rem.executeUpdate()
  1023. except :
  1024. pass
  1025. rem=conn.prepareStatement("DELETE FROM buffer_scheme_contents WHERE scheme_id=?")
  1026. rem.setString(1, eventParam1)
  1027. try :
  1028. rem.executeUpdate()
  1029. rem.close()
  1030. conn.close()
  1031. except :
  1032. try :
  1033. conn.close()
  1034. except :
  1035. pass
  1036. return rebuildMainHtml(st)
  1037.  
  1038. if event == "delete_c" :
  1039. HTML = HTML_MESSAGE = HEADER+"Do you really want to delete '"+eventParam2+"' scheme?<br><br>"
  1040. HTML += "<button value=\"Yes\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" delete "+eventParam1+" x x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  1041. HTML += "<button value=\"No\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" delete_1 x x x\" width=200 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">"
  1042. HTML += FOOTER
  1043. return HTML
  1044.  
  1045. if event == "create_1" :
  1046. return createScheme()
  1047.  
  1048. if event == "edit_1" :
  1049. return editScheme()
  1050.  
  1051. if event == "delete_1" :
  1052. return deleteScheme()
  1053.  
  1054. if event == "manage_scheme_1" :
  1055. return viewAllSchemeBuffs(eventParam1,eventParam2,"add")
  1056.  
  1057. if event == "manage_scheme_2" :
  1058. return viewAllSchemeBuffs(eventParam1,eventParam2,"remove")
  1059.  
  1060. if event == "manage_scheme_select" :
  1061. return getOptionList(eventParam1)
  1062.  
  1063. if event == "remove_buff" :
  1064. event = eventParam1.split("_")
  1065. scheme = event[0]
  1066. skill = event[1]
  1067. level = event[2]
  1068. con=L2DatabaseFactory.getInstance().getConnection()
  1069. rem=con.prepareStatement("DELETE FROM buffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1")
  1070. rem.setString(1, scheme)
  1071. rem.setString(2, skill)
  1072. rem.setString(3, level)
  1073. try :
  1074. rem.executeUpdate()
  1075. rem.close()
  1076. con.close()
  1077. except :
  1078. pass
  1079. if getBuffCount(scheme) == 0 :
  1080. HTML = getOptionList(scheme)
  1081. else :
  1082. HTML = viewAllSchemeBuffs(scheme,eventParam2,"remove")
  1083. return HTML
  1084.  
  1085. if event == "add_buff" :
  1086. event = eventParam1.split("_")
  1087. scheme = event[0]
  1088. skill = event[1]
  1089. level = event[2]
  1090. con=L2DatabaseFactory.getInstance().getConnection()
  1091. ins = con.prepareStatement("INSERT INTO buffer_scheme_contents (scheme_id,skill_id,skill_level) VALUES (?,?,?)")
  1092. ins.setString(1, str(scheme))
  1093. ins.setString(2, str(skill))
  1094. ins.setString(3, str(level))
  1095. try :
  1096. ins.executeUpdate()
  1097. ins.close()
  1098. con.close()
  1099. except :
  1100. pass
  1101. if getBuffCount(scheme) == MAX_BUFFS_PER_SCHEME :
  1102. HTML = getOptionList(scheme)
  1103. else :
  1104. HTML = viewAllSchemeBuffs(scheme,eventParam2,"add")
  1105. return HTML
  1106.  
  1107. if event == "edit_buff_list" :
  1108. return viewAllBuffs(eventParam1,eventParam2,eventParam3)
  1109.  
  1110. if event == "changeBuffSet" :
  1111. eventParam2 = eventParam2.replace("Fighter","0")
  1112. eventParam2 = eventParam2.replace("Mage","1")
  1113. eventParam2 = eventParam2.replace("All","2")
  1114. eventParam2 = eventParam2.replace("None","3")
  1115. return manageSelectedSet(eventParam1,eventParam2,eventParam3)
  1116.  
  1117. if event == "editSelectedBuff" :
  1118. eventParam2 = eventParam2.replace("-"," ")
  1119. split = eventParam2.split(" ")
  1120. action = split[0]
  1121. page = split[1]
  1122. manageSelectedBuff(eventParam1,action)
  1123. if eventParam3 == "buff" : typeName = "Buffs"
  1124. if eventParam3 == "song" : typeName = "Songs"
  1125. if eventParam3 == "dance" : typeName = "Dances"
  1126. if eventParam3 == "chant" : typeName = "Chants"
  1127. if eventParam3 == "kamael" : typeName = "Kamael_Buffs"
  1128. if eventParam3 == "special" : typeName = "Special_Buffs"
  1129. return viewAllBuffs(eventParam3,typeName,page)
  1130.  
  1131. if event == "viewSelectedConfig" :
  1132. return viewSelectedConfig(eventParam1,eventParam2)
  1133.  
  1134. if event == "changeConfig" :
  1135. return updateConfigValue(eventParam1,eventParam2,eventParam3)
  1136.  
  1137. if event == "redirect" :
  1138. if eventParam1 == "view_buffs" :
  1139. return buildHtml("buff")
  1140. if eventParam1 == "view_songs" :
  1141. return buildHtml("song")
  1142. if eventParam1 == "view_dances" :
  1143. return buildHtml("dance")
  1144. if eventParam1 == "view_chants" :
  1145. return build Html("chant")
  1146. if eventParam1 == "view_kamael" :
  1147. return buildHtml("kamael")
  1148. if eventParam1 == "view_special" :
  1149. return buildHtml("special")
  1150. # buff casting code
  1151. if event == "heal" :
  1152. if currentTime > st.getInt("blockUntilTime") :
  1153. if player.isInsideZone(0) :
  1154. HEAL_PRICE = HEAL_PRICE * PVP_ZONE_PRICE_MULTIPLIER
  1155. if st.getQuestItemsCount(CONSUMABLE_ID) < HEAL_PRICE :
  1156. return showText("Sorry","You don't have enough adena!","False",0,0)
  1157. else :
  1158. heal()
  1159. st.takeItems(CONSUMABLE_ID,HEAL_PRICE)
  1160. if TIME_OUT == "True":
  1161. addTimeout(1,TIME_OUT_TIME + 2,600)
  1162. return rebuildMainHtml(st)
  1163. return rebuildMainHtml(st)
  1164.  
  1165. if event == "removeBuffs" :
  1166. if currentTime > st.getInt("blockUntilTime") :
  1167. if player.isInsideZone(0) :
  1168. BUFF_REMOVE_PRICE = BUFF_REMOVE_PRICE * PVP_ZONE_PRICE_MULTIPLIER
  1169. if st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_REMOVE_PRICE :
  1170. return showText("Sorry","You don't have enough adena!","False",0,0)
  1171. else :
  1172. st.getPlayer().stopAllEffects()
  1173. st.takeItems(CONSUMABLE_ID,BUFF_REMOVE_PRICE)
  1174. if TIME_OUT == "True":
  1175. addTimeout(2,TIME_OUT_TIME + 3,600)
  1176. return rebuildMainHtml(st)
  1177. return rebuildMainHtml(st)
  1178.  
  1179. if event == "cast" :
  1180. if currentTime > st.getInt("blockUntilTime") :
  1181. buffs = []
  1182. levels = []
  1183. id = 0
  1184. level = 0
  1185. conn=L2DatabaseFactory.getInstance().getConnection()
  1186. rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id="+eventParam1)
  1187. action=rss.executeQuery()
  1188. while (action.next()) :
  1189. try :
  1190. enabled = 1
  1191. # check if that buff is enabled
  1192. id = int(action.getString("skill_id"))
  1193. level = int(action.getString("skill_level"))
  1194. skillType = getBuffType(int(action.getString("skill_id")))
  1195. if skillType == "buff" :
  1196. if ENABLE_BUFFS == "True" :
  1197. if isEnabled(id,level) == "True" :
  1198. buffs += [id]
  1199. levels += [level]
  1200. if skillType == "song" :
  1201. if ENABLE_SONGS == "True" :
  1202. if isEnabled(id,level) == "True" :
  1203. buffs += [id]
  1204. levels += [level]
  1205. if skillType == "dance" :
  1206. if ENABLE_DANCES == "True" :
  1207. if isEnabled(id,level) == "True" :
  1208. buffs += [id]
  1209. levels += [level]
  1210. if skillType == "chant" :
  1211. if ENABLE_CHANTS == "True" :
  1212. if isEnabled(id,level) == "True" :
  1213. buffs += [id]
  1214. levels += [level]
  1215. if skillType == "kamael" :
  1216. if ENABLE_KAMAEL == "True" :
  1217. if isEnabled(id,level) == "True" :
  1218. buffs += [id]
  1219. levels += [level]
  1220. if skillType == "special" :
  1221. if ENABLE_SPECIAL == "True" :
  1222. if isEnabled(id,level) == "True" :
  1223. buffs += [id]
  1224. levels += [level]
  1225. except :
  1226. print "Query error!"
  1227. try :
  1228. conn.close()
  1229. except :
  1230. pass
  1231.  
  1232. # check if there are any buffs in the array
  1233. if len(buffs) == 0 :
  1234. return viewAllSchemeBuffs(eventParam1,1,"add")
  1235. # clear till this point
  1236. else :
  1237. if getVar("freeBuffs") == "False" :
  1238. if player.isInsideZone(0) :
  1239. SCHEME_BUFF_PRICE = SCHEME_BUFF_PRICE * PVP_ZONE_PRICE_MULTIPLIER
  1240. if st.getQuestItemsCount(CONSUMABLE_ID) < SCHEME_BUFF_PRICE :
  1241. return showText("Sorry","You don't have enough adena!","False",0,0)
  1242. else :
  1243. st.takeItems(CONSUMABLE_ID,SCHEME_BUFF_PRICE)
  1244. i = 0
  1245. while i <= len(buffs) - 1 :
  1246. SkillTable.getInstance().getInfo(buffs[i],levels[i]).getEffects(player,player)
  1247. i = i + 1
  1248. heal()
  1249. if getVar("timeOut") == "True":
  1250. addTimeout(3,TIME_OUT_TIME+5,600)
  1251. return rebuildMainHtml(st)
  1252. else :
  1253. return rebuildMainHtml(st)
  1254.  
  1255. if event == "giveBuffs" :
  1256. if eventParam3 == "buff" :
  1257. cost = BUFF_PRICE
  1258. if eventParam3 == "song" :
  1259. cost = SONG_PRICE
  1260. if eventParam3 == "dance" :
  1261. cost = DANCE_PRICE
  1262. if eventParam3 == "chant" :
  1263. cost = CHANT_PRICE
  1264. if eventParam3 == "kamael" :
  1265. cost = KAMAEL_PRICE
  1266. if eventParam3 == "special" :
  1267. cost = SPECIAL_PRICE
  1268. if currentTime > st.getInt("blockUntilTime") :
  1269. if getVar("freeBuffs") == "False" :
  1270. # we need to generate the price depending of the Zone type
  1271. if player.isInsideZone(0) :
  1272. cost = cost * PVP_ZONE_PRICE_MULTIPLIER
  1273. if st.getQuestItemsCount(CONSUMABLE_ID) < cost :
  1274. return showText("Sorry","You don't have enough adena!","False",0,0)
  1275. else :
  1276. st.takeItems(CONSUMABLE_ID,cost)
  1277. # maybe need some space check..
  1278. SkillTable.getInstance().getInfo(int(eventParam1),int(eventParam2)).getEffects(st.getPlayer(),st.getPlayer())
  1279. heal()
  1280. if getVar("timeOut") == "True":
  1281. addTimeout(3,TIME_OUT_TIME,600)
  1282. return buildHtml(eventParam3)
  1283. else :
  1284. return buildHtml(eventParam3)
  1285.  
  1286. if event == "castBuffSet" :
  1287. if currentTime > st.getInt("blockUntilTime") :
  1288. if getVar("freeBuffs") == "False" :
  1289. if player.isInsideZone(0) :
  1290. BUFF_SET_PRICE = BUFF_SET_PRICE * PVP_ZONE_PRICE_MULTIPLIER
  1291. if st.getQuestItemsCount(CONSUMABLE_ID) < BUFF_SET_PRICE :
  1292. return showText("Sorry","You don't have enough adena!","False",0,0)
  1293. else :
  1294. st.takeItems(CONSUMABLE_ID,BUFF_SET_PRICE)
  1295. buff_sets=[]
  1296. player_class = 3
  1297. i = 0
  1298. i f st.getPlayer().isMageClass() :
  1299. player_class = 1
  1300. else :
  1301. player_class = 0
  1302. conn=L2DatabaseFactory.getInstance().getConnection()
  1303. getSimilarNameCount = conn.prepareStatement("SELECT buffId,buffLevel FROM buffer_buff_list WHERE forClass IN (?,?) ORDER BY id ASC")
  1304. getSimilarNameCount.setString(1, str(player_class))
  1305. getSimilarNameCount.setString(2, "2")
  1306. rss = getSimilarNameCount.executeQuery()
  1307. while (rss.next()) :
  1308. try :
  1309. id = rss.getInt("buffId")
  1310. lvl = rss.getInt("buffLevel")
  1311. buff_sets += [id,lvl]
  1312. except :
  1313. buff_sets = []
  1314. conn.close()
  1315. try:
  1316. conn.close()
  1317. except:
  1318. pass
  1319. while i <= len(buff_sets)-2 :
  1320. SkillTable.getInstance().getInfo(buff_sets[i],buff_sets[i+1]).getEffects(st.getPlayer(),st.getPlayer())
  1321. i = i + 2
  1322. heal()
  1323. if getVar("timeOut") == "True":
  1324. addTimeout(3,TIME_OUT_TIME + 10,600)
  1325. return rebuildMainHtml(st)
  1326. else :
  1327. return rebuildMainHtml(st)
  1328.  
  1329. return rebuildMainHtml(st)
  1330.  
  1331. def onFirstTalk (self,npc,player):
  1332. st = player.getQuestState(QUEST_LOADING_INFO)
  1333. if not st :
  1334. st = self.newQuestState(player)
  1335. if player.isGM() :
  1336. return rebuildMainHtml(st)
  1337. else :
  1338. if player.getLevel() < int(getVar("minlevel")) :
  1339. return showText("Info","Your level is too low!<br>You have to be at least level <font color\"LEVEL\">"+getVar("minlevel")+"</font>,<br>to use my services!","False","Return","main")
  1340. elif getVar("buffWithKarma") == "False" and player.getKarma() > 0 :
  1341. return showText("Info","You have too much karma!<br>Come back,<br>when you don't have any karma!","False","Return","main")
  1342. elif player.getPvpFlag() > 0 :
  1343. return showText("Info","You can't buff while you are flagged!<br>Wait some time and try again!","False","Return","main")
  1344. elif player.isAttackingNow() :
  1345. return showText("Info","You can't buff while you are attacking!<br>Stop your fight and try again!","False","Return","main")
  1346. elif Olympiad.getInstance().isRegistered(player):
  1347. return showText("info","You can't buff while you are registered for the Olympiad Games!","False","Return","main")
  1348. else:
  1349. return rebuildMainHtml(st)
  1350.  
  1351.  
  1352. QUEST = Quest(QUEST_ID,QUEST_LOADING_INFO,QUEST_DESCRIPTION)
  1353.  
  1354. QUEST.addStartNpc(NPC_ID)
  1355. QUEST.addFirstTalkId(NPC_ID)
  1356. QUEST.addTalkId(NPC_ID)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement