BcStorm MUS Commands

Results 1 to 6 of 6
  1. #1
    Lurking around Clawed is offline
    MemberRank
    Jun 2012 Join Date
    RaGEZONELocation
    785Posts

    BcStorm MUS Commands

    I've added a few MUS commands to my BcStorm EMU, i will be adding more to this list soon.

    Replace: /Butterfly/Net/MusConnection.cs
    With:
    PHP Code:
    namespace Butterfly.Net
    {
        
    using Butterfly;
        
    using Butterfly.Core;
        
    using Butterfly.HabboHotel.GameClients;
        
    using Butterfly.Messages;
        
    using DataButterfly_Manager.DataButterfly.Session_Details.Interfaces;
        
    using System;
        
    using System.Data;
        
    using System.Net.Sockets;
        
    using System.Text;
        
    using HabboEvents;

        
    internal class MusConnection
        
    {
            private 
    byte[] buffer = new byte[0x400];
            private 
    Socket socket;

            
    internal MusConnection(Socket _socket)
            {
                
    this.socket _socket;
                try
                {
                    
    this.socket.BeginReceive(this.buffer0this.buffer.LengthSocketFlags.None, new AsyncCallback(this.OnEvent_RecieveData), this.socket);
                }
                catch
                {
                    
    this.tryClose();
                }
            }

            
    internal void OnEvent_RecieveData(IAsyncResult iAr)
            {
                try
                {
                    
    int count 0;
                    try
                    {
                        
    count this.socket.EndReceive(iAr);
                    }
                    catch
                    {
                        
    this.tryClose();
                        return;
                    }
                    
    string data Encoding.Default.GetString(this.buffer0count);
                    if (
    data.Length 0)
                    {
                        
    this.processCommand(data);
                    }
                }
                catch
                {
                }
                
    this.tryClose();
            }

            
    internal void processCommand(string data)
            {
                
    String header "";
                
    String param "";

                if (
    data.IndexOf(Convert.ToChar(1)) != -1)
                {
                    
    header data.Split(Convert.ToChar(1))[0].Trim();
                    
    param data.Split(Convert.ToChar(1))[1];
                }
                else
                {
                    
    header data.Remove(Convert.ToChar(1)).Trim();
                    
    param "";

                }

                
    string[] pars param.Split(' ');
                
    GameClient Client null;

                switch (
    header.ToLower())
                {
                    case 
    "update_credits":
                        {
                            
    string Username ButterflyEnvironment.GetGame().GetClientManager().GetNameById(uint.Parse(pars[0]));
                            
    Client ButterflyEnvironment.GetGame().GetClientManager().GetClientByUserID(uint.Parse(pars[0]));
                            if (
    Client == null)
                            {
                                
    Logging.WriteLine("User [" Username "] does not seem to be online!");
                                return;
                            }
                            
    DataRow newCredits;
                            
    using (IQueryAdapter dbClient ButterflyEnvironment.GetDataButterflyManager().getQueryreactor())
                            {
                                
    dbClient.setQuery("SELECT credits FROM users WHERE id = @userid");
                                
    dbClient.addParameter("userid", (int)Client.GetHabbo().Id);
                                
    newCredits dbClient.getRow();
                            }
                            
    Client.GetHabbo().Credits = (int)newCredits["credits"];
                            
    Client.GetHabbo().UpdateCreditsBalance();
                            
    Logging.WriteLine("Credits for user [" Username "] updated.");
                            
    Logging.WriteLine("Completed MUS command: 'update_credits'");
                            return;
                        }
                    case 
    "update_pixels":
                        {
                            
    string Username ButterflyEnvironment.GetGame().GetClientManager().GetNameById(uint.Parse(pars[0]));
                            
    Client ButterflyEnvironment.GetGame().GetClientManager().GetClientByUserID(uint.Parse(pars[0]));
                            if (
    Client == null)
                            {
                                
    Logging.WriteLine("User [" Username "] does not seem to be online!");
                                return;
                            }
                            
    DataRow newPixels;
                            
    using (IQueryAdapter dbClient ButterflyEnvironment.GetDataButterflyManager().getQueryreactor())
                            {
                                
    dbClient.setQuery("SELECT activity_points FROM users WHERE id = @userid");
                                
    dbClient.addParameter("userid", (int)Client.GetHabbo().Id);
                                
    newPixels dbClient.getRow();
                            }
                            
    Client.GetHabbo().ActivityPoints = (int)newPixels["activity_points"];
                            
    Client.GetHabbo().UpdateActivityPointsBalance(true);
                            
    Logging.WriteLine("Pixels for user [" Username "] updated.");
                            
    Logging.WriteLine("Completed MUS command: 'update_pixels'");
                            return;
                        }
                    case 
    "signout":
                        {
                            
    string Username ButterflyEnvironment.GetGame().GetClientManager().GetNameById(uint.Parse(pars[0]));
                            
    Client ButterflyEnvironment.GetGame().GetClientManager().GetClientByUsername(pars[0]);
                            if (
    Client == null)
                            {
                                
    Logging.WriteLine("User [" Username "] does not seem to be online!");
                                return;
                            }
                            
    ButterflyEnvironment.GetGame().GetClientManager().GetClientByUserID(uint.Parse(pars[0])).Disconnect();
                            
    Logging.WriteLine("Disconnected user [" Username "]");
                            
    Logging.WriteLine("Completed MUS command: 'signout'");
                            return;
                        }
                    case 
    "ha":
                        {
                            
    string Message param;
                            
    ServerMessage nMessage = new ServerMessage(Outgoing.BroadcastMessage);
                            
    nMessage.AppendString("Notice from Hotel Management:\r\n" Message);
                            
    ButterflyEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(nMessage);
                            
    Logging.WriteLine("Completed MUS command: 'ha'");
                            return;
                        }
                    case 
    "hal":
                        {
                            
    string Link pars[0];
                            
    string Message ButterflyEnvironment.FilterInjectionChars(MergeParams(pars1));
                            
    ServerMessage nMessage = new ServerMessage(Outgoing.SendNotif);
                            
    nMessage.AppendString("Notice from Hotel Management:\r\n" Message);
                            
    nMessage.AppendString(Link);
                            
    ButterflyEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(nMessage);
                            
    Logging.WriteLine("Completed MUS command: 'hal'");
                            return;
                        }
                    case 
    "unban":
                        {
                            if (
    pars[0].Length 1)
                            {
                                
    ButterflyEnvironment.GetGame().GetBanManager().UnbanUser(pars[0]);
                            }
                            
    Logging.WriteLine("Completed MUS command: 'unban'");
                            return;
                        }
                    case 
    "shutdown":
                        {
                            
    ButterflyEnvironment.PreformShutDown(true);
                            
    Logging.WriteLine("Completed MUS command: 'shutdown'");
                            return;
                        }
                }
                
    Logging.WriteLine("MUS Command: '" header "' does not exist. Data: '" param "'");
            }

            private static 
    string MergeParams(string[] Paramsint Start)
            {
                
    StringBuilder MergedParams = new StringBuilder();

                for (
    int i 0Params.Lengthi++)
                {
                    if (
    Start)
                    {
                        continue;
                    }

                    if (
    Start)
                    {
                        
    MergedParams.Append(" ");
                    }

                    
    MergedParams.Append(Params[i]);
                }

                return 
    MergedParams.ToString();
            }

            
    internal void tryClose()
            {
                try
                {
                    
    this.socket.Shutdown(SocketShutdown.Both);
                    
    this.socket.Close();
                    
    this.socket.Dispose();
                }
                catch
                {
                }
                
    this.socket null;
                
    this.buffer null;
            }
        }

    There's only a few so far, but i've been adding things & upgrading alot, so i will add more soon.

    Commands:
    Code:
    update_credits [userid]
    update_pixels [userid]
    signout [userid]
    ha [message]
    hal [link] [message]
    unban [username/ip]
    shutdown
    EDIT;
    A few new commands
    PHP Code:
    case "alert":
        {
            
    string Username ButterflyEnvironment.GetGame().GetClientManager().GetNameById(uint.Parse(pars[0]));
            
    string TargetUser null;
            
    GameClient TargetClient null;
            
    TargetUser pars[0];
            
    TargetClient ButterflyEnvironment.GetGame().GetClientManager().GetClientByUsername(TargetUser);
            if (
    TargetClient == null)
            {
                
    Logging.WriteLine("User [" Username "] does not seem to be online!");
                return;
            }
            
    TargetClient.SendNotif(MergeParams(pars1));
            
    Logging.WriteLine("Alert has been sent.");
            
    Logging.WriteLine("Completed MUS command: 'alert'");
            return;
        }
    case 
    "update_catalogue":
        {
            
    using (IQueryAdapter dbClient ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                
    ButterflyEnvironment.GetGame().GetCatalog().Initialize(dbClient);
                
    ButterflyEnvironment.GetGame().GetItemManager().LoadItems(dbClient);
            }
            
    ButterflyEnvironment.GetGame().GetCatalog().InitCache();
            
    ButterflyEnvironment.GetGame().GetClientManager().QueueBroadcaseMessage(new ServerMessage(Outgoing.UpdateShop));
            
    Logging.WriteLine("Completed MUS command: 'update_catalogue'");
            return;
        }
    case 
    "update_items":
        {
            
    ButterflyEnvironment.GetGame().reloaditems();
            
    Logging.WriteLine("Completed MUS command: 'update_items'");
            return;
        }
    case 
    "unload_room":
        {
            
    Room RoomId ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(uint.Parse(pars[0]));
            
    ButterflyEnvironment.GetGame().GetRoomManager().UnloadRoom(RoomId);
            
    Logging.WriteLine("Completed MUS command: 'unload_room'");
            return;
        }
    case 
    "ban":
        {
            
    string Username ButterflyEnvironment.GetGame().GetClientManager().GetNameById(uint.Parse(pars[0]));
            
    GameClient tClient null;
            
    tClient ButterflyEnvironment.GetGame().GetClientManager().GetClientByUsername(pars[0]);
            if (
    tClient == null)
            {
                
    Logging.WriteLine("User [" Username "] does not seem to be online!");
                return;
            }
            
    int BanTime 0;
            try
            {
                
    BanTime int.Parse(pars[1]);
            }
            catch (
    FormatException) {
                
    Logging.WriteLine("An error has occured.");
                return;
            }
            if (
    BanTime <= 600)
            {
                
    Logging.WriteLine("Ban time is in seconds and must be at least than 600 seconds (ten minutes). For more specific preset ban times, use the mod tool.");
                return;
            }
            else
            {
                
    ButterflyEnvironment.GetGame().GetBanManager().BanUser(tClient"Staff"BanTimeMergeParams(pars2), false);
                
    Logging.WriteLine("User [" Username "] has been banned!");
            }

            
    Logging.WriteLine("Completed MUS command: 'ban'");
            return;
        } 
    Commands:
    Code:
    alert [userid] [message]
    update_catalogue
    update_items
    unload_room [roomid]
    ban [username]
    New one's has not been tested, if they don't work let me know.
    I'll be adding these to my EMU later, so i'll let you know if they work.
    Last edited by Clawed; 20-05-13 at 02:17 PM. Reason: New commands


  2. #2
    Valued Member smasher1994 is offline
    MemberRank
    Sep 2008 Join Date
    122Posts

    Re: BcStorm MUS Commands

    Nice release, really.

    Can you code something like a MUS Command which Update the rank in the Client automatic. So the User don't want to reload the Client.. did u knoww what I mean?

  3. #3
    The one and only! Hejula is offline
    MemberRank
    Nov 2008 Join Date
    4,128Posts

    Re: BcStorm MUS Commands

    Ahh this is excellent!! Thanks Clawed!!!

    P.S. gay reputation comment is not gay

  4. #4
    Iron like a Lion in Zion! vLife is online now
    Super ModRank
    Apr 2009 Join Date
    The BahamasLocation
    3,788Posts

    Re: BcStorm MUS Commands

    Nicely done to say the least.
    When your done with adding all the commands you need to, mind making them into a text file? I'd like to have that.

  5. #5
    Run, but I'll find you. Ddos Attack is offline
    MemberRank
    Jan 2011 Join Date
    AustraliaLocation
    908Posts

    Re: BcStorm MUS Commands

    Nice release. I can't seem to get MUS working at all on my hotel though. I'm using UberCMS and BCStorm. Nothing MUS-wise works. Everything for MUS is enabled though. It was working when we were using Phoenix, but not now. Any ideas?

  6. #6
    Lurking around Clawed is offline
    MemberRank
    Jun 2012 Join Date
    RaGEZONELocation
    785Posts

    Re: BcStorm MUS Commands

    Quote Originally Posted by smasher1994 View Post
    Nice release, really.

    Can you code something like a MUS Command which Update the rank in the Client automatic. So the User don't want to reload the Client.. did u knoww what I mean?
    I know what you mean, can be done, means sending quite a few ServerMessage()'s for mod tool, etc, etc, but can be done.

    Quote Originally Posted by vLife View Post
    Nicely done to say the least.
    When your done with adding all the commands you need to, mind making them into a text file? I'd like to have that.
    Yes :)

    Quote Originally Posted by Ddos Attack View Post
    Nice release. I can't seem to get MUS working at all on my hotel though. I'm using UberCMS and BCStorm. Nothing MUS-wise works. Everything for MUS is enabled though. It was working when we were using Phoenix, but not now. Any ideas?
    Here's my MUS function:
    PHP Code:
    function MusSocket($header$data "")
    {
    $musData $header.chr(1).$data;
    $sock = @socket_create(AF_INETSOCK_STREAMgetprotobyname("tcp"));
    @
    socket_connect($sock"IP"intval("PORT"));
    @
    socket_send($sock$musDatastrlen($musData), MSG_DONTROUTE);
    @
    socket_close($sock);

    Last edited by Clawed; 20-05-13 at 07:50 PM.



Advertisement