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.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.
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 tooHere 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());