Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 60.84 KB | None | 0 0
  1. <?php
  2. set_time_limit( 0 ); // Tempo maximo de execucao
  3. error_reporting( 0 ); // Nao mostrar erros
  4.  
  5. class zBot
  6. {
  7. /* Sample config */
  8. public $ixatlink = "http://linkixat"; // Link do iXat
  9. public $usuario = "login"; // Usuario BOT
  10. public $senha = "password"; // Senha admin123
  11. public $sala = "lobby"; // Sala [Nome]
  12. /* Lembre-se que a conta do BOT precisa ter everypower! */
  13. public $nome = "Bot"; // Nome do BOT
  14. public $hat = "(hat#xB#g)"; // Hat do BOT
  15. public $glow = "(glow#000222#FF0000)"; // Glow do BOT
  16. public $status = "Bot Helper"; // Status do BOT
  17. public $statusglow = "000222#ff0000"; // Statusglow do BOT
  18. public $statuscolor = "000222#ff0000"; // Statuscolor do BOT
  19. public $textcolor = "(text#ea3422#ffffff)"; // Statuscolor do BOT
  20. public $avatar = "(BOT)"; // Avatar do BOT
  21. public $home = "http://linkixat"; // Homepage[casinha] do BOT
  22. public $maxKicks = 4; //Number of kicks before ban
  23. public $admins = Array( 1,10000 ); // IDs com acesso exemplo Array(42,100,96218942); etc...
  24. public $semacesso = "You dont allowed use commands!"; // Mensagem sem acesso..
  25. public $autoWelcome = "Bem Vindo ao nomedoxat (hug#c)!"; // Mensagem de welcome para os usuarios
  26. public $automember = True; // True = ativado, False = desativado
  27. public $autoguest = False; // True = ativado, False = desativado
  28. public $censor = array("fuck","bitch","motherfucker","penis","pussy");
  29. public $censor2 = array("test","hehe","hey","hi");
  30. public $spam = "5";
  31. public $flood = "3";
  32. /* Extra */
  33. public $usuarios;
  34. public $logado;
  35. public $socket;
  36. public $chatID;
  37. public $botID;
  38. public $porta;
  39. public $ip;
  40. public $k;
  41.  
  42. /* Funcao de conectar com o ixat */
  43. public function conectar( )
  44. {
  45. $this->pegarInfos();
  46. $this->socket = socket_create( AF_INET, SOCK_STREAM, SOL_TCP );
  47. $test = socket_connect( $this->socket, $this->ip, $this->porta );
  48. echo "--> Connecting {$this->ip}:{$this->porta}...\n";
  49. If ( !$test ) {
  50. die( "<-- Failed Connection!\n" );
  51. } //!$test
  52. }
  53.  
  54. /* Funcao de desconetar [usado para debug] */
  55. public function desconectar( )
  56. {
  57. If ( isset( $this->socket ) && $this->socket == True )
  58. socket_close( $this->socket );
  59. $this->socket = False;
  60. }
  61.  
  62. /* Funcao de pegar informacoes sobre o usuario bot... */
  63. function pegarInfos( )
  64. {
  65. $curl = curl_init( $this->ixatlink . "/mobile?" . time() );
  66. curl_setopt( $curl, CURLOPT_RETURNTRANSFER, True );
  67. curl_setopt( $curl, CURLOPT_POST, True );
  68. curl_setopt( $curl, CURLOPT_POSTFIELDS, "username={$this->usuario}&password={$this->senha}&room={$this->sala}" );
  69. $url = curl_exec( $curl );
  70. $parte1 = explode( "\"id\":\"", $url );
  71. $id = explode( "\"", $parte1[ 1 ] );
  72. $this->botID = $id[ 0 ];
  73. $parte2 = explode( "\"k\":\"", $url );
  74. $k = explode( "\"", $parte2[ 1 ] );
  75. $this->k = $k[ 0 ];
  76. $parte3 = explode( "'<y r=\"", $url );
  77. $sala_data = explode('c="', $url);
  78. $salaID = explode('"', $sala_data[1]);
  79. $this->chatID = $salaID[0];
  80. $parte4 = explode( "WebSocket('ws://", $url );
  81. $ip = explode( ":", $parte4[ 1 ] );
  82. $this->ip = $ip[ 0 ];
  83. $dx_data = explode("\"xats\":\"", $url);
  84. $dx = explode("\"", $dx_data[1]);
  85. $this->dx = $dx[0];
  86. $d1_data = explode("\"days\":\"", $url);
  87. $d1 = explode("\"", $d1_data[1]);
  88. $this->d1 = $d1[0];
  89. $d4_data = explode('"p4":', $url);
  90. $d4 = explode(',"', $d4_data[1]);
  91. $this->d4 = $d4[0];
  92. $d5_data = explode('"p5":', $url);
  93. $d5 = explode(',"', $d5_data[1]);
  94. $this->d5 = $d5[0];
  95. $d6_data = explode('"p6":', $url);
  96. $d6 = explode(',"', $d6_data[1]);
  97. $this->d6 = $d6[0];
  98. $d7_data = explode('"p7":', $url);
  99. $d7 = explode(',"', $d7_data[1]);
  100. $this->d7 = $d7[0];
  101. $d8_data = explode('"p8":', $url);
  102. $d8 = explode(',"', $d8_data[1]);
  103. $this->d8 = $d8[0];
  104. $d9_data = explode('"p9":', $url);
  105. $d9 = explode(',"', $d9_data[1]);
  106. $this->d9 = $d9[0];
  107. $d10_data = explode('"p10":', $url);
  108. $d10 = explode(',"', $d10_data[1]);
  109. $this->d10 = $d10[0];
  110. $d11_data = explode('"p11":', $url);
  111. $d11 = explode(',"', $d11_data[1]);
  112. $this->d11 = $d11[0];
  113. $d12_data = explode('"p12":', $url);
  114. $d12 = explode(',"', $d12_data[1]);
  115. $this->d12 = $d12[0];
  116. $d13_data = explode('"p13":', $url);
  117. $d13 = explode(',"', $d13_data[1]);
  118. $this->d13 = $d13[0];
  119. $d14_data = explode('p14":', $url);
  120. $d14 = explode(',"', $d14_data[1]);
  121. $this->d14 = $d14[0];
  122. $d15_data = explode('p15":', $url);
  123. $d15 = explode('}', $d15_data[1]);
  124. $this->d15 = $d15[0];
  125. $parte5 = explode( $this->ip . ":", $url );
  126. $porta = explode( "/", $parte5[ 1 ] );
  127. $this->porta = $porta[ 0 ];
  128. If ( empty( $url ) ) {
  129. die( "<-- Falha na conexao, ou o site pode estar offlne!!\n" );
  130. } //empty( $url )
  131. If ( empty( $this->botID ) ) {
  132. die( "<-- O chat nao existe, ou os dados estao incorretos!\n" );
  133. } //empty( $this->botID )
  134. }
  135.  
  136. /* Passar codigo XML para pegar B1 e B2 */
  137. public function passarXML( $xml, $retornar = null )
  138. {
  139. $conteudo = @simplexml_load_string( trim( $xml ) );
  140. Foreach ( $conteudo->Attributes() as $i => $u )
  141. $retornar[ $i ] = (string) ( (string) $u );
  142. return $retornar;
  143. }
  144.  
  145. /* Enviar packets obvio ._. */
  146. public function enviar( $packet )
  147. {
  148. If ( $packet[ strlen( $packet ) - 1 ] != chr( 0 ) )
  149. $packet .= chr( 0 );
  150. echo "[BOT]-> {$packet}\n";
  151. return socket_write( $this->socket, $packet, strlen( $packet ) );
  152. }
  153.  
  154. /* Entrar no ixat grupo */
  155. public function entrar( )
  156. {
  157. $this->conectar();
  158. $this->enviar( "<y r=\"{$this->chatID}\" />" );
  159. $x = $this->passarXML(socket_read($this->socket, 10090));
  160. $b1 = floor(2 << ($x["yi"] % 94)) % $x["yc"] + $x["yi"];
  161. $b2 = floor(pow(2, $x["ys"] % 27));
  162. $j2 = "cb=\"0\" ";
  163. $j2 .= "auth1=\"{$b1}\" ";
  164. $j2 .= "auth2=\"{$b2}\" ";
  165. $j2 .= "y=\"{$x[ 'yi' ]}\" ";
  166. $j2 .= "k=\"{$this->k}\" ";
  167. $j2 .= "k3=\"0\" ";
  168. $j2 .= "d1=\"{$this->d1}\" ";
  169. $j2 .= "p=\"0\" ";
  170. $j2 .= "c=\"{$this->chatID}\" ";
  171. $j2 .= "f=\"8192\" ";
  172. $j2 .= "u=\"{$this->botID}\" ";
  173. $j2 .= "m6=\"131072\" ";
  174. $j2 .= "d0=\"0\" ";
  175. $j2 .= "d2=\"0\" ";
  176. $j2 .= "d4=\"{$this->d4}\" ";
  177. $j2 .= "d5=\"{$this->d5}\" ";
  178. $j2 .= "d6=\"{$this->d6}\" ";
  179. $j2 .= "d7=\"{$this->d7}\" ";
  180. $j2 .= "d8=\"{$this->d8}\" ";
  181. $j2 .= "d9=\"{$this->d9}\" ";
  182. $j2 .= "d10=\"{$this->d10}\" ";
  183. $j2 .= "d11=\"{$this->d11}\" ";
  184. $j2 .= "d12=\"{$this->d12}\" ";
  185. $j2 .= "d13=\"{$this->d13}\" ";
  186. $j2 .= "d14=\"{$this->d14}\" ";
  187. $j2 .= "d15=\"{$this->d15}\" ";
  188. $j2 .= "N=\"{$this->usuario}\" ";
  189. $j2 .= "n=\"{$this->nome}{$this->hat}{$this->glow}##{$this->status}#{$this->statusglow}#{$this->statuscolor}\" ";
  190. $j2 .= "a=\"{$this->avatar}\" ";
  191. $j2 .= "h=\"{$this->home}\" ";
  192. $j2 .= "v=\"0\"";
  193. $j2 = "<j2 {$j2} />";
  194. $this->enviar( $j2 );
  195. }
  196.  
  197. /* Carregar packets */
  198. public function carregar( $verIfi = True, $teste_var = True )
  199. {
  200. $x = "";
  201. try {
  202. $x = rtrim( socket_read( $this->socket, 2048 ) );
  203. $x = str_replace( "", "", $x );
  204. }
  205. catch ( Exception $e ) {
  206. return "DESLIGADO";
  207. }
  208. If ( !$x )
  209. return "DESLIGADO";
  210. If ( $x[ strlen( $x ) - 1 ] != ">" )
  211. $x .= $this->carregar( True );
  212. If ( $verIfi )
  213. $this->packets( $x, $teste_var );
  214. return $x;
  215. }
  216.  
  217. /* Mostrar packets e etc... */
  218. public function packets( $packet, $teste = True, $teste2 = False )
  219. {
  220. If ( substr_count( $packet, ">" ) > 1 ) {
  221. $packet = explode( "/>", $packet );
  222. $teste2 = True;
  223. } //substr_count( $packet, ">" ) > 1
  224. Foreach ( (Array) $packet as $p ) {
  225. If ( $teste2 )
  226. $p .= "/>";
  227. $p = trim( $p );
  228. If ( strlen( $p ) < 5 )
  229. return;
  230. echo "[IXAT]-> {$p}\n";
  231. $tipo = trim( strtolower( substr( $p, 1, strpos( $p . " ", " " ) ) ) );
  232. $p = trim( str_replace( "<" . $tipo, "", str_replace( "/>", "", $p ) ) );
  233. $p = str_replace( "\"", "", str_replace( "\" ", "&", str_replace( "&", "__38", $p ) ) );
  234. parse_str( $p, $this->packet[ $tipo ] );
  235. Foreach ( $this->packet[ $tipo ] as $x => $v )
  236. $this->packet[ $tipo ][ $x ] = str_replace( "__38", "&", str_replace( "pl_", "+", $v ) );
  237. If ( $teste )
  238. $this->tipos( $tipo, $this->packet[ $tipo ] );
  239. } //(Array) $packet as $p
  240. }
  241.  
  242. /* Algums tipos de packets e comandos podem ser adicionado aqui! */
  243. public function tipos( $tipo, $packet )
  244. {
  245. switch ( $tipo ) {
  246. /* Packets */
  247. case 'u':
  248. $u = $this->fetchUser($packet['u']);
  249. $this->users[$packet['u']]['cb'] = @$packet['cb'];
  250. $this->users[$packet['u']]['s'] = @$packet['s'];
  251. $this->users[$packet['u']]['f'] = (isset($packet['f'])) ? (int)$packet['f'] : 0;
  252. $this->users[$packet['u']]['id'] = $packet['u'];
  253. $this->users[$packet['u']]['d0'] = (isset($packet['d0'])) ? (int)$packet['d0'] : 0;
  254. $this->users[$packet['u']]['d2'] = (isset($packet['d2'])) ? @$packet['d2'] : 0;
  255. $this->users[$packet['u']]['q'] = (isset($packet['q'])) ? (int)$packet['q'] : 0;
  256. $this->users[$packet['u']]['registered'] = ((key_exists('N',$packet))?$packet['N']:'Unregistered');
  257. //$this->users[$packet['u']]['name'] = (substr(@$packet['n'],0,1)=="$") ? substr(@$packet['n'],0,1) : $packet['n'];
  258. $this->users[$packet['u']]['name'] = @$packet['n'];
  259. $this->users[$packet['u']]['avatar'] = (isset($packet['a'])) ? @$packet['a'] : 'No Avatar';
  260. $this->users[$packet['u']]['home'] = (isset($packet['h'])) ? @$packet['h'] : 'No Homepage';
  261. $this->users[$packet['u']]['v'] = (@$packet['v']) ? @$packet['v'] : 0;
  262. $this->users[$packet['u']]['bride'] = (isset($packet['d2'])) ? @$packet['d2'] : 0;
  263. $this->users[$packet['u']]['rel'] = (@$packet['d0'] & 1) ? 1 : 2;//Relationship Type: 1=BFF 2=Married #note that if they not in a relationship it will show there Married this can be fixed by detecting if they have a bride [D2]
  264. $this->users[$packet['u']]['sub'] = (isset($packet['p0'])) ? 1 : 0;
  265. if($this->autoWelcome!=''&&!isset($packet['s']))$this->sendPM($packet['u'], $this->autoWelcome);
  266.  
  267. if($packet['rank'] == 5)
  268. {
  269. if($this->automember){
  270. $this->member($packet['u']);
  271. }
  272. }
  273. if($packet['rank'] == 3)
  274. {
  275. if($this->autoguest){
  276. $this->guest($packet['u']);
  277. }
  278. }
  279. break;
  280.  
  281.  
  282.  
  283. case "z":
  284. $this->enviarMSG( "Don't click me :( !", "PM", $packet[ "u" ] );
  285. break;
  286. case'i':
  287. $info = explode(';=', $this->packet['i']['b']);
  288. $this->radioinfo = str_replace("http://", "", $info[4]);
  289. $ci = explode(';=', $packet['b']);
  290. $this->chatInfo = array('background'=>$ci[0], 'tabbedChat'=>$ci[1],'tabbedChatID'=>$ci[2],'language'=>$ci[3],'radio'=>str_replace('http://','',$ci[4]),'buttons'=>$ci[5]);
  291. print_r($this->chatInfo);
  292. break;
  293.  
  294. case "m": // Mensagem
  295. if(isset($this->packet['m']['s'])) return;
  296. if(($this->packet['m']['t']) =='oi bot') {
  297.  
  298. $user = $this->users[ $packet[ "u" ] ];
  299. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  300. $this->enviarMSG ('oi (hug) ['.$usuario.'] como vai?');
  301. }
  302. if(($this->packet['m']['t']) =='bot gay') {
  303.  
  304. $user = $this->users[ $packet[ "u" ] ];
  305. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  306. $this->enviarMSG ('gay e seu pai (un)['.$usuario.'] ');
  307. }
  308.  
  309. if(($this->packet['m']['t']) =='me ajuda?') {
  310.  
  311. $user = $this->users[ $packet[ "u" ] ];
  312. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  313. $this->enviarMSG ('problemas ?? (what) ['.$usuario.'] ');
  314. }
  315. if(($this->packet['m']['t']) =='me da xats') {
  316.  
  317. $user = $this->users[ $packet[ "u" ] ];
  318. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  319. $this->enviarMSG ('Sem pedir ['.$usuario.'] ');
  320. }
  321. if(($this->packet['m']['t']) =='xd') {
  322.  
  323. $user = $this->users[ $packet[ "u" ] ];
  324. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  325. $this->enviarMSG ('(xd) ['.$usuario.'] ');
  326. }
  327. if(($this->packet['m']['t']) =='everypower') {
  328.  
  329. $user = $this->users[ $packet[ "u" ] ];
  330. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  331. $this->enviarMSG ('sem pedir ['.$usuario.'] ');
  332. }
  333. if(($this->packet['m']['t']) =='bot como vai voce?') {
  334.  
  335. $user = $this->users[ $packet[ "u" ] ];
  336. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  337. $this->enviarMSG ('Eu vou muito bem! (jolly) ['.$usuario.'] ');
  338. }
  339. if(($this->packet['m']['t']) =='bot') {
  340.  
  341. $user = $this->users[ $packet[ "u" ] ];
  342. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  343. $this->enviarMSG ('Sim ? (what)['.$usuario.'] ');
  344. }
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352. case "p":
  353. if(isset($packet["i"]) && $packet["i"] > 0)
  354. if(substr($packet['t']) && ++$this->users[$packet['u']]['messages'] >= 1 && time() - $this->users[$packet['u']]['time'] < 1)
  355. {
  356. $this->enviarMSG("Flood");
  357. }
  358.  
  359. $caps = $packet['t'];
  360. if(ereg("^([A-Z]+)$", $caps[6])) {
  361. $this->kick('Caps Lock', $packet['u']);
  362. }
  363. if(preg_match('/(.)\1{' . ($this->spam - 1) . ',}/', strtolower($packet['t'])) != 0)
  364. {
  365. $this->kick('Spam Detectado', $packet['u']);
  366. }
  367.  
  368. if($this->censor($packet['t'])) {
  369. //$this->send('<c p="Esta palavra não é permitido aqui.(d)" u="'.$packet['u'].'" t="/k" />');
  370. $this->kick('This word is not allowed here.(d)',$packet['u']);
  371. }
  372. If ( isset( $packet[ "i" ] ) && $packet[ "i" ] > 0 )
  373. break;
  374.  
  375. $msg = $mensagem = explode( " ", $packet[ "t" ] );
  376. unset( $msg[ 0 ] );
  377. $msg = implode( " ", $msg );
  378. If ( isset( $mensagem[ 0 ] ) && $mensagem[ 0 ][ 0 ] != "!" )
  379. break;
  380. $user = $this->usuarios[ $packet[ "u" ] ];
  381. $usuario = ( $user[ "N" ] ) ? $user[ "N" ] : $user[ "u" ];
  382. switch ( substr( $mensagem[ 0 ], 1 ) ) {
  383. /* Comandos para todos */
  384. case "say":
  385. // !say [msg]
  386. $user = $this->users[ $packet[ "u" ] ];
  387. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  388. $this->enviarMSG ('['.$usuario.'] '.$msg);
  389. break;
  390.  
  391. case "test":
  392. // !say [msg]
  393. $user = $this->users[ $packet[ "u" ] ];
  394. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  395. $this->enviarMSG ('('.$msg.') ');
  396. break;
  397.  
  398.  
  399. case "sayadm":
  400. if ( !in_array( $packet[ 'u' ], $this->admins ) )
  401. {
  402. return $this->enviarMSG($this->withoutaccess, "PM", $packet['u']);
  403. }
  404.  
  405. $this->enviarMSG($msg);
  406. break;
  407.  
  408.  
  409.  
  410.  
  411. case "info":
  412. // !info
  413. $this->enviarMSG( "Zbot Criado por IZerang Editado por Smoke", "PM", $packet[ "u" ] );
  414. break;
  415.  
  416.  
  417. case'smiles':
  418. mysql_connect('localhost','root','');
  419. mysql_select_db('pulse') or $this->sendMesage('Can\'t connect.');
  420. $message = explode(' ', $mensagem[1], 1);
  421. $power = $message[0];
  422. $db = mysql_query("SELECT * FROM `powers` WHERE name='$power'");
  423. $row = mysql_fetch_array($db);
  424. if(!$row['name']) {$this->enviarMSG('Power not found! (d)');}
  425. else {
  426. $powers = str_replace(',',' | ',$row['topsh']);
  427. if(empty($row['topsh'])) {$this->enviarMSG(ucfirst($power).' has only ('.$power.') as smilies.');}
  428. else {
  429. $this->enviarMSG('('.$power.'#) Smilies : '.$powers);}}
  430. break;
  431.  
  432. case'dunceme':
  433. $message = explode(' ', $mensagem[1], 1);
  434. $users = $message[0];
  435. if(empty($users)) $users = $packet['u'];
  436. $this->enviar('<c p="You have been dunced by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are undunced." u="'. $packet['u'] .'" t="/gd3600" />');
  437.  
  438. case'undunceme':
  439. $message = explode(' ', $mensagem[1], 1);
  440. $users = $message[0];
  441. if(empty($users)) $users = $packet['u'];
  442. $this->enviar('<c p="You have been yellow by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are undunce." u="'. $packet['u'] .'" t="/gd3600" />');
  443.  
  444. break;
  445. case'snakeme':
  446. $message = explode(' ', $mensagem[1], 1);
  447. $users = $message[0];
  448. if(empty($users)) $users = $packet['u'];
  449. $this->enviar('<c w="134" p="You have been snaked by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unsnaked." u="'. $packet['u'] .'" t="/g3600" />');
  450.  
  451. break;
  452. case'spaceme':
  453. $message = explode(' ', $mensagem[1], 1);
  454. $users = $message[0];
  455. if(empty($users)) $users = $packet['u'];
  456. $this->enviar('<c w="136" p="You have been spaced by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unspaced." u="'. $packet['u'] .'" t="/g3600" />');
  457.  
  458. break;
  459. case'matchme':
  460. $message = explode(' ', $mensagem[1], 1);
  461. $users = $message[0];
  462. if(empty($users)) $users = $packet['u'];
  463. $this->enviar('<c w="140" p="You have been match by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unmatch." u="'. $packet['u'] .'" t="/g3600" />');
  464.  
  465. break;
  466. case'mazeme':
  467. $message = explode(' ', $mensagem[1], 1);
  468. $users = $message[0];
  469. if(empty($users)) $users = $packet['u'];
  470. $this->enviar('<c w="152" p="You have been mazed by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unmazed." u="'. $packet['u'] .'" t="/g3600" />');
  471.  
  472. break;
  473. case'codeme':
  474. $message = explode(' ', $mensagem[1], 1);
  475. $users = $message[0];
  476. if(empty($users)) $users = $packet['u'];
  477. $this->enviar('<c w="162" p="You have been coded by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are uncoded." u="'. $packet['u'] .'" t="/g3600" />');
  478.  
  479. break;
  480. case'reverseme':
  481. $message = explode(' ', $mensagem[1], 1);
  482. $users = $message[0];
  483. if(empty($users)) $users = $packet['u'];
  484. $this->enviar('<c w="176" p="You have been reverse by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unreversed." u="'. $packet['u'] .'" t="/g3600" />');
  485.  
  486. break;
  487. case'zipme':
  488. $message = explode(' ', $mensagem[1], 1);
  489. $users = $message[0];
  490. if(empty($users)) $users = $packet['u'];
  491. $this->enviar('<c w="184" p="You have been zip by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unzip." u="'. $packet['u'] .'" t="/g3600" />');
  492.  
  493. break;
  494. case'soltme':
  495. $message = explode(' ', $mensagem[1], 1);
  496. $users = $message[0];
  497. if(empty($users)) $users = $packet['u'];
  498. $this->enviar('<c w="236" p="You have been solt by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unsolt." u="'. $packet['u'] .'" t="/g3600" />');
  499.  
  500. break;
  501.  
  502. case'zapme':
  503. $message = explode(' ', $mensagem[1], 1);
  504. $users = $message[0];
  505. if(empty($users)) $users = $packet['u'];
  506. $this->enviar('<c w="121" p="You have been zapped by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unzapped. #screamman#bump" u="'. $packet['u'] .'" t="/k" />');
  507.  
  508. break;
  509. case'gagme':
  510. $message = explode(' ', $mensagem[1], 1);
  511. $users = $message[0];
  512. if(empty($users)) $users = $packet['u'];
  513. $this->enviar('<c w="41" p="You have been gagged by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are ungagged." u="'. $packet['u'] .'" t="/gg3600" />');
  514.  
  515. break;
  516. case'naughtyme':
  517. $message = explode(' ', $mensagem[1], 1);
  518. $users = $message[0];
  519. if(empty($users)) $users = $packet['u'];
  520. $this->enviar('<c p="You have been naughty by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unnaughty." u="'. $packet['u'] .'" t="/gn3600" />');
  521.  
  522. break;
  523. case'yellowme':
  524. $message = explode(' ', $mensagem[1], 1);
  525. $users = $message[0];
  526. if(empty($users)) $users = $packet['u'];
  527. $this->enviar('<c p="You have been yellow by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unyellow." u="'. $packet['u'] .'" t="/gy3600" />');
  528.  
  529. break;
  530.  
  531. case'modme':
  532. $message = explode(' ', $message[1], 1);
  533. $users = $message[0];
  534. if ( !in_array( $packet[ 'u' ], $this->admins ) )
  535. {
  536. return $this->sendmsg($this->withoutaccess, "PM", $packet['u']);
  537. }
  538. $this->enviar('<c p="voce que pediu ['.$this->users[$packet['u']]['registered'].'] " u="'.$packet['u'].'" t="/m" />');
  539. break;
  540.  
  541. case'ownerme':
  542. $message = explode(' ', $message[1], 1);
  543. $users = $message[0];
  544. if ( !in_array( $packet[ 'u' ], $this->admins ) )
  545. {
  546. return $this->sendmsg($this->withoutaccess, "PM", $packet['u']);
  547. }
  548. $this->enviar('<c p="voce que pediu ['.$this->users[$packet['u']]['registered'].'] " u="'.$packet['u'].'" t="/M" />');
  549. break;
  550.  
  551. case'gagme':
  552. $message = explode(' ', $mensagem[1], 1);
  553. $users = $message[0];
  554. if(empty($users)) $users = $packet['u'];
  555. $this->enviar('<c p="You have been gagged by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are gagged." u="'. $packet['u'] .'" t="/gg" />');
  556.  
  557. case'kickme':
  558. $message = explode(' ', $mensagem[1], 1);
  559. $users = $message[0];
  560. if(empty($users)) $users = $packet['u'];
  561. $this->enviar('<c p="You have been kicked by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unkick." u="'. $packet['u'] .'" t="/k" />');
  562.  
  563. case'banme':
  564. $message = explode(' ', $mensagem[1], 1);
  565. $users = $message[0];
  566. if(empty($users)) $users = $packet['u'];
  567. $this->enviar('<c p="You have been Banned by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unbanned." u="'. $packet['u'] .'" t="/g" />');
  568.  
  569. case'muteme':
  570. $message = explode(' ', $mensagem[1], 1);
  571. $users = $message[0];
  572. if(empty($users)) $users = $packet['u'];
  573. $this->enviar('<c p="You have been Muted by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are unmute." u="'. $packet['u'] .'" t="/gm" />');
  574.  
  575.  
  576.  
  577.  
  578. case 'radio':
  579. $connection = explode(':', $this->radioinfo);
  580. $url = fsockopen($connection[0],$connection[1]);
  581. if($this->radioinfo == 'semnome' or !$this->radioinfo){$this->enviarMSG("This group chat does not have a radio."); return false;}
  582. if(!$url){
  583. $this->sendmsg("Connection failed."); return false;
  584. } else {
  585. fputs($url,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n");
  586. $socket = fread($url, 1000);
  587. $return = explode(",", $socket);
  588. $final = str_replace("</body></html>", "", $return[6]);
  589. if(!$final){
  590. $this->enviarMSG("M?sica Atual: nameless."); return false;
  591. } else
  592. $this->enviarMSG("M?sica Atual: {$final}");
  593. }
  594. break;
  595.  
  596.  
  597.  
  598.  
  599. case 'id':
  600. $id = file_get_contents('http://xat.com/web_gear/chat/auser3.php');
  601. if(!$id) { return $this->enviarMSG('unable to connect!',($type==0)?1:$type,$packet['u']); }
  602. //$id = str_replace($id, '=', ' = ');
  603. $t = explode('&',$id);
  604. $id = array('id'=>$t[1], 'k1'=>$t[2], 'k2'=>$t[3]);
  605.  
  606. $link = 'http://xat.com/web_gear/chat/register.php?'.$id['id'].'&'.$id['k1'].'&'.$id['k2'].'&mode=1';
  607. $this->enviarMSG(implode(', ',$id),($type==0)?1:$type,$packet['u']);
  608. $this->enviarMSG($link,($type==0)?1:$type,$packet['u']);
  609.  
  610. break;
  611.  
  612. case 'youtube':
  613. case '11':
  614. $query = str_replace(' ', '%20', $msg);
  615. $x = file_get_contents('http://gdata.youtube.com/feeds/api/videos?max-results=3&q=' . str_replace(' ', '%20', urlencode($query)));
  616. $js = json_decode(json_encode(new SimpleXMLElement($x)));
  617. if (!isset($js->entry[0]->title))
  618. return $this->enviarMSG('No results from Youtube.', $type, $msg['u']);
  619. $videos = array();
  620. $i = 0;
  621. while ($i != 3) {
  622. $URL = get_object_vars($js->entry[$i]->link[0]);
  623. $link = explode('&', $URL['@attributes']->href);
  624. if (!empty($link[0]))
  625. $this->enviarMSG($js->entry[$i]->title . ' - ' . $link[0], $type, $msg['u']);
  626. $i++;
  627. sleep(3);
  628. }
  629. break;
  630. case'typing':
  631. switch(strtolower($mensagem[1])){
  632. case 'on':
  633. $this->enviar('/RTypeOn');
  634. break;
  635.  
  636. case 'off':
  637. $this->enviar('/RTypeOff');
  638. break;
  639. }
  640. break;
  641. case'price1':
  642. $message = explode(' ', $mensagem[1], 1);
  643. $powers = $message[0];
  644. mysql_connect('localhost','root','');
  645. mysql_select_db('pulse');
  646. if(is_numeric($powers)){
  647. $db = mysql_query("SELECT * FROM `powers` WHERE id ='$powers'");}
  648. else {$db = mysql_query("SELECT * FROM `powers` WHERE name ='$powers'");}
  649. $row = mysql_fetch_array($db);
  650. if($row['name'] == true) {
  651. if(empty($row['xats'])) {$row['xats'] = '0 - 0';}
  652. if(empty($row['days'])) {$row['days'] = '0 - 0';}
  653. $this->enviarMSG(htmlentities(ucfirst($row['name'])).' custos '.$row['xats'].' xats ou '.$row['days'].' days.');
  654. } else { $this->enviarMSG('Power not found.');}
  655. break;
  656.  
  657. case'rinfo':
  658. $this->enviarMSG('ID : '.$this->sala.' | Buttons : _'.$this->chatInfo['buttons'].' | Radio : '.$this->chatInfo['radio'].' | Background : '.$this->chatInfo['background']);
  659. break;
  660. case "cmd":
  661. // !info
  662. $this->enviarMSG( "!online , !say , !price , !love , !choose , !perg , !info ,
  663. mazeme,snakeme,!att", "PM", $packet[ "u" ] );
  664. break;
  665.  
  666. case 'online':
  667. $this->enviarMSG( $users . '' . 'There ' . count( $this->users ) . ' Users Online.' );
  668. break;
  669.  
  670. case "choose":
  671. // !choose [coisa] [coisa2]
  672. $mensagem = explode( ' ou ', strtolower( $msg ) );
  673. if ( !isset( $mensagem[ 0 ] ) || empty( $mensagem[ 1 ] ) || count( array_keys( $mensagem ) ) == 1 )
  674. return $this->enviarMSG( 'It takes two choice (D)', "PM", $packet[ 'u' ] );
  675. $mensagem = array_values( $mensagem );
  676. $rand = $mensagem[ array_rand( $mensagem ) ];
  677. $this->enviarMSG( 'I prefer ' . $rand, "PM", $packet[ 'u' ] );
  678. break;
  679.  
  680. case "perg":
  681. case "8ball":
  682. // !perg/!8ball [pergunta]
  683. $respostas = array(
  684. 'Maybe',
  685. 'Sim.',
  686. 'Do Not.',
  687. 'My sources said no.',
  688. 'Ah, SIM and SIM',
  689. 'In fact I do not know',
  690. 'Outlook does not provide \'-\'',
  691. 'I think not',
  692. 'Very good',
  693. 'It was determined that yes.'
  694. );
  695. $resposta = $respostas[ array_rand( $respostas ) ];
  696. $mensagens = array( );
  697. foreach ( $mensagens as $k => $valor ) {
  698. $valor2 = strtoupper( $valor );
  699. array_push( $mensagens, $valor2 );
  700. } //$mensagens as $k => $valor
  701. $this->enviarMSG( ' [' . $usuario . ']' . $resposta, "PM", $packet[ 'u' ] );
  702. break;
  703.  
  704. case 'lovetest':
  705. // !lovetest [alguma coisa] [alguma coisa2]
  706. $gerar = rand( 0, 100 );
  707. $this->enviarMSG( $mensagem[ 1 ] . ' + ' . $mensagem[ 2 ] . ' = ' . $gerar . '%' );
  708. break;
  709.  
  710. /* Comandos para admin */
  711. case "reiniciar":
  712. // !reiniciar
  713. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  714. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  715. } //!in_Array( $packet[ "u" ], $this->admins )
  716. $this->enviarMSG( "[Server]: I'm being restarted (backoff)" );
  717. $this->reiniciar();
  718. break;
  719.  
  720.  
  721. case'userinfo':
  722. $message = explode(' ', $mensagem[1], 1);
  723. $user = $message[0];
  724.  
  725. if(!$this->users[$user]['id']){ $this->enviarMSG('I Do not NOOB.');}
  726. else{
  727. if($this->users[$user]['rel'] == 2) $this->users[$user]['rel'] = "Married";
  728. if($this->users[$user]['rel'] == 1) $this->users[$user]['rel'] = "BFF";
  729. $myNick = explode("##", $this->users[$user]['name'], 2);
  730. $myNick[0] = htmlspecialchars(html_entity_decode(htmlspecialchars_decode($myNick[0])));
  731. $relation = $this->users[$user]['rel'].' to '.$this->users[$user]['d2'];
  732. if($relation == 'Married to 0') $relation = 'Relation not found.';
  733. $name = explode('##', $this->users[$user]['name']);
  734. $n = $name[1];
  735. $this->enviarMSG('Name : '.$myNick[0].' | Status : '.str_replace('#',' | ',$n).'| Avatar : '.$this->users[$user]['avatar'].' | Home : '.$this->users[$user]['home'].' | Relation : '.$relation);
  736. }
  737. break;
  738.  
  739. case "desligar":
  740. case "die":
  741. // !die
  742. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  743. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  744. } //!in_Array( $packet[ "u" ], $this->admins )
  745. $this->enviarMSG( "[Server]: I'm shutting down (bye)" );
  746. die( );
  747. break;
  748.  
  749. case 'automember':
  750. // !automember [on/off]
  751. if ( !in_array( $packet[ 'u' ], $this->admins ) )
  752. {
  753. return $this->enviarMSG( 'You do not have to use this command!', 'PM', $packet[ 'u' ] );
  754. } //!in_array( $packet[ 'u' ], $this->admins )
  755. switch ( $mensagem[ 1 ] )
  756. {
  757. case 'on':
  758. $this->automember = True;
  759. $this->enviarMSG( 'The automember system was activated!' );
  760. break;
  761.  
  762. case 'off':
  763. $this->automember = False;
  764. $this->enviarMSG( 'The automember system has been disabled!' );
  765. break;
  766.  
  767. default:
  768. $this->enviarMSG( 'You should choose an option [on / off].' );
  769. } //$mensagem[ 1 ]
  770. break;
  771. case 'autoguest':
  772. // !automember [on/off]
  773. if ( !in_array( $packet[ 'u' ], $this->admins ) )
  774. {
  775. return $this->enviarMSG( 'You do not have to use this command!', 'PM', $packet[ 'u' ] );
  776. } //!in_array( $packet[ 'u' ], $this->admins )
  777. switch ( $mensagem[ 1 ] )
  778. {
  779. case 'on':
  780. $this->autoguest = True;
  781. $this->enviarMSG( 'The autoguest system was activated!' );
  782. break;
  783.  
  784. case 'off':
  785. $this->autoguest = False;
  786. $this->enviarMSG( 'The autoguest system has been disabled!' );
  787. break;
  788.  
  789. default:
  790. $this->enviarMSG( 'You should choose an option [on / off].' );
  791. } //$mensagem[ 1 ]
  792. break;
  793.  
  794. case 'edit':
  795. // !edit name , status , glow , hat ,avatar
  796. if ( !in_array( $packet[ 'u' ], $this->admins ) )
  797. {
  798. return $this->enviarMSG( 'You do not have to use this command!', 'PM', $packet[ 'u' ] );
  799. } //!in_array( $packet[ 'u' ], $this->admins )
  800. switch ( $mensagem[ 1 ] )
  801. {
  802. case'name':
  803. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  804. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  805. } //!in_Array( $packet[ "u" ], $this->admins )
  806. $this->nome = $mensagem[ 2 ];
  807. $this->entrar();
  808. $this->enviarMSG('My name has been changed to : '.$this->nome);
  809.  
  810. break;
  811.  
  812. case'status':
  813. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  814. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  815. } //!in_Array( $packet[ "u" ], $this->admins )
  816. $this->status = htmlentities($mensagem[2]);
  817. $this->entrar();
  818. $this->enviarMSG('My status has been changed : '.$this->status );
  819. break;
  820.  
  821. case'glow':
  822. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  823. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  824. } //!in_Array( $packet[ "u" ], $this->admins )
  825. $mensagem = explode( ' ou ', strtolower( $msg ) );
  826. if ( !isset( $mensagem[ 1 ] ) || empty( $mensagem[ 1 ] ) || count( array_keys( $mensagem ) ) == 1 )
  827. $this->glow = $mensagem[0];
  828. $this->entrar();
  829. $this->enviarMSG('My GlowColor has been changed to [ #'.$this->glow.' ]');
  830. break;
  831.  
  832. case'hat':
  833. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  834. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  835. } //!in_Array( $packet[ "u" ], $this->admins )
  836. $mensagem = explode( ' ou ', strtolower( $msg ) );
  837. if ( !isset( $mensagem[ 1 ] ) || empty( $mensagem[ 1 ] ) || count( array_keys( $mensagem ) ) == 1 )
  838. $this->hat = $mensagem[0];
  839. $this->entrar();
  840. $this->enviarMSG('My hat was changed to Success : ' );
  841. break;
  842.  
  843. case'home':
  844. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  845. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  846. } //!in_Array( $packet[ "u" ], $this->admins )
  847. $mensagem = explode( ' ou ', strtolower( $msg ) );
  848. if ( !isset( $mensagem[ 1 ] ) || empty( $mensagem[ 1 ] ) || count( array_keys( $mensagem ) ) == 1 )
  849. $this->home = $mensagem[0];
  850. $this->entrar();
  851. $this->enviarMSG('My little house has been changed : ' );
  852. break;
  853.  
  854. case'welcome':
  855. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  856. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  857. } //!in_Array( $packet[ "u" ], $this->admins )
  858. $mensagem = explode( ' ou ', strtolower( $msg ) );
  859. if ( !isset( $mensagem[ 1 ] ) || empty( $mensagem[ 1 ] ) || count( array_keys( $mensagem ) ) == 1 )
  860. $this->autoWelcome = $mensagem[0];
  861. $this->entrar();
  862. $this->enviarMSG('My Welcome message has changed for : '.$this->autoWelcome );
  863. break;
  864.  
  865.  
  866. default:
  867. $this->enviarMSG( 'You should choose an option : !edit [name , status , glow , hat ,avatar].' );
  868. } //$mensagem[ 1 ]
  869. break;
  870.  
  871. /* Command Admin Para Bot Created Juninho & Sloom! */
  872. case "staff":
  873. // !staff
  874. $this->enviarMSG( " 1 , 4 , 7 , 2M , 1802 , 69 ", "PM", $packet[ "u" ] );
  875. break;
  876.  
  877. case'avatar':
  878. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  879. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  880. } //!in_Array( $packet[ "u" ], $this->admins )
  881. $this->avatar = $mensagem[1];
  882. $this->avatar = str_replace(' (', '(', $this->avatar);
  883. $this->avatar = str_replace(') ', ')', $this->avatar);
  884. $this->avatar = str_replace(' ', ' ', $this->avatar);
  885. $this->entrar();
  886. $this->entrar();
  887. $this->enviarMSG('My avatar has been changed : '.$this->avatar );
  888. break;
  889. case'last':
  890. $pow2 = file_get_contents('http://xat.com/web_gear/chat/pow2.php?Milk=1234');
  891. $pow2 = json_decode($pow2, true);
  892. $powername = array_search($pow2['0']['1']['id'], $pow2['5']['1']);
  893. $status = ($pow2[0][1]['text'] == '[LIMITED]') ? 'LIMITED':'UNLIMITED';
  894. $smilie = array_merge(array($powername), array_keys($pow2['3']['1'], $pow2['0']['1']['id'])); //get all smilies of the new power
  895. $smilies = array();
  896. $pawns = array();
  897. foreach($smilie as $v)
  898. array_push($smilies, $v);
  899. foreach($pow2[6][1] as $name => $value)
  900. if($name != 'time' && $value[0] == $pow2['0']['1']['id'])
  901. array_push($pawns, 'h'.$name);
  902. $smilielist = implode(", ", $smilies);
  903. $pawnlist = implode(", ", $pawns);
  904. $this->enviarMSG(ucfirst($powername).' | ID : '.$pow2['0']['1']['id'].' | Status : '.$status.' | Smilies: '.ucfirst($smilielist).' | Hats : '.$pawnlist);
  905. break;
  906. case 'calc':
  907. /* Command created by iZerang */
  908. // !calc [numero] [/ * * -] [numero 2]
  909. if ( is_numeric( $mensagem[1] ) && is_numeric( $mensagem[3] ) ) {
  910. switch ( $mensagem[2] ) {
  911.  
  912. case "*":
  913. $x = $mensagem[1] * $mensagem[3];
  914. $this->enviarMSG("{$mensagem[1]} x {$mensagem[3]} = {$x}");
  915. break;
  916.  
  917. case "/":
  918. $x = $mensagem[1] / $mensagem[3];
  919. $this->enviarMSG("{$mensagem[1]} + {$mensagem[3]} = {$x}");
  920. break;
  921.  
  922. case "+":
  923. $x = $mensagem[1] + $mensagem[3];
  924. $this->enviarMSG("{$mensagem[1]} + {$mensagem[3]} = {$x}");
  925. break;
  926.  
  927. case "-":
  928. $x = $mensagem[1] - $mensagem[3];
  929. $this->enviarMSG("{$mensagem[1]} - {$mensagem[3]} = {$x}");
  930. break;
  931. }
  932. //$mensagem[2]
  933. } //is_numeric( $mensagem[1] ) && is_numeric( $mensagem[3] )
  934. else {
  935. $this->enviarMSG( 'You must enter a valid account' , "PM", $packet[ "u" ] );
  936. }
  937. break;
  938.  
  939. case 'price':
  940. /* Command created by iZerang */
  941. $x1 = strtr(substr($mensagem[1], 0, 1), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  942. $x2 = strtr(substr($mensagem[1], 1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz");
  943. $msg = $x1.$x2;
  944. if(empty($msg)){$this->enviarMSG('The power of the name can not be empty.'); return;}
  945. $url = @file_get_contents('http://xatalert.com/fairtrade/');
  946. file_put_contents($core->lib . "prices.txt", $pricelist);
  947. if(empty($msg)){$this->enviarMSG('Failed to get price notify an administrator!'); return;}
  948. $parte1 = explode($msg.'</abbr></td><td></td><td>(', $url);
  949. $final = explode(')</td><td>',$parte1[1]);
  950. if(!$final[0]){
  951. $parte1 = explode($msg.'</abbr></td><td><img src="http://xat.com/images/apicon.png" border="0"></td><td>(', $url);
  952. $final = explode(')</td><td>',$parte1[1]);
  953. }
  954. $parte2 = explode($msg.'</abbr></td><td></td><td>('.$final[0].')</td><td>', $url);
  955. $final2 = explode('</td><td>',$parte2[1]);
  956. if(!$final2[0]){
  957. $parte2 = explode($msg.'</abbr></td><td><img src="http://xat.com/images/apicon.png" border="0"></td><td>('.$final[0].')</td><td>', $url);
  958. $final2 = explode('</td><td>',$parte2[1]);
  959. }
  960. $parte3 = explode($msg.'</abbr></td><td><img src="http://xat.com/images/apicon.png" border="0"></td><td>('.$final[0].')</td><td>'.$final2[0].'</td><td>', $url);
  961. $final3 = explode('</td><td>',$parte3[1]);
  962. if(!$final3[0]){
  963. $parte3 = explode($msg.'</abbr></td><td></td><td>('.$final[0].')</td><td>'.$final2[0].'</td><td>', $url);
  964. $final3 = explode('</td><td>',$parte3[1]);
  965. }
  966. if(!$final[0]){$this->enviarMSG('Power nonexistent, or not added yet.');}else
  967. $this->enviarMSG('The power in the '.$msg.' store costs: '.$final[0].', trade: '.$final2[0].', in days: '.$final3[0].'.');
  968. break;
  969.  
  970. case 'dx':
  971. $days = intval($message[1]);
  972. if($days < 1)
  973. return $this->sendPM($packet['u'], 'days must be 1 or more');
  974.  
  975. $tradeValue = 13;
  976. $xats = floor($days * $tradeValue);
  977. $this->enviarMSG($days.' days equals '.$xats.' xats');
  978. break;
  979.  
  980. case 'xclear11111111111111':
  981. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  982. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  983. } //!in_Array( $packet[ "u" ], $this->admins )
  984. return $this->enviarMSG('Sorry, but you are not allowed to do so!');;
  985. $this->clear = $mensagem[1];
  986. case 'msg11111111111111':
  987. case 'chat11111111111':
  988. case 'messages1111111111111':
  989. case 'message1111111111111111':
  990. $this->clearMsg(true,25);
  991. $this->socket->connect();
  992. $this->network->join();
  993. break;
  994.  
  995.  
  996.  
  997. } //substr( $mensagem[ 0 ], 1 )
  998. } //$tipo
  999. }
  1000.  
  1001. /* Reiniciar o servidor */
  1002. public function reiniciar( )
  1003. {
  1004. $this->conectar();
  1005. $this->entrar();
  1006. }
  1007. public function fetchUser($id) {
  1008. $id = $this->parseU($id);
  1009. if(isset($this->users[$id]))
  1010. return $this->users[$id];
  1011. else
  1012. return false;
  1013. }
  1014. function kick($message, $id, $log=true) {
  1015. if($log) {
  1016. if(!empty($this->users[$id]['kicks']) ) $this->users[$id]['kicks']++;
  1017. else $this->users[$id]['kicks'] = 1;
  1018. }
  1019. if($this->users[$id]['kicks'] > $this->maxKicks) {
  1020. $this->ban($message,$id,3600);
  1021. $this->users[$id]['kicks'] = 0;
  1022. return;
  1023. }
  1024. $this->enviar('<c p="'.$message." ".$this->users[$id]['kicks'].'/'.$this->maxKicks.'" u="'.$id.'" t="/k" />');
  1025. }
  1026. function ban($message, $id, $time) {
  1027. $this->enviar('<c p="'.ereg_replace('[^A-Za-z0-9.! ]','',$message).'" u="'.$id.'" t="/g'.$time.'" />');
  1028. }
  1029. public function sendPM($id=0, $packet='') {
  1030. $id = $this->parseU($id);
  1031. $this->enviar('<p u="'.$id.'" t="'.$packet.'" d="'.$id.'" />');
  1032. }
  1033.  
  1034. public function parseU($id) {
  1035. if(strpos($id, "_") > -1)
  1036. $e = explode("_", $id);
  1037. $u = (strpos($id, "_") > -1) ? $e[0] : $id;
  1038. return $u;
  1039. }
  1040.  
  1041. function member($id,$time=null) {
  1042. if(!$time) $time = 0;
  1043. $id = $this->parseU($id);
  1044. $this->sendC($id, '/e',$time);
  1045. }
  1046. function guest($id,$time=null) {
  1047. if(!$time) $time = 0;
  1048. $id = $this->parseU($id);
  1049. $this->sendC($id, '/r',$time);
  1050. }
  1051.  
  1052. public function sendC($id=0, $com='') {//Shit always comes in handy after awhile.
  1053. $this->enviar('<c u="'.$id.'" t="'.$com.'" />');
  1054. }
  1055. public function censor($message) {
  1056. $badwords = $this->censor;
  1057. $message = @preg_replace('#\((.+)\)#U','',strtolower(' '.$message.' '));
  1058. foreach($badwords as $bad) {
  1059. $bad = trim($bad);
  1060. if(strpos($message.' ', $bad.' ')!==false) {
  1061. if(strlen($bad)>=2) {
  1062. return true;
  1063. }
  1064. }
  1065.  
  1066. }
  1067.  
  1068. }
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078. /* Enviar MSG, definido com tipo e ID */
  1079. function enviarMSG( $mensagem, $tipo = "MSG", $id = 0 )
  1080. {
  1081. If ( !$mensagem ) {
  1082. return False;
  1083. } //!$mensagem
  1084. switch ( $tipo ) {
  1085. case "MSG": // Sample
  1086. $this->enviar( "<m t=\"{$mensagem}\" u=\"{$this->botID}\" />" );
  1087. break;
  1088.  
  1089. case "PM": // PM
  1090. $this->enviar( "<p u=\"{$id}\" t=\"{$mensagem}\" d=\"{$id}\" />" );
  1091. break;
  1092.  
  1093. case "PC": // Privado
  1094. $this->enviar( "<z d=\"{$id}\" u=\"{$this->botID}\" t=\"{$mensagem}\" />" );
  1095. break;
  1096. } //$tipo
  1097. }
  1098.  
  1099. }
  1100.  
  1101. $bot = new zBot(); // Estanciar a class
  1102.  
  1103. while ( 1 ) {
  1104. try {
  1105. If ( $bot->carregar() == "DESLIGADO" ) {
  1106. $bot->desconectar();
  1107. $bot->entrar();
  1108. } //$bot->carregar() == "DESLIGADO"
  1109. }
  1110. catch ( Exception $e ) {
  1111. die( $e );
  1112. }
  1113. } //1
  1114.  
  1115. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement