Txc
Member
- Jan 26, 2017
- 84
- 45
Hey devbest, today I'm finally releasing a command that everyone should have coded into their emulators. It's more or less essential for building on a hotel because everyone complains about stacktiles. As well as a lot of people have the buggy versions of stackheight coded into your emulators, so I'll bring you mine
Go to habbo.cs and search for "private int _currentRoomId;". Under that put this line
Next go to the folder path HabboHotel>Rooms>Chat>Commands>User and create StackHeightCommand.cs and paste this code into the class
Next go to GetRoomEntryDataEvent and near the bottom add this line
Now we make our edits to RoomItemHandler.cs (This is the last class we will be editing)
Find this line
Under it add
Next find
Replace it with this
Finally find this
Replacing it with this
Don't forget to reference your command the way you want it in commandmanager.cs like one or more of these examples
In the database table Permissions_Commands make sure you add the entry for command_stack_height with rank 1 as the default permission.
And there you have it, a stack height that works by default requiring no edits to the code I provided. Enjoy!
Go to habbo.cs and search for "private int _currentRoomId;". Under that put this line
Code:
public double ForceHeight;
Next go to the folder path HabboHotel>Rooms>Chat>Commands>User and create StackHeightCommand.cs and paste this code into the class
Code:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Plus.Communication.Packets.Outgoing.Inventory.Furni;
using System.Globalization;
namespace Plus.HabboHotel.Rooms.Chat.Commands.User
{
class StackHeightCommand : IChatCommand
{
public string PermissionRequired
{
get
{
return "command_stack_height";
}
}
public string Parameters
{
get
{
return "%message%";
}
}
public string Description
{
get
{
return "Set the Stack Height.";
}
}
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
{
if (!Room.CheckRights(Session, false, false))
{
Session.SendNotification("You don't have permission for the command `stack_height`");
return;
}
RoomUser user = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (user == null)
{
Session.SendNotification("User not found.");
return;
}
if (Params.Length < 2)
{
Session.SendWhisper("Please enter a numeric value or type ':sh -' to turn it off");
return;
}
if (Params[1] == "-")
{
Session.SendWhisper("Stack Height Disabled");
Session.GetHabbo().ForceHeight = -1;
return;
}
double value;
bool checkIfParsable = Double.TryParse(Params[1], out value);
if (checkIfParsable == false)
{
Session.SendWhisper("Please enter a numeric value or type ':sh -' to turn it off");
return;
}
double HeightValue = Convert.ToDouble(Params[1]);
if (HeightValue < 0 || HeightValue > 100)
{
Session.SendWhisper("Please enter a value between 0 and 100");
return;
}
Session.GetHabbo().ForceHeight = HeightValue;
Session.SendWhisper("Stack Height Is: " + Convert.ToString(HeightValue));
}
}
}
Next go to GetRoomEntryDataEvent and near the bottom add this line
Code:
//force the stackheight to be set off by default
Session.GetHabbo().ForceHeight = -1;
Now we make our edits to RoomItemHandler.cs (This is the last class we will be editing)
Find this line
Code:
// Start calculating new Z coordinate
Double newZ = _room.GetGameMap().Model.SqFloorHeight[newX, newY];
Code:
if (Session.GetHabbo().ForceHeight != -1)
{
newZ = Session.GetHabbo().ForceHeight;
}
Code:
if (Item.Rotation != newRot && Item.GetX == newX && Item.GetY == newY)
newZ = Item.GetZ;
Code:
if (Item.Rotation != newRot && Item.GetX == newX && Item.GetY == newY)
if (Session.GetHabbo().ForceHeight != -1)
{
newZ = Session.GetHabbo().ForceHeight;
}
else
{
newZ = Item.GetZ;
}
Code:
// Are there any higher objects in the stack!?
foreach (Item I in ItemsComplete.ToList())
{
if (I == null)
continue;
if (I.Id == Item.Id)
continue;
if (I.GetBaseItem().InteractionType == InteractionType.STACKTOOL)
{
newZ = I.GetZ;
break;
}
if (I.TotalHeight > newZ)
{
newZ = I.TotalHeight;
}
}
Code:
// Are there any higher objects in the stack!?
foreach (Item I in ItemsComplete.ToList())
{
if (I == null)
continue;
if (I.Id == Item.Id)
continue;
if (I.GetBaseItem().InteractionType == InteractionType.STACKTOOL && Session.GetHabbo().ForceHeight == -1)
{
newZ = I.GetZ;
break;
}
if (I.TotalHeight > newZ && Session.GetHabbo().ForceHeight != -1)
{
newZ = Session.GetHabbo().ForceHeight;
}
else if (I.TotalHeight > newZ && Session.GetHabbo().ForceHeight == -1)
{
newZ = I.TotalHeight;
}
}
Don't forget to reference your command the way you want it in commandmanager.cs like one or more of these examples
Code:
this.Register("fh", new StackHeightCommand());
this.Register("sh", new StackHeightCommand());
this.Register("setsh", new StackHeightCommand());
In the database table Permissions_Commands make sure you add the entry for command_stack_height with rank 1 as the default permission.
And there you have it, a stack height that works by default requiring no edits to the code I provided. Enjoy!