Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.68 KB | None | 0 0
  1. --Since for GladoR
  2. quest fishing_mission_1 begin
  3.     state start begin
  4.         function is_fish_in_eq(is_remove, fish_get_id)
  5.             local fish_count_1 = 0
  6.             local fish_count_2 = 0
  7.             local fish_count_3 = 0
  8.             for i = 0, 180 do
  9.                 item.select_cell(i)
  10.                 local dwVnum = item.get_vnum()
  11.                 local dwCm = item.get_socket(0)
  12.                 if dwVnum == 27803 then
  13.                     if dwCm >= 10 then
  14.                         if is_remove and fish_count_1 < 5 then
  15.                             item.remove(1)
  16.                         end
  17.                         fish_count_1 = fish_count_1 + 1
  18.                     end
  19.                 elseif dwVnum == 27804 then
  20.                     if dwCm >= 10 then
  21.                         if is_remove and fish_count_2 < 5 then
  22.                             item.remove(1)
  23.                         end
  24.                         fish_count_2 = fish_count_2 + 1
  25.                     end
  26.                 elseif dwVnum == 27805 then
  27.                     if dwCm >= 10 then
  28.                         if is_remove and fish_count_3 < 5 then
  29.                             item.remove(1)
  30.                         end
  31.                         fish_count_3 = fish_count_3 + 1
  32.                     end
  33.                 end
  34.                 if fish_count_1 >= 5 and fish_count_2 >= 5 and fish_count_3 >= 5 then
  35.                     return true
  36.                 end
  37.             end
  38.             if fish_get_id > 0 then
  39.                 if fish_get_id == 1 then
  40.                     return fish_count_1
  41.                 elseif fish_get_id == 2 then
  42.                     return fish_count_2
  43.                 elseif fish_get_id == 3 then
  44.                     return fish_count_3
  45.                 end
  46.             end
  47.             return false
  48.         end
  49.        
  50.         when login or enter or levelup with pc.level >= 80 begin
  51.             set_state(information)
  52.         end
  53.     end
  54.     state information begin
  55.         when letter begin
  56.             target.vid("__TARGET__", find_npc_by_vnum(9009), "Rybak")
  57.             send_letter("Rybak - Wędkarstwo")
  58.         end
  59.         when button or info begin
  60.             say("Witaj, "..pc.get_name().." !")
  61.             say("Rybak znajdujący się w miasteczku właśnie Cię szukał.")
  62.             say("Udaj się do niego aby zdobyć więcej informacji.")
  63.             say()
  64.         end
  65.         when __TARGET__.target.click or 9009.chat."Odnalazłem Cię !" begin
  66.             target.delete("__TARGET__")
  67.             npc.name()
  68.             say_reward("Witaj początkujący Wędkarzu !")
  69.             say_reward("Będę potrzebował abyś złowił dla mnie kilka przeciętnych ryb")
  70.             say_zloto("Karaś: 5x")
  71.             say_zloto("Ryba Mandaryna: 5x")
  72.             say_zloto("Duży Karaś: 5x")
  73.             say_zloto("Pamiętaj że ryby musisz wyłowić sam.")
  74.             say_zloto("Minimalna Długość każdej z złowionych ryb to 10 cm.")
  75.             say()
  76.             clear_letter()
  77.             set_state(drop)
  78.         end
  79.     end
  80.     state drop begin
  81.         when letter begin
  82.             target.vid("__TARGET__", find_npc_by_vnum(9009), "Rybak")
  83.             send_letter("Rybak - Zadanie I")
  84.         end
  85.         when button or info begin
  86.             say("Witaj, "..pc.get_name().." !")
  87.             say("Musisz wykazać się sprytem i cierpliwością,a zostaniesz")
  88.             say("sowicie nagrodzony.")
  89.             say_zloto("Potrzebujesz:")
  90.             say_zloto("-Karaś: "..pc.getqf("fish_1").."/5")
  91.             say_zloto("-Ryba Mandaryna: "..pc.getqf("fish_2").."/5")
  92.             say_zloto("-Duży Karaś: "..pc.getqf("fish_3").."/5")
  93.             if pc.getqf("fish_1") >= 5 and pc.getqf("fish_2") >= 5 and pc.getqf("fish_3") >= 5 then
  94.                 say_reward("Oddaj Rybakowi złowione Ryby !")
  95.             else
  96.                 say_zloto("Pamiętaj że ryby musisz wyłowić sam.")
  97.                 say_zloto("Minimalna Długość każdej z złowionych ryb to 10 cm.")
  98.             end
  99.         end
  100.         when fishing begin -- Event Pomyślnego połowu Ryby
  101.             local dwVnum = item.vnum
  102.             local cm = item.get_socket(0)
  103.             if dwVnum == 27803 then
  104.                 if cm >= 10 then
  105.                     pc.setqf("fish_1", pc.getqf("fish_1") + 1)
  106.                     chat("<Wędkarstwo> Ten Karaś jest idealny dla Rybaka")
  107.                 else
  108.                     chat("<Wędkarstwo> "..item_name(dwVnum).." jest zbyt mały aby rybak go przyjął..")
  109.                 end
  110.             elseif dwVnum == 27804 then
  111.                 if cm >= 10 then
  112.                     pc.setqf("fish_2", pc.getqf("fish_2") + 1)
  113.                     chat("<Wędkarstwo> Ta Ryba Mandaryna jest idealna dla rybaka !")
  114.                 else
  115.                     chat("<Wędkarstwo> "..item_name(dwVnum).." jest zbyt mała aby rybak ją przyjął..")
  116.                 end
  117.             elseif dwVnum == 27805 then
  118.                 if cm >= 10 then
  119.                     pc.setqf("fish_3", pc.getqf("fish_3") + 1)
  120.                     chat("<Wędkarstwo> Ten Karaś jest idealny dla Rybaka")
  121.                 else
  122.                     chat("<Wędkarstwo> "..item_name(dwVnum).." jest zbyt mały aby rybak go przyjął..")
  123.                 end
  124.             end
  125.         end
  126.         when 9009.chat."Oddaj Złowione Ryby" begin
  127.             npc.name()
  128.             if pc.getqf("fish_1") < 5 or pc.getqf("fish_2") < 5 or pc.getqf("fish_3") < 5 then
  129.                 say_zloto("Potrzebujesz:")
  130.                 say_zloto("-Karaś: "..pc.getqf("fish_1").."/5")
  131.                 say_zloto("-Ryba Mandaryna: "..pc.getqf("fish_2").."/5")
  132.                 say_zloto("-Duży Karaś: "..pc.getqf("fish_3").."/5")
  133.                 say_zloto("Pamiętaj że ryby musisz wyłowić sam.")
  134.                 say_zloto("Minimalna Długość każdej z złowionych ryb to 10 cm.")
  135.                 return
  136.             end
  137.             if !fishing_mission_1.is_fish_in_eq(false, 0) then
  138.                 say_zloto("Potrzebujesz:")
  139.                 say_zloto("-Karaś: "..fishing_mission_1.is_fish_in_eq(false, 1).."/5")
  140.                 say_zloto("-Ryba Mandaryna: "..fishing_mission_1.is_fish_in_eq(false, 2).."/5")
  141.                 say_zloto("-Duży Karaś: "..fishing_mission_1.is_fish_in_eq(false, 3).."/5")
  142.                 say_zloto("Pamiętaj że ryby musisz wyłowić sam.")
  143.                 say_zloto("Minimalna Długość każdej z złowionych ryb to 10 cm.")
  144.                 say()
  145.                 say_reward("Brakuje Ci Ryb w Ekwipunku !")
  146.                 return
  147.             else
  148.                 pc.setqf("fish_1", 0) -- Kasuje Qf
  149.                 pc.setqf("fish_2", 0)
  150.                 pc.setqf("fish_3", 0)
  151.                 fishing_mission_1.is_fish_in_eq(true, 0) -- Usuwam Przedmioty
  152.                 say_zloto("Otrzymujesz:")
  153.                 say_zloto("+5% Szansy na Pomyślne Złowienie Ryby na stałe")
  154.                 say_zloto("+10% Odporności na Ludzi")
  155.                 say_zloto("-1x Skrzynia Item-Shop")
  156.                 say_zloto("-10x Kukurydza")
  157.                 say_zloto("-10x Żaba")
  158.                 pc.setqf("chance", 5)
  159.                 affect.add_new(apply.RESIST_HUMAN, 10, 60*60*24*365*20, 3)
  160.                 pc.give_item2(27591, 10)
  161.                 pc.give_item2(27592, 10)
  162.                 pc.give_item2(53502, 1)
  163.                 clear_letter()
  164.                 set_state(__COMPLETE__)
  165.             end
  166.            
  167.         end
  168.     end
  169.     state __COMPLETE__ begin
  170.     end
  171. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement