nfell2009

CodeGenAPI - 1.0

Jun 18th, 2014
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 6.13 KB | None | 0 0
  1. #CodeGenAPI
  2. #By nfell2009
  3.  
  4. options:
  5.     P: &8[&aCGA&8]&a
  6.  
  7. on skript load:
  8.     delete {cga.alphabet::*}
  9.     add "a" to {cga.alphabet::*}
  10.     add "b" to {cga.alphabet::*}
  11.     add "c" to {cga.alphabet::*}
  12.     add "d" to {cga.alphabet::*}
  13.     add "e" to {cga.alphabet::*}
  14.     add "f" to {cga.alphabet::*}
  15.     add "g" to {cga.alphabet::*}
  16.     add "h" to {cga.alphabet::*}
  17.     add "i" to {cga.alphabet::*}
  18.     add "j" to {cga.alphabet::*}
  19.     add "k" to {cga.alphabet::*}
  20.     add "l" to {cga.alphabet::*}
  21.     add "m" to {cga.alphabet::*}
  22.     add "n" to {cga.alphabet::*}
  23.     add "o" to {cga.alphabet::*}
  24.     add "p" to {cga.alphabet::*}
  25.     add "q" to {cga.alphabet::*}
  26.     add "r" to {cga.alphabet::*}
  27.     add "s" to {cga.alphabet::*}
  28.     add "t" to {cga.alphabet::*}
  29.     add "u" to {cga.alphabet::*}
  30.     add "v" to {cga.alphabet::*}
  31.     add "w" to {cga.alphabet::*}
  32.     add "x" to {cga.alphabet::*}
  33.     add "y" to {cga.alphabet::*}
  34.     add "z" to {cga.alphabet::*}
  35.    
  36. command /codegenapi [<text>] [<text>] [<text>] [<text>] [<text>]:
  37.     executable by: console
  38.     trigger:
  39.         if arg 1 is "generate" or "gen" or "g":
  40.             if arg 2 is "key" or "k":
  41.                 if arg 3 is not set:
  42.                     broadcast "{@P} A Skript just tried to create an API key for CodeGenAPI, however it failed to give its name"
  43.                 else:
  44.                     loop 100000000 times:
  45.                         set {_type1} to a rounded random integer between 1 and 10
  46.                         set {_type2} to a rounded random integer between 1 and 10
  47.                         set {_type3} to a rounded random integer between 1 and 10
  48.                         set {_type4} to a rounded random integer between 1 and 10
  49.                         set {_type5} to a rounded random integer between 1 and 10
  50.                         set {_type6} to a rounded random integer between 1 and 10
  51.                        
  52.                         if {_type1} is equal to 1 or 3 or 5 or 7 or 9:
  53.                             set {_char1} to a rounded random integer between 1 and 9
  54.                         else:
  55.                             set {_rand} to a rounded random integer between 1 and 26
  56.                             set {_char1} to {cga.alphabet::%{_rand}%}
  57.                            
  58.                         if {_type2} is equal to 1 or 3 or 5 or 7 or 9:
  59.                             set {_char2} to a rounded random integer between 1 and 9
  60.                         else:
  61.                             set {_rand} to a rounded random integer between 1 and 26
  62.                             set {_char2} to {cga.alphabet::%{_rand}%}
  63.                            
  64.                         if {_type3} is equal to 1 or 3 or 5 or 7 or 9:
  65.                             set {_char3} to a rounded random integer between 1 and 9
  66.                         else:
  67.                             set {_rand} to a rounded random integer between 1 and 26
  68.                             set {_char3} to {cga.alphabet::%{_rand}%}
  69.                            
  70.                         if {_type4} is equal to 1 or 3 or 5 or 7 or 9:
  71.                             set {_char4} to a rounded random integer between 1 and 9
  72.                         else:
  73.                             set {_rand} to a rounded random integer between 1 and 26
  74.                             set {_char4} to {cga.alphabet::%{_rand}%}
  75.                            
  76.                         if {_type5} is equal to 1 or 3 or 5 or 7 or 9:
  77.                             set {_char5} to a rounded random integer between 1 and 9
  78.                         else:
  79.                             set {_rand} to a rounded random integer between 1 and 26
  80.                             set {_char5} to {cga.alphabet::%{_rand}%}
  81.                            
  82.                         if {_type6} is equal to 1 or 3 or 5 or 7 or 9:
  83.                             set {_char6} to a rounded random integer between 1 and 9
  84.                         else:
  85.                             set {_rand} to a rounded random integer between 1 and 26
  86.                             set {_char6} to {cga.alphabet::%{_rand}%}
  87.                            
  88.                         set {_code} to "%{_char1}%%{_char2}%%{_char3}%%{_char4}%%{_char5}%%{_char6}%"
  89.                         if {cga.codelist::%{_code}%} is not set:
  90.                             set {cga.codelist::%{_code}%} to {_code}
  91.                             set {cga.%arg 3%.code} to {_code}
  92.                             stop loop
  93.                            
  94.             else if arg 2 is "code" or "c":
  95.                 set {_key} to arg 3
  96.                 if arg 3 is not set:
  97.                     broadcast "{@P} A Skript tried to generate a code with CodeGenAPI, but failed to supply its API Key"
  98.                 else if {cga.codelist::%{_key}%} is not set:
  99.                     broadcast "{@P} A Skript tried to generate a code with CodeGenAPI, but the API Key given doesn't exist"
  100.                 else if {cga.codelist::%{_key}%} is set:
  101.                     if arg 4 is set:
  102.                         loop 100000000 times:
  103.                             set {_type1} to a rounded random integer between 1 and 10
  104.                             set {_type2} to a rounded random integer between 1 and 10
  105.                             set {_type3} to a rounded random integer between 1 and 10
  106.                             set {_type4} to a rounded random integer between 1 and 10
  107.                             set {_type5} to a rounded random integer between 1 and 10
  108.                             set {_type6} to a rounded random integer between 1 and 10
  109.                            
  110.                             if {_type1} is equal to 1 or 3 or 5 or 7 or 9:
  111.                                 set {_char1} to a rounded random integer between 1 and 9
  112.                             else:
  113.                                 set {_rand} to a rounded random integer between 1 and 26
  114.                                 set {_char1} to {cga.alphabet::%{_rand}%}
  115.                                
  116.                             if {_type2} is equal to 1 or 3 or 5 or 7 or 9:
  117.                                 set {_char2} to a rounded random integer between 1 and 9
  118.                             else:
  119.                                 set {_rand} to a rounded random integer between 1 and 26
  120.                                 set {_char2} to {cga.alphabet::%{_rand}%}
  121.                                
  122.                             if {_type3} is equal to 1 or 3 or 5 or 7 or 9:
  123.                                 set {_char3} to a rounded random integer between 1 and 9
  124.                             else:
  125.                                 set {_rand} to a rounded random integer between 1 and 26
  126.                                 set {_char3} to {cga.alphabet::%{_rand}%}
  127.                                
  128.                             if {_type4} is equal to 1 or 3 or 5 or 7 or 9:
  129.                                 set {_char4} to a rounded random integer between 1 and 9
  130.                             else:
  131.                                 set {_rand} to a rounded random integer between 1 and 26
  132.                                 set {_char4} to {cga.alphabet::%{_rand}%}
  133.                                
  134.                             if {_type5} is equal to 1 or 3 or 5 or 7 or 9:
  135.                                 set {_char5} to a rounded random integer between 1 and 9
  136.                             else:
  137.                                 set {_rand} to a rounded random integer between 1 and 26
  138.                                 set {_char5} to {cga.alphabet::%{_rand}%}
  139.                                
  140.                             if {_type6} is equal to 1 or 3 or 5 or 7 or 9:
  141.                                 set {_char6} to a rounded random integer between 1 and 9
  142.                             else:
  143.                                 set {_rand} to a rounded random integer between 1 and 26
  144.                                 set {_char6} to {cga.alphabet::%{_rand}%}
  145.                                
  146.                             set {_code} to "%{_char1}%%{_char2}%%{_char3}%%{_char4}%%{_char5}%%{_char6}%"
  147.                             if {cga.%{_key}%.list::%{_code}%} is not set:
  148.                                 set {cga.%{_key}%.%arg 4%.code} to {_code}
  149.                                 set {cga.%{_key}%.list::%{_code}%} to {_code}
  150.                                 stop loop
  151.                     else:
  152.                         broadcast "{@P} A Skript tried to generate a code with CodeGenAPI, but failed to give a unique identifier"
Advertisement
Add Comment
Please, Sign In to add comment