Esempio n. 1
0
 function logout($userId)
 {
     $msg = new CMessage();
     $msg->setName("LO");
     $msg->serialUint32($userId);
     return parent::sendMessage($msg);
 }
 function createScenario($sessionId, $callbackClient)
 {
     $msg = new CMessage();
     $msg->setName("CSC");
     $msg->serialUint32($sessionId);
     $callbackClient->sendMessage($msg);
 }
Esempio n. 3
0
 function login($userId, $ipAddress, $callbackClient)
 {
     $msg = new CMessage();
     $msg->setName("LG");
     $msg->serialUint32($userId);
     $msg->serialUint32($ipAddress);
     $callbackClient->sendMessage($msg);
 }
Esempio n. 4
0
 function notifyForumMessage($guildId, $forumId)
 {
     $msg = new CMessage();
     $msg->setName("MFS_NFM");
     $msg->serialUint32($guildId);
     $msg->serialUint32($forumId);
     return parent::sendMessage($msg);
 }
Esempio n. 5
0
 function waitMessage()
 {
     if (!$this->ConSock) {
         debug(sprintf("Socket is not valid\n"));
         return false;
     }
     $size = 0;
     $val = fread($this->ConSock, 1);
     $info = stream_get_meta_data($this->ConSock);
     if ($info['timed_out']) {
         debug('Connection timed out!');
         return false;
     }
     $size = ord($val) << 24;
     $val = fread($this->ConSock, 1);
     $info = stream_get_meta_data($this->ConSock);
     if ($info['timed_out']) {
         debug('Connection timed out!');
         return false;
     }
     $size = ord($val) << 16;
     $val = fread($this->ConSock, 1);
     $info = stream_get_meta_data($this->ConSock);
     if ($info['timed_out']) {
         debug('Connection timed out!');
         return false;
     }
     $size += ord($val) << 8;
     $val = fread($this->ConSock, 1);
     $info = stream_get_meta_data($this->ConSock);
     if ($info['timed_out']) {
         debug('Connection timed out!');
         return false;
     }
     $size += ord($val);
     debug(sprintf("receive packet size '%d'<br>\n", $size));
     $fake = fread($this->ConSock, 5);
     $info = stream_get_meta_data($this->ConSock);
     if ($info['timed_out']) {
         debug('Connection timed out!');
         return false;
     }
     $size -= 5;
     // remove the fake
     $Buffer = "";
     while ($size > 0 && strlen($Buffer) != $size) {
         $Buffer .= fread($this->ConSock, $size - strlen($Buffer));
         $info = stream_get_meta_data($this->ConSock);
         if ($info['timed_out']) {
             debug('Connection timed out!');
             return false;
         }
     }
     $msgin = new CMemStream();
     $msgin->setBuffer($Buffer);
     // decode msg name
     $msgin->serialString($name);
     debug(sprintf("Message name = '%s'<BR>", $name));
     $message = new CMessage();
     $message->setBuffer(substr($msgin->Buffer, $msgin->Pos));
     $message->setName($name);
     debug(sprintf("In message name = '%s'<br>", $message->MsgName));
     return $message;
 }
 function forwardToDss($charId, $msg)
 {
     $msg = new CMessage();
     $msg->setName("DSS_FW");
     $msg->serialUint32($charId);
     $msg->serialUint32($msg);
     return parent::sendMessage($msg);
 }
Esempio n. 7
0
 function getHighRezGraph($varAddr, $startDate, $endDate, $milliStep)
 {
     $msg = new CMessage();
     $msg->setName("GHRG");
     $msg->serialString($varAddr);
     $msg->serialUint32($startDate);
     $msg->serialUint32($endDate);
     $msg->serialUint32($milliStep);
     $ret = "";
     $ret = parent::sendMessage($msg);
     if ($ret == false) {
         // error during send
         $this->invokeError("getHighRezGraph", "Error in 'sendMessage'");
         return false;
     }
     $retMsg = parent::waitMessage();
     if ($ret == false) {
         // error during send
         $this->invokeError("getHighRezGraph", "Error in 'waitMessage'");
         return false;
     }
     if (!($retMsg->MsgName === "R_GHRG")) {
         // error during send
         $this->invokeError("getHighRezGraph", "Invalid response, awaited 'R_GHRG', received '" . $retMsg->MsgName . "'");
         return false;
     }
     // serial the return value
     $nbElem = 0;
     $retMsg->serialUInt32($nbElem);
     $retValue = array();
     for ($i = 0; $i < $nbElem; $i++) {
         $retMsg->serialString($item);
         $retValue[] = $item;
     }
     // return the return value
     return $retValue;
 }