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 Q&A
Picking up users furniture
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="Sledmore" data-source="post: 428281" data-attributes="member: 591"><p>I believe that command needs rewriting, it does more work than it should.</p><p></p><p><a href="https://github.com/Sledmore/PlusEMU/blob/master/HabboHotel/Rooms/Chat/Commands/User/PickAllCommand.cs#L33" target="_blank">https://github.com/Sledmore/PlusEMU/blob/master/HabboHotel/Rooms/Chat/Commands/User/PickAllCommand.cs#L33</a></p><p></p><p>The issue is mostly line 33, it removes all items but sends to that session.</p><p></p><p><a href="https://github.com/Sledmore/PlusEMU/blob/master/HabboHotel/Rooms/RoomItemHandling.cs#L856" target="_blank">https://github.com/Sledmore/PlusEMU/blob/master/HabboHotel/Rooms/RoomItemHandling.cs#L856</a></p><p></p><p>A couple tweaks and you can send it to the correct user.</p><p></p><p><strong>Also, I believe this command is wrong, I think the correct use is pickall for the users furniture, and :ejectall for everything else.</strong></p><p></p><p>Maybe a nicer way to do it would be;</p><p></p><p>[PHP]</p><p>public void Execute(GameClients.GameClient session, Rooms.Room room, string[] Params)</p><p>{</p><p> if (!room.CheckRights(session, true))</p><p> return;</p><p></p><p> foreach (Item item in room.GetRoomItemHandler().GetWallAndFloor.Where(x => x.UserID == room.OwnerId).ToList())</p><p> {</p><p> if (item == null)</p><p> continue;</p><p></p><p> room.GetRoomItemHandler().RemoveFurniture(session, item.Id);</p><p> session.GetHabbo().GetInventoryComponent().AddNewItem(item.Id, item.BaseItem, item.ExtraData, item.GroupId, true, true, item.LimitedNo, item.LimitedTot);</p><p> session.GetHabbo().GetInventoryComponent().UpdateItems(false);</p><p> }</p><p></p><p> List<Item> Items = room.GetRoomItemHandler().GetWallAndFloor.ToList();</p><p> if (Items.Count > 0)</p><p> {</p><p> session.SendWhisper("Items that belong to other users still exist within this room, use :ejectall to eject them!");</p><p> }</p><p></p><p> session.SendPacket(new FurniListUpdateComposer());</p><p>}</p><p>[/PHP]</p><p></p><p>Eject All could then be seen as;</p><p></p><p>[PHP]</p><p>public void Execute(GameClients.GameClient session, Rooms.Room room, string[] Params)</p><p>{</p><p> if (session.GetHabbo().Id == room.OwnerId)</p><p> {</p><p> // ehh</p><p> if (!room.CheckRights(session, true))</p><p> return;</p><p> </p><p> foreach (Item item in room.GetRoomItemHandler().GetWallAndFloor.ToList())</p><p> {</p><p> if (item == null)</p><p> continue;</p><p></p><p> GameClient client = Environment.GetGame().GetClientManager().GetClientByUserID(item.UserID);</p><p> if (client != null && client.GetHabbo() != null)</p><p> {</p><p> room.GetRoomItemHandler().RemoveFurniture(client, item.Id);</p><p> client.GetHabbo().GetInventoryComponent().AddNewItem(item.Id, item.BaseItem, item.ExtraData, item.GroupId, true, true, item.LimitedNo, item.LimitedTot);</p><p> client.GetHabbo().GetInventoryComponent().UpdateItems(false);</p><p> }</p><p> else</p><p> {</p><p> room.GetRoomItemHandler().RemoveFurniture(null, item.Id);</p><p> using (IQueryAdapter dbClient = Environment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> dbClient.RunQuery("UPDATE `items` SET `room_id` = '0' WHERE `id` = '" + item.Id + "' LIMIT 1");</p><p> }</p><p> }</p><p> }</p><p> }</p><p> else</p><p> {</p><p> // We're removing our own items only here.</p><p> foreach (Item item in room.GetRoomItemHandler().GetWallAndFloor.Where(x => x.UserID == session.GetHabbo().Id).ToList())</p><p> {</p><p> if (item == null)</p><p> continue;</p><p></p><p> room.GetRoomItemHandler().RemoveFurniture(session, item.Id);</p><p> session.GetHabbo().GetInventoryComponent().AddNewItem(item.Id, item.BaseItem, item.ExtraData, item.GroupId, true, true, item.LimitedNo, item.LimitedTot);</p><p> session.GetHabbo().GetInventoryComponent().UpdateItems(false);</p><p> }</p><p> }</p><p>}[/PHP]</p></blockquote><p></p>
[QUOTE="Sledmore, post: 428281, member: 591"] I believe that command needs rewriting, it does more work than it should. [URL]https://github.com/Sledmore/PlusEMU/blob/master/HabboHotel/Rooms/Chat/Commands/User/PickAllCommand.cs#L33[/URL] The issue is mostly line 33, it removes all items but sends to that session. [URL]https://github.com/Sledmore/PlusEMU/blob/master/HabboHotel/Rooms/RoomItemHandling.cs#L856[/URL] A couple tweaks and you can send it to the correct user. [B]Also, I believe this command is wrong, I think the correct use is pickall for the users furniture, and :ejectall for everything else.[/B] 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()); } [/PHP] 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); } } }[/PHP] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Picking up users furniture
Top