Skip to content
La2Base
Home
DownloadsWikiForumFAQ
Search
ruen
Sign up Login
HomeFilesWikiLogin
  • Home
  • Downloads
  • Wiki
  • FAQ
  • Contact Us
  • About
  • Rules
  • Privacy
  • Terms of Service

© 2026 la2base.com · All rights reserved

ruen
Forum/Квесты/[help] Виладж мастер
Search

[help] Виладж мастер

2 replies46 viewsCurrently viewing: 1
A6y
A6y

User

Участник

Posts: 91

На форуме с: 07/07/2007

Репутация: +46

Рейтинг: 0

· 05/04/2009, 03:49 PM

Собственно переделываю сервер под себя ввожу новые профы и тут дошло дело до получения профессии у виладж мастера. Полез разбираться с квестами на смену профу и тут у меня ступор...

Вот собственно набросок измененного кода

Код
import sys

from net.sf.l2j.gameserver.model.quest        import State
from net.sf.l2j.gameserver.model.quest        import QuestState
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest

qn = "dwarven_warior_occupation_change_1"
#Quest items
GAZE_OF_ABYSS     = 1244
#Reward Item
SHADOW_WEAPON_COUPON_DGRADE = 8869
#XENOS
NPCS=[40011]
#event:[newclass,req_class,req_race,low_ni,low_i,ok_ni,ok_i,req_item]
#low_ni : level too low, and you don't have quest item
#low_i: level too low, despite you have the item
#ok_ni: level ok, but you don't have quest item
#ok_i: level ok, you got quest item, class change takes place
CLASSES = {
    "PK":[100,53,4,"15","16","17","18",GAZE_OF_ABYSS],
    }
#Messages
default = "No Quest"

def change(st,player,newclass,item) :
   st.takeItems(item,1)
   st.playSound("ItemSound.quest_fanfare_2")
   player.setClassId(newclass)
   player.setBaseClass(newclass)
   player.broadcastUserInfo()
   return

class Quest (JQuest) :

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

def onAdvEvent (self,event,npc,player) :
   npcId    = npc.getNpcId()
   htmltext = default
   suffix = ''
   st = player.getQuestState(qn)
   if not st : return
   race     = player.getRace().ordinal()
   classid  = player.getClassId().getId()
   level    = player.getLevel()
   if npcId not in NPCS : return
   if not event in CLASSES.keys() :
     return event
   else :
     newclass,req_class,req_race,low_ni,low_i,ok_ni,ok_i,req_item=CLASSES[event]
     if race == req_race and classid == req_class :
        item = st.getQuestItemsCount(req_item)
        if level < 20 :
           suffix = "-"+low_i+".htm"
           if not item :
              suffix = "-"+low_ni+".htm"
        else :
           if not item :
              suffix = "-"+ok_ni+".htm"
           else :
              suffix = "-"+ok_i+".htm"
              st.giveItems(SHADOW_WEAPON_COUPON_DGRADE,15)
              change(st,player,newclass,req_item)
     st.exitQuest(1)
     htmltext = str(npcId)+suffix
   return htmltext

def onTalk (self,npc,player):
   st = player.getQuestState(qn)
   npcId = npc.getNpcId()
   race    = player.getRace().ordinal()
   classId = player.getClassId()
   id = classId.getId()
   htmltext = default
   if player.isSubClassActive() :
      st.exitQuest(1)
      return htmltext
   # Dark Elves only
   if npcId in NPCS :
     htmltext = str(npcId)
     if race in [4] :
       if classId.level() == 1 : # first occupation change already made
         htmltext += "-32.htm"
       elif classId.level() >= 2 : # second/third occupation change already made
         htmltext += "-31.htm"
       elif id == 31 :      # DE Fighter
         return htmltext+"-01.htm"
       elif id == 38 :      # DE Mystic
         return htmltext+"-08.htm"
     else :
       htmltext += "-33.htm"  # other races
   st.exitQuest(1)
   return htmltext

QUEST   = Quest(99997,qn,"village_master")
CREATED = State('Start', QUEST)

QUEST.setInitialState(CREATED)

for npc in NPCS :
    QUEST.addStartNpc(npc)
    QUEST.addTalkId(npc)


Вот код HTML у нпц

Код
<a action="bypass -h npc_%objectId%_Quest dwarven_warior_occupation_change_1">Listen to information about second class transfer.</a><br>

При нажатии у нпц на Listen to information about second class transfer
в чате пишет 40011 . и все и нечего не открывает... покамись в этой сфере не селен... но пытаюсь вехать.. за помощь отблагодарю спасибкой

0
A6y
A6y

User

Участник

Posts: 91

На форуме с: 07/07/2007

Репутация: +46

Рейтинг: 0

· 05/04/2009, 04:26 PM

Все разобрался сам... Тему можно удалить....

0
Войдите или зарегистрируйтесь чтобы ответить