Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $isplayin = false;
- $botid = rand(60, 90);
- $Username = "";
- $Password = "";
- //Server connects to Icicle
- class FindFour extends Pickle {
- function waitPack($pstr) {
- global $rawPack;
- global $isplayin;
- $isok = false;
- $rawPack = $this->readRawPacket();
- while(!$isok) {
- if (stripos($rawPack, $pstr)) return true;
- $rawPack = $this->readRawPacket();
- if ($isplayin and stripos($rawPack, "xt%ut%23%206%")) return false;
- }
- }
- function glowest($row) {
- for($y = 5; $y >= -1; $y--) {
- if($y != -1 and $row[$y] == 0) return $y + 1;
- if($y == -1) {
- return false;
- }
- }
- }
- function hrow($xx, $yy) {
- global $setted;
- $row = $setted[$xx];
- $all = 0;
- for($i = 5; $i >= $yy; $i--) {
- if($row[$i] == 2) {
- $all++;
- } else {
- $all = 0;
- }
- if($i == 0) break;
- }
- if($all >= 2) return "$xx," . ($yy - $all + 1) . "," . ($all + 7);
- return ",,0";
- }
- function hline($xx, $yy) {
- global $setted;
- $line = array();
- foreach($setted as $key => $melo) {
- $line[$key] = $setted[$key][$yy];
- }
- $lstr = implode($line);
- $stpos = strpos($lstr, "222");
- if($stpos and $line[$stpos - 1] == 0) return ($stpos - 1) . ",$yy,10";
- if($stpos and $line[$stpos + 4] == 0) return ($stpos + 4) . ",$yy,10";
- }
- }
- connect($Username, $Password, 108);
- echo("$Username has logged into Icicle.\n");
- $PlayerID =& PlayerID;
- echo "His ID is $PlayerID!\n";
- joinRoom(110);
- joinRoom(220, 0, 0);
- echo "At Sky Lodge!\n";
- sendRawPacket("%xt%sf%%" . intRoomID . "%" . PlayerID . "%18%");
- sendRawPacket("%xt%z%gz%81%");
- sendRawPacket("%xt%z%jz%81%");
- waitPack("xt%uz%81%1%");
- $nm = stribet($rawPack, "xt%uz%81%1%", "%");
- $isplayin = true;
- echo "Received Master Pack (Playing agains $nm)\n";
- for($ix = 0; $ix <= 6; $ix++) {
- for($iy = 0; $iy <= 5; $iy++) {
- $setted[$ix][$iy] = 0;
- }
- }
- $PlayArray = array("Nobody", "Me", $nm);
- while(true) {
- $glend = false;
- while(!$glend) {
- $x = rand(0, 6);
- $row = $setted[$x];
- $glend = glowest($row);
- if($glend) $y = glowest($row) - 1;
- }
- $messman = explode(",", hrow($xx, $yy));
- if($messman[2] > 0) {
- $x = $messman[0];
- $y = $messman[1];
- $prio = $messman[2];
- }
- $messman = explode(",", hline($xx, $yy));
- if($messman[2] > 0 and $messman[2] > $prio) {
- $x = $messman[0];
- $y = $messman[1];
- $prio = $messman[2];
- }
- echo "I will set to $x, $y!\n";
- sendRawPacket("%xt%z%zm%81%$x%$y%.");
- $setted[$x][$y] = 1;
- if(!waitPack("xt%zm%81%1%")) {
- $isplayin = false;
- echo "*** Must restart ***\n";
- for($ix = 0; $ix <= 6; $ix++) {
- for($iy = 0; $iy <= 5; $iy++) {
- $setted[$ix][$iy] = 0;
- }
- }
- sendRawPacket("%xt%s%u#sp%23%344%410%.");
- sleep(1);
- sendRawPacket("%xt%s%u#sp%23%310%397%.");
- sendRawPacket("%xt%s%a#jt%23%206%.");
- sendRawPacket("%xt%z%gz%81%.");
- sendRawPacket("%xt%z%jz%81%.");
- waitPack("xt%uz%81%1%");
- $nm = stribet($rawPack, "xt%uz%81%1%", "%");
- $isplayin = true;
- echo "Received Start Packet (Playing agains $nm)\n";
- }
- $xx = stribet($rawPack, "%xt%zm%81%1%", "%");
- $yy = stribet($rawPack, "%xt%zm%81%1%$x%", "%");
- echo "Player set to $xx, $yy;";
- $setted[$xx][$yy] = 2;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement