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 Releases
Server Releases
[RELEASE] [COMMAND] [PlusEMU] View Inventories
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="Damien" data-source="post: 392413" data-attributes="member: 72299"><p>This is a command I coded as a response to a help thread that was posted a few days ago which can be found <a href="https://devbest.com/threads/check-users-inventory.80847/" target="_blank">here</a>!</p><p></p><p>The command enables you to view other players inventories through your own, while making sure items can't be placed, traded and exchanged in the marketplace. The idea for this command came from [USER=36373]@JayCustom[/USER], so all credits go to him for this. Enjoy!</p><p></p><p>Image:</p><p>[SPOILER]</p><p><img src="http://g.recordit.co/8Y0HlHCrPC.gif" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p>[/SPOILER]</p><p></p><p>Firstly create a new command and name the file "ViewInventoryCommand.cs" and copy and paste this code into the file:</p><p>[CODE]</p><p>using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Collections.Generic;</p><p></p><p>using Plus.HabboHotel.GameClients;</p><p>using Plus.Communication.Packets.Outgoing.Inventory.Furni;</p><p></p><p>namespace Plus.HabboHotel.Rooms.Chat.Commands.Administrator</p><p>{</p><p> class ViewInventoryCommand : IChatCommand</p><p> {</p><p> public string PermissionRequired</p><p> {</p><p> get { return "command_viewinventory"; }</p><p> }</p><p></p><p> public string Parameters</p><p> {</p><p> get { return ""; }</p><p> }</p><p></p><p> public string Description</p><p> {</p><p> get { return ""; }</p><p> }</p><p></p><p> public void Execute(GameClient Session, Room Room, string[] Params)</p><p> {</p><p> if (Session.GetHabbo().ViewInventory)</p><p> {</p><p> Session.SendMessage(new FurniListComposer(Session.GetHabbo().GetInventoryComponent().GetFloorItems().ToList(), Session.GetHabbo().GetInventoryComponent().GetWallItems()));</p><p> Session.GetHabbo().ViewInventory = false;</p><p> Session.SendWhisper("Inventory reverted back to your own.");</p><p> return;</p><p> }</p><p></p><p> if (Params.Length == 1)</p><p> {</p><p> Session.SendWhisper("Please enter the username of the user you'd like to check inventory.");</p><p> return;</p><p> }</p><p></p><p> GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);</p><p> if (TargetClient == null)</p><p> {</p><p> Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");</p><p> return;</p><p> }</p><p></p><p> if (TargetClient.GetHabbo() == null)</p><p> {</p><p> Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");</p><p> return;</p><p> }</p><p> </p><p> Session.SendMessage(new FurniListComposer(TargetClient.GetHabbo().GetInventoryComponent().GetFloorItems().ToList(), TargetClient.GetHabbo().GetInventoryComponent().GetWallItems(), true));</p><p> Session.GetHabbo().ViewInventory = true;</p><p></p><p> Session.SendWhisper("Next time you open your inventory you'll see " + TargetClient.GetHabbo().Username + "'s inventory.");</p><p> }</p><p> }</p><p>}</p><p>[/CODE]</p><p></p><p></p><p>Inside CommandManager.cs add these commands aswell as any variations of your choosing:</p><p>[CODE]</p><p>this._commands.Add("viewinventory", new ViewInventoryCommand());</p><p> this._commands.Add("inv", new ViewInventoryCommand());</p><p>[/CODE]</p><p></p><p></p><p>Inside FurniListComposer.cs, replace the code with this:</p><p>[CODE]</p><p>using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Collections.Generic;</p><p></p><p>using Plus.HabboHotel.Items;</p><p>using Plus.HabboHotel.Groups;</p><p>using Plus.HabboHotel.Users;</p><p>using Plus.HabboHotel.Catalog.Utilities;</p><p></p><p>namespace Plus.Communication.Packets.Outgoing.Inventory.Furni</p><p>{</p><p> class FurniListComposer : ServerPacket</p><p> {</p><p> public FurniListComposer(List<Item> Items, ICollection<Item> Walls, bool StaffCheck = false)</p><p> : base(ServerPacketHeader.FurniListMessageComposer)</p><p> {</p><p> base.WriteInteger(1);</p><p> base.WriteInteger(1);</p><p></p><p> base.WriteInteger(Items.Count + Walls.Count);</p><p> foreach (Item Item in Items.ToList())</p><p> WriteItem(Item, StaffCheck);</p><p></p><p> foreach (Item Item in Walls.ToList())</p><p> WriteItem(Item, StaffCheck);</p><p> }</p><p></p><p> private void WriteItem(Item Item, bool StaffCheck)</p><p> {</p><p> base.WriteInteger(Item.Id);</p><p> base.WriteString(Item.GetBaseItem().Type.ToString().ToUpper());</p><p> base.WriteInteger(Item.Id);</p><p> base.WriteInteger(Item.GetBaseItem().SpriteId);</p><p> ItemBehaviourUtility.GenerateExtradata(Item, this);</p><p> base.WriteBoolean(StaffCheck ? false : Item.GetBaseItem().AllowEcotronRecycle);</p><p> base.WriteBoolean(StaffCheck ? false : Item.GetBaseItem().AllowTrade);</p><p> base.WriteBoolean(Item.LimitedNo == 0 ? Item.GetBaseItem().AllowInventoryStack : false);</p><p> base.WriteBoolean(StaffCheck ? false : ItemUtility.IsRare(Item));</p><p> base.WriteInteger(-1);//Seconds to expiration.</p><p> base.WriteBoolean(true);</p><p> base.WriteInteger(-1);//Item RoomId</p><p></p><p> if (!Item.IsWallItem)</p><p> {</p><p> base.WriteString(string.Empty);</p><p> base.WriteInteger(0);</p><p> }</p><p> }</p><p> }</p><p>}</p><p>[/CODE]</p><p>This is what stops the user, trading; selling or recycling any of the other users items.</p><p></p><p></p><p>Inside PlaceObjectEvent.cs under this line:</p><p>[CODE]</p><p>if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)</p><p> return;</p><p>[/CODE]</p><p></p><p></p><p>Add this segment of code:</p><p>[CODE]</p><p>if (Session.GetHabbo().ViewInventory)</p><p> {</p><p> Session.SendMessage(new RoomNotificationComposer("furni_placement_error", "message", "This item doesn't belong to you. Are you currently viewing someone elses inventory?"));</p><p> return;</p><p> }</p><p>[/CODE]</p><p></p><p></p><p>In Habbo.cs at the top add this:</p><p>[CODE]</p><p>private bool _ViewInventory;</p><p>[/CODE]</p><p></p><p></p><p>Also in Habbo.cs in the Habbo method add this:</p><p>[CODE]</p><p>this._ViewInventory = false;</p><p>[/CODE]</p><p></p><p></p><p>Finally in Habbo.cs at the bottom add this:</p><p>[CODE]</p><p>public bool ViewInventory</p><p> {</p><p> get { return this._ViewInventory; }</p><p> set { this._ViewInventory = value; }</p><p> }</p><p>[/CODE]</p><p></p><p>And there you have it, if I've missed anything please post a comment bellow and I'll add it to the thread.</p><p>[USER=72653]@GuruGuru[/USER], [USER=36373]@JayCustom[/USER], [USER=72270]@Core[/USER].</p></blockquote><p></p>
[QUOTE="Damien, post: 392413, member: 72299"] This is a command I coded as a response to a help thread that was posted a few days ago which can be found [URL='https://devbest.com/threads/check-users-inventory.80847/']here[/URL]! The command enables you to view other players inventories through your own, while making sure items can't be placed, traded and exchanged in the marketplace. The idea for this command came from [USER=36373]@JayCustom[/USER], so all credits go to him for this. Enjoy! Image: [SPOILER] [IMG]http://g.recordit.co/8Y0HlHCrPC.gif[/IMG] [/SPOILER] Firstly create a new command and name the file "ViewInventoryCommand.cs" and copy and paste this code into the file: [CODE] using System; using System.Linq; using System.Text; using System.Collections.Generic; using Plus.HabboHotel.GameClients; using Plus.Communication.Packets.Outgoing.Inventory.Furni; namespace Plus.HabboHotel.Rooms.Chat.Commands.Administrator { class ViewInventoryCommand : IChatCommand { public string PermissionRequired { get { return "command_viewinventory"; } } public string Parameters { get { return ""; } } public string Description { get { return ""; } } public void Execute(GameClient Session, Room Room, string[] Params) { if (Session.GetHabbo().ViewInventory) { Session.SendMessage(new FurniListComposer(Session.GetHabbo().GetInventoryComponent().GetFloorItems().ToList(), Session.GetHabbo().GetInventoryComponent().GetWallItems())); Session.GetHabbo().ViewInventory = false; Session.SendWhisper("Inventory reverted back to your own."); return; } if (Params.Length == 1) { Session.SendWhisper("Please enter the username of the user you'd like to check inventory."); return; } GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient == null) { Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online."); return; } if (TargetClient.GetHabbo() == null) { Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online."); return; } Session.SendMessage(new FurniListComposer(TargetClient.GetHabbo().GetInventoryComponent().GetFloorItems().ToList(), TargetClient.GetHabbo().GetInventoryComponent().GetWallItems(), true)); Session.GetHabbo().ViewInventory = true; Session.SendWhisper("Next time you open your inventory you'll see " + TargetClient.GetHabbo().Username + "'s inventory."); } } } [/CODE] Inside CommandManager.cs add these commands aswell as any variations of your choosing: [CODE] this._commands.Add("viewinventory", new ViewInventoryCommand()); this._commands.Add("inv", new ViewInventoryCommand()); [/CODE] Inside FurniListComposer.cs, replace the code with this: [CODE] using System; using System.Linq; using System.Text; using System.Collections.Generic; using Plus.HabboHotel.Items; using Plus.HabboHotel.Groups; using Plus.HabboHotel.Users; using Plus.HabboHotel.Catalog.Utilities; namespace Plus.Communication.Packets.Outgoing.Inventory.Furni { class FurniListComposer : ServerPacket { public FurniListComposer(List<Item> Items, ICollection<Item> Walls, bool StaffCheck = false) : base(ServerPacketHeader.FurniListMessageComposer) { base.WriteInteger(1); base.WriteInteger(1); base.WriteInteger(Items.Count + Walls.Count); foreach (Item Item in Items.ToList()) WriteItem(Item, StaffCheck); foreach (Item Item in Walls.ToList()) WriteItem(Item, StaffCheck); } private void WriteItem(Item Item, bool StaffCheck) { base.WriteInteger(Item.Id); base.WriteString(Item.GetBaseItem().Type.ToString().ToUpper()); base.WriteInteger(Item.Id); base.WriteInteger(Item.GetBaseItem().SpriteId); ItemBehaviourUtility.GenerateExtradata(Item, this); base.WriteBoolean(StaffCheck ? false : Item.GetBaseItem().AllowEcotronRecycle); base.WriteBoolean(StaffCheck ? false : Item.GetBaseItem().AllowTrade); base.WriteBoolean(Item.LimitedNo == 0 ? Item.GetBaseItem().AllowInventoryStack : false); base.WriteBoolean(StaffCheck ? false : ItemUtility.IsRare(Item)); base.WriteInteger(-1);//Seconds to expiration. base.WriteBoolean(true); base.WriteInteger(-1);//Item RoomId if (!Item.IsWallItem) { base.WriteString(string.Empty); base.WriteInteger(0); } } } } [/CODE] This is what stops the user, trading; selling or recycling any of the other users items. Inside PlaceObjectEvent.cs under this line: [CODE] if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom) return; [/CODE] Add this segment of code: [CODE] if (Session.GetHabbo().ViewInventory) { Session.SendMessage(new RoomNotificationComposer("furni_placement_error", "message", "This item doesn't belong to you. Are you currently viewing someone elses inventory?")); return; } [/CODE] In Habbo.cs at the top add this: [CODE] private bool _ViewInventory; [/CODE] Also in Habbo.cs in the Habbo method add this: [CODE] this._ViewInventory = false; [/CODE] Finally in Habbo.cs at the bottom add this: [CODE] public bool ViewInventory { get { return this._ViewInventory; } set { this._ViewInventory = value; } } [/CODE] And there you have it, if I've missed anything please post a comment bellow and I'll add it to the thread. [USER=72653]@GuruGuru[/USER], [USER=36373]@JayCustom[/USER], [USER=72270]@Core[/USER]. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
Server Releases
[RELEASE] [COMMAND] [PlusEMU] View Inventories
Top