Guest User

Untitled

a guest
Dec 26th, 2012
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.24 KB | None | 0 0
  1. quest lotto_dziwko begin
  2.     state start begin
  3.         when 20095.take with item.get_type() == 10 begin
  4.             npc.name()
  5.             say("Twoje punkty wymiany: "..pc.getqf("lotto"))
  6.             say("Czy chcesz oddać :")
  7.             say_item_vnum(item.get_vnum())
  8.             if select(locale.yes,locale.no) == 1 then
  9.                 local limit = 50
  10.                 local xd = math.random(limit)
  11.                 npc.name()
  12.                 say("Za "..item_name(item.get_vnum()).." otrzymano "..xd.." punktów.")                
  13.                 say("Punkty te możesz wymienić za punkty na loterii")
  14.                 say("Pamiętaj, że im więcej masz")
  15.                 say("punktów, tym większa ilość losów!")
  16.                 pc.setqf("lotto", pc.getqf("lotto")+xd)
  17.                 item.remove()
  18.             end
  19.         end
  20.         when 20095.chat."Loteria!" begin
  21.             npc.name()
  22.             say("Witaj!")
  23.             say("Zajmuję się małym konkursem.")
  24.             say("Obracam wartościowymi przedmiotami w loterii.")
  25.             say("Jeśli masz wystarczającą ilość punktów, mogę ")
  26.             say("wpuścić Cię do loterii. Ale! Możesz losować ")
  27.             say("raz na 12 godzin. Chyba, że zagadasz")
  28.             say("do mnie i ubijemy mały biznes... To jak?")
  29.             wait()
  30.             if pc.getqf("lotto") < 1 then
  31.                 npc.name()
  32.                 say("Wybacz, ale nie masz żadnych punktów!")
  33.                 return
  34.             else
  35.                 local y = {
  36.                     [1] = {71084},
  37.                     [2] = {71085},
  38.                     [3] = {71001},
  39.                     [4] = {71004},
  40.                     [5] = {71018},
  41.                     [6] = {71019},
  42.                     [7] = {71020},
  43.                     [8] = {71034},
  44.                     [9] = {71044},
  45.                     [10] = {71045},
  46.                 }
  47.                 local n = number(1, table.getn(y))
  48.                 local limit_count = 100
  49.                 local z = math.random(limit_count)
  50.                 local acc_time = get_time()
  51.                 local old_time = pc.getqf("lotto_limit")
  52.                 if acc_time < old_time and pc.getqf("lotto_troll") == 0 then
  53.                     local diff = math.ceil((old_time - acc_time)/3600)
  54.                     local h
  55.                         if diff == 1 then
  56.                             h = "godzinę."
  57.                         elseif (diff >= 2 and diff <= 4) or diff >= 22 then
  58.                             h = "godziny."
  59.                         else
  60.                             h = "godzin."
  61.                         end
  62.                     npc.name()
  63.                     say("Musisz poczekać jeszcze "..diff.." "..h)
  64.                 else
  65.                     pc.setqf("lotto", pc.getqf("lotto")-1)
  66.                     npc.name()
  67.                     say("Twój wylosowany przedmiot to:")
  68.                     say_item_vnum(y[n][1])
  69.                     say("W ilości "..z.." sztuk.")
  70.                     say("")
  71.                     say_reward("Pozostałe losy: "..pc.getqf("lotto"))
  72.                     say_reward("Została nałożona blokada czasowa.")
  73.                     say_reward("Do zobaczenia za 12 godzin!")
  74.                     if pc.getqf("lotto_troll") == 1 then
  75.                         pc.setqf("lotto_troll", 0)
  76.                     end
  77.                     pc.give_item2(y[n][1], z)
  78.                     pc.setqf("lotto_limit", get_time()+12*60*60)
  79.                 end
  80.             end
  81.         end
  82.         when 20095.chat."Obejście Limitu" begin
  83.             local xd = 50
  84.             npc.name()
  85.             say("Mogę zrobić dla Ciebie wyjątek")
  86.             say("jeśli posiadasz "..xd.." losów.")
  87.             say("Wtedy zdejmę Twoją blokadę.")
  88.             say_reward("Kontynuować?")
  89.             if select(locale.yes,locale.no) == 1 then
  90.                 if pc.getqf("lotto_troll") == 1 then
  91.                     npc.name()
  92.                     say("Ale Ty nie masz blokady!")
  93.                     return
  94.                 else
  95.                     if pc.getqf("lotto") < x then
  96.                         npc.name()
  97.                         say("Nie masz "..xd.." punktów!")
  98.                     else
  99.                         npc.name()
  100.                         say("Dobrze, zdjąłem Twoją blokadę.")
  101.                         say("Teraz znów możesz brać udział w loterii.")
  102.                         pc.setqf("lotto_troll", 1)
  103.                         pc.setqf("lotto", pc.getqf("lotto")-xd)
  104.                     end
  105.                 end
  106.             end
  107.         end
  108.     end
  109. end
Advertisement
Add Comment
Please, Sign In to add comment