Advertisement
Guest User

Untitled

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