09-19-2011, 06:09 PM
Доброго времени суток.
Поставил НПЦ (Donate Shop) на сборку L2jFrozen rev.886.
Все функции в нем работают, а вот выдача геройства на определенное количество дней почему-то нет.Вообщем питон работает но когда приходит время выдать геройство этого не происходит, а получаю лишь эррор в ГС:
Вот и сам питон:
Помогите решить эту проблему.
Буду очень благодарен за помощь.
С меня +
Поставил НПЦ (Donate Shop) на сборку L2jFrozen rev.886.
Все функции в нем работают, а вот выдача геройства на определенное количество дней почему-то нет.Вообщем питон работает но когда приходит время выдать геройство этого не происходит, а получаю лишь эррор в ГС:
GS
E:\L2jFrozen rev.886\gameserver\data\scripts\custom\50301_Hero\__init__.py
Traceback (innermost last):
File "__init__.py", line 90, in onAdvEvent
AttributeError: addHero
at org.python.core.Py.AttributeError(Unknown Source)
at org.python.core.PyInstance.invoke(Unknown Source)
at org.python.pycode._pyx43.onAdvEvent$3(__init__.py:90)
at org.python.pycode._pyx43.call_function(__init__.py)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyFunction.__call__(Unknown Source)
at org.python.core.PyMethod.__call__(Unknown Source)
at org.python.core.PyObject.__call__(Unknown Source)
at org.python.core.PyObject._jcallexc(Unknown Source)
at org.python.core.PyObject._jcall(Unknown Source)
at org.python.proxies.main$Quest$40.onAdvEvent(Unknown Source)
at com.l2jfrozen.gameserver.model.quest.Quest.notifyEvent(Quest.java:476
)
at com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance.processQue
stEvent(L2PcInstance.java:1877)
at com.l2jfrozen.gameserver.network.clientpackets.RequestBypassToServer.
runImpl(RequestBypassToServer.java:310)
at com.l2jfrozen.gameserver.network.clientpackets.L2GameClientPacket.run
(L2GameClientPacket.java:75)
at com.l2jfrozen.gameserver.network.L2GameClient.run(L2GameClient.java:1
202)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Traceback (innermost last):
File "__init__.py", line 90, in onAdvEvent
AttributeError: addHero
at org.python.core.Py.AttributeError(Unknown Source)
at org.python.core.PyInstance.invoke(Unknown Source)
at org.python.pycode._pyx43.onAdvEvent$3(__init__.py:90)
at org.python.pycode._pyx43.call_function(__init__.py)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyFunction.__call__(Unknown Source)
at org.python.core.PyMethod.__call__(Unknown Source)
at org.python.core.PyObject.__call__(Unknown Source)
at org.python.core.PyObject._jcallexc(Unknown Source)
at org.python.core.PyObject._jcall(Unknown Source)
at org.python.proxies.main$Quest$40.onAdvEvent(Unknown Source)
at com.l2jfrozen.gameserver.model.quest.Quest.notifyEvent(Quest.java:476
)
at com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance.processQue
stEvent(L2PcInstance.java:1877)
at com.l2jfrozen.gameserver.network.clientpackets.RequestBypassToServer.
runImpl(RequestBypassToServer.java:310)
at com.l2jfrozen.gameserver.network.clientpackets.L2GameClientPacket.run
(L2GameClientPacket.java:75)
at com.l2jfrozen.gameserver.network.L2GameClient.run(L2GameClient.java:1
202)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Вот и сам питон:
Hero
import sys
from java.lang import Integer
from com.l2jfrozen.gameserver.model.entity import Hero
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
###################
qn = "50301_Hero" #
NPC = 300301 #
###################
##############################################################
Item = 9998 # ID валюты #
Count = 1 # Каждый день гер.уможается на цену #
Iname = "Donate Coin" # Имя валюты #
##############################################################
day = [] # Тут не трогаем
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onAdvEvent(self,event,npc,player) :
global day
st = player.getQuestState(qn)
htmltext = event
xHRx = 0
eventSplit = event.split(" ")
event = eventSplit[0]
if event == "countHero" :
try :
xHRx = Integer.parseInt(eventSplit[1])
except :
htmltext = "start.htm"
return htmltext
if (xHRx < 10):
htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
htmltext += u"<font color=\"LEVEL\">\u041c\u0438\u043d\u0438\u043c\u0443\u043c \u0445\u0438\u0440\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430 10 \u0434\u043d\u0435\u0439 !</font>"
htmltext += u"<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><br>"
htmltext += u"<table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
htmltext += "</center></body></html>"
return htmltext
day.append(xHRx)
counts = int(xHRx*Count)
st.playSound("ItemSound.quest_accept")
htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32>"
htmltext += u"<table><tr><td align=center><font color=\"FF0000\">"+str(xHRx)+"</font> "
htmltext += u"<font color=\"LEVEL\">\u0434\u043d\u0435\u0439 \u0433\u0435\u0440\u043e\u0439\u0441\u0442\u0432\u0430,</td></tr>"
htmltext += u"<tr><td align=center>C\u0442\u043e\u0438\u0442:</font> <font color=\"FF0000\">"+str(counts)+"</font> <font color=\"LEVEL\">"+Iname+" !</font></td></tr></table>"
htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
htmltext += u"<table><tr><td align=center><button value=\"\u041f\u043e\u043b\u0443\u0447\u0442\u044c \u0433\u0435\u0440\u043e\u0439\u0441\u0442\u0432\u043e\" action=\"bypass -h Quest 50301_Hero setHero\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"></td></tr>"
htmltext += u"<tr><td></td></tr><tr><td align=center><button value=\"\u041e\u0442\u043c\u0435\u043d\u0430\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32>"
htmltext += "</center></body></html>"
return htmltext
if event == "setHero" :
days = day[0]
countss = int(days*Count)
if st.getQuestItemsCount(Item) < countss :
htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
htmltext += u"<font color=\"LEVEL\">\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !</font>"
htmltext += u"<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><br>"
htmltext += u"<table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
htmltext += "</center></body></html>"
return htmltext
elif not player.isNoble() :
htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
htmltext += u"<font color=\"LEVEL\">\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0433\u0435\u0440\u043e\u0439\u0441\u0442\u0432\u043e,<br>\u041d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u0432\u043e\u0440\u044f\u043d\u0438\u043d\u043e\u043c !</font>"
htmltext += u"<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><br>"
htmltext += u"<table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
htmltext += "</center></body></html>"
return htmltext
elif player.isHero():
htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
htmltext += u"<font color=\"LEVEL\">\u0412\u044b \u0438 \u0442\u0430\u043a \u0433\u0435\u0440\u043e\u0439 !</font>"
htmltext += u"<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><br>"
htmltext += u"<table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
htmltext += "</center></body></html>"
return htmltext
st.takeItems(Item,countss)
Hero.getInstance().addHero(player,days)
st.giveItems(6842,1)
st.playSound("ItemSound.quest_finish")
htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
htmltext += u"<font color=\"LEVEL\">\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0433\u0435\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043d\u0430</font> <font color=\"FF0000\">"+str(days)+"</font> "
htmltext += u"<font color=\"LEVEL\">\u0434\u043d\u0435\u0439 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
htmltext += u"<img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><br><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
htmltext += "</center></body></html>"
st.exitQuest(1)
day = []
return htmltext
def onTalk(self,npc,player) :
htmltext = "Sorry !"
st = player.getQuestState(qn)
if not st :
st = self.newQuestState(player)
htmltext = "start.htm"
return htmltext
QUEST = Quest(50301,qn,"custom")
CREATED = State('Start', QUEST)
STARTING = State('Starting', QUEST)
STARTED = State('Started', QUEST)
COMPLETED = State('Completed', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)
from java.lang import Integer
from com.l2jfrozen.gameserver.model.entity import Hero
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
###################
qn = "50301_Hero" #
NPC = 300301 #
###################
##############################################################
Item = 9998 # ID валюты #
Count = 1 # Каждый день гер.уможается на цену #
Iname = "Donate Coin" # Имя валюты #
##############################################################
day = [] # Тут не трогаем
class Quest (JQuest) :
def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
def onAdvEvent(self,event,npc,player) :
global day
st = player.getQuestState(qn)
htmltext = event
xHRx = 0
eventSplit = event.split(" ")
event = eventSplit[0]
if event == "countHero" :
try :
xHRx = Integer.parseInt(eventSplit[1])
except :
htmltext = "start.htm"
return htmltext
if (xHRx < 10):
htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
htmltext += u"<font color=\"LEVEL\">\u041c\u0438\u043d\u0438\u043c\u0443\u043c \u0445\u0438\u0440\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430 10 \u0434\u043d\u0435\u0439 !</font>"
htmltext += u"<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><br>"
htmltext += u"<table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
htmltext += "</center></body></html>"
return htmltext
day.append(xHRx)
counts = int(xHRx*Count)
st.playSound("ItemSound.quest_accept")
htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32>"
htmltext += u"<table><tr><td align=center><font color=\"FF0000\">"+str(xHRx)+"</font> "
htmltext += u"<font color=\"LEVEL\">\u0434\u043d\u0435\u0439 \u0433\u0435\u0440\u043e\u0439\u0441\u0442\u0432\u0430,</td></tr>"
htmltext += u"<tr><td align=center>C\u0442\u043e\u0438\u0442:</font> <font color=\"FF0000\">"+str(counts)+"</font> <font color=\"LEVEL\">"+Iname+" !</font></td></tr></table>"
htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
htmltext += u"<table><tr><td align=center><button value=\"\u041f\u043e\u043b\u0443\u0447\u0442\u044c \u0433\u0435\u0440\u043e\u0439\u0441\u0442\u0432\u043e\" action=\"bypass -h Quest 50301_Hero setHero\" width=135 height=24 back=\"L2UI_CH3.bigbutton3_down\" fore=\"L2UI_CH3.bigbutton3\"></td></tr>"
htmltext += u"<tr><td></td></tr><tr><td align=center><button value=\"\u041e\u0442\u043c\u0435\u043d\u0430\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
htmltext += "<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32>"
htmltext += "</center></body></html>"
return htmltext
if event == "setHero" :
days = day[0]
countss = int(days*Count)
if st.getQuestItemsCount(Item) < countss :
htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
htmltext += u"<font color=\"LEVEL\">\u0423 \u0432\u0430\u0441 \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 !</font>"
htmltext += u"<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><br>"
htmltext += u"<table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
htmltext += "</center></body></html>"
return htmltext
elif not player.isNoble() :
htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
htmltext += u"<font color=\"LEVEL\">\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0433\u0435\u0440\u043e\u0439\u0441\u0442\u0432\u043e,<br>\u041d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u0432\u043e\u0440\u044f\u043d\u0438\u043d\u043e\u043c !</font>"
htmltext += u"<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><br>"
htmltext += u"<table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
htmltext += "</center></body></html>"
return htmltext
elif player.isHero():
htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
htmltext += u"<font color=\"LEVEL\">\u0412\u044b \u0438 \u0442\u0430\u043a \u0433\u0435\u0440\u043e\u0439 !</font>"
htmltext += u"<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><br>"
htmltext += u"<table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
htmltext += "</center></body></html>"
return htmltext
st.takeItems(Item,countss)
Hero.getInstance().addHero(player,days)
st.giveItems(6842,1)
st.playSound("ItemSound.quest_finish")
htmltext = "<html><title>Exclusive Shop</title><body><center><br><br>"
htmltext += "<img src=\"L2UI_CH3.onscrmsg_pattern01_1\" width=300 height=32><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
htmltext += u"<font color=\"LEVEL\">\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0433\u0435\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043d\u0430</font> <font color=\"FF0000\">"+str(days)+"</font> "
htmltext += u"<font color=\"LEVEL\">\u0434\u043d\u0435\u0439 !</font><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"
htmltext += u"<img src=\"L2UI_CH3.onscrmsg_pattern01_2\" width=300 height=32><br><table><tr><td align=center><button value=\"\u0412\u044b\u0445\u043e\u0434\" action=\"bypass -h npc_%objectId%_Close\" width=75 height=22 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\"></td></tr></table>"
htmltext += "</center></body></html>"
st.exitQuest(1)
day = []
return htmltext
def onTalk(self,npc,player) :
htmltext = "Sorry !"
st = player.getQuestState(qn)
if not st :
st = self.newQuestState(player)
htmltext = "start.htm"
return htmltext
QUEST = Quest(50301,qn,"custom")
CREATED = State('Start', QUEST)
STARTING = State('Starting', QUEST)
STARTED = State('Started', QUEST)
COMPLETED = State('Completed', QUEST)
QUEST.setInitialState(CREATED)
QUEST.addStartNpc(NPC)
QUEST.addTalkId(NPC)
Помогите решить эту проблему.
Буду очень благодарен за помощь.
С меня +