Jump to content
Sign in to follow this  
svjatoy

Подскажите С Бафером

Recommended Posts

Подскажите, что и где дописать в скрипте у бафера, чтоб установить возможность пользоваться им до определенного уровня

заранее спасибо

Вот скрипт бафера

 

import sys

from com.l2jfrozen.util.database import L2DatabaseFactory

from com.l2jfrozen.gameserver.model.quest import State

from com.l2jfrozen.gameserver.model.quest import QuestState

from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest

from com.l2jfrozen.gameserver.model.actor.instance import L2PcInstance

from com.l2jfrozen.gameserver.model import L2Skill

from java.util import Iterator

from com.l2jfrozen.gameserver.datatables import SkillTable

 

qn = "Buffer_by_Sydhe"

NPC = [50104]

ACCEPT_BUFF = [1040, 1068, 1035, 1043, 1077, 1078, 1085, 1311, 1032,

1036, 1045, 1048, 4352, 4357, 4391, 4403, 4405, 1243,

1388, 1389, 1087, 1259, 1059, 1268]

ACCEPT_DANCES = [271, 272, 273, 274, 275, 276, 277, 307, 309,

310, 311, 365]

ACCEPT_SONGS = [364, 264, 306, 269, 270, 265, 363, 349, 308,

305, 304, 267, 266, 268]

ACCEPT_CHANTS = [1251, 1252, 1253, 1284, 1006, 1007, 1009, 1362,

1310, 1309, 1308, 1391, 1390]

ACCEPT_SPECIAL = [1364, 1356, 1355, 1357, 1413, 4702, 4703, 4700,

4699, 1323]

ACCEPT_RESISTS = [1393, 1392, 1182, 1189, 1191, 1073]

 

QuestId = -1

QuestName = "Buffer"

QuestDesc = "custom"

 

print qn + " Buffer l2maxi.ru (KFan)"

 

class Quest (JQuest) :

 

def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)

 

def onEvent(self, event, st):

htmltext = "Sory, failed Event"

ownerid = st.getPlayer().getObjectId()

effects = st.getPlayer().getAllEffects()

if event.startswith("page_") :

page = int(event.replace("page_", ""))

htmltext = str(page) + ".htm"

elif event == "cancel" :

st.getPlayer().stopAllEffects()

htmltext = "1.htm"

activePage = 1

elif event == "reload" :

st.getPlayer().restoreCP()

st.getPlayer().restoreHP()

st.getPlayer().restoreMP()

htmltext = "1.htm"

elif event.startswith("buff_") :

id_lvl = event.replace("buff_", "")

id_lvl = id_lvl.split("_")

SkillTable.getInstance().getInfo(int(id_lvl[0]), int(id_lvl[1])).getEffects(st.getPlayer(), st.getPlayer())

htmltext = str(int(id_lvl[2])) + ".htm"

elif event.startswith("profile_") :

act = event.replace("profile_", "")

con = L2DatabaseFactory.getInstance().getConnection()

if act.startswith("buff_") :

act = str(int(act.replace("buff_", "")))

sql = con.prepareStatement("SELECT * FROM profile_buff WHERE char_id = ? AND pindex = ?")

sql.setInt(1, int(ownerid))

sql.setInt(2, int(act))

rs = sql.executeQuery()

rs.next()

full_buffs = rs.getString("skills").split(";")

sql.close()

rs.close()

for buff in full_buffs :

if buff != "" :

buff = buff.split(",")

SkillTable.getInstance().getInfo(int(buff[0]), int(buff[1])).getEffects(st.getPlayer(), st.getPlayer())

 

htmltext = "1.htm"

elif act.startswith("save_") :

act = str(int(act.replace("save_", "")))

sqll = con.prepareStatement("DELETE FROM profile_buff WHERE char_id = ? AND pindex = ?")

sqll.setInt(1, int(ownerid))

sqll.setInt(2, int(act))

sqll.execute()

sqll.close()

saving = "++"

for eff in effects :

eff_id = eff.getSkill().getId()

eff_level = eff.getSkill().getLevel()

if saving == "++" :

if (eff_id in ACCEPT_BUFF or eff_id in ACCEPT_DANCES or eff_id in ACCEPT_SONGS or eff_id in ACCEPT_CHANTS or eff_id in ACCEPT_SPECIAL or eff_id in ACCEPT_RESISTS) :

saving = str(eff_id) + "," + str(eff_level) + ";"

else :

if (eff_id in ACCEPT_BUFF or eff_id in ACCEPT_DANCES or eff_id in ACCEPT_SONGS or eff_id in ACCEPT_CHANTS or eff_id in ACCEPT_SPECIAL or eff_id in ACCEPT_RESISTS) :

saving += str(eff_id) + "," + str(eff_level) + ";"

sql = con.prepareStatement("INSERT INTO profile_buff (char_id, pindex, skills) VALUES ('" + str(ownerid) + "', '" + str(act) + "', '" + saving + "')")

sql.execute()

sql.close()

htmltext = "8.htm"

con.close()

return htmltext

 

def onTalk (self, npc, player):

htmltext = "1.htm"

st = player.getQuestState(qn)

if not st : return htmltext

npcId = npc.getNpcId()

return htmltext

 

 

QUEST = Quest(QuestId, qn, QuestDesc)

CREATED = State('Start', QUEST)

STARTED = State('Started', QUEST)

COMPLETED = State('Completed', QUEST)

QUEST.setInitialState(CREATED)

 

for npcId in NPC:

QUEST.addStartNpc(npcId)

QUEST.addTalkId(npcId)

Edited by svjatoy

Share this post


Link to post
Share on other sites
def onTalk (self, npc, player):
if player.getLevel() > 10:
return "ты очень большой для меня.htm"
else:
htmltext = "1.htm"
st = player.getQuestState(qn)
if not st : return htmltext
npcId = npc.getNpcId()
return htmltext

Edited by kanutoiiika

Share this post


Link to post
Share on other sites

def onTalk (self, npc, player):
if player.getLevel() > 10:
return "ты очень большой для меня.htm"
else:
htmltext = "1.htm"
st = player.getQuestState(qn)
if not st : return htmltext
npcId = npc.getNpcId()
return htmltext

спасибо за помощь но я наверно не так что то делаю так как твоя подсказка правильная но не работает

 

если можешь подскажи где я не правильно что то понимаю или делаю

я добавил еще одного бафера в cборку под id 50104

при разговоре с ним у меня идет переход на скрипт 50104.html (как java понимает что переходить надо именно на этот разговор я не понимаю но думаю в этом вся загвоздка)

 

50104.html представляет собой так

 

<html><title>Lineage II</title>

<br>

<table width="200" cellspacing="-2"><tr><td width=22 height=26><img src="l2ui.lottotc"></td><td width=128 height=26><img src="l2ui.lottotc" width=180 height=26></td><td height=26><img src="l2ui.lottotc" width=91 height=26></td></tr></table>

<center>

<table cellspacing="-2"><tr><td><img src="l2ui.lottoml" width=20 height=80><img src="l2ui.lottoml" width=20 height=50></td><td><img src="Buffer.main_pic1_by_Sydhe" width=128 height=128></td><td><img src="Buffer.main_pic3_by_Sydhe" width=128 height=128></td><td><img src="l2ui.lottomr" width=20 height=80><img src="l2ui.lottomr" width=20 height=50></td></tr></table>

<table width=1 height=1><tr></tr></table><table cellspacing="-2"><tr><td><img src="l2ui.lottoml" width=20 height=80><img src="l2ui.lottoml" width=20 height=50></td><td><img src="Buffer.main_pic2_by_Sydhe" width=128 height=128></td><td><img src="Buffer.main_pic4_by_Sydhe" width=128 height=128></td><td><img src="l2ui.lottomr" width=20 height=80><img src="l2ui.lottomr" width=20 height=50></td></tr></table></center><br>

</center>

<table width="200" cellspacing="-4"><tr><td width=25 height=26><img src="l2ui.lottobc"></td><td height=26><img src="l2ui.lottobc" width=180 height=26></td><td height=26><img src="l2ui.lottobc" width=95 height=26></td></tr></table>

<br>

<center>

<table cellspacing="-3"><tr>

<td><button value="Бафнуться" action="bypass -h npc_%objectId%_Quest Buffer_by_Sydhe" width=122 height=22 back="Buffer.btn1_by_Sydhe" fore="Buffer.btn3_by_Sydhe"></td>

</tr></table>

</center>

<br><br><font color=888888><center>L2underworld.ru</center></font>

</body></html>

 

дальше идет переход на файл unit.ru как я понял но если я добавляю то что ты указал выше то перехода не осуществляется

может я что то не догоняю помогите плиз кто может

если кому то интересно вот ссылка на бафера которого я пытаюсь настроить

http://l2maxi.ru/java/addons/6275-bufferhtmlikonki.html

Edited by svjatoy

Share this post


Link to post
Share on other sites

kanutoiiika

я добавил тебя в скайпе плизик включи скайп помоги с бафером я отблагодарю даже

Edited by svjatoy

Share this post


Link to post
Share on other sites

спасибо за помочь kanutoiiika

тему можно закрывать

Edited by svjatoy

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...