npc edit / bypass help
Posted: Tue Mar 08, 2011 12:57 am
L2J Revision LATEST:
L2JDP Revision LATEST:
hello , i wanna have 1 npc (AIO in my case ) but with 2 buffers , my AIO has one buffer and i wanna add one 2nd
i think i have to add in my AIO npc in the button i want ,the bypass for the 2nd buffer , right or not ?
here is my AIO'S code
and here is my 2nds buffer py
its not all the code here because The maximum number of allowed characters is 60000
well , i just wanna have Scheme Buffer on my AIO if is it possible , its not problem to remove the 1st buffer, just i dont know how to do it , thats why im asking you here ppl
just show me one way to do it , with bypass code or any other better solution 
sorry if i made the post on the wrong category
L2JDP Revision LATEST:
hello , i wanna have 1 npc (AIO in my case ) but with 2 buffers , my AIO has one buffer and i wanna add one 2nd
i think i have to add in my AIO npc in the button i want ,the bypass for the 2nd buffer , right or not ?

here is my AIO'S code
Code: Select all
<html><head> <title>Buffer</title><center><img src="l2font-e.mini_logo-e" width=240 height=92><body><center><button action="bypass -h npc_%objectId%_Link teleporter/buffer/NpcBuffer-0.htm" value="Deluxe Buffer" width=120 height=27 back="L2UI_CT1.Gauge_DF_Attribute_Water" fore="L2UI_CT1.Gauge_DF_Attribute_Water"><br><button action="bypass -h npc_%objectId%_Quest 555_NPCBUFFER" value="Scheme Buffer" width=120 height=27 back="L2UI_CT1.Gauge_DF_Attribute_Water" fore="L2UI_CT1.Gauge_DF_Attribute_Water"></body></html>
Code: Select all
import sysfrom java.lang import Systemfrom java.util import Iteratorfrom com.l2jserver import Configfrom com.l2jserver import L2DatabaseFactoryfrom com.l2jserver.gameserver.model.quest import Statefrom com.l2jserver.gameserver.model.quest import QuestStatefrom com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuestfrom com.l2jserver.gameserver.datatables import SkillTablefrom com.l2jserver.gameserver.datatables import ItemTablefrom com.l2jserver.gameserver.model.actor.instance import L2PetInstancefrom com.l2jserver.gameserver.model.actor.instance import L2SummonInstancefrom com.l2jserver.gameserver.model.zone import L2ZoneTypefrom com.l2jserver.gameserver.network.serverpackets import SetupGauge QUEST_ID = 55555QUEST_NAME = "NPCBuffer"QUEST_DESCRIPTION = "custom"QUEST_LOADING_INFO = str(QUEST_ID)+"_"+QUEST_NAMENPC_ID = 555555 print "============================="print "INFO Loaded DELUX BUFFER"print "=============================" # ============================================================ ## GLOBAL FUNCTIONS # def getBuffType(id) : # gets buff type (depends of the ID) conn=L2DatabaseFactory.getInstance().getConnection() act = conn.prepareStatement("SELECT buffType FROM buffer_buff_list WHERE buffId=? LIMIT 1") act.setInt(1, int(id)) rs=act.executeQuery() if rs : rs.next() try : val = rs.getString("buffType") conn.close() except : val = "none" try : conn.close() except: pass else : val = "none" return val def isEnabled(id,level) : # check if buff is enabled val = "" conn=L2DatabaseFactory.getInstance().getConnection() act = conn.prepareStatement("SELECT canUse FROM buffer_buff_list WHERE buffId=? AND buffLevel=? LIMIT 1") act.setInt(1, int(id)) act.setInt(2, int(level)) rs=act.executeQuery() if rs : rs.next() try : val = rs.getString("canUse") conn.close() except : val = "0" try : conn.close() except: pass else : val = "0" if val == "1" : val = "True" if val == "0" : val = "False" return val def isUsed(scheme,id,level) : # check if skill is already in the scheme list count = 0 used = False conn=L2DatabaseFactory.getInstance().getConnection() rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id=\""+str(scheme)+"\" AND skill_id=\""+str(id)+"\" AND skill_level=\""+str(level)+"\"") action=rss.executeQuery() while (action.next()) : try : count = count + 1 except : count = 0 try : conn.close() except : pass if count > 0 : used = True else : used = False return used def getVar(optionName): # gets variable from the database conn=L2DatabaseFactory.getInstance().getConnection() act = conn.prepareStatement("SELECT configValue FROM buffer_configuration WHERE configName=\""+optionName+"\" LIMIT 1") rs=act.executeQuery() if rs : rs.next() try : val = rs.getString("configValue") conn.close() except : val = "0" try : conn.close() except: pass else : val = "0" return val def getclassbuff(id): conn=L2DatabaseFactory.getInstance().getConnection() getTipo = conn.prepareStatement("SELECT * FROM buffer_buff_list WHERE buffId=\""+id+"\"") gt=getTipo.executeQuery() if gt : gt.next() try : xtipo = gt.getString("buffType") conn.close() except : xtipo = "none" try : conn.close() except : pass val = 0 if xtipo == "song" or xtipo == "dance" : val = 1 return val def getdanceCount(scheme,xval) : # get dance count in the current scheme count = 0 conn=L2DatabaseFactory.getInstance().getConnection() rss = conn.prepareStatement("SELECT * FROM buffer_scheme_contents WHERE scheme_id=\""+str(scheme)+"\" AND buff_class=\""+xval+"\"") action=rss.executeQuery() while (action.next()) : try : count = count + 1 except : count = 0 try : conn.close() except : pass return count # ## ============================================================ # def showText(type,text,buttonEnabled,buttonName,location) : MESSAGE = "<html><head><title>"+getVar("title")+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>" MESSAGE += "<font color=\"LEVEL\">"+type+"</font><br>"+text+"<br>" if buttonEnabled == "True" : 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\">" MESSAGE += "<font color=\"303030\">Rin4a's Buffer</font></center></body></html>" return MESSAGE def petvar(st) : # generates scheme list HTML: available schemes, scheme management schemeId = "" val = "true" conn=L2DatabaseFactory.getInstance().getConnection() rss = conn.prepareStatement("SELECT * FROM buffer_pet_list WHERE player_id="+str(st.getPlayer().getObjectId())+" AND scheme_name=\"PetOn\"") action=rss.executeQuery() while (action.next()) : try : schemeId = action.getString("scheme_name") val = "false" except : pass try : conn.close() except : pass return val def generateScheme(st) : # generates scheme list HTML: available schemes, scheme management schemeName = [] schemeId = [] HTML = "" conn=L2DatabaseFactory.getInstance().getConnection() rss = conn.prepareStatement("SELECT * FROM buffer_scheme_list WHERE player_id="+str(st.getPlayer().getObjectId())) action=rss.executeQuery() while (action.next()) : try : schemeName += [action.getString("scheme_name")] schemeId += [action.getString("id")] except : print "Query error!" try : conn.close() except : pass if len(schemeName) > 0: HTML += "<br1>Available Schemes<br1>" i = 0 while i <= len(schemeName) - 1: HTML += "<button value=\""+schemeName[i]+"\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" cast "+schemeId[i]+" x x\" width=130 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" i = i + 1 HTML += "<br>Schemes Management" if len(schemeName) < int(getVar("schemeCount")) : HTML += "<table><tr><td><button value=\"Create\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" create_1 x x x\" width=50 height=18 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" else : HTML += "<table width=100><tr>" if len(schemeName) > 0 : HTML += "<td><button value=\"Edit\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" edit_1 x x x\" width=50 height=18 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" HTML += "<td><button value=\"Delete\" action=\"bypass -h Quest "+QUEST_LOADING_INFO+" delete_1 x x x\" width=50 height=18 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table>" else : HTML += "</tr></table>" return HTMLdef getdivineins(st): conn=L2DatabaseFactory.getInstance().getConnection() itemidList = conn.prepareStatement("SELECT * FROM character_skills WHERE charId =\""+str(st.player.getObjectId())+"\" AND class_index =\""+str(st.player.getClassIndex())+"\" AND skill_id = \"1405\" LIMIT 1") il=itemidList.executeQuery() if il : il.next() try : val = il.getInt("skill_level") conn.close() except : val = 0 try : conn.close() except: pass else : val = 0 return val def rebuildMainHtml(st) : # generating main HMTL file MAIN_HTML_MESSAGE = "<html><head><title>"+getVar("title")+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>" available = True if getVar("vipBuffer") == "True" : if st.getPlayer().getAccessLevel() < int(getVar("vipBufferMinAccessLevel")) : available = False if available == True : if st.getPlayer().isInsideZone(0) : if int(getVar("pvpMultiplier")) == 1 : MAIN_HTML_MESSAGE += "ZONE PRICE MULTIPLIER: <font color=\"LEVEL\">OFF</font><br>" else : MAIN_HTML_MESSAGE += "ZONE PRICE MULTIPLIER: <font color=\"LEVEL\">"+getVar("pvpMultiplier")+"</font><br>" else : MAIN_HTML_MESSAGE += "ZONE PRICE MULTIPLIER: <font color=\"LEVEL\">OFF</font><br>" if st.player.getPet() != None : if petvar(st) == "true": MAIN_HTML_MESSAGE += "<button value=\"Pet: Off\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " buffpet PetOn 0 0\" width=60 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" else: MAIN_HTML_MESSAGE += "<button value=\"Pet: On\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " buffpet YYYYYYYYYY 0 0\" width=60 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" if getVar("schemeSystem") == "Disabled" : if getVar("enableBuffs") == "True" : 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\">" if getVar("enableResist") == "True" : MAIN_HTML_MESSAGE += "<button value=\"Resist\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " redirect view_resists 0 0\" width=130 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" if getVar("enableSongs") == "True" : 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\">" if getVar("enableDances") == "True" : 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\">" if getVar("enableChants") == "True" : 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\">" if getVar("enableKamael") == "True" : MAIN_HTML_MESSAGE += "<button value=\"Others\" 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\">" if getVar("enableSpecial") == "True" : 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\">" if getVar("schemeSystem") == "Enabled" : MAIN_HTML_MESSAGE += generateScheme(st) # generate the new scheme system if getVar("enableBuffSet") == "True" : MAIN_HTML_MESSAGE += "<br>Miscellaneous<br1>" MAIN_HTML_MESSAGE += "<button value=\"Auto Buff\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " castBuffSet 0 0 0\" width=80 height=18 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" if getVar("enableHeal") == "True" : MAIN_HTML_MESSAGE += "<button value=\"Heal\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " heal 0 0 0\" width=80 height=18 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" if getVar("enableBuffRemove") == "True": MAIN_HTML_MESSAGE += "<button value=\"Rem. buffs\" action=\"bypass -h Quest " + QUEST_LOADING_INFO + " removeBuffs 0 0 0\" width=80 height=18 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" if st.getPlayer().isGM() : MAIN_HTML_MESSAGE += "<br>Configurations<br1>" 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\">" 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\">" else : MAIN_HTML_MESSAGE += "This buffer is only for VIP's!<br>Contact the administrator for more info!<br>" MAIN_HTML_MESSAGE += "<font color=\"303030\">Rin4a's Buffer</font></center></body></html>" return MAIN_HTML_MESSAGE class Quest (JQuest) : def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) def onAdvEvent (self,event,npc,player) : st = player.getQuestState(QUEST_LOADING_INFO) htmltext = event currentTime = int(System.currentTimeMillis()/1000) # get current game time ( FOR TIME OUT SYSTEM ) HEADER = "<html><head><title>"+getVar("title")+"</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>" FOOTER = "<br><font color=\"303030\">Rin4a's Buffer</font></center></body></html>" STYLE = getVar("style") CONSUMABLE_ID = int(getVar("consumableId")) BUFF_WITH_KARMA = getVar("buffWithKarma") TIME_OUT = getVar("timeOut") TIME_OUT_TIME = int(getVar("timeOutTime")) FREE_BUFFS = getVar("freeBuffs") HEAL_PRICE = int(getVar("healPrice")) BUFF_PRICE = int(getVar("buffPrice")) RESIST_PRICE = int(getVar("resistPrice")) SONG_PRICE = int(getVar("songPrice")) DANCE_PRICE = int(getVar("dancePrice")) CHANT_PRICE = int(getVar("chantPrice")) KAMAEL_PRICE = int(getVar("kamaelPrice")) SPECIAL_PRICE = int(getVar("specialPrice")) BUFF_REMOVE_PRICE = int(getVar("buffRemovePrice")) ENABLE_HEAL = getVar("enableHeal") ENABLE_BUFFS = getVar("enableBuffs") ENABLE_RESIST = getVar("enableResist") ENABLE_SONGS = getVar("enableSongs") ENABLE_DANCES = getVar("enableDances") ENABLE_CHANTS = getVar("enableChants") ENABLE_KAMAEL = getVar("enableKamael") ENABLE_SPECIAL = getVar("enableSpecial") ENABLE_BUFF_REMOVE = getVar("enableBuffRemove") MIN_ACCESS_LEVEL = int(getVar("gmAccessLevel")) ENABLE_BUFF_SET = getVar("enableBuffSet") BUFF_SET_PRICE = int(getVar("buffSetPrice")) ENABLE_BUFF_SORT = getVar("sortBuffs") MAX_BUFFS_PER_SCHEME = Config.BUFFS_MAX_AMOUNT + Config.DANCES_MAX_AMOUNT + getdivineins(st) SCHEME_BUFF_PRICE = int(getVar("schemeBuffPrice")) SCHEMES_PER_PLAYER = getVar("schemeCount") PVP_ZONE_PRICE_MULTIPLIER = int(getVar("pvpMultiplier")) VIP_ENABLED = getVar("vipBuffer") VIP_MIN_ACCESS = int(getVar("vipBufferMinAccessLevel")) if petvar(st) == "false" and st.player.getPet() != None : getpetbuff = 1 else: getpetbuff = 0 # ====================================================== # # HTML GENERATION - SCHEME SYSTEM # def createScheme() : # just a HTML file: scheme creation HTML = HEADER+"<br>You MUST seprerate new words with a dot (.)<br><br>Scheme name: <edit var=\"name\" width=100><br><br>" 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\">" 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\">" HTML += FOOTER return HTML

well , i just wanna have Scheme Buffer on my AIO if is it possible , its not problem to remove the 1st buffer, just i dont know how to do it , thats why im asking you here ppl


sorry if i made the post on the wrong category
