Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Releases
Server Releases
Fully Functional Stack Height Command
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Txc" data-source="post: 433955" data-attributes="member: 73856"><p>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</p><p></p><p>Go to habbo.cs and search for "private int _currentRoomId;". Under that put this line</p><p>[CODE]public double ForceHeight;[/CODE]</p><p></p><p>Next go to the folder path HabboHotel>Rooms>Chat>Commands>User and create StackHeightCommand.cs and paste this code into the class</p><p>[CODE]using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Collections.Generic;</p><p>using Plus.Communication.Packets.Outgoing.Inventory.Furni;</p><p>using System.Globalization;</p><p></p><p>namespace Plus.HabboHotel.Rooms.Chat.Commands.User</p><p>{</p><p> class StackHeightCommand : IChatCommand</p><p> {</p><p> public string PermissionRequired</p><p> {</p><p> get</p><p> {</p><p> return "command_stack_height";</p><p> }</p><p> }</p><p> public string Parameters</p><p> {</p><p> get</p><p> {</p><p> return "%message%";</p><p> }</p><p> }</p><p> public string Description</p><p> {</p><p> get</p><p> {</p><p> return "Set the Stack Height.";</p><p> }</p><p> }</p><p> public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)</p><p> {</p><p></p><p> if (!Room.CheckRights(Session, false, false))</p><p> {</p><p> Session.SendNotification("You don't have permission for the command `stack_height`");</p><p> return;</p><p> }</p><p></p><p> RoomUser user = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);</p><p> if (user == null)</p><p> {</p><p> Session.SendNotification("User not found.");</p><p> return;</p><p> }</p><p></p><p></p><p> if (Params.Length < 2)</p><p> {</p><p> Session.SendWhisper("Please enter a numeric value or type ':sh -' to turn it off");</p><p> return;</p><p> }</p><p></p><p> if (Params[1] == "-")</p><p> {</p><p> Session.SendWhisper("Stack Height Disabled");</p><p> Session.GetHabbo().ForceHeight = -1;</p><p> return;</p><p> }</p><p></p><p> double value;</p><p> bool checkIfParsable = Double.TryParse(Params[1], out value);</p><p> if (checkIfParsable == false)</p><p> {</p><p> Session.SendWhisper("Please enter a numeric value or type ':sh -' to turn it off");</p><p> return;</p><p> }</p><p></p><p> </p><p> double HeightValue = Convert.ToDouble(Params[1]);</p><p> if (HeightValue < 0 || HeightValue > 100)</p><p> {</p><p> Session.SendWhisper("Please enter a value between 0 and 100");</p><p> return;</p><p> }</p><p></p><p> Session.GetHabbo().ForceHeight = HeightValue;</p><p> Session.SendWhisper("Stack Height Is: " + Convert.ToString(HeightValue));</p><p> }</p><p> }</p><p>}</p><p>[/CODE]</p><p></p><p>Next go to GetRoomEntryDataEvent and near the bottom add this line</p><p>[CODE] //force the stackheight to be set off by default</p><p> Session.GetHabbo().ForceHeight = -1;[/CODE]</p><p></p><p>Now we make our edits to RoomItemHandler.cs (This is the last class we will be editing)</p><p></p><p>Find this line</p><p>[CODE]// Start calculating new Z coordinate</p><p> Double newZ = _room.GetGameMap().Model.SqFloorHeight[newX, newY];[/CODE]</p><p>Under it add</p><p>[CODE] if (Session.GetHabbo().ForceHeight != -1)</p><p> {</p><p> newZ = Session.GetHabbo().ForceHeight;</p><p> }[/CODE]</p><p>Next find </p><p>[CODE] if (Item.Rotation != newRot && Item.GetX == newX && Item.GetY == newY)</p><p> newZ = Item.GetZ;[/CODE]</p><p>Replace it with this</p><p>[CODE]if (Item.Rotation != newRot && Item.GetX == newX && Item.GetY == newY)</p><p> if (Session.GetHabbo().ForceHeight != -1)</p><p> {</p><p> newZ = Session.GetHabbo().ForceHeight;</p><p> }</p><p> else</p><p> {</p><p> newZ = Item.GetZ;</p><p> }[/CODE]</p><p>Finally find this </p><p>[CODE] // Are there any higher objects in the stack!?</p><p> foreach (Item I in ItemsComplete.ToList())</p><p> {</p><p> if (I == null)</p><p> continue;</p><p> if (I.Id == Item.Id)</p><p> continue;</p><p></p><p> if (I.GetBaseItem().InteractionType == InteractionType.STACKTOOL)</p><p> { </p><p> newZ = I.GetZ;</p><p> break;</p><p> }</p><p> if (I.TotalHeight > newZ)</p><p> {</p><p> newZ = I.TotalHeight;</p><p> }</p><p> }[/CODE]</p><p>Replacing it with this</p><p>[CODE] // Are there any higher objects in the stack!?</p><p> foreach (Item I in ItemsComplete.ToList())</p><p> {</p><p> if (I == null)</p><p> continue;</p><p> if (I.Id == Item.Id)</p><p> continue;</p><p></p><p> if (I.GetBaseItem().InteractionType == InteractionType.STACKTOOL && Session.GetHabbo().ForceHeight == -1)</p><p> { </p><p> newZ = I.GetZ;</p><p> break;</p><p> }</p><p> if (I.TotalHeight > newZ && Session.GetHabbo().ForceHeight != -1)</p><p> {</p><p> newZ = Session.GetHabbo().ForceHeight;</p><p> }</p><p> else if (I.TotalHeight > newZ && Session.GetHabbo().ForceHeight == -1)</p><p> {</p><p> newZ = I.TotalHeight;</p><p> }</p><p> }[/CODE]</p><p></p><p>Don't forget to reference your command the way you want it in commandmanager.cs like one or more of these examples</p><p>[CODE]this.Register("fh", new StackHeightCommand());</p><p> this.Register("sh", new StackHeightCommand());</p><p> this.Register("setsh", new StackHeightCommand());[/CODE]</p><p></p><p>In the database table Permissions_Commands make sure you add the entry for command_stack_height with rank 1 as the default permission.</p><p></p><p>And there you have it, a stack height that works by default requiring no edits to the code I provided. Enjoy!</p></blockquote><p></p>
[QUOTE="Txc, post: 433955, member: 73856"] 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 [CODE]public double ForceHeight;[/CODE] 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)); } } } [/CODE] 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;[/CODE] 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] Under it add [CODE] if (Session.GetHabbo().ForceHeight != -1) { newZ = Session.GetHabbo().ForceHeight; }[/CODE] Next find [CODE] if (Item.Rotation != newRot && Item.GetX == newX && Item.GetY == newY) newZ = Item.GetZ;[/CODE] Replace it with this [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] Finally find this [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] Replacing it with this [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; } }[/CODE] 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());[/CODE] 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! [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
Server Releases
Fully Functional Stack Height Command
Top