Advertisement
Guest User

Untitled

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