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());
}
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?I believe that command needs rewriting, it does more work than it should.
You must be registered for see links
The issue is mostly line 33, it removes all items but sends to that session.
You must be registered for see links
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); } } }