Check User's Inventory

JayC

Always Learning
Aug 8, 2013
5,493
1,398
If you code something to view their inventory then yes..

Housekeeping would be the *easiest* way to do it...

however I had thought about making a command that allowed you to say :viewinventory {username}
and then opening your inventory and seeing their items and then putting a test in so that if you tried to place or trade the other users item it would say "This is not your inventory".

Never actually attempted - just thought about it.
 

Damien

Don't need glasses if you can C#
Feb 26, 2012
425
638
If you code something to view their inventory then yes..

Housekeeping would be the *easiest* way to do it...

however I had thought about making a command that allowed you to say :viewinventory {username}
and then opening your inventory and seeing their items and then putting a test in so that if you tried to place or trade the other users item it would say "This is not your inventory".

Never actually attempted - just thought about it.
I really liked this idea so I started coding a command for this last night. My main problem was getting the inventory to "update" due to the fact it gets cached. I used the update composers from the catalogue to get it working. Just need to finish reverting the inventory back to your own then I'm done.

I'll make a post for it once I've competed it and I'll give you credits for the idea.
 

Core

Member
Nov 10, 2016
356
138
Here is a command which I just wrote now (not tested but logically should work). It will list all items in inventory and tell you how many of each item they have.

Code:
InventoryComponent Inventory = Room?.GetRoomUserManager()?.GetRoomUserByHabbo(Params[0])?.GetClient()?.GetHabbo()?.GetInventoryComponent();

            if(Inventory == null)
            {
                Session.SendWhisper("User was not found or inventory not initilized.");
                return;
            }

            Dictionary<ItemData, int> _itemCount = new Dictionary<ItemData, int>();

            foreach (Item Itm in Inventory.GetItems)
            {
                if (_itemCount.ContainsKey(Itm.Data))
                {
                    _itemCount[Itm.Data]++;
                }
                else { _itemCount.Add(Itm.Data, 0); }
            }

            StringBuilder Message = new StringBuilder();

            foreach(KeyValuePair<ItemData, int> Itm in _itemCount)
            {
                Message.AppendLine($"[-] {Itm.Key.PublicName} - x{Itm.Value}");
            }

            Session.SendNotification(Message.ToString());
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
Here is a command which I just wrote now (not tested but logically should work). It will list all items in inventory and tell you how many of each item they have.

Code:
InventoryComponent Inventory = Room?.GetRoomUserManager()?.GetRoomUserByHabbo(Params[0])?.GetClient()?.GetHabbo()?.GetInventoryComponent();

            if(Inventory == null)
            {
                Session.SendWhisper("User was not found or inventory not initilized.");
                return;
            }

            Dictionary<ItemData, int> _itemCount = new Dictionary<ItemData, int>();

            foreach (Item Itm in Inventory.GetItems)
            {
                if (_itemCount.ContainsKey(Itm.Data))
                {
                    _itemCount[Itm.Data]++;
                }
                else { _itemCount.Add(Itm.Data, 0); }
            }

            StringBuilder Message = new StringBuilder();

            foreach(KeyValuePair<ItemData, int> Itm in _itemCount)
            {
                Message.AppendLine($"[-] {Itm.Key.PublicName} - x{Itm.Value}");
            }

            Session.SendNotification(Message.ToString());
This is another great way to do it :) Thanks for this release too
 

Damien

Don't need glasses if you can C#
Feb 26, 2012
425
638
You can find a thread I posted in response to this about your question here:
Code:
https://devbest.com/threads/release-command-plusemu-view-inventories.80890/

Make sure to set this and "best Answer".

-Thanks!
 

Users who are viewing this thread

Top