eri000n

Untitled

May 3rd, 2023
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.24 KB | None | 0 0
  1. -- # --------------------------------------------- #
  2. -- # Questfile from Metin2SF by Ethoard #
  3. -- # --------------------------------------------- #
  4.  
  5. quest pet_system begin
  6. state start begin
  7. when letter begin
  8. cmdchat("petguihideshow "..q.getcurrentquestindex())
  9. end
  10.  
  11. function givebonus(x)
  12. local mobVnum = pc.getqf("mobVnum")
  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_'..mobVnum).."")
  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ś ", 1},
  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
  94. 53007.use or 53008.use or 53009.use or 53010.use or 53011.use or 53012.use or
  95. 53013.use or 53017.use or 53026.use or 53027.use or 53028.use or 53029.use or
  96. 53030.use or 53031.use or 53032.use or 53033.use or 53034.use or 53035.use or
  97. 53036.use or 53037.use or 53038.use or 53039.use or 53040.use or 53041.use or
  98. 53042.use or 53043.use or 53044.use or 53045.use or 53046.use or 53047.use or
  99. 53048.use begin
  100. local pet_info = pet_system.get_pet_info(item.vnum)
  101. pc.setqf("pet_item_id", item.get_id())
  102.  
  103. if null != pet_info then
  104.  
  105. local mobVnum = pet_info[1]
  106. local petName = pet_info[2]
  107. local spawn_effect_file_name = pet_system.get_spawn_effect_file(pet_info[4])
  108.  
  109. pc.setqf("mobVnum",mobVnum)
  110.  
  111. if true == pet.is_summon(mobVnum) then
  112. if spawn_effect_file_name != nil then
  113. pet.spawn_effect (mobVnum, spawn_effect_file_name)
  114. end
  115. pet.unsummon(mobVnum)
  116. pc.setqf("pet_vnum", 0)
  117. pet_system.removebonus(pc.getqf('petlevel_'..mobVnum))
  118. cmdchat("HidePetGui")
  119. syschat("Twój zwierzak został odesłany")
  120. else
  121. if pet.count_summoned() < 1 then
  122. pet.summon(mobVnum, " ".. petName, false)
  123. pc.setqf("pet_vnum", mobVnum)
  124. if pet_info[4] ~= nil then
  125. cmdchat(pet_info[4])
  126. end
  127. if pc.getqf('petlevel_'..mobVnum) == 0 then
  128. pc.setqf('petlevel_'..mobVnum,1)
  129. end
  130. syschat("Twój zwierzak został wezwany.")
  131. pet_system.givebonus(pc.getqf('petlevel_'..mobVnum))
  132. local expprocent1 = {20, 80, 160, 350, 400}
  133. cmdchat("PetProcentExp "..(pc.getqf("exp_"..mobVnum)/expprocent1[pc.getqf("petlevel_"..mobVnum)]).."")
  134. cmdchat("ShowPetGui")
  135. loop_timer("bugcheck", 0.2)
  136. else
  137. syschat("Masz już zwierzaka!")
  138. end
  139. if spawn_effect_file_name != nil then
  140. pet.spawn_effect(mobVnum, spawn_effect_file_name)
  141. end
  142. end -- if pet.is_summon
  143. end -- if null != pet_info
  144. end -- when
  145. when kill with not npc.is_pc() begin
  146. local mobVnum = pc.getqf("mobVnum")
  147. if pc.getqf("petlevel_"..mobVnum) == 5 then
  148. return
  149. else
  150. if pc.getqf("petruf")==1 then
  151. --intervall = 10
  152. --if pc.get_level() <= mob.get_level(npc.get_race())+ intervall then -- du darfst nur max 10 lvl über das monster sein
  153. pc.setqf("exp_"..mobVnum,pc.getqf("exp_"..mobVnum)+1)
  154. local exp2up = {2000, 8000, 16000, 35000, 40000}
  155. local expprocent = {20, 80, 160, 350, 400}
  156. cmdchat("PetProcentExp "..(pc.getqf("exp_"..mobVnum)/expprocent[pc.getqf("petlevel_"..mobVnum)]).."")
  157. if pc.getqf("exp_"..mobVnum) == exp2up[pc.getqf("petlevel_"..mobVnum)] then
  158. if pc.getqf("petlevel_"..mobVnum) == 4 then
  159. say_title("Gratulacje!")
  160. say("Twój zwierzak osiąga poziom "..(pc.getqf("petlevel_"..mobVnum)+1).."")
  161. say_reward("To był ostatni poziom!")
  162. end
  163. say_title("Gratulacje!")
  164. say("Twój zwierzak osiąga poziom "..(pc.getqf("petlevel_"..mobVnum)+1).."")
  165. say("Przywołaj go ponownie!")
  166. pc.setqf("petlevel_"..mobVnum,pc.getqf("petlevel_"..mobVnum)+1)
  167. pc.setqf("exp_"..mobVnum,0)
  168. pet_system.removebonus(pc.getqf('petlevel'))
  169. end
  170. end -- if not...
  171. end -- if pc.get...
  172. end -- when
  173.  
  174. -- Bugschutz
  175.  
  176. when bugcheck.timer begin
  177. if pc.is_dead() then
  178. pet_system.removebonus(pc.getqf('petlevel'))
  179. end
  180. end
  181.  
  182. when login or logout or disconnect with pc.getqf("petruf") == 1 begin
  183. local mobVnum = pc.getqf("mobVnum")
  184. pet_system.removebonus(pc.getqf('petlevel_'..mobVnum))
  185. cmdchat("HidePetGui")
  186. chat("Twój zwierzak nie przyszedł z tobą....")
  187. chat("Przywołaj go ponownie!")
  188. end
  189. when button or info begin
  190. local mobVnum = pc.getqf("mobVnum")
  191. if pc.getqf("petruf") == 1 and pc.getqf("petguishow") == 1 then
  192. cmdchat("HidePetGui")
  193. pc.setqf("petguishow",0)
  194. syschat("Twoje okno ze zwierzakiem zostało zamknięte, możesz je ponownie otworzyć za pomocą przycisku w inwentarzu!")
  195. elseif pc.getqf("petruf") == 1 and pc.getqf("petguishow") == 0 then
  196. cmdchat("ShowPetGui")
  197. local expprocent1 = {20, 80, 160, 350, 400}
  198. cmdchat("PetProcentExp "..(pc.getqf("exp_"..mobVnum)/expprocent1[pc.getqf("petlevel_"..mobVnum)]).."")
  199. pc.setqf("petguishow",1)
  200. syschat("Twoje okno ze zwierzakiem zostało otwarte, możesz je ponownie zamknąć za pomocą przycisku w inwentarzu!")
  201. elseif pc.getqf("petruf") == 0 then
  202. syschat("Nie przywołałeś zwierzaka!")
  203. end
  204. end
  205.  
  206. end -- state
  207. end -- quest
Advertisement
Add Comment
Please, Sign In to add comment