HabboEMU - Furniture owner issue

Daltron

Web Developer
Aug 6, 2015
283
152
I will place furniture in a user's room then :unload or even reload the room and it changes the owner name to a different user.
Example:
Room Owner:

My furniture:

After reloading the room:


Any help would be greatly appreciated I desperately need this fixed!
 

Daltron

Web Developer
Aug 6, 2015
283
152
My issue is that when you drop a furni and reload the room it changes the owner of the furniture to the room over do you mean add the permissions?\
@JayCustom
 
Last edited:

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,194
3,901
It could be an issue with the SaveFurniture method, double check if in the emulator to make sure it doesn't update items to the room owner.
 

Daltron

Web Developer
Aug 6, 2015
283
152
Only two instances both are in Room.cs


@Sledmore

______
EDIT
____
I've found this in RoomData.cs

Odd :confused:
 
Last edited:

Damien

Don't need glasses if you can C#
Feb 26, 2012
426
642
The users name not showing up when you place an item in someone elses room a packet structure issue.

Inside ObjectsComposer.cs if you haven't defined all the users who have placed items in the room their usernames wont show up. It should look like this:
fwZdRf4WRTWWgeHl6t6tXQ.png


For the room owner issue. Can you confirm if the owner in the database is actually getting changed and try it on another user, see if the username changes or if it's same. It may be that someone has edited something in the source, that's forcing the user to a set id, or even that set username.
 

Daltron

Web Developer
Aug 6, 2015
283
152
The users name not showing up when you place an item in someone elses room a packet structure issue.

Inside ObjectsComposer.cs if you haven't defined all the users who have placed items in the room their usernames wont show up. It should look like this:
fwZdRf4WRTWWgeHl6t6tXQ.png


For the room owner issue. Can you confirm if the owner in the database is actually getting changed and try it on another user, see if the username changes or if it's same. It may be that someone has edited something in the source, that's forcing the user to a set id, or even that set username.
This is what my class current looks like,

Do you suggest I change it to what you have provided above?

I'm having an issue where it changes furniture owners names when you drop them in other users rooms. For example:
Stan placed a throne in Jessica's room.
Stan reloads the room.
The furniture then changes to Jessica's name.
Then once you click on Jessica's name(in the small furniture box), It shows Stan's profile.
Upon emulator restart the furniture then is able to be picked up by Jessica and placed into her inventory.
Once again any help is greatly appreciated.
 

Damien

Don't need glasses if you can C#
Feb 26, 2012
426
642
Sorry I misread the post. I thought the room owner was changing when you placed furniture too.

If you give me 5mins I'll quickly code something that'll fix your issue and update my post.
 

Damien

Don't need glasses if you can C#
Feb 26, 2012
426
642
inside the ObjectsComposer.cs and ItemsComposer.cs classes add this method:
Code:
private void WriteFurniOwners(Item[] Objects)
{
    Dictionary<int, string> furniOwners = new Dictionary<int, string>();
    foreach (Item Item in Objects)
    {
        if (!furniOwners.ContainsKey(Item.UserID))
            furniOwners.Add(Item.UserID, Item.Username);
    }

    WriteInteger(furniOwners.Count);
    foreach (var furniOwner in furniOwners)
    {
        WriteInteger(furniOwner.Key);
        WriteString(furniOwner.Value);
    }
}


Then replace that first loop with this:
Code:
WriteFurniOwners(Objects);


And it should look something like this:
l7E7okZsTpqq-jB7N2H_Pg.png


This is not the best solution. A better solution would be to create a dictionary in the room class that handles that data and load the data when the items are loaded.
 
Last edited:

Daltron

Web Developer
Aug 6, 2015
283
152
Code:
class ObjectsComposer : ServerPacket
    {
        public ObjectsComposer(Item[] Objects, Room Room)
            : base(ServerPacketHeader.ObjectsMessageComposer)
        {
            base.WriteInteger(1);
            base.WriteInteger(Room.OwnerId);
            base.WriteString(Room.OwnerName);

            List<Item> l = new List<Item>();
            if (Room.HideWired)
            {
                for (int i = 0; i < Objects.Count(); i++)
                {
                    Item it = Objects[i];
                    if (it == null)
                        continue;

                    if (it.IsWired)
                        continue;

                    l.Add(it);
                }
                Objects = l.ToArray();
                base.WriteInteger(Objects.Length);
                for (int i = 0; i < Objects.Count(); i++)
                {
                    Item Item = Objects[i];
                    WriteFloorItem(Item, Convert.ToInt32(Item.UserID));
                }
            }
            else
            {
                base.WriteInteger(Objects.Length);
                for (int i = 0; i < Objects.Count(); i++)
                {
                    Item Item = Objects[i];
                    WriteFloorItem(Item, Convert.ToInt32(Item.UserID));
                }
            }
        }

        private void WriteFurniOwners(Item[] Objects)
        {
            Dictionary<int, string> furniOwners = new Dictionary<int, string>();
            foreach (Item Item in Objects)
            {
                if (!furniOwners.ContainsKey(Item.UserID))
                    furniOwners.Add(Item.UserID, Item.Username);
            }

            WriteInteger(furniOwners.Count);
            foreach (var furniOwner in furniOwners)
            {
                WriteInteger(furniOwner.Key);
                WriteString(furniOwner.Value);
            }
        }

I must be writing it wrong, How do I replace the first loop so it doesn't mess up my HideWired command?
@Damien
My entire class is below.
C#:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

using Emulator.Utilities;
using Emulator.HabboHotel.Rooms;
using Emulator.HabboHotel.Items;
using Emulator.HabboHotel.Groups;
using Emulator.HabboHotel.Users;

namespace Emulator.Communication.Packets.Outgoing.Rooms.Engine
{
    class ObjectsComposer : ServerPacket
    {
        public ObjectsComposer(Item[] Objects, Room Room)
            : base(ServerPacketHeader.ObjectsMessageComposer)
        {
            base.WriteInteger(1);
            base.WriteInteger(Room.OwnerId);
            base.WriteString(Room.OwnerName);

            List<Item> l = new List<Item>();
            if (Room.HideWired)
            {
                for (int i = 0; i < Objects.Count(); i++)
                {
                    Item it = Objects[i];
                    if (it == null)
                        continue;

                    if (it.IsWired)
                        continue;

                    l.Add(it);
                }
                Objects = l.ToArray();
                base.WriteInteger(Objects.Length);
                for (int i = 0; i < Objects.Count(); i++)
                {
                    Item Item = Objects[i];
                    WriteFloorItem(Item, Convert.ToInt32(Item.UserID));
                }
            }
            else
            {
                base.WriteInteger(Objects.Length);
                for (int i = 0; i < Objects.Count(); i++)
                {
                    Item Item = Objects[i];
                    WriteFloorItem(Item, Convert.ToInt32(Item.UserID));
                }
            }
        }

        private void WriteFurniOwners(Item[] Objects)
        {
            Dictionary<int, string> furniOwners = new Dictionary<int, string>();
            foreach (Item Item in Objects)
            {
                if (!furniOwners.ContainsKey(Item.UserID))
                    furniOwners.Add(Item.UserID, Item.Username);
            }

            WriteInteger(furniOwners.Count);
            foreach (var furniOwner in furniOwners)
            {
                WriteInteger(furniOwner.Key);
                WriteString(furniOwner.Value);
            }
        }

        private void WriteFloorItem(Item Item, int UserID)
        {
            base.WriteInteger(Item.Id);
            base.WriteInteger(Item.GetBaseItem().SpriteId);
            base.WriteInteger(Item.GetX);
            base.WriteInteger(Item.GetY);
            base.WriteInteger(Item.Rotation);
            base.WriteString(String.Format("{0:0.00}", TextHandling.GetString(Item.GetZ)));
            base.WriteString(String.Empty);

            if (Item.LimitedNo > 0)
            {
                base.WriteInteger(1);
                base.WriteInteger(256);
                base.WriteString(Item.ExtraData);
                base.WriteInteger(Item.LimitedNo);
                base.WriteInteger(Item.LimitedTot);
            }
            else if (Item.Data.InteractionType == InteractionType.FX_PROVIDER)
            {
                base.WriteInteger(0);
                base.WriteInteger(1);
                base.WriteInteger(1);
                base.WriteString("effectId");
                base.WriteString(Item.ExtraData);
            }
            else if (Item.Data.InteractionType == InteractionType.PINATA)
            {
                base.WriteInteger(0);
                base.WriteInteger(7);
                base.WriteString("6");
                if (Item.ExtraData.Length <= 0) base.WriteInteger(0);
                else base.WriteInteger(int.Parse(Item.ExtraData));
                base.WriteInteger(100);
            }
            else if (Item.Data.InteractionType == InteractionType.PINATATRIGGERED)
            {
                base.WriteInteger(0);
                base.WriteInteger(7);  // miran2 grafic xq no c acuerda xdddddd kva men xDDDDDDDD esk me mandaron un guasap menju eeeer xqude popddddduddddddddddddddddxdd
                base.WriteString("0");
                if (Item.ExtraData.Length <= 0) base.WriteInteger(0);
                else base.WriteInteger(int.Parse(Item.ExtraData));
                base.WriteInteger(1);
            }
            else if (Item.Data.InteractionType == InteractionType.MAGICEGG)
            {
                base.WriteInteger(0);
                base.WriteInteger(7);
                base.WriteString(Item.ExtraData);
                if (Item.ExtraData.Length <= 0)
                {
                    base.WriteInteger(0);
                }
                else
                {
                    base.WriteInteger(int.Parse(Item.ExtraData));
                }
                base.WriteInteger(23);
            }
            else if (Item.Data.InteractionType == InteractionType.MAGICCHEST)
            {
                base.WriteInteger(0);
                base.WriteInteger(7);
                base.WriteString(Item.ExtraData);
                if (Item.ExtraData.Length <= 0)
                {
                    base.WriteInteger(0);
                }
                else
                {
                    base.WriteInteger(int.Parse(Item.ExtraData));
                }
                base.WriteInteger(1);
            }
            else
            {
                ItemBehaviourUtility.GenerateExtradata(Item, this);
            }

            base.WriteInteger(-1); // to-do: check
            base.WriteInteger((Item.GetBaseItem().Modes > 1) ? 1 : 0);
            base.WriteInteger(UserID);
        }
    }
}
 

moso

Member
Mar 1, 2019
43
5
Hello I am french I use yezzemulator I have the same worries I do not understand too much you can help me by discord please? My discord: moso#7385
@Damien @Hxmada

Problem resolved thanks u Hxmada :p
 
Last edited:

Users who are viewing this thread

Top