MUS for UberEmulator

Page 1 of 2 12 LastLast
Results 1 to 15 of 28
  1. #1
    1 + 3 + 3 = 7 EvilCoder is offline
    MemberRank
    Jul 2009 Join Date
    /home/mvdworpLocation
    334Posts

    MUS for UberEmulator

    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
    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);
    }
    Example for MUS Usage:
    Code:
    SendMUSData('ALEA' . 'This message is for everyone!');
    At UberEnvironment.cs is an location it says: Uberemulator ready for connections.
    Paste this above it.

    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!"); }
    That will send everyone in the hotel online an message. From the websever :)

    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
    Last edited by EvilCoder; 10-12-11 at 12:52 PM.


  2. #2
    What about no. Davidaap is offline
    MemberRank
    Nov 2009 Join Date
    773Posts

    Re: MUS for UberEmulator

    Orginal uber had a class for that

  3. #3
    swagggggg Livar is offline
    MemberRank
    Oct 2008 Join Date
    United KingdomLocation
    2,272Posts

    Re: MUS for UberEmulator

    lolwut. The MUS work's in uber && Phoenix. All you need to do if your using uberCMS, is enable MUS in the inc.config.


  4. #4
    1 + 3 + 3 = 7 EvilCoder is offline
    MemberRank
    Jul 2009 Join Date
    /home/mvdworpLocation
    334Posts

    Re: MUS for UberEmulator

    Is it? oh. Didnt notice. Sorry for this useless thread 'x
    The ubersource i had didnt had Muss. So i recoded it.

  5. #5
    Account Upgraded | Title Enabled! Wupz0r is offline
    MemberRank
    Oct 2011 Join Date
    RaGEZONELocation
    229Posts

    Re: MUS for UberEmulator

    Someone raped this MUS.

  6. #6
    1 + 3 + 3 = 7 EvilCoder is offline
    MemberRank
    Jul 2009 Join Date
    /home/mvdworpLocation
    334Posts

    Re: MUS for UberEmulator

    Yes, if you put 0.0.0.0 as ip. Then everyone can send Packets trolled so hard for that.

  7. #7
    The Legend Returns vista4life is offline
    MemberRank
    Mar 2007 Join Date
    The NetherlandsLocation
    843Posts

    Re: MUS for UberEmulator

    Quote Originally Posted by Wupz0r View Post
    Someone raped this MUS.
    true, if i look those codes it looks like holograph mus *.*

    uberemulator(the orginal one) mus port works perfect never got problems with it.

  8. #8
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,773Posts

    Re: MUS for UberEmulator

    Be warned, Someone can have much fun on this if you don't protect it!

  9. #9
    1 + 3 + 3 = 7 EvilCoder is offline
    MemberRank
    Jul 2009 Join Date
    /home/mvdworpLocation
    334Posts

    Re: MUS for UberEmulator

    It doesnt allow you to use 0.0.0.0 enymore.
    Disabled that bullshit. Only allows one IP. Thats for ex: 222.222.222.222 or 127.0.0.1. Dont go fuck arround with this code. Works fine :)

    ~ Peace

  10. #10
    Gamma Spamma Liam is offline
    MemberRank
    Dec 2011 Join Date
    Down UnderLocation
    2,946Posts

    Re: MUS for UberEmulator

    Omfg, this was already in UberEmulator..

  11. #11
    Old Habbo Developer AresCJ is offline
    MemberRank
    Jan 2009 Join Date
    USALocation
    1,183Posts

    Re: MUS for UberEmulator

    Okay, but my question is what was wrong with the MUS Connection in Uber? By the looks of it, I tested a server and MUS is fine. Maybe you just have to PF your MUS port, but server-wise MUS is fine.

  12. #12
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,773Posts

    Re: MUS for UberEmulator

    Portforward mus? Haha then i have fun xd
    Posted via Mobile Device

  13. #13
    What about no. Davidaap is offline
    MemberRank
    Nov 2009 Join Date
    773Posts

    Re: MUS for UberEmulator

    Quote Originally Posted by joopie View Post
    Portforward mus? Haha then i have fun xd
    Posted via Mobile Device
    Uber Mus is protected ;)

  14. #14
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,773Posts
    Quote Originally Posted by Davidaap View Post
    Uber Mus is protected ;)
    You think? The last time i treid it worked fine xd
    Posted via Mobile Device

  15. #15
    Old Habbo Developer AresCJ is offline
    MemberRank
    Jan 2009 Join Date
    USALocation
    1,183Posts

    Re: MUS for UberEmulator

    Quote Originally Posted by joopie View Post
    Portforward mus? Haha then i have fun xd
    Posted via Mobile Device
    I said portforward the MUS port, because that could be an issue if it doesn't work on your hotel, etc..?



Page 1 of 2 12 LastLast

Advertisement