[Plus Emulator] Better Stack Height Command

Jaden

not so active
Aug 24, 2014
886
263
The way it was implemented on it's release followed many bad practice methods, so I'll just release mine from a while back cause y not?

(I put it in a folder called Builder under the namespace Plus.HabboHotel.Roleplay.Commands.Builder just change that to where the files you create are located.)

SetStackHeightCommand.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Plus.HabboHotel.GameClients;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Rooms.Chat.Commands;

namespace Plus.HabboHotel.Roleplay.Commands.Builder
{
    internal sealed class SetStackHeightCommand : IChatCommand
    {
        public string PermissionRequired => "";
        public string Parameters => "%height%";
        public string Description => "something.";

        public void Execute(GameClient session, Room room, string[] Params)
        {
            if (Params.Length == 1)
                return;
            
            if (!double.TryParse(Params[1], out session.GetHabbo().StackHeight))
                session.SendWhisper("Please enter a valid integer or double value.");
        }
    }
}

ClearStackHeightCommand.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Plus.HabboHotel.GameClients;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Rooms.Chat.Commands;

namespace Plus.HabboHotel.Roleplay.Commands.Builder
{
    internal sealed class ClearStackHeightCommand : IChatCommand
    {
        public string PermissionRequired => "";
        public string Parameters => "";
        public string Description => "something.";

        public void Execute(GameClient session, Room room, string[] Params)
        {
            session.GetHabbo().StackHeight = 0;
        }
    }
}

Add in the Register function corresponding to the folder you put it in.
Code:
Register("setsh", new SetStackHeightCommand());
Register("clearsh", new ClearStackHeightCommand());

Anywhere in your Habbo.cs (Habbo class)
Code:
public double StackHeight;

Find in your RoomItemHandling.cs
Code:
Double newZ = _room.GetGameMap().Model.SqFloorHeight[newX, newY];

Add under it
Code:
if (Math.Abs(Session.GetHabbo().StackHeight) > Math.Pow(1, -9))
            newZ = Session.GetHabbo().StackHeight;

Debug/compile and then you're set.
 

MasterJiq

Member
Jul 8, 2016
385
23
For the newbies that wan't to add this command,

replace this
Code:
namespace Plus.HabboHotel.Roleplay.Commands.Builder
with this:
Code:
namespace Plus.HabboHotel.Rooms.Chat.Commands.Administrator

Thanks.
 

Fume

wag1 piff ting
Dec 4, 2014
172
33
Get this error when trying to debug:
fI-PI4AgSOal3vFtNvkvNg.png

It's saying the '=>' is expecting a ';'
 

Brad

Well-Known Member
Jun 5, 2012
2,320
993
Good release, but it could be done even better. Also why use 2 commands When you could just do
Code:
 if (Params.Length < 2)
            {
                if (user.BuildHeight >= 0)
                {
                    Session.SendWhisper("Stack height has been reset.");
                    user.BuildHeight = -1;
                    return;
                }
                else
                {
                    Session.SendNotification("Invalid input.");
                    return;
                }
            }
 
Feb 27, 2013
140
70
This still has a few issues with it.
1. It doesn't tell the user what they set their stack height to so if they forget they'll just have to keep repeatedly testing and remember what height they set things to.
2. You can't use decimals and it also seems like :setsh 1 doesn't work
3. When you go to place furni on the same tile as another piece of furniture the height of the other piece of furniture overrides the stackheight
The code is really clean though.
 

Jaden

not so active
Aug 24, 2014
886
263
This still has a few issues with it.
1. It doesn't tell the user what they set their stack height to so if they forget they'll just have to keep repeatedly testing and remember what height they set things to.
2. You can't use decimals and it also seems like :setsh 1 doesn't work
3. When you go to place furni on the same tile as another piece of furniture the height of the other piece of furniture overrides the stackheight
The code is really clean though.
Hmm, are you sure you didn't change the datatype value from a double to something else? Decimals worked fine for me.

Idk what to tell you about all that other stuff, this command was only made to get the job done.
 

Txc

Member
Jan 26, 2017
84
45
The problem is it doesn't force the object to sit at the height it was set to, whilst ignoring the properties of the surrounding objects. Other than that the command works as long as the objects don't collide it seems.
 

chiefqueef

gooby pls
Jan 8, 2012
404
104
Hey i followed this tutorial and this is what i get? ive added it the exact same way as the set command n that seems to work fine :S
 

Marko97

M97 Project based Plus EMU
Aug 7, 2013
99
45
Get this error when trying to debug:
fI-PI4AgSOal3vFtNvkvNg.png

It's saying the '=>' is expecting a ';'

Use this:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Plus.HabboHotel.GameClients;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Rooms.Chat.Commands;

namespace Plus.HabboHotel.Rooms.Chat.Commands.User
{
    internal sealed class SetStackHeightCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_stack"; }
        }

        public string Parameters
        {
            get { return ""; }
        }

        public string Description
        {
            get { return "Sh command."; }
        }

        public void Execute(GameClient session, Room room, string[] Params)
        {
            if (Params.Length == 1)
                return;

            if (!double.TryParse(Params[1], out session.GetHabbo().StackHeight))
                session.SendWhisper("Invalid value.", 34);
        }
    }
}

PS: Insert this code in HabboHotel/Rooms/Chat/Commands/User/SetStackHeightCommand.cs
 
I've found a bug in this command.
If you insert this, the ball 1 tile not work.

The problematic code is:
Code:
            if (Math.Abs(Session.GetHabbo().StackHeight) > Math.Pow(1, -9))
            {
                newZ = Session.GetHabbo().StackHeight;
            }
 

habbotep

New Member
Apr 13, 2017
11
0
Yes! Its true, not working when the height is 0.1, 0.2, 0.3 etc, only work when the height its >= to 1.1,
Then, when the height is >= to 1.1 then puts really the height to 0.1
I don't understand!
Help!
Sorry but my bad English.

I use Plus EMU R2 *****.
 
Feb 27, 2013
140
70
Yes! Its true, not working when the height is 0.1, 0.2, 0.3 etc, only work when the height its >= to 1.1,
Then, when the height is >= to 1.1 then puts really the height to 0.1
I don't understand!
Help!
Sorry but my bad English.

I use Plus EMU R2 *****.
I've used this before and it didn't have the greatest of functionality. The publisher only released 1 version and didn't fix the problems in this thread.

I'd suggest downloading an emulator from the public releases and just ripping one of their stack height commands (don't worry, the release you steal it from probably stole it from someone else, this is the RETRO community)

Hope that helps.
 

habbotep

New Member
Apr 13, 2017
11
0
I've used this before and it didn't have the greatest of functionality. The publisher only released 1 version and didn't fix the problems in this thread.

I'd suggest downloading an emulator from the public releases and just ripping one of their stack height commands (don't worry, the release you steal it from probably stole it from someone else, this is the RETRO community)

Hope that helps.

Can you put the code here, please?

Thank
 

Users who are viewing this thread

Top