Hello RZ,
Some people are still looking for MUS Connection.
To update tags etc.
Here is the .CS file for UberEmulator >:)
Code:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using System.Net.Sockets; using Uber.HabboHotel; using Uber.Core; using Uber.HabboHotel.GameClients; using Uber; namespace MLD_Productions.Net { class MussTcpConnection { public static class musSocketServer { private static Socket socketHandler; private static int _Port; private static string _musHost; /// <summary> /// Initializes the socket listener for MUS connections and starts listening. /// </summary> /// <param name="bindPort">The port where the socket listener should be bound to.</param> /// <remarks></remarks> internal static bool Init(int bindPort, string musHost) { _Port = bindPort; _musHost = musHost; socketHandler = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); try { socketHandler.Bind(new IPEndPoint(IPAddress.Any, bindPort)); socketHandler.Listen(25); socketHandler.BeginAccept(new AsyncCallback(connectionRequest), socketHandler); Console.WriteLine("-> MUS TCP luistert naar " + musHost + ":" + bindPort); return true; } catch { Console.WriteLine("Error while setting up asynchronous socket server for MUS connections on port " + bindPort); Console.WriteLine("Port " + bindPort + " could be invalid or in use already."); return false; } } private static void connectionRequest(IAsyncResult iAr) { Socket newSocket = ((Socket)iAr.AsyncState).EndAccept(iAr); if (newSocket.RemoteEndPoint.ToString().Split(':')[0] != _musHost) { newSocket.Close(); return; } musConnection newConnection = new musConnection(newSocket); socketHandler.BeginAccept(new AsyncCallback(connectionRequest), socketHandler); } private class musConnection { private Socket Connector; private byte[] dataBuffer = new byte[10001]; /// <summary> /// Initializes the musConnection and listens for one single packet, processes it and closes the connection. On any error, the connection is closed. /// </summary> /// <param name="Connector">The socket of the musConnection.</param> internal musConnection(Socket Connector) { this.Connector = Connector; Connector.BeginReceive(dataBuffer, 0, dataBuffer.Length, SocketFlags.None, new AsyncCallback(dataArrival), null); } /// <summary> /// Called when a packet is received, the packet will be processed and the connection will be closed (after processing packet) in all cases. No errors will be thrown. /// </summary> /// <param name="iAr"></param>\ // private void dataArrival(IAsyncResult iAr) { try { int bytesReceived = Connector.EndReceive(iAr); string Data = System.Text.Encoding.ASCII.GetString(dataBuffer, 0, bytesReceived); string musHeader = Data.Substring(0, 4); string[] musData = Data.Substring(4).Split(Convert.ToChar(2)); #region MUS trigger commands // Unsafe code, but on any error it jumps to the catch block & disconnects the socket switch (musHeader) { case "ALED": // Housekeeping - textmessage [BK] :: "HKTM123This is a test message to user with ID 123" { uint userID = Convert.ToUInt32(int.Parse(musData[0])); string Message = musData[1]; GameClient tTargetClient = HangEnvironment.GetGame().GetClientManager().GetClientByHabbo(userID); if (tTargetClient != null) { tTargetClient.SendNotif(Message); } break; } case "UPRA": // Housekeeping - textmessage [BK] :: "HKTM123This is a test message to user with ID 123" { uint userID = Convert.ToUInt32(int.Parse(musData[0])); GameClient tTargetClient = HangEnvironment.GetGame().GetClientManager().GetClientByHabbo(userID); if (tTargetClient != null) { tTargetClient.GetHabbo().LoadTags(tTargetClient.GetHabbo().HabboDataRow); } break; } case "ALEA": // Housekeeping - textmessage [BK] :: "HKTM123This is a test message to user with ID 123" { string Message = musData[0]; HangEnvironment.SendMassMessage(Message); break; } } #endregion } catch { } } } } } }
Config.ini Requires:
Code:## MUS TCP/IP Configuration mus.tcp.status=ON mus.tcp.bindip=IP-FROM-WEBSERVER mus.tcp.port=30001
PHP Function SendMUSData
Example for MUS Usage:Code:function SendMUSData($data){ $ip = 'IP FROM EMULATOR'; $port = '30001'; if(!is_numeric($port)){ return false; } $sock = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp')); socket_connect($sock, $ip, $port); if(!is_resource($sock)){ return false; } else { socket_send($sock, $data, strlen($data), MSG_DONTROUTE); return true; } socket_close($sock); }
At UberEnvironment.cs is an location it says: Uberemulator ready for connections.Code:SendMUSData('ALEA' . 'This message is for everyone!');
Paste this above it.
That will send everyone in the hotel online an message. From the websever :)Code:if (UberEnvironment.GetConfig().data["mus.tcp.status"].ToString() == "ON") { MLD_Productions.Net.MussTcpConnection.musSocketServer.Init(Convert.ToInt32(UberEnvironment.GetConfig().data["mus.tcp.port"].ToString()), UberEnvironment.GetConfig().data["mus.tcp.bindip"].ToString()); } else if (UberEnvironment.GetConfig().data["mus.tcp.status"].ToString() == "OFF") { Console.WriteLine("-> MUS has been disabled."); } else { Console.WriteLine("-> MUS Variable hasnt been found!"); }
This is for an R63 Emulator.
And yes. This has came from V26 Emulators. but has been made compitable with R63.
Hope you like.
If you dont like it, dont bump and get out. ;3
Regards.
Mikeuyz






