Advertisement
al3taibi

Untitled

Nov 20th, 2019
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.49 KB | None | 0 0
  1. <?php
  2.  
  3. error_reporting(0);
  4.  
  5. include_once 'vk.php';
  6. include_once 'config.php';
  7. include_once 'exdbase.php';
  8.  
  9. $prizes = [
  10.     1 => [
  11.         'money' => 100000000,
  12.         'pcase' => 15,
  13.     ],
  14.     2 => [
  15.         'money' => 75000000,
  16.         'pcase' => 10,
  17.     ],
  18.     3 => [
  19.         'money' => 75000000,
  20.         'pcase' => 8,
  21.     ],
  22.     4 => [
  23.         'money' => 50000000,
  24.         'pcase' => 5,
  25.     ],
  26.     5 => [
  27.         'money' => 50000000,
  28.         'pcase' => 5,
  29.     ],
  30.     6 => [
  31.         'money' => 50000000,
  32.         'pcase' => 5,
  33.         'randomcar' => true
  34.     ],
  35.     7 => [
  36.         'money' => 30000000,
  37.         'pcase' => 5,
  38.         'profilechange' => 5,
  39.         'randomcar' => true
  40.     ],
  41.     8 => [
  42.         'money' => 30000000,
  43.         'pcase' => 3,
  44.         'profilechange' => 3,
  45.         'randomcar' => true
  46.     ],
  47.     9 => [
  48.         'money' => 30000000,
  49.         'pcase' => 3,
  50.         'profilechange' => 1,
  51.         'randomcar' => true
  52.     ],
  53.     10 => [
  54.         'profilechange' => 2147483648
  55.     ],
  56.     11 => [
  57.         'money' => 25000000,
  58.         'pcase' => 1,
  59.         'randombiz' => true
  60.     ],
  61.     12 => [
  62.         'money' => 25000000,
  63.         'pcase' => 1,
  64.         'randombiz' => true
  65.     ],
  66.     13 => [
  67.         'money' => 25000000,
  68.         'pcase' => 1,
  69.         'randombiz' => true
  70.     ],
  71.     14 => [
  72.         'money' => 25000000,
  73.         'pcase' => 1,
  74.         'randombiz' => true
  75.     ],
  76.     15 => [
  77.         'money' => 20000000,
  78.         'pcase' => 1,
  79.         'randombiz' => true
  80.     ],
  81.     16 => [
  82.         'money' => 20000000,
  83.         'pcase' => 1,
  84.         'randombiz' => true
  85.     ],
  86.     17 => [
  87.         'money' => 15000000,
  88.         'pcase' => 1,
  89.         'unlockgarage' => true,
  90.         'randombiz' => true
  91.     ],
  92.     18 => [
  93.         'money' => 15000000,
  94.         'pcase' => 1,
  95.         'unlockgarage' => true,
  96.         'randombiz' => true
  97.     ],
  98.     19 => [
  99.         'money' => 15000000,
  100.         'pcase' => 1,
  101.         'unlockgarage' => true,
  102.         'randombiz' => true
  103.     ],
  104.     20 => [
  105.         'exclusivecar' => true
  106.     ],
  107.     21 => [
  108.         'money' => 10000000,
  109.         'pcase' => 1,
  110.         'randomcar' => true
  111.     ],
  112.     22 => [
  113.         'money' => 10000000,
  114.         'pcase' => 1,
  115.         'randomcar' => true
  116.     ],
  117.     23 => [
  118.         'money' => 10000000,
  119.         'pcase' => 1,
  120.         'randombiz' => true
  121.     ],
  122.     24 => [
  123.         'money' => 10000000,
  124.         'pcase' => 1,
  125.         'randombiz' => true
  126.     ],
  127.     25 => [
  128.         'money' => 10000000,
  129.         'pcase' => 1,
  130.         'randombiz' => true
  131.     ],
  132.     26 => [
  133.         'money' => 10000000,
  134.         'pcase' => 1,
  135.         'randombiz' => true
  136.     ],
  137.     27 => [
  138.         'money' => 10000000,
  139.         'pcase' => 1,
  140.         'pet' => true
  141.     ],
  142.     28 => [
  143.         'money' => 10000000,
  144.         'pcase' => 1,
  145.         'pet' => true
  146.     ],
  147.     29 => [
  148.         'money' => 10000000,
  149.         'pcase' => 1,
  150.         'pet' => true
  151.     ],
  152.     30 => [
  153.         'customfunction' => true
  154.     ],
  155.     31 => [
  156.         'money' => 5000000,
  157.         'pcase' => 1,
  158.         'randompet' => true
  159.     ],
  160.     32 => [
  161.         'money' => 5000000,
  162.         'pcase' => 1,
  163.         'randompet' => true
  164.     ],
  165.     33 => [
  166.         'money' => 5000000,
  167.         'pcase' => 1,
  168.         'randompet' => true
  169.     ],
  170.     34 => [
  171.         'money' => 5000000,
  172.         'pcase' => 1,
  173.         'exp' => 1500
  174.     ],
  175.     35 => [
  176.         'money' => 5000000,
  177.         'pcase' => 1,
  178.         'exp' => 1000
  179.     ],
  180.     36 => [
  181.         'money' => 5000000,
  182.         'pcase' => 1,
  183.         'exp' => 500
  184.     ],
  185.     37 => [
  186.         'money' => 3000000,
  187.         'pcase' => 2
  188.     ],
  189.     38 => [
  190.         'money' => 3000000,
  191.         'pcase' => 2
  192.     ],
  193.     39 => [
  194.         'money' => 3000000,
  195.         'pcase' => 2
  196.     ],
  197.     40 => [
  198.         'exclusiverang' => true
  199.     ],
  200.     41 => [
  201.         'money' => 2000000,
  202.         'pcase' => 2
  203.     ],
  204.     42 => [
  205.         'money' => 2000000,
  206.         'pcase' => 1
  207.     ],
  208.     43 => [
  209.         'money' => 2000000,
  210.         'clover' => 30
  211.     ],
  212.     44 => [
  213.         'money' => 2000000,
  214.         'clover' => 20
  215.     ],
  216.     45 => [
  217.         'money' => 2000000,
  218.         'clover' => 10
  219.     ],
  220.     46 => [
  221.         'money' => 1000000,
  222.         'case' => 5
  223.     ],
  224.     47 => [
  225.         'money' => 1000000,
  226.         'case' => 5
  227.     ],
  228.     48 => [
  229.         'money' => 1000000,
  230.         'case' => 5
  231.     ],
  232.     49 => [
  233.         'pcase' => 1
  234.     ],
  235.     50 => [
  236.         'ban' => true
  237.     ]
  238. ];
  239. $concurs_users = json_decode(file_get_contents('concurs.json'), true); // concurs.json -- файл с участниками
  240. for ($x = 0; $x < 50; $x++) shuffle($concurs_users);
  241. $users = [];
  242. $text = "🥳 Конкурс окончен!\n\n😧 Всего участников -- " . money(count($concurs_users)) . "\n🤑 Ниже приведены все победители конкурса, поздравляем!\n\n";
  243.  
  244. $DB = new exDBase(DB['host'], DB['login'], DB['password'], "nedobot");
  245.  
  246. for ($x = 1; $x <= 50; $x++) {
  247.     $newuser = $concurs_users[array_rand($concurs_users)];
  248.     while (in_array($newuser, $users)) $newuser = $concurs_users[array_rand($concurs_users)];
  249.     $users[$x] = $newuser;
  250.     $text .= bNum($x) . " место -- [id" . $newuser . "|" . setName($newuser) . "]\n";
  251.     $user = json_decode(file_get_contents('users/' . $newuser . '.json'), true);
  252.     $temptext = "🥳 " . setName1($newuser) . ", поздравляем, ты победил в конкурсе и занял " . bNum($x) . " место! Твои призы:\n\n";
  253.     if($prizes[$x]['money']) {
  254.         $temptext .= "• " . money($prizes[$x]['money']) . " 💰\n";
  255.         $user['money'] += $prizes[$x]['money'];
  256.     }
  257.     if($prizes[$x]['exp']){
  258.         $temptext .= "• " . money($prizes[$x]['exp']) . " ⭐️\n";
  259.         $user['exp'] += $prizes[$x]['exp'];
  260.     }
  261.     if($prizes[$x]['clover']){
  262.         $temptext .= "• " . money($prizes[$x]['clover']) . " 🍀\n";
  263.         $user['clover'] += $prizes[$x]['clover'];
  264.     }
  265.     if($prizes[$x]['case']){
  266.         $temptext .= "• " . money($prizes[$x]['case']) . " 📦\n";
  267.         $user['cases'] += $prizes[$x]['cases'];
  268.     }
  269.     if($prizes[$x]['pcase']){
  270.         $DB->insert('special_cases', [
  271.             'user_id' => $newuser,
  272.             'cases' => 2,
  273.             'opened' => 0,
  274.             'pet' => 0,
  275.             'gradient' => 0,
  276.             'profilebacks' => 0
  277.         ], false);
  278.         $DB->update('special_cases', ['user_id' => $newuser], ['cases' => $DB->fetchFirst('special_cases', ['user_id' => $newuser], ['cases'])['cases'] + $prizes[$x]['pcase']]);
  279.         $temptext .= "• " . money($prizes[$x]['pcase']) . " 🎁\n";
  280.     }
  281.     if($prizes[$x]['profilechange'] > 0){
  282.         $DB->insert('special_cases', [
  283.             'user_id' => $newuser,
  284.             'cases' => 2,
  285.             'opened' => 0,
  286.             'pet' => 0,
  287.             'gradient' => 0,
  288.             'profilebacks' => 0
  289.         ], false);
  290.         if($prizes[$x]['profilechange'] != 2147483648) {
  291.             $DB->update('special_cases', ['user_id' => $newuser], ['profilebacks' => $DB->fetchFirst('special_cases', ['user_id' => $newuser], ['profilebacks'])['profilebacks'] + $prizes[$x]['profilechange']]);
  292.             $temptext .= "• Возможность сменить фон профиля (+" . $prizes[$x]['profilechange'] . ") 🌄";
  293.         }else{
  294.             $DB->update('special_cases', ['user_id' => $newuser], ['profilebacks' => 2147483648]);
  295.             $temptext .= "• Бесконечное кол-во возможностей сменить фон профиля 🌄";
  296.  
  297.         }
  298.     }
  299.     if($prizes[$x]['unlockgarage']){
  300.         $garage = $DB->fetchFirst('garage', ['user_id' => $newuser]);
  301.         if($garage){
  302.             if($garage['car3'] === 666){
  303.                 $DB->update('garage', ['user_id' => $newuser], ['car3' => 0]);
  304.                 $temptext .= "• Разблокировка третьего слота гаража 🔐\n";
  305.             }else $temptext .= "• Разблокировка третьего слота гаража (но у Вас уже разблокирован третий слот, так что данный выигрыш Вы не получаете) 🔐\n";
  306.         }else $temptext .= "• Разблокировка третьего слота гаража (но у Вас нет гаража, так что данный выигрыш Вы не получаете) 🔐\n";
  307.         unset($garage);
  308.     }
  309.     if($prizes[$x]['randomcar']) $temptext .= "• Автомобиль на выбор (напишите @vinogradov.sasha для получения) 🏎\n";
  310.     if($prizes[$x]['randombiz']) $temptext .= "• Здание на выбор (напишите @vinogradov.sasha для получения) 🏭\n";
  311.     if($prizes[$x]['exclusivecar']) $temptext .= "• Эксклюзивное авто (напишите @vinogradov.sasha для получения) 🚜\n";
  312.     if($prizes[$x]['exclusiverang']) $temptext .= "• Эксклюзивный ранг (напишите @vinogradov.sasha для получения) 💎\n";
  313.     if($prizes[$x]['pet']) $temptext .= "• Питомец на выбор (напишите @vinogradov.sasha для получения) 🐰\n";
  314.     if($prizes[$x]['randompet']) $temptext .= "• Случайный питомец (напишите @vinogradov.sasha для получения) 🐰\n";
  315.     if($prizes[$x]['customfunction']) $temptext .= "• Реализация Вашей функции (напишите @vinogradov.sasha для подробностей) 🐣\n";
  316.     if($prizes[$x]['ban']) $temptext .= "• Бан...? Отпиши @vinogradov.sasha для спец. приза 😏\n";
  317.     file_put_contents('users/' . $newuser . '.json', json_encode($user), LOCK_EX);
  318.     MsgSend($temptext . "\n\n🎈 Поздравляем!", $newuser);
  319. }
  320.  
  321. $DB->close();
  322.  
  323. file_put_contents('concurs.txt', $text . "\n\nНе огорчайтесь, если не выиграли в этот раз. Повезёт в следующий! 🍀\n\n#!#");
  324.  
  325. function bNum($num)
  326. {
  327.     if ($num == 10) return "🔟";
  328.     $nums = ['0️⃣', '1️⃣', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣', '8️⃣', '9️⃣'];
  329.     $newnum = "";
  330.     while (strlen($num)) {
  331.         $newnum .= $nums[substr($num, 0, 1)];
  332.         $num = substr($num, 1);
  333.     }
  334.     return $newnum;
  335. }
  336. function money($money)
  337. {
  338.     return number_format($money, 0, '', '.');
  339. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement