Guest User

Untitled

a guest
Jun 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.75 KB | None | 0 0
  1. # Made by Mr. Have fun! - version 0.2 by Rolarga
  2. # C5 addons by DrLecter
  3. import sys
  4. from net.sf.l2j.gameserver.model.quest import State
  5. from net.sf.l2j.gameserver.model.quest import QuestState
  6. from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest
  7.  
  8. qn = "999_C3Tutorial"
  9.  
  10. RECOMMENDATION_01 = 1067
  11. RECOMMENDATION_02 = 1068
  12. LEAF_OF_MOTHERTREE = 1069
  13. BLOOD_OF_JUNDIN = 1070
  14. LICENSE_OF_MINER = 1498
  15. VOUCHER_OF_FLAME = 1496
  16. SOULSHOT_NOVICE = 5789
  17. SPIRITSHOT_NOVICE = 5790
  18. BLUE_GEM=6353
  19. TOKEN = 8542
  20. SCROLL= 8594
  21. # event:[htmlfile,radarX,radarY,radarZ,item,classId1,gift1,count1,classId2,gift2,count2]
  22. EVENTS={
  23. "30008_02":["30008-03.htm",-84058, 243239,-3730,RECOMMENDATION_01 ,0x00,SOULSHOT_NOVICE  ,200,0x00,              0,  0],
  24. "30017_02":["30017-03.htm",-84058, 243239,-3730,RECOMMENDATION_02 ,0x0a,SPIRITSHOT_NOVICE,100,0x00,              0,  0],
  25. "30370_02":["30370-03.htm", 45491,  48359,-3086,LEAF_OF_MOTHERTREE,0x19,SPIRITSHOT_NOVICE,100,0x12,SOULSHOT_NOVICE,200],
  26. "30129_02":["30129-03.htm", 12116,  16666,-4610,BLOOD_OF_JUNDIN   ,0x26,SPIRITSHOT_NOVICE,100,0x1f,SOULSHOT_NOVICE,200],
  27. "30528_02":["30528-03.htm",115642,-178046, -941,LICENSE_OF_MINER  ,0x35,SOULSHOT_NOVICE  ,200,0x00,              0,  0],
  28. "30573_02":["30573-03.htm",-45067,-113549, -235,VOUCHER_OF_FLAME  ,0x31,SPIRITSHOT_NOVICE,100,0x2c,SOULSHOT_NOVICE,200]
  29. }
  30.  
  31. # npcId:[raceId,[htmlfiles],npcTyp,item]
  32. TALKS={
  33. 30017:[0,["30017-01.htm","30017-02.htm","30017-04.htm"],0,0],
  34. 30008:[0,["30008-01.htm","30008-02.htm","30008-04.htm"],0,0],
  35. 30370:[1,["30370-01.htm","30370-02.htm","30370-04.htm"],0,0],
  36. 30129:[2,["30129-01.htm","30129-02.htm","30129-04.htm"],0,0],
  37. 30573:[3,["30573-01.htm","30573-02.htm","30573-04.htm"],0,0],
  38. 30528:[4,["30528-01.htm","30528-02.htm","30528-04.htm"],0,0],
  39. 30018:[0,["30131-01.htm",0,"30019-03a.htm","30019-04.htm",],1,RECOMMENDATION_02],
  40. 30019:[0,["30131-01.htm",0,"30019-03a.htm","30019-04.htm",],1,RECOMMENDATION_02],
  41. 30020:[0,["30131-01.htm",0,"30019-03a.htm","30019-04.htm",],1,RECOMMENDATION_02],
  42. 30021:[0,["30131-01.htm",0,"30019-03a.htm","30019-04.htm",],1,RECOMMENDATION_02],
  43. 30009:[0,["30530-01.htm","30009-03.htm",0,"30009-04.htm",],1,RECOMMENDATION_01],
  44. 30011:[0,["30530-01.htm","30009-03.htm",0,"30009-04.htm",],1,RECOMMENDATION_01],
  45. 30012:[0,["30530-01.htm","30009-03.htm",0,"30009-04.htm",],1,RECOMMENDATION_01],
  46. 30056:[0,["30530-01.htm","30009-03.htm",0,"30009-04.htm",],1,RECOMMENDATION_01],
  47. 30400:[1,["30131-01.htm","30400-03.htm","30400-03a.htm","30400-04.htm",],1,LEAF_OF_MOTHERTREE],
  48. 30401:[1,["30131-01.htm","30400-03.htm","30400-03a.htm","30400-04.htm",],1,LEAF_OF_MOTHERTREE],
  49. 30402:[1,["30131-01.htm","30400-03.htm","30400-03a.htm","30400-04.htm",],1,LEAF_OF_MOTHERTREE],
  50. 30403:[1,["30131-01.htm","30400-03.htm","30400-03a.htm","30400-04.htm",],1,LEAF_OF_MOTHERTREE],
  51. 30131:[2,["30131-01.htm","30131-03.htm","30131-03a.htm","30131-04.htm",],1,BLOOD_OF_JUNDIN],
  52. 30404:[2,["30131-01.htm","30131-03.htm","30131-03a.htm","30131-04.htm",],1,BLOOD_OF_JUNDIN],
  53. 30574:[3,["30575-01.htm","30575-03.htm","30575-03a.htm","30575-04.htm",],1,VOUCHER_OF_FLAME],
  54. 30575:[3,["30575-01.htm","30575-03.htm","30575-03a.htm","30575-04.htm",],1,VOUCHER_OF_FLAME],
  55. 30530:[4,["30530-01.htm","30530-03.htm",0,"30530-04.htm",],1,LICENSE_OF_MINER]
  56. }    
  57.  
  58. class Quest (JQuest) :
  59.  
  60.  def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
  61.  
  62.  def onEvent (self,event,st) :
  63.     htmltext = event
  64.     htmlfile,radarX,radarY,radarZ,item,classId1,gift1,count1,classId2,gift2,count2 = EVENTS[event]
  65.     st.addRadar(radarX,radarY,radarZ);
  66.     htmltext=htmlfile
  67.     if st.getQuestItemsCount(item) and st.getInt("onlyone") == 0:
  68.       st.addExpAndSp(0,50)
  69.       st.takeItems(item,1)
  70.       if st.getPlayer().getClassId().getId() == classId1 :
  71.         st.giveItems(gift1,count1)
  72.       elif st.getPlayer().getClassId().getId() == classId2 :
  73.         if gift2:
  74.            st.giveItems(gift2,count2)
  75.       st.unset("cond")
  76.       st.set("onlyone","1")
  77.       st.setState(State.COMPLETED)
  78.       st.playSound("ItemSound.quest_finish")
  79.     return htmltext
  80.  
  81.  def onFirstTalk (self,npc,player):
  82.    st = player.getQuestState(qn)
  83.    if st :
  84.      id = st.getState()
  85.      onlyone=st.getInt("onlyone")
  86.      if id == State.COMPLETED and onlyone == 1:
  87.        st.set("onlyone","2")
  88.        if player.getClassId().isMage() :
  89.          st.giveItems(SPIRITSHOT_NOVICE,100)
  90.        else:
  91.          st.giveItems(SOULSHOT_NOVICE,200)
  92.        st.giveItems(TOKEN,12)
  93.        if st.getRandom(2):
  94.          st.giveItems(SCROLL,2)
  95.    return
  96.  
  97.  
  98.  def onTalk (self,npc,player):
  99.    htmltext = "<html><body>You are either not carrying out your quest or don't meet the criteria.</body></html>"
  100.    st = player.getQuestState(qn)
  101.    if not st : return htmltext
  102.    npcId = npc.getNpcId()
  103.    id = st.getState()
  104.    cond=st.getInt("cond")
  105.    onlyone=st.getInt("onlyone")
  106.    level=player.getLevel()
  107.    isMage = player.getClassId().isMage()
  108.    npcTyp=0
  109.    if id == State.CREATED :
  110.      st.setState(State.STARTED)
  111.      st.set("onlyone","0")
  112.    raceId,htmlfiles,npcTyp,item = TALKS[npcId]
  113.    if (level >= 10 or onlyone) and npcTyp == 1:
  114.        htmltext = "30575-05.htm"
  115.    elif onlyone == 0 and level < 10 :
  116.     if player.getRace().ordinal() == raceId :
  117.       htmltext=htmlfiles[0]
  118.       if npcTyp==1:
  119.        if cond==0 :
  120.         if isMage :
  121.          st.set("cond","1")
  122.          st.setState(State.STARTED)
  123.          st.playSound("ItemSound.quest_tutorial")
  124.         else:
  125.          htmltext="30530-01.htm"
  126.          st.set("cond","1")
  127.          st.setState(State.STARTED)
  128.          st.playSound("ItemSound.quest_tutorial")
  129.        elif cond==1 and st.getQuestItemsCount(item)==0 :
  130.          if st.getQuestItemsCount(BLUE_GEM) :
  131.            st.takeItems(BLUE_GEM,st.getQuestItemsCount(BLUE_GEM))
  132.            st.giveItems(item,1)
  133.            st.set("cond","2")
  134.            st.playSound("ItemSound.quest_middle")
  135.            if isMage :
  136.              st.giveItems(SPIRITSHOT_NOVICE,100)
  137.              htmltext = htmlfiles[2]
  138.              if htmltext == 0 :
  139.                  htmltext = "<html><body>I am sorry.  I only help warriors.  Please go to another Newbie Helper who may assist you.</body></html>"
  140.            else:
  141.              st.giveItems(SOULSHOT_NOVICE,200)
  142.              htmltext = htmlfiles[1]
  143.              if htmltext == 0 :
  144.                  htmltext = "<html><body>I am sorry.  I only help mystics.  Please go to another Newbie Helper who may assist you.</body></html>"
  145.          else:
  146.            if isMage :
  147.              htmltext = "30131-02.htm"
  148.              if player.getRace().ordinal() == 3 :
  149.               htmltext = "30575-02.htm"
  150.            else:
  151.              htmltext = "30530-02.htm"
  152.        elif cond==2 :
  153.         htmltext = htmlfiles[3]
  154.       elif npcTyp == 0 :
  155.         if cond==1 :
  156.           htmltext = htmlfiles[0]
  157.         elif cond==2 :
  158.           htmltext = htmlfiles[1]
  159.         elif cond==3 :
  160.           htmltext = htmlfiles[2]
  161.    else:
  162.        htmltext = "<html><body>You are too experienced now.</body></html>"
  163.    return htmltext
  164.  
  165.  def onKill(self,npc,player,isPet):
  166.    st = player.getQuestState(qn)
  167.    if not st : return
  168.    if st.getState() != State.STARTED : return
  169.    if st.getInt("cond")==1 and st.getRandom(100) < 25 and st.getQuestItemsCount(BLUE_GEM) == 0 :
  170.       st.giveItems(BLUE_GEM,1)
  171.       st.playSound("ItemSound.quest_itemget")
  172.       st.playSound("ItemSound.quest_tutorial")
  173.    return
  174.  
  175. QUEST       = Quest(999,qn,"Interlude Tutorial")
  176.  
  177.  
  178.  
  179. for startNpc in [30008,30009,30017,30019,30129,30131,30573,30575,30370,30528,30530,30400,30401,30402,30403,30404,30600,30601,30602,30598,30599]:
  180.   QUEST.addStartNpc(startNpc)
  181.   QUEST.addTalkId(startNpc)
  182.  
  183. for npc in [30600, 30601, 30602, 30598, 30599]:
  184.   QUEST.addFirstTalkId(npc)
  185.  
  186. QUEST.addKillId(18342)
  187. QUEST.addKillId(20001)
Add Comment
Please, Sign In to add comment