08-17-2012, 10:56 AM
Такой вопрос, написал небольшой тестовый квест, чтобы проверить выдачу скиллов. В итоге вылетают ошибки на addSkill. Может косяк с импортами, но вроде добавил уже всё что можно.
Вот addSkill
Что не так?
Код:
import sys
from ru.l2open import Config
from ru.l2open.gameserver.model.quest import State
from ru.l2open.gameserver.model.quest import QuestState
from ru.l2open.gameserver.datatables import SkillTable
from ru.l2open.gameserver.model.quest.jython import QuestJython as JQuest
from ru.l2open.gameserver.model.actor.instance import L2PcInstance
from ru.l2open.gameserver.model import L2Skill
from ru.l2open.gameserver.model.L2Skill import *
from ru.l2open.gameserver.model.actor.instance.L2PcInstance import *
from ru.l2open.util import Rnd
qn = "1001_Hunting"
class Quest (JQuest) :
def __init__(self,id,name,descr):
JQuest.__init__(self,id,name,descr)
def onAdvEvent (self,event,npc,player) :
htmltext = event
st = player.getQuestState(qn)
cond = st.getInt("cond")
if not st : return
if event == "30008-01.htm" :
st.set("cond","1")
st.setState(State.STARTED)
st.playSound("ItemSound.quest_accept")
htmltext = event
return htmltext
def onTalk (self,npc,player):
htmltext = "30008-00.htm"
st = player.getQuestState(qn)
if not st : return htmltext
npcId = npc.getNpcId()
id = st.getState()
if id == State.CREATED :
if player.getLevel() < 4 :
st.setState(State.STARTED)
htmltext = "30008-01.htm"
st.set("cond","1")
else:
htmltext = "30008-00.htm"
st.exitQuest(1)
elif id == State.COMPLETED :
htmltext = "30008-00.htm"
elif id == State.STARTED :
try :
cond = st.getInt("cond")
except :
cond = None
if cond == 1 :
if npcId == 30008 :
st.addExpAndSp(5,0)
st.takeItems(2,100)
st.giveItems(57,100)
st.set("cond","2")
htmltext = "30008-02.htm"
elif cond == 2 :
if npcId == 30008 and st.getQuestItemsCount(57) >=1 :
st.addExpAndSp(6,0)
st.takeItems(3,100)
st.giveItems(57,1)
st.addSkill(601, true)
htmltext = "30008-03.htm"
return htmltext
QUEST = Quest(1001,qn,"Hunting")
QUEST.addStartNpc(30008)
QUEST.addTalkId(30008)
Вот addSkill
Код:
public L2Skill addSkill(L2Skill newSkill, boolean store)
{
// Add a skill to the L2PcInstance _skills and its Func objects to the calculator set of the L2PcInstance
L2Skill oldSkill = super.addSkill(newSkill);
// Add or update a L2PcInstance skill in the character_skills table of the database
if (store) storeSkill(newSkill, oldSkill, -1);
return oldSkill;
}
Что не так?