/** * Receive the selected server from client */ public static function packet_0xA0($data, $client) { $server = dechex($data[1] . $data[2]); UltimaPHP::$socketClients[$client]['connected_server'] = (int) $server - 1; UltimaPHP::log("Account " . UltimaPHP::$socketClients[$client]['account']->account . " connecting on server " . UltimaPHP::$servers[UltimaPHP::$socketClients[$client]['connected_server']]['name']); UltimaPHP::$socketClients[$client]['account']->sendConnectionConfirmation(); }
/** * Disconnect account from server * * Reasons: * 0 - Incorrect namae/password. * 1 - Someone is already using this account. * 2 - Your account has been blocked. * 3 - Your account credentials are invalid. * 4 - Communication problem. [DEFAULT] * 5 - The IGR concurrency limit has been met. * 6 - The IGR time limit has been met. * 7 - General IGR authentication failure. */ public function disconnect($reason = 4) { $packet = chr(130) . chr(hexdec($reason)); UltimaPHP::log("Client " . UltimaPHP::$socketClients[$this->client]['ip'] . " disconnected from the server"); Sockets::out($this->client, $packet, false, true, true); }
/** * Register an $event to run in $client after $time seconds. * */ public static function addEvent($client, $event, $time, $runInLot = false, $dispatchLot = false) { $mt = microtime(true); if (!is_array($event)) { UltimaPHP::log("Unknow event was send to the server.", UltimaPHP::LOG_WARNING); return false; } else { UltimaPHP::$socketEvents[$mt][] = array('event' => $event, 'client' => $client, 'time' => $mt + $time, 'lot' => array($runInLot, $dispatchLot)); return true; } }