[PLUS] FloorPlanEditorRoomProperties fix with the 2x2 tiles

Jerry

not rly active lol
Jul 8, 2013
1,957
522
Hi,

I'm not sure if anyone has really bothered to fix this, but on retros using Plus Emulator (including Habboon) when you open the floorplan editor, the floorplan model doesn't prevent you from removing tiles/making tiles higher when 2x2 furniture are placed.

Here's an example of a messy floorplan map with 2x2 furniture placed in a room:
You must be registered for see images attach


To fix this, go to the FloorPlanEditorRoomPropertiesEvent.cs file and replace everything with:
Code:
using System.Linq;
using System.Collections.Generic;

using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Items;
using Plus.Communication.Packets.Outgoing.Rooms.FloorPlan;
using Plus.Communication.Packets.Outgoing.Rooms.Engine;
using System.Drawing;

namespace Plus.Communication.Packets.Incoming.Rooms.FloorPlan
{
    class FloorPlanEditorRoomPropertiesEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
                return;

            Room Room = Session.GetHabbo().CurrentRoom;
            if (Room == null)
                return;
           
            if (Room.GetGameMap().Model == null)
                return;

            List<Point> Squares = new List<Point>();
            Room.GetRoomItemManager().GetFloor.ToList().ForEach(Item =>
            {
                Item.GetCoords.ForEach(Point =>
                {
                    if (!Squares.Contains(Point))
                        Squares.Add(Point);
                });
            });

            Session.SendPacket(new FloorPlanFloorMapComposer(Squares));
            Session.SendPacket(new FloorPlanSendDoorComposer(Room.GetGameMap().Model.DoorX, Room.GetGameMap().Model.DoorY, Room.GetGameMap().Model.DoorOrientation));
            Session.SendPacket(new RoomVisualizationSettingsComposer(Room.WallThickness, Room.FloorThickness, PlusEnvironment.EnumToBool(Room.Hidewall.ToString())));

            Squares.Clear();
            Squares = null;
        }
    }
}

After that, compile changes and your floorplan editor should look like this with 2x2 furniture placed in the room:
You must be registered for see images attach


That's it!
 

Txc

Member
Jan 26, 2017
84
45
What edits did you make to the corresponding server packet?

also I know someone's gonna come across this error so I may as well state it now to avoid 10 pointless thread replies. In default Plus the line
"Room.GetRoomItemManager().GetFloor.ToList().ForEach(Item =>"
should be
"Room.GetRoomItemHandler().GetFloor.ToList().ForEach(Item =>"
 

Bjork

Member
Feb 7, 2012
73
29
The code isn't complete. The code inside FloorPlanFloorMapComposer needs to be edited aswell.
 

Bjork

Member
Feb 7, 2012
73
29
You gotta change it from Item to Point lol

Yes but 75%+ here doesn't know what to change so it's useless. When you make a tutorial, you make it complete.

Here is the piece of missing code:

FloorPlanFloorMapComposer.cs

Code:
class FloorPlanFloorMapComposer : ServerPacket
    {
        public FloorPlanFloorMapComposer(List<Point> Items)
            : base(ServerPacketHeader.FloorPlanFloorMapMessageComposer)
        {
            base.WriteInteger(Items.Count);
            foreach (Point Item in Items.ToList())
            {
                base.WriteInteger(Item.X);
                base.WriteInteger(Item.Y);
            }
        }
    }
 

Users who are viewing this thread

Top