VegaS1234

[Lua] Choose the item

Apr 19th, 2017 (edited)
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.34 KB | None | 0 0
  1. --[[
  2. ###########################
  3. # Author: VegaS           #
  4. # Date: 2017.04.20        #
  5. # Quest: Choose the item  #
  6. ###########################
  7. ]]
  8. quest select_item_quest begin
  9.     state start begin
  10.         when login with pc.get_level() == 1 begin
  11.             send_letter("Choose the item")
  12.         end
  13.        
  14.         when button or info begin
  15.             say_title(string.format("Welcome to our server %s!", pc.get_name()))
  16.             say("For start, we give you the opportunity")
  17.             say("to choose a item with bonus.")
  18.             say("I hope you choose wise!")
  19.             say("")
  20.            
  21.             local SETTINGS_DICT = {
  22.                 [WARRIOR]   = {
  23.                     ['type_weapon'] = {"Fms"},
  24.                     ['vnum'] = {299, 3219}
  25.                 },
  26.                 [ASSASSIN]  = {
  27.                     ['type_weapon'] = {"Pumnal", "Arc"},
  28.                     ['vnum'] = {1179, 2199}
  29.                 },
  30.                 [SURA]      = {
  31.                     ['type_weapon'] = {"Fms"},
  32.                     ['vnum'] = {299}
  33.                 },
  34.                 [SHAMAN]    = {
  35.                     ['type_weapon'] = {"Clopot", "Evantai"},
  36.                     ['vnum'] = {5119, 7169}
  37.                 },
  38.             }
  39.             local jobIndex = pc.get_job()
  40.             local dict = SETTINGS_DICT[jobIndex]['type_weapon']
  41.  
  42.             table.insert(dict, "Exit")
  43.             local key = select_table(dict);
  44.            
  45.             if (key == table.getn(dict)) then
  46.                 send_letter("Choose the item")
  47.                 return
  48.             end
  49.  
  50.             pc.give_item2_select(SETTINGS_DICT[jobIndex]['vnum'][key])
  51.             item.set_value(0, 72, 55)
  52.             set_state(__COMPLETE__)
  53.         end
  54.     enddd
  55.     state __COMPLETE__ begin end
  56. end
Advertisement
Add Comment
Please, Sign In to add comment