[RELEASE] [COMMAND] [PlusEMU] View Inventories

Chenaho

Member
Feb 9, 2016
45
9
Great job mate, does use a lot of resources on Flash though it tends to lagg a little and/or crash, but none the less great command!
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
Great job mate, does use a lot of resources on Flash though it tends to lagg a little and/or crash, but none the less great command!
This should not lagg nor crash, all its doing is loading more items. If you are lagging/crashing your computer specs cannot support playing a retro, or your server specs are too low.
 

Chenaho

Member
Feb 9, 2016
45
9
This should not lagg nor crash, all its doing is loading more items. If you are lagging/crashing your computer specs cannot support playing a retro, or your server specs are too low.
Server and laptop specs aren't enough to support playing a retro lmfao. Anyone else experiencing this issue?!
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
Server and laptop specs aren't enough to support playing a retro lmfao. Anyone else experiencing this issue?!
Another issue is if you use the command with your inventory open its not flash failing its the emulator trying to fetch and update at the same time just causing minor lagg
 

Puuk

New Member
Oct 24, 2013
1
0
Where do I place
this._commands.Add("viewinventory", new ViewInventoryCommand());
this._commands.Add("inv", new ViewInventoryCommand());
In CommandManager?
 

JynX

Posting Freak
Feb 6, 2016
710
438
LTD's when using this command or LTD's as a whole? Didn't remove the comment 'cause I thought you was relating it to when you used this command.
When you don't use this command you would have an LTD like this: . Whereas with the command all LTD's look as if they are pure when they are not in reality.
 

MasterJiq

Member
Jul 8, 2016
385
23
Use this sql please, makesure if you create custom commands, include the sql.
Code:
INSERT INTO `permissions_commands` (`command`, `group_id`, `subscription_id`) VALUES
('command_viewinventory', '9', '0');
 

Meap

Don't need glasses if you C#
Nov 7, 2010
1,045
296
Use this sql please, makesure if you create custom commands, include the sql.
Code:
INSERT INTO `permissions_commands` (`command`, `group_id`, `subscription_id`) VALUES
('command_viewinventory', '9', '0');
If you know how to add commands I'm
Pretty sure you can add in the extra line in the commands table it's not like it's a pain to do unlike new furniture releases
 

Chenaho

Member
Feb 9, 2016
45
9
So has anyone got any info on how to fix LTD window on items?
 
This should work?
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);
           
            if (Item.LimitedNo > 0)
            {
                base.WriteInteger(1);
                base.WriteInteger(256);
                base.WriteString(Item.ExtraData);
                base.WriteInteger(Item.LimitedNo);
                base.WriteInteger(Item.LimitedTot);
            }
            else
            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);
            }
        }
    }
}
 

MasterJiq

Member
Jul 8, 2016
385
23
So has anyone got any info on how to fix LTD window on items?
 
This should work?
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);
          
            if (Item.LimitedNo > 0)
            {
                base.WriteInteger(1);
                base.WriteInteger(256);
                base.WriteString(Item.ExtraData);
                base.WriteInteger(Item.LimitedNo);
                base.WriteInteger(Item.LimitedTot);
            }
            else
            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);
            }
        }
    }
}

I've tried that codes, working. Thanks
 

Seriosk

Programmer;
Oct 29, 2016
256
105
Hey, just a few things to point out (constructive criticism)

This code:
Code:
if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
               return;

Can be simplified which is called sequential checks, so:
Code:
if (Session?.GetHabbo() == null || !Session.GetHabbo().InRoom)
               return;

Some of your codes don't follow the official naming conventions, example:
Code:
_ViewInventory

The correct naming convention would be:
Code:
_viewInventory

Also where you have this in a lot of places:
Code:
base.WriteInteger(1);

It's a redundant qualifier, it can be written as this:
Code:
WriteInteger(1);

It's nothing major but its a few small things that hopefully help some people out. I haven't really checked all the could just quickly scrolled through.
Good tutorial though, its a pretty smart idea and will help many.
 

MasterJiq

Member
Jul 8, 2016
385
23
Hey, just a few things to point out (constructive criticism)

This code:
Code:
if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
               return;

Can be simplified which is called sequential checks, so:
Code:
if (Session?.GetHabbo() == null || !Session.GetHabbo().InRoom)
               return;

Some of your codes don't follow the official naming conventions, example:
Code:
_ViewInventory

The correct naming convention would be:
Code:
_viewInventory

Also where you have this in a lot of places:
Code:
base.WriteInteger(1);

It's a redundant qualifier, it can be written as this:
Code:
WriteInteger(1);

It's nothing major but its a few small things that hopefully help some people out. I haven't really checked all the could just quickly scrolled through.
Good tutorial though, its a pretty smart idea and will help many.

So in command manager, this.Register("cmd", new Command()); should be Register("cmd", new Command()); ? Just asking if it true, I've done that and I wan't to know if that is true.
 

Users who are viewing this thread

Top