[C#] Mercury EMU MUS - senduser

Results 1 to 10 of 10
  1. #1
    R.I.P Millercent FatalLulz is offline
    MemberRank
    Nov 2012 Join Date
    AustraliaLocation
    2,248Posts

    [C#] Mercury EMU MUS - senduser

    Hi,

    I've noticed Mercury doesn't have a senduser MUS command to forward users to a set room when clicking a forward room link. Is anyone able to point me in the right direction of making one? Phoenix's senduser MUS is way to obfuscated to use and butterfly renames don't have it.

    This is Mercury's MUS -

    Code:
    string a;
    			if ((a = text.ToLower()) != null)
    			{
    				if (!(a == "updatemotto"))
    				{
    					GameClient clientByUserID;
    					if (!(a == "updaterooms"))
    					{
    						if (!(a == "addtoinventory"))
    						{
    							if (!(a == "updatecredits"))
    							{
    								if (!(a == "updatesubscription"))
    								{
    									goto IL_38B;
    								}
    								uint userID = Convert.ToUInt32(array[0]);
    								clientByUserID = MercuryEnvironment.GetGame().GetClientManager().GetClientByUserID(userID);
    								if (clientByUserID != null && clientByUserID.GetHabbo() != null)
    								{
    									clientByUserID.GetHabbo().GetSubscriptionManager().ReloadSubscription();
    									clientByUserID.GetHabbo().SerializeClub();
    									clientByUserID.SendMessage(new ServerMessage(Outgoing.PublishShopMessageComposer));
    									goto IL_3A3;
    								}
    								goto IL_3A3;
    							}
    							else
    							{
    								uint userID2 = Convert.ToUInt32(array[0]);
    								int credits = Convert.ToInt32(array[1]);
    								clientByUserID = MercuryEnvironment.GetGame().GetClientManager().GetClientByUserID(userID2);
    								if (clientByUserID != null && clientByUserID.GetHabbo() != null)
    								{
    									clientByUserID.GetHabbo().Credits = credits;
    									clientByUserID.GetHabbo().UpdateCreditsBalance();
    									goto IL_3A3;
    								}
    								goto IL_3A3;
    							}
    						}
    					}
    					else
    					{
    						uint num = Convert.ToUInt32(array[0]);
    						string arg_20F_0 = array[1];
    						using (Dictionary<uint, Room>.ValueCollection.Enumerator enumerator = MercuryEnvironment.GetGame().GetRoomManager().loadedRooms.Values.GetEnumerator())
    						{
    							while (enumerator.MoveNext())
    							{
    								Room current = enumerator.Current;
    								if ((long)current.OwnerId == (long)((ulong)num))
    								{
    									MercuryEnvironment.GetGame().GetRoomManager().UnloadRoom(current);
    									current.RequestReload();
    								}
    							}
    							goto IL_3A3;
    						}
    					}
    					uint userID3 = Convert.ToUInt32(array[0]);
    					int id = Convert.ToInt32(array[1]);
    					clientByUserID = MercuryEnvironment.GetGame().GetClientManager().GetClientByUserID(userID3);
    					if (clientByUserID != null && clientByUserID.GetHabbo() != null && clientByUserID.GetHabbo().GetInventoryComponent() != null)
    					{
    						clientByUserID.GetHabbo().GetInventoryComponent().UpdateItems(true);
    						clientByUserID.GetHabbo().GetInventoryComponent().SendNewItems((uint)id);
    					}
    				}
    				else
    				{
    					GameClient clientByUserID = MercuryEnvironment.GetGame().GetClientManager().GetClientByUserID(Convert.ToUInt32(array[0]));
    					clientByUserID.GetHabbo().Motto = MusConnection.MergeParams(array, 1);
    					ServerMessage serverMessage = new ServerMessage(Outgoing.UpdateUserDataMessageComposer);
    					serverMessage.AppendInt32(-1);
    					serverMessage.AppendString(clientByUserID.GetHabbo().Look);
    					serverMessage.AppendString(clientByUserID.GetHabbo().Gender.ToLower());
    					serverMessage.AppendString(clientByUserID.GetHabbo().Motto);
    					serverMessage.AppendInt32(clientByUserID.GetHabbo().AchievementPoints);
    					clientByUserID.SendMessage(serverMessage);
    					if (clientByUserID.GetHabbo().CurrentRoom != null)
    					{
    						RoomUser roomUserByHabbo = clientByUserID.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(clientByUserID.GetHabbo().Username);
    						ServerMessage serverMessage2 = new ServerMessage(Outgoing.UpdateUserDataMessageComposer);
    						serverMessage2.AppendInt32(roomUserByHabbo.VirtualId);
    						serverMessage2.AppendString(clientByUserID.GetHabbo().Look);
    						serverMessage2.AppendString(clientByUserID.GetHabbo().Gender.ToLower());
    						serverMessage2.AppendString(clientByUserID.GetHabbo().Motto);
    						serverMessage2.AppendInt32(clientByUserID.GetHabbo().AchievementPoints);
    						clientByUserID.GetHabbo().CurrentRoom.SendMessage(serverMessage2);
    					}
    				}
    Anyone able to send me going?


  2. #2
    Member Alex Be is offline
    MemberRank
    Nov 2013 Join Date
    AustraliaLocation
    68Posts

    Re: [C#] Mercury EMU MUS - senduser

    *Update*

    Try Looking in Plus Emulator. and see that has a mus of forwarding users.
    Last edited by Alex Be; 26-09-14 at 07:51 AM.

  3. #3
    R.I.P Millercent FatalLulz is offline
    MemberRank
    Nov 2012 Join Date
    AustraliaLocation
    2,248Posts

    Re: [C#] Mercury EMU MUS - senduser

    Quote Originally Posted by Alex Be View Post
    *Update*

    Try Looking in Plus Emulator. and see that has a mus of forwarding users.
    Which one? The 2013 didn't have it as I checked in Silverwave. The revision 2 one I don't think had it as well? I never saw it when viewing the .cs - I'll go double check.

    -- UPDATE --

    Yeah none of the butterfly edits/renames have it.
    Last edited by FatalLulz; 26-09-14 at 09:10 AM.

  4. #4
    Check http://arcturus.pw The General is offline
    DeveloperRank
    Aug 2011 Join Date
    7,608Posts

    Re: [C#] Mercury EMU MUS - senduser

    Whoever wrote that shit code should be publicly executed.

  5. #5
    R.I.P Millercent FatalLulz is offline
    MemberRank
    Nov 2012 Join Date
    AustraliaLocation
    2,248Posts

    Re: [C#] Mercury EMU MUS - senduser

    Quote Originally Posted by The General View Post
    Whoever wrote that shit code should be publicly executed.
    MrPudding did. PlusR2 and the others were coded rather like phoenix and better. Still require help on this.

    This is Phoenix's senduser MUS from the original clean source;
    Code:
    case "senduser":
                    {
                        uint habboId = uint.Parse(str2.Split(new char[] { ' ' })[0]);
                        uint num3 = uint.Parse(str2.Split(new char[] { ' ' })[1]);
                        GameClient clientByHabbo = PhoenixEnvironment.GetGame().GetClientManager().GetClientByHabbo(habboId);
                        room = PhoenixEnvironment.GetGame().GetRoomManager().GetRoom(num3);
                        if (clientByHabbo != null)
                        {
                            ServerMessage message2 = new ServerMessage(0x11e);
                            message2.AppendBoolean(room.IsPublic);
                            message2.AppendUInt(num3);
                            clientByHabbo.SendMessage(message2);
                        }
                        break;
                    }

  6. #6
    I (L) Willem Spot Ify is offline
    MemberRank
    Jun 2012 Join Date
    The NetherlandsLocation
    294Posts

    Re: [C#] Mercury EMU MUS - senduser

    Holyshit that code is soo fucked why didnt he just do it by a switch ......
    The guy who coded this cant code c# I think....

    But what I should do is remove all If(a....) And add a switch then you can easy add a senduser command...

    gr spotifty @FataLulz
    Yeah thats what I mean that looks much cleaner and better to read and now you just add this code:
    PHP Code:
             case "senduser":
                        {
                            
    uint UserId Convert.ToUInt32(Params[0]);
                            
    int RoomId Convert.ToInt32(Params[1]);

                            
    Client SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                            if (
    Client != null)
                            {
                                
    ServerMessage SendUser = new ServerMessage(Outgoing.RoomForwardMessageComposer);
                                
    SendUser.AppendInt32(RoomId);
                                
    Client.SendMessage(SendUser);
                            }
                        } 
    And then does your Senduser work yeahh

    Gr SpotIfy
    Last edited by Spot Ify; 27-09-14 at 12:59 AM.

  7. #7
    R.I.P Millercent FatalLulz is offline
    MemberRank
    Nov 2012 Join Date
    AustraliaLocation
    2,248Posts

    Re: [C#] Mercury EMU MUS - senduser

    Quote Originally Posted by Spot Ify View Post
    Holyshit that code is soo fucked why didnt he just do it by a switch ......
    The guy who coded this cant code c# I think....

    But what I should do is remove all If(a....) And add a switch then you can easy add a senduser command...

    gr spotifty
    So you mean like this?
    Code:
    switch (header.ToLower())
                {
                    case "updatemotto":
                        {
                            Client = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUserID(Convert.ToUInt32(Params[0]));
                            Client.GetHabbo().Motto = MergeParams(Params, 1);
    
                            ServerMessage Update = new ServerMessage(Outgoing.UpdateUserInformation);
                            Update.AppendInt32(-1);
                            Update.AppendString(Client.GetHabbo().Look);
                            Update.AppendString(Client.GetHabbo().Gender.ToLower());
                            Update.AppendString(Client.GetHabbo().Motto);
                            Update.AppendInt32(Client.GetHabbo().AchievementPoints);
                            Client.SendMessage(Update);
                            if (Client.GetHabbo().CurrentRoom != null)
                            {
                                User = Client.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Client.GetHabbo().Username);
                                ServerMessage RoomUpdate = new ServerMessage(Outgoing.UpdateUserInformation);
                                RoomUpdate.AppendInt32(User.VirtualId);
                                RoomUpdate.AppendString(Client.GetHabbo().Look);
                                RoomUpdate.AppendString(Client.GetHabbo().Gender.ToLower());
                                RoomUpdate.AppendString(Client.GetHabbo().Motto);
                                RoomUpdate.AppendInt32(Client.GetHabbo().AchievementPoints);
                                Client.GetHabbo().CurrentRoom.SendMessage(RoomUpdate);
                            }
                            
                            break;
                        }
                    case "updaterooms":
                        {
                            uint OwnerId = Convert.ToUInt32(Params[0]);
                            string Owner = Params[1];
                            foreach (Room room in SilverwaveEnvironment.GetGame().GetRoomManager().loadedRooms.Values)
                            {
                                if (room.OwnerId == OwnerId)
                                {
                                    SilverwaveEnvironment.GetGame().GetRoomManager().UnloadRoom(room);
                                    room.RequestReload();
                                }
                            }
                            break;
                        }
                    case "addtoinventory":
                        {
                            uint UserId = Convert.ToUInt32(Params[0]);
                            int ItemId = Convert.ToInt32(Params[1]);
    
                            Client = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
    
                            if (Client != null && Client.GetHabbo() != null && Client.GetHabbo().GetInventoryComponent() != null)
                            {
                                Client.GetHabbo().GetInventoryComponent().UpdateItems(true);
                                Client.GetHabbo().GetInventoryComponent().SendNewItems(ItemId);
                            }
    
                            break;
                        }
                    case "updatecredits":
                        {
                            uint UserId = Convert.ToUInt32(Params[0]);
                            int NewCredits = Convert.ToInt32(Params[1]);
                            Client = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
    
                            if (Client != null && Client.GetHabbo() != null)
                            {
                                Client.GetHabbo().Credits = NewCredits;
                                Client.GetHabbo().UpdateCreditsBalance();
                            }
    
                            break;
                        }
                    case "updatesubscription":
                        {
                            uint UserId = Convert.ToUInt32(Params[0]);
                            int DurationSeconds = Convert.ToInt32(Params[1]);
                            Client = SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                            if (Client != null && Client.GetHabbo() != null)
                            {
                                Client.GetHabbo().GetSubscriptionManager().ReloadSubscription(1, DurationSeconds, Client);
                                Client.GetHabbo().SerializeClub();
                                Client.SendMessage(new ServerMessage(Outgoing.UpdateShop));
                            }
    
                            break;
                        }

  8. #8
    Check http://arcturus.pw The General is offline
    DeveloperRank
    Aug 2011 Join Date
    7,608Posts

    Re: [C#] Mercury EMU MUS - senduser

    Quote Originally Posted by FatalLulz View Post
    So you mean like this?
    Yes. /5char

  9. #9
    R.I.P Millercent FatalLulz is offline
    MemberRank
    Nov 2012 Join Date
    AustraliaLocation
    2,248Posts

    Re: [C#] Mercury EMU MUS - senduser

    Quote Originally Posted by Spot Ify View Post

    gr spotifty @FataLulz
    Yeah thats what I mean that looks much cleaner and better to read and now you just add this code:
    PHP Code:
             case "senduser":
                        {
                            
    uint UserId Convert.ToUInt32(Params[0]);
                            
    int RoomId Convert.ToInt32(Params[1]);

                            
    Client SilverwaveEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                            if (
    Client != null)
                            {
                                
    ServerMessage SendUser = new ServerMessage(Outgoing.RoomForwardMessageComposer);
                                
    SendUser.AppendInt32(RoomId);
                                
    Client.SendMessage(SendUser);
                            }
                        } 
    And then does your Senduser work yeahh

    Gr SpotIfy
    Although it build fine and all once edited, I can't seem to forward to a room. This is the link I use http://127.0.0.1/client?forwardId=2&roomId=1 - and it's not forwarding. I've changed the link, room exists. Not sure what the problem is?

  10. #10
    Check http://arcturus.pw The General is offline
    DeveloperRank
    Aug 2011 Join Date
    7,608Posts

    Re: [C#] Mercury EMU MUS - senduser

    You don't have to use that in combination with MUS command. The client does that by itself aslong as you set a parameter value.

    Thought it was something like:

    Code:
    "forward.type" = 2,
    "forward.id" = <?php echo $_GET['roomId']; ?>
    A socket command will not work as the command has already been send to the server before the client is even loaded and you're logged in.



Advertisement