Advertisement
Protocol_

iRath's find four bot/ Thanks to Pare

Apr 12th, 2012
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.51 KB | None | 0 0
  1.  
  2. <?php
  3.   $isplayin = false;
  4.   $botid = rand(60, 90);
  5. $Username = "";
  6. $Password = "";
  7. //Server connects to Icicle
  8. class FindFour extends Pickle {
  9.  
  10.   function waitPack($pstr) {
  11.     global $rawPack;
  12.     global $isplayin;
  13.     $isok = false;
  14.     $rawPack = $this->readRawPacket();
  15.     while(!$isok) {
  16.       if (stripos($rawPack, $pstr)) return true;
  17.       $rawPack = $this->readRawPacket();
  18.       if ($isplayin and stripos($rawPack, "xt%ut%23%206%")) return false;
  19.     }
  20.   }
  21.  
  22.   function glowest($row) {
  23.     for($y = 5; $y >= -1; $y--) {
  24.       if($y != -1 and $row[$y] == 0) return $y + 1;
  25.       if($y == -1) {
  26.         return false;
  27.       }
  28.     }
  29.   }
  30.  
  31.   function hrow($xx, $yy) {
  32.     global $setted;
  33.     $row = $setted[$xx];
  34.     $all = 0;
  35.     for($i = 5; $i >= $yy; $i--) {
  36.       if($row[$i] == 2) {
  37.         $all++;
  38.       } else {
  39.         $all = 0;
  40.       }
  41.       if($i == 0) break;
  42.     }
  43.     if($all >= 2) return "$xx," . ($yy - $all + 1) . "," . ($all + 7);
  44.     return ",,0";
  45.   }
  46.  
  47.   function hline($xx, $yy) {
  48.     global $setted;
  49.     $line = array();
  50.     foreach($setted as $key => $melo) {
  51.       $line[$key] = $setted[$key][$yy];
  52.     }
  53.     $lstr = implode($line);
  54.     $stpos = strpos($lstr, "222");
  55.     if($stpos and $line[$stpos - 1] == 0) return ($stpos - 1) . ",$yy,10";
  56.     if($stpos and $line[$stpos + 4] == 0) return ($stpos + 4) . ",$yy,10";
  57.   }
  58.  
  59. }
  60.  
  61.   connect($Username, $Password, 108);
  62.     echo("$Username has logged into Icicle.\n");
  63.     $PlayerID =& PlayerID;
  64.     echo "His ID is $PlayerID!\n";
  65.     joinRoom(110);
  66.     joinRoom(220, 0, 0);
  67.     echo "At Sky Lodge!\n";
  68.     sendRawPacket("%xt%sf%%" . intRoomID . "%" . PlayerID . "%18%");
  69.     sendRawPacket("%xt%z%gz%81%");
  70.  
  71.     sendRawPacket("%xt%z%jz%81%");
  72.    
  73.     waitPack("xt%uz%81%1%");
  74.     $nm = stribet($rawPack, "xt%uz%81%1%", "%");
  75.     $isplayin = true;
  76.     echo "Received Master Pack (Playing agains $nm)\n";
  77.     for($ix = 0; $ix <= 6; $ix++) {
  78.       for($iy = 0; $iy <= 5; $iy++) {
  79.         $setted[$ix][$iy] = 0;
  80.       }
  81.     }
  82.  
  83.   $PlayArray = array("Nobody", "Me", $nm);
  84.   while(true) {
  85.     $glend = false;
  86.     while(!$glend) {
  87.       $x = rand(0, 6);
  88.       $row = $setted[$x];
  89.       $glend = glowest($row);
  90.       if($glend) $y = glowest($row) - 1;
  91.     }
  92.     $messman = explode(",", hrow($xx, $yy));
  93.     if($messman[2] > 0) {
  94.       $x = $messman[0];
  95.       $y = $messman[1];
  96.       $prio = $messman[2];
  97.     }
  98.     $messman = explode(",", hline($xx, $yy));
  99.     if($messman[2] > 0 and $messman[2] > $prio) {
  100.       $x = $messman[0];
  101.       $y = $messman[1];
  102.       $prio = $messman[2];
  103.     }
  104.     echo "I will set to $x, $y!\n";
  105.     sendRawPacket("%xt%z%zm%81%$x%$y%.");
  106.     $setted[$x][$y] = 1;
  107.     if(!waitPack("xt%zm%81%1%")) {
  108.       $isplayin = false;
  109.       echo "*** Must restart ***\n";
  110.       for($ix = 0; $ix <= 6; $ix++) {
  111.         for($iy = 0; $iy <= 5; $iy++) {
  112.           $setted[$ix][$iy] = 0;
  113.         }
  114.       }
  115.       sendRawPacket("%xt%s%u#sp%23%344%410%.");
  116.       sleep(1);
  117.       sendRawPacket("%xt%s%u#sp%23%310%397%.");
  118.       sendRawPacket("%xt%s%a#jt%23%206%.");
  119.       sendRawPacket("%xt%z%gz%81%.");
  120.       sendRawPacket("%xt%z%jz%81%.");
  121.       waitPack("xt%uz%81%1%");
  122.       $nm = stribet($rawPack, "xt%uz%81%1%", "%");
  123.       $isplayin = true;
  124.       echo "Received Start Packet (Playing agains $nm)\n";
  125.     }
  126.     $xx = stribet($rawPack, "%xt%zm%81%1%", "%");
  127.     $yy = stribet($rawPack, "%xt%zm%81%1%$x%", "%");
  128.     echo "Player set to $xx, $yy;";
  129.     $setted[$xx][$yy] = 2;
  130.   }
  131.  
  132. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement