eri000n

Untitled

May 3rd, 2023
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.28 KB | None | 0 0
  1.  
  2. -- # --------------------------------------------- #
  3. -- # Questfile from Metin2SF by Ethoard #
  4. -- # --------------------------------------------- #
  5.  
  6. quest pet_system begin
  7. state start begin
  8. when letter begin
  9. cmdchat("petguihideshow "..q.getcurrentquestindex())
  10. end
  11.  
  12. function givebonus(x)
  13. local y,boni = {10,54,1},pet_system.bonusliste()
  14. table.foreach(boni[x],function(i,l) cmdchat("HaustierBonus"..i.." "..l.."") affect.add_collect(y[i],l,60*60*24*365*60) end )
  15. cmdchat("HaustierLevel "..pc.getqf('petlevel').."")
  16. cmdchat("HaustierName "..pc.get_name().."")
  17. pc.setqf("petruf",1)
  18. pc.setqf("petguishow",1)
  19. end
  20.  
  21. function bonusliste()
  22. return {
  23. [1] = {20,10,500},
  24. [2] = {30,20,1000},
  25. [3] = {40,30,1500},
  26. [4] = {50,45,2000},
  27. [5] = {65,60,3000},
  28. }
  29. end
  30.  
  31. function removebonus(x)
  32. local y,boni = {10,54,1},pet_system.bonusliste()
  33. table.foreach(boni[x],function(i,l) affect.remove_collect(y[i],l,60*60*24*365*60) end )
  34. pc.setqf("petruf",0)
  35. cmdchat("HidePetGui")
  36. pc.setqf("petguishow",0)
  37. cleartimer("bugcheck")
  38. end
  39.  
  40. function get_pet_info(itemVnum)
  41. pet_info_map = {
  42. [53001] = {34001, "Ognisty Feniks", 0},
  43. [53002] = {34002, "Mały Reniferek", 0},
  44. [53003] = {34003, "Lodowy Feniks", 0},
  45. [53005] = {34004, "Azraeluś ", 1},
  46. [53006] = {34009, "Złoty Azraeluś ", 1},
  47. [53007] = {34010, "Bambi", 0},
  48. [53008] = {34011, "Knuud", 0},
  49. [53009] = {34012, "Bao Bao", 0},
  50. [53010] = {34008, "Leonidas", 0},
  51. [53011] = {34007, "Ethan", 0},
  52. [53012] = {34005, "Boczuś ", 0},
  53. [53013] = {34006, "Rufus", 0},
  54. [53017] = {34013, "Kat", 0},
  55. [53026] = {34026, "Scooby Doo", 0},
  56. [53027] = {34027, "Kudłaty", 0},
  57. [53028] = {34028, "Biały Lis", 0},
  58. [53029] = {34029, "Królik", 0},
  59. [53030] = {34030, "Halloween Bałwan", 0},
  60. [53031] = {34031, "Opanc. Smoczek", 0},
  61. [53032] = {34032, "Trzygłowy Smok", 0},
  62. [53033] = {34033, "Drakuś ", 0},
  63. [53034] = {34034, "Malphite", 0},
  64. [53035] = {34035, "Prastary Smok", 0},
  65. [53036] = {34036, "Azjatycki Smok", 0},
  66. [53037] = {34037, "Zmutowany Bulbasaur", 0},
  67. [53038] = {34038, "Smocze Dziecko", 0},
  68. [53039] = {34039, "Dostojny Żółw", 0},
  69. [53040] = {34040, "Lew Samuraja", 0},
  70. [53041] = {34041, "Słodki Koala", 0},
  71. [53042] = {34042, "Osa", 0},
  72. [53043] = {34043, "Demoniczny Lew", 0},
  73. [53044] = {34044, "Krokodyl Samuraj", 0},
  74. [53045] = {34045, "Papuga Pirat", 0},
  75. [53046] = {34046, "Zakochany Kundel", 0},
  76. [53047] = {34047, "Waleczna Pantera ", 0},
  77. [53048] = {34048, "Gryf", 0},
  78. }
  79. itemVnum = tonumber(itemVnum)
  80. return pet_info_map[itemVnum]
  81. end
  82. function get_spawn_effect_file(idx)
  83. effect_table = {
  84. [0] = nil,
  85. [1] = "d:\\\\ymir work\\\\effect\\\\etc\\\\appear_die\\\\npc2_appear.mse",
  86. }
  87. return effect_table [idx]
  88. end
  89. when login with pc.getqf("pet_vnum") != 0 begin
  90. item.select(pc.getqf("pet_item_id"))
  91. pet.summon(pc.getqf("pet_vnum"), " Pet", false)
  92. end
  93. when 53001.use or 53002.use or 53003.use or 53005.use or 53006.use or 53007.use or 53008.use or 53009.use or 53010.use or 53011.use or 53012.use or 53013.use or 53017.use or 53026.use or 53027.use or 53028.use or 53029.use or 53030.use or 53031.use or 53032.use or 53033.use or 53034.use or 53035.use or 53036.use or 53037.use or 53038.use or 53039.use or 53040.use or 53041.use or 53042.use or 53043.use or 53044.use or 53045.use or 53046.use or 53047.use or 53048.use begin
  94. local pet_info = pet_system.get_pet_info(item.vnum)
  95. pc.setqf("pet_item_id", item.get_id())
  96. if null != pet_info then
  97. local mobVnum = pet_info[1]
  98. local petName = pet_info[2]
  99. local spawn_effect_file_name = pet_system.get_spawn_effect_file(pet_info[3])
  100. if true == pet.is_summon(mobVnum) then
  101. if spawn_effect_file_name != nil then
  102. pet.spawn_effect (mobVnum, spawn_effect_file_name)
  103. end
  104. pet.unsummon(mobVnum)
  105. pet_system.removebonus(pc.getqf('petlevel'))
  106. syschat("Twój zwierzak został odesłany.")
  107. pc.setqf("pet_vnum", 0)
  108. else
  109. if pet.count_summoned() < 1 or pc.is_gm() then
  110. pet.summon(mobVnum, petName, false)
  111. pc.setqf("pet_vnum", mobVnum)
  112. if pet_info[4] ~= nil then
  113. cmdchat(pet_info[4])
  114. end
  115. if pc.getqf('petlevel') == 0 then
  116. pc.setqf('petlevel',1)
  117. end
  118. syschat("Twój zwierzak został wezwany.")
  119. pet_system.givebonus(pc.getqf('petlevel'))
  120. local expprocent1 = {20, 80, 160, 350, 400}
  121. cmdchat("PetProcentExp "..(pc.getqf("exp")/expprocent1[pc.getqf("petlevel")]).."")
  122. cmdchat("ShowPetGui")
  123. loop_timer("bugcheck", 0.2)
  124. else
  125. syschat("Masz już zwierzaka!")
  126. end
  127. if spawn_effect_file_name != nil then
  128. pet.spawn_effect(mobVnum, spawn_effect_file_name)
  129. end
  130. end -- if pet.is_summon
  131. end -- if null != pet_info
  132. end -- when
  133. when kill with not npc.is_pc() begin
  134. if pc.getqf("petlevel") == 5 then
  135. return
  136. else
  137. if pc.getqf("petruf")==1 then
  138. --intervall = 10
  139. --if pc.get_level() <= mob.get_level(npc.get_race())+ intervall then -- du darfst nur max 10 lvl über das monster sein
  140. pc.setqf("exp",pc.getqf("exp")+1)
  141. local exp2up = {2000, 8000, 16000, 35000, 40000}
  142. local expprocent = {20, 80, 160, 350, 400}
  143. cmdchat("PetProcentExp "..(pc.getqf("exp")/expprocent[pc.getqf("petlevel")]).."")
  144. if pc.getqf("exp") == exp2up[pc.getqf("petlevel")] then
  145. if pc.getqf("petlevel") == 4 then
  146. say_title("Gratulacje")
  147. say("Twój zwierzak osiąga poziom "..(pc.getqf("petlevel")+1).."")
  148. say_reward("To był ostatni poziom!")
  149. end
  150. say_title("Gratulacje")
  151. say("Twój zwierzak osiąga poziom "..(pc.getqf("petlevel")+1).."")
  152. say("Przywołaj jeszcze raz swojego zwierzaka!")
  153. pc.setqf("petlevel",pc.getqf("petlevel")+1)
  154. pc.setqf("exp",0)
  155. pet_system.removebonus(pc.getqf('petlevel'))
  156. end
  157. end -- if not...
  158. end -- if pc.get...
  159. end -- when
  160.  
  161. -- Bugschutz
  162.  
  163. when bugcheck.timer begin
  164. if pc.is_dead() then
  165. pet_system.removebonus(pc.getqf('petlevel'))
  166. end
  167. end
  168.  
  169. when login or logout or disconnect with pc.getqf("petruf") == 1 begin
  170. pet_system.removebonus(pc.getqf('petlevel'))
  171. cmdchat("HidePetGui")
  172. chat("Twój zwierzak nie przyszedł z tobą....")
  173. chat("Przywołaj go jeszcze raz!")
  174. end
  175. when button or info begin
  176. if pc.getqf("petruf") == 1 and pc.getqf("petguishow") == 1 then
  177. cmdchat("HidePetGui")
  178. pc.setqf("petguishow",0)
  179. syschat("Twoje okno ze zwierzakiem zostało zamknięte, możesz je ponownie otworzyć za pomocą przycisku w inwentarzu!")
  180. elseif pc.getqf("petruf") == 1 and pc.getqf("petguishow") == 0 then
  181. cmdchat("ShowPetGui")
  182. local expprocent1 = {20, 80, 160, 350, 400}
  183. cmdchat("PetProcentExp "..(pc.getqf("exp")/expprocent1[pc.getqf("petlevel")]).."")
  184. pc.setqf("petguishow",1)
  185. syschat("Twoje okno ze zwierzakiem zostało otwarte, możesz je ponownie zamknąć za pomocą przycisku w inwentarzu!")
  186. elseif pc.getqf("petruf") == 0 then
  187. syschat("Du hast kein Haustier gerufen!")
  188. end
  189. end
  190.  
  191. end -- state
  192. end -- quest
Advertisement
Add Comment
Please, Sign In to add comment