eri000n

Untitled

May 4th, 2023
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.09 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.  
  102. if null != pet_info then
  103.  
  104. local mobVnum = pet_info[1]
  105. local petName = pet_info[2]
  106. local spawn_effect_file_name = pet_system.get_spawn_effect_file(pet_info[4])
  107.  
  108. pc.setqf("mobVnum",mobVnum)
  109.  
  110. if true == pet.is_summon(mobVnum) then
  111. if spawn_effect_file_name != nil then
  112. pet.spawn_effect (mobVnum, spawn_effect_file_name)
  113. end
  114. pet.unsummon(mobVnum)
  115. pet_system.removebonus(pc.getqf('petlevel_'..mobVnum))
  116. cmdchat("HidePetGui")
  117. syschat("Twój zwierzak został odesłany")
  118. else
  119. if pet.count_summoned() < 1 then
  120. pet.summon(mobVnum, " Lv. "..(pc.getqf("petlevel_"..mobVnum)).." ".. petName, false)
  121. if pet_info[4] ~= nil then
  122. cmdchat(pet_info[4])
  123. end
  124. if pc.getqf('petlevel_'..mobVnum) == 0 then
  125. pc.setqf('petlevel_'..mobVnum,1)
  126. end
  127. syschat("Twój zwierzak został wezwany.")
  128. pet_system.givebonus(pc.getqf('petlevel_'..mobVnum))
  129. local expprocent1 = {20, 80, 160, 350, 400}
  130. cmdchat("PetProcentExp "..(pc.getqf("exp_"..mobVnum)/expprocent1[pc.getqf("petlevel_"..mobVnum)]).."")
  131. cmdchat("ShowPetGui")
  132. loop_timer("bugcheck", 0.2)
  133. else
  134. syschat("Masz już zwierzaka!")
  135. end
  136. if spawn_effect_file_name != nil then
  137. pet.spawn_effect(mobVnum, spawn_effect_file_name)
  138. end
  139. end -- if pet.is_summon
  140. end -- if null != pet_info
  141. end -- when
  142. when kill with not npc.is_pc() begin
  143. local mobVnum = pc.getqf("mobVnum")
  144. if pc.getqf("petlevel_"..mobVnum) == 5 then
  145. return
  146. else
  147. if pc.getqf("petruf")==1 then
  148. --intervall = 10
  149. --if pc.get_level() <= mob.get_level(npc.get_race())+ intervall then -- du darfst nur max 10 lvl über das monster sein
  150. pc.setqf("exp_"..mobVnum,pc.getqf("exp_"..mobVnum)+1)
  151. local exp2up = {2000, 8000, 16000, 35000, 40000}
  152. local expprocent = {20, 80, 160, 350, 400}
  153. cmdchat("PetProcentExp "..(pc.getqf("exp_"..mobVnum)/expprocent[pc.getqf("petlevel_"..mobVnum)]).."")
  154. if pc.getqf("exp_"..mobVnum) == exp2up[pc.getqf("petlevel_"..mobVnum)] then
  155. if pc.getqf("petlevel_"..mobVnum) == 4 then
  156. notice_all("|cFFFFFF30|h[CH"..pc.get_channel_id().."]:|h|r Zwierzak "..pc.get_name().." osiąga swój maksymalny poziom "..(pc.getqf("petlevel_"..mobVnum)+1).." Gratulacje!")
  157.  
  158. end
  159. say_title("Gratulacje!")
  160. say("Twój zwierzak osiąga poziom "..(pc.getqf("petlevel_"..mobVnum)+1).."")
  161. say("Przywołaj go ponownie!")
  162. pc.setqf("petlevel_"..mobVnum,pc.getqf("petlevel_"..mobVnum)+1)
  163. pc.setqf("exp_"..mobVnum,0)
  164. pet_system.removebonus(pc.getqf('petlevel'))
  165. end
  166. end -- if not...
  167. end -- if pc.get...
  168. end -- when
  169.  
  170. -- Bugschutz
  171.  
  172. when bugcheck.timer begin
  173. if pc.is_dead() then
  174. pet_system.removebonus(pc.getqf('petlevel'))
  175. end
  176. end
  177.  
  178. when login or logout or disconnect with pc.getqf("petruf") == 1 begin
  179. local mobVnum = pc.getqf("mobVnum")
  180. pet_system.removebonus(pc.getqf('petlevel_'..mobVnum))
  181. cmdchat("HidePetGui")
  182. chat("Twój zwierzak nie przyszedł z tobą....")
  183. chat("Przywołaj go ponownie!")
  184. end
  185. when button or info begin
  186. local mobVnum = pc.getqf("mobVnum")
  187. if pc.getqf("petruf") == 1 and pc.getqf("petguishow") == 1 then
  188. cmdchat("HidePetGui")
  189. pc.setqf("petguishow",0)
  190. syschat("Twoje okno ze zwierzakiem zostało zamknięte, możesz je ponownie otworzyć za pomocą przycisku w inwentarzu!")
  191. elseif pc.getqf("petruf") == 1 and pc.getqf("petguishow") == 0 then
  192. cmdchat("ShowPetGui")
  193. local expprocent1 = {20, 80, 160, 350, 400}
  194. cmdchat("PetProcentExp "..(pc.getqf("exp_"..mobVnum)/expprocent1[pc.getqf("petlevel_"..mobVnum)]).."")
  195. pc.setqf("petguishow",1)
  196. syschat("Twoje okno ze zwierzakiem zostało otwarte, możesz je ponownie zamknąć za pomocą przycisku w inwentarzu!")
  197. elseif pc.getqf("petruf") == 0 then
  198. syschat("Nie przywołałeś zwierzaka!")
  199. end
  200. end
  201.  
  202. end -- state
  203. end -- quest
Advertisement
Add Comment
Please, Sign In to add comment