Advertisement
kyroskoh

Twitch CustomAPI - Next Heist

May 7th, 2016
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.58 KB | None | 0 0
  1. <?php
  2. $Difficulties = array
  3. (
  4. //  "Hard",         // Not even worth the time.
  5. //  "Very Hard",    // Too easy and boring.
  6.     "Death Wish",   // Here we go. - Out of order, on purpose.
  7.     "Very Hard",    // Not really worth it, but wanted to add more variety.
  8.     "Overkill"      // Meh, better.
  9. );
  10.  
  11.  
  12. $PrimaryWeapons = array
  13. (
  14.     "Golden AK.762 Rifle",
  15.     "AMCAR Rifle",
  16.     "AK Rifle",
  17.     "CAR-4 Rifle",
  18.     "UAR Rifle",
  19.     "AK.762 Rifle",
  20.     "JP36 Rifle",
  21.     "M308 Rifle",
  22.     "AK5 Rifle",
  23.     "AMR-16 Rifle",
  24.     "Commando 553 Rifle",
  25.     "Eagle Heavy Rifle",
  26.     "Falcon Rifle",
  27.     "Clarion Rifle",
  28.     "Gecko 7.62 Rifle",
  29.     "Gewehr 3 Rifle",
  30.     "Queen's Wrath Rifle",
  31.     "Lion's Roar Rifle",
  32.  
  33.     "Predator 12G Shotgun",
  34.     "Reinfeld 880 Shotgun",
  35.     "IZHMA 12G Shotgun",
  36.     "Mosconi 12G Shotgun",
  37.     "M1014 Shotgun",
  38.     "Raven Shotgun",
  39.  
  40.     "Rattlesnake Sniper Rifle",
  41.     "R93 Sniper Rifle",
  42.     "Thanatos .50 cal Sniper Rifle",
  43.     "Nagant Sniper Rifle",
  44.  
  45.     "Akimbo Chimano Compact Pistols",
  46.     "Akimbo Crosskill Pistols",
  47.     "Akimbo Bernetti 9 Pistols",
  48.     "Akimbo Deagle Pistols",
  49.  
  50.     "RPK LMG",
  51.     "KSP LMG",
  52.     "Brenner 21 LMG",
  53.     "Buzzsaw 42 LMG",
  54.  
  55.     "GL40 Grenade Launcher",
  56.     "OVE9000 Primary Saw"
  57. );
  58.  
  59.  
  60. $SecondaryWeapons = array
  61. (
  62.     "Chicago Typewriter SMG",
  63.     "Mark 10 SMG",
  64.     "Compact-5 SMG",
  65.     "CMP SMG",
  66.     "Para SMG",
  67.     "Krinkov SMG",
  68.     "Kobus 90 SMG",
  69.     "Swedish K SMG",
  70.     "SpecOps SMG",
  71.     "Cobra SMG",
  72.     "Blaster 9mm SMG",
  73.     "Uzi SMG",
  74.     "Patchett L2A1 SMG",
  75.  
  76.     "Interceptor .45 Pistol",
  77.     "Chimano Custom Pistol",
  78.     "Chimano Compact Pistol",
  79.     "Chimano 88 Pistol",
  80.     "Crosskill Pistol",
  81.     "Bernetti 9 Pistol",
  82.     "Bronco .44 Pistol",
  83.     "STRYK 18c Pistol",
  84.     "Deagle Pistol",
  85.     "Gruber Kurz Pistol",
  86.     "Signature .40 Pistol",
  87.     "Broomstick Pistol",
  88.     "LEO Pistol",
  89.  
  90.     "The Judge Shotgun",
  91.     "Locomotive 12G Shotgun",
  92.     "Street Sweeper Shotgun",
  93.  
  94.     "OVE9000 Secondary Saw"
  95. );
  96.  
  97.  
  98. $Heists = array
  99. (
  100.     "Art Gallery",
  101.     "Bank Heist Pro",
  102.     "Bank Heist: Cash",
  103.     "Bank Heist: Deposit",
  104.     "Bank Heist: Gold Pro",
  105.     "Diamond Store",
  106.     "Jewelry Store",
  107.     "Shadow Raid",
  108.     "Transport: Crossroads",
  109.     "Transport: Downtown",
  110.     "Transport: Harbor",
  111.     "Transport: Park",
  112.     "Transport: Underpass",
  113.  
  114.     "Firestarter",
  115.     "Firestarter Pro",
  116.     "Rats",
  117.     "Rats Pro",
  118.     "Watchdogs",
  119.     "Watchdogs Pro",
  120.  
  121.     "The Bomb: Dockyard",
  122.     "The Bomb: Forest Kappa",
  123.  
  124.     "Hotline Miami",
  125.     "Hotline Miami Pro",
  126.     "Hoxton Breakout",
  127.     "Hoxton Breakout Pro",
  128.     "The Big Bank",
  129.     "The Diamond",
  130.  
  131.     "Big Oil Pro",
  132.     "Election Day",
  133.     "Election Day Pro",
  134.     "Framing Frame",
  135.     "Framing Frame Pro",
  136.     "Four Stores",
  137.     "Mallcrasher",
  138.     "Nightlub",
  139.     "Ukrainian Job Pro",
  140.     "White Xmas"
  141. );
  142. // Generate random heist & difficulty.
  143. $Heist = $Heists[mt_rand(0, count($Heists) - 1)];
  144. $Difficulty = $Difficulties[mt_rand(0, count($Difficulties) - 1)];
  145. // Weapons for the broadcaster.
  146. $PrimaryWeapon = $PrimaryWeapons[mt_rand(0, count($PrimaryWeapons) - 1)];
  147. $SecondaryWeapon = $SecondaryWeapons[mt_rand(0, count($SecondaryWeapons) - 1)];
  148. // Check for no input, set default value of 1.
  149. if(empty($_GET["GeneralQuery"]))
  150. {
  151.     $_GET["GeneralQuery"] = 1;
  152. }
  153. // Check for numeric input.
  154. if(is_numeric($_GET["GeneralQuery"]))
  155. {
  156.     // Input needs to be less than 4, greater than or equal to 1.
  157.     if($_GET["GeneralQuery"] > 4 || $_GET["GeneralQuery"] <= 1)
  158.     {
  159.         // Set default to 1 for any numeric input out of bounds.
  160.         $_GET["GeneralQuery"] = 1;
  161.     }
  162. }
  163. // Input was alphabetical
  164. else
  165. {
  166.     // Seperate the input, by "," put in array.
  167.     $NamesArray=explode(",",$_GET["GeneralQuery"]);
  168.     $NamesArray=array_map(function($word){return (ucwords(strtolower($word)));},$NamesArray);
  169.     // Count the array, set the value to match.
  170.     $_GET["GeneralQuery"] = count($NamesArray) + 1;
  171. }
  172. // Always print the broadcaster loadout.
  173. $GeneralQuery = $_GET["GeneralQuery"];
  174. echo 'Next up is: ' . $Heist . ' on ' . $Difficulty . ', ' . htmlspecialchars($_GET["Broadcaster"]) . ' will use the ' . $PrimaryWeapon . ' and the ' . $SecondaryWeapon . '! ';
  175. // Player 2 loadout.
  176. if ($_GET["GeneralQuery"] >= 2)
  177. {
  178.     // Set the Player 2 loadout.
  179.     $PrimaryWeapon2 = $PrimaryWeapons[mt_rand(0, count($PrimaryWeapons) - 1)];
  180.     $SecondaryWeapon2 = $SecondaryWeapons[mt_rand(0, count($SecondaryWeapons) - 1)];
  181.     // Input was numeric. Default value.
  182.     if (empty($NamesArray))
  183.     {
  184.         echo 'Player 2 ';
  185.     }
  186.     // Input was alphabetical
  187.     else
  188.     {
  189.         echo $NamesArray[0] . ' ';
  190.     }
  191.     // Print player 2 loadout.
  192.     echo 'will use the ' . $PrimaryWeapon2 . ' and the ' . $SecondaryWeapon2 . '! ';
  193. }
  194. // Player 3 loadout.
  195. if ($_GET["GeneralQuery"] >= 3)
  196. {
  197.     // Set the Player 3 loadout.
  198.     $PrimaryWeapon3 = $PrimaryWeapons[mt_rand(0, count($PrimaryWeapons) - 1)];
  199.     $SecondaryWeapon3 = $SecondaryWeapons[mt_rand(0, count($SecondaryWeapons) - 1)];
  200.     // Input was numeric. Default value.
  201.     if (empty($NamesArray))
  202.     {
  203.         echo 'Player 3 ';
  204.     }
  205.     // Input was alphabetical
  206.     else
  207.     {
  208.         echo $NamesArray[1] . ' ';
  209.     }
  210.     // Print player 3 loadout.
  211.     echo 'will use the ' . $PrimaryWeapon3 . ' and the ' . $SecondaryWeapon3 . '! ';
  212. }
  213. // Player 4 loadout.
  214. if ($_GET["GeneralQuery"] >= 4)
  215. {
  216.     // Input was numeric. Default value.
  217.     $PrimaryWeapon4 = $PrimaryWeapons[mt_rand(0, count($PrimaryWeapons) - 1)];
  218.     $SecondaryWeapon4 = $SecondaryWeapons[mt_rand(0, count($SecondaryWeapons) - 1)];
  219.     // Input was numeric.
  220.     if (empty($NamesArray))
  221.     {
  222.         echo 'Player 4 ';
  223.     }
  224.     // Input was alphabetical
  225.     else
  226.     {
  227.         echo $NamesArray[2] . ' ';
  228.     }
  229.     // Print player 4 loadout.
  230.     echo 'will use the ' . $PrimaryWeapon4 . ' and the ' . $SecondaryWeapon4 . '!';
  231. }
  232. ?>
  233.  
  234. Example:
  235. NextHeist.php?Broadcaster=TwitchBroadcaster&GeneralQuery=4
  236. or
  237. NextHeist.php?Broadcaster=TwitchBroadcaster&GeneralQuery=john, JACK, jIm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement