deadx2

Untitled

Aug 28th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.09 KB | None | 0 0
  1. quest tombola_start begin
  2.     state start begin
  3.         when login begin
  4.             local number_list = number(1,TOMBOLA_QUANTITY_LIST)
  5.             local item_reward_list = string.format(TOMBOLA_REWARD_LIST[number_list][1][1]).."|".. string.format(TOMBOLA_REWARD_LIST[number_list][1][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][2][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][2][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][3][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][3][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][4][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][4][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][5][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][5][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][6][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][6][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][7][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][7][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][8][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][8][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][9][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][9][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][10][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][10][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][11][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][11][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][12][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][12][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][13][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][13][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][14][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][14][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][15][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][15][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][16][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][16][2])
  6.             cmdchat("tombola_start "..q.getcurrentquestindex()) --- this command send quest index to client, you'll see now why is important  
  7.             --chat("tombola_prepare "..item_reward_list)
  8.             cmdchat("tombola_prepare "..item_reward_list)
  9.         end
  10.        
  11.         when button or info begin
  12.             if pc.getqf("start_game") == 0 then
  13.                 --local number_use = pc.getf("tombola_start","used_today")
  14.                 if pc.get_level() < TOMBOLA_LIMIT_LVL then
  15.                     notice("Ta przyjemność zarezerwowana jest dla bardziej doświadczonych graczy.")
  16.                     notice("Zdobądź "..TOMBOLA_LIMIT_LVL.." poziom i wygrywaj w Tomboli!")
  17.                     return
  18.                 end
  19.                 --local first_use = pc.getf("tombola_start","limit_time")--time when use first time of day
  20.  
  21.                 --if first_use + TOMBOLA_LIMIT_TIME < get_time() then
  22.             --      pc.setf("tombola_start","used_today",TOMBOLA_COUNT_FREE)
  23.             --      number_use = TOMBOLA_COUNT_FREE
  24.             --      pc.setf("tombola_start","limit_time",get_time())
  25.             --  end
  26.                 local ilosc_sm = pc.get_sm()
  27.                 local ilosc_sz = pc.get_sz()
  28.             --  if number_use > 0 then
  29.             --      tombola_start.losuj()
  30.             --  else
  31.                     --if number_use == 0 then
  32.                 --      notice("TOMBOLA ERROR 12")
  33.                 --      return
  34.                 --  end
  35.                     if ilosc_sm < TOMBOLA_PRICE then
  36.                         notice("Nie masz wystarczającej ilości SM.")
  37.                         notice("Możesz skorzystać z losowania za jedyne "..TOMBOLA_PRICE.." Smoczych Monet.")
  38.                         notice("Doładuj Smocze Monety na naszej stronie "..ADRES_WWW.." i zagraj jeszcze raz!")
  39.                         return
  40.                     end
  41.                     tombola_start.losuj()
  42.                 end
  43.             --end
  44.         end
  45.  
  46.  
  47.  
  48.         function losuj()
  49.             local number_list = number(1,TOMBOLA_QUANTITY_LIST)
  50.             local item_reward_list = string.format(TOMBOLA_REWARD_LIST[number_list][1][1]).."|".. string.format(TOMBOLA_REWARD_LIST[number_list][1][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][2][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][2][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][3][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][3][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][4][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][4][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][5][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][5][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][6][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][6][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][7][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][7][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][8][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][8][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][9][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][9][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][10][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][10][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][11][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][11][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][12][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][12][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][13][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][13][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][14][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][14][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][15][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][15][2]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][16][1]).."|"..string.format(TOMBOLA_REWARD_LIST[number_list][16][2])
  51.             cmdchat("tombola_prepare "..item_reward_list)
  52.             local liczba_okrazen = math.random(1,3)
  53.             local ktory_item = math.random(1,16)
  54.             local item_reward = TOMBOLA_REWARD_LIST[number_list][ktory_item][1]
  55.             local reward_count = TOMBOLA_REWARD_LIST[number_list][ktory_item][2]
  56.             local to_position = (ktory_item-1)+(liczba_okrazen*16)
  57.             local speed_down =  math.random(2,10)
  58.             pc.setqf("item_reward",item_reward)
  59.             pc.setqf("reward_count",reward_count)
  60.             cmdchat("tombola_run "..to_position.."|"..speed_down)
  61.             --chat("item wylosowany:"..item_name(item_reward))--debug mode
  62.             pc.setqf("start_game", 1)
  63.         end
  64.     end
  65. end
Add Comment
Please, Sign In to add comment