Picking up users furniture

Wolverine

Member
Aug 1, 2014
90
3
Sometimes when I enter a room and users :pickall, it goes into my inventory even though it's not my room.. does anyone know a fix 4 this? to be clear i am not the furniture owner.
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
I believe that command needs rewriting, it does more work than it should.



The issue is mostly line 33, it removes all items but sends to that session.



A couple tweaks and you can send it to the correct user.

Also, I believe this command is wrong, I think the correct use is pickall for the users furniture, and :ejectall for everything else.

Maybe a nicer way to do it would be;

PHP:
public void Execute(GameClients.GameClient session, Rooms.Room room, string[] Params)
{
    if (!room.CheckRights(session, true))
        return;

    foreach (Item item in room.GetRoomItemHandler().GetWallAndFloor.Where(x => x.UserID == room.OwnerId).ToList())
    {
        if (item == null)
            continue;

        room.GetRoomItemHandler().RemoveFurniture(session, item.Id);
        session.GetHabbo().GetInventoryComponent().AddNewItem(item.Id, item.BaseItem, item.ExtraData, item.GroupId, true, true, item.LimitedNo, item.LimitedTot);
        session.GetHabbo().GetInventoryComponent().UpdateItems(false);
    }

    List<Item> Items = room.GetRoomItemHandler().GetWallAndFloor.ToList();
    if (Items.Count > 0)
    {
        session.SendWhisper("Items that belong to other users still exist within this room, use :ejectall to eject them!");
    }

    session.SendPacket(new FurniListUpdateComposer());
}

Eject All could then be seen as;

PHP:
public void Execute(GameClients.GameClient session, Rooms.Room room, string[] Params)
{
    if (session.GetHabbo().Id == room.OwnerId)
    {
        // ehh
        if (!room.CheckRights(session, true))
            return;
      
        foreach (Item item in room.GetRoomItemHandler().GetWallAndFloor.ToList())
        {
            if (item == null)
                continue;

            GameClient client = Environment.GetGame().GetClientManager().GetClientByUserID(item.UserID);
            if (client != null && client.GetHabbo() != null)
            {
                room.GetRoomItemHandler().RemoveFurniture(client, item.Id);
                client.GetHabbo().GetInventoryComponent().AddNewItem(item.Id, item.BaseItem, item.ExtraData, item.GroupId, true, true, item.LimitedNo, item.LimitedTot);
                client.GetHabbo().GetInventoryComponent().UpdateItems(false);
            }
            else
            {
                room.GetRoomItemHandler().RemoveFurniture(null, item.Id);
                using (IQueryAdapter dbClient = Environment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.RunQuery("UPDATE `items` SET `room_id` = '0' WHERE `id` = '" + item.Id + "' LIMIT 1");
                }
            }
        }
    }
    else
    {
        // We're removing our own items only here.
        foreach (Item item in room.GetRoomItemHandler().GetWallAndFloor.Where(x => x.UserID == session.GetHabbo().Id).ToList())
        {
            if (item == null)
                continue;

            room.GetRoomItemHandler().RemoveFurniture(session, item.Id);
            session.GetHabbo().GetInventoryComponent().AddNewItem(item.Id, item.BaseItem, item.ExtraData, item.GroupId, true, true, item.LimitedNo, item.LimitedTot);
            session.GetHabbo().GetInventoryComponent().UpdateItems(false);
        }
    }
}
 

Wolverine

Member
Aug 1, 2014
90
3
I believe that command needs rewriting, it does more work than it should.



The issue is mostly line 33, it removes all items but sends to that session.



A couple tweaks and you can send it to the correct user.

Also, I believe this command is wrong, I think the correct use is pickall for the users furniture, and :ejectall for everything else.

Maybe a nicer way to do it would be;

PHP:
public void Execute(GameClients.GameClient session, Rooms.Room room, string[] Params)
{
    if (!room.CheckRights(session, true))
        return;

    foreach (Item item in room.GetRoomItemHandler().GetWallAndFloor.Where(x => x.UserID == room.OwnerId).ToList())
    {
        if (item == null)
            continue;

        room.GetRoomItemHandler().RemoveFurniture(session, item.Id);
        session.GetHabbo().GetInventoryComponent().AddNewItem(item.Id, item.BaseItem, item.ExtraData, item.GroupId, true, true, item.LimitedNo, item.LimitedTot);
        session.GetHabbo().GetInventoryComponent().UpdateItems(false);
    }

    List<Item> Items = room.GetRoomItemHandler().GetWallAndFloor.ToList();
    if (Items.Count > 0)
    {
        session.SendWhisper("Items that belong to other users still exist within this room, use :ejectall to eject them!");
    }

    session.SendPacket(new FurniListUpdateComposer());
}

Eject All could then be seen as;

PHP:
public void Execute(GameClients.GameClient session, Rooms.Room room, string[] Params)
{
    if (session.GetHabbo().Id == room.OwnerId)
    {
        // ehh
        if (!room.CheckRights(session, true))
            return;
    
        foreach (Item item in room.GetRoomItemHandler().GetWallAndFloor.ToList())
        {
            if (item == null)
                continue;

            GameClient client = Environment.GetGame().GetClientManager().GetClientByUserID(item.UserID);
            if (client != null && client.GetHabbo() != null)
            {
                room.GetRoomItemHandler().RemoveFurniture(client, item.Id);
                client.GetHabbo().GetInventoryComponent().AddNewItem(item.Id, item.BaseItem, item.ExtraData, item.GroupId, true, true, item.LimitedNo, item.LimitedTot);
                client.GetHabbo().GetInventoryComponent().UpdateItems(false);
            }
            else
            {
                room.GetRoomItemHandler().RemoveFurniture(null, item.Id);
                using (IQueryAdapter dbClient = Environment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.RunQuery("UPDATE `items` SET `room_id` = '0' WHERE `id` = '" + item.Id + "' LIMIT 1");
                }
            }
        }
    }
    else
    {
        // We're removing our own items only here.
        foreach (Item item in room.GetRoomItemHandler().GetWallAndFloor.Where(x => x.UserID == session.GetHabbo().Id).ToList())
        {
            if (item == null)
                continue;

            room.GetRoomItemHandler().RemoveFurniture(session, item.Id);
            session.GetHabbo().GetInventoryComponent().AddNewItem(item.Id, item.BaseItem, item.ExtraData, item.GroupId, true, true, item.LimitedNo, item.LimitedTot);
            session.GetHabbo().GetInventoryComponent().UpdateItems(false);
        }
    }
}
What files are these located in?

also i have noticed whoever clicks on the furniture, it says it's theirs,, any reason why that is?
 

Users who are viewing this thread

Top