Ejemplo n.º 1
0
<?php

spl_autoload_register(function ($strClass) {
    require_once sprintf('Penguin/%s.php', $strClass);
});
$objPenguin = new Penguin();
// Proxy settings
//$objPenguin->setProxy("127.0.0.1", 9050);
try {
    $objPenguin->login('Username', 'Password');
    $objPenguin->joinServer('Sled');
} catch (ConnectionException $objException) {
    die;
}
$objPenguin->joinRoom(100);
while (true) {
    $strData = $objPenguin->recv();
    if (XTParser::IsValid($strData)) {
        echo $strData, chr(10);
    }
}
Ejemplo n.º 2
0
    $username = $_POST["username"];
    $password = $_POST["password"];
    spl_autoload_register(function ($strClass) {
        require_once sprintf('Penguin/%s.php', $strClass);
    });
    $objPenguin = new Penguin();
    global $itemid;
    $objPenguin->addListener("jr", function ($packet) use($objPenguin) {
        $objPenguin->addItem($_POST["itemid"]);
    });
    $objPenguin->addListener("ai", function ($packet) {
        echo "Successfully added item ", "\n";
        die;
    });
    $objPenguin->addListener("e", function ($packet) use($objPenguin) {
        die($objPenguin->arrErrors[$packet[3]]["Description"]);
    });
    try {
        $objPenguin->login($username, $password);
        $objPenguin->joinServer('Sled');
    } catch (ConnectionException $objException) {
        die;
    }
    $objPenguin->joinRoom(805);
    while (true) {
        $strData = $objPenguin->recv();
        if (XTParser::IsValid($strData)) {
            // echo $strData, chr(10);
        }
    }
}
Ejemplo n.º 3
0
        $objPenguin->arrRoom[$intPlayer]->setX($intX);
        $objPenguin->arrRoom[$intPlayer]->setY($intY);
    }
    if ($intPlayer == $mixTarget) {
        $objPenguin->sendPosition($intX, $intY);
    }
});
$objPenguin->addListener('pbn', function ($arrPacket) use(&$mixTarget) {
    $mixTarget = $arrPacket[4];
});
$objPenguin->addListener('bf', function ($arrPacket) use($objPenguin) {
    $intRoom = $arrPacket[3];
    if ($intRoom == -1) {
        echo 'Target is offline', chr(10), die;
    }
    $objPenguin->joinRoom($intRoom);
});
$objPenguin->addListener('rp', function ($arrPacket) use($objPenguin, &$mixTarget) {
    $intPlayer = $arrPacket[3];
    unset($objPenguin->arrRoom[$intPlayer]);
    if ($intPlayer == $mixTarget) {
        $objPenguin->findBuddy($mixTarget);
    }
});
try {
    $objPenguin->login('Username', 'Password');
    $objPenguin->joinServer('Sleet');
} catch (ConnectionException $objException) {
    die;
}
if (!is_numeric($mixTarget)) {