How to add catalog page under catalog page?

Jemay

New Member
Jan 28, 2018
7
1
Hey,
i was wondering that how to add catalog page under another catalog page where is all the item pages?

Here is an example:
v4iN6By.png


I did add an page id after page id but it didn't work.

Thank you for helping :)
 

Joe

Well-Known Member
Jun 10, 2012
4,090
1,918
Thread moved to Habbo Help & Support

Not sure if this is coded in Plus, putting a category inside a category, then again I've never tried it so I don't know if it would work.

You'd just use the parent ID of the catalogue page to be in that certain page if that makes sense.
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
Communication --> Packets --> Outgoing --> Catalog --> CatalogIndexComposer.cs

Only supports 3 levels. As you can see here.. We can only have 3 levels of pages. It is in the habbo.swf so adding another page level, would not make it work unfortunately.

Code:
using System.Collections.Generic;
using Plus.HabboHotel.Catalog;
using Plus.HabboHotel.GameClients;

namespace Plus.Communication.Packets.Outgoing.Catalog
{
    public class CatalogIndexComposer : ServerPacket
    {
        public CatalogIndexComposer(GameClient Session, ICollection<CatalogPage> Pages, int Sub = 0)
            : base(ServerPacketHeader.CatalogIndexMessageComposer)
        {
            WriteRootIndex(Session, Pages);

            foreach (CatalogPage Page in Pages)
            {
                if (Page.ParentId != -1 || Page.MinimumRank > Session.GetHabbo().Rank || (Page.MinimumVIP > Session.GetHabbo().VIPRank))
                    continue;

                WritePage(Page, CalcTreeSize(Session, Pages, Page.Id));

                foreach (CatalogPage child in Pages)
                {
                    if (child.ParentId != Page.Id || child.MinimumRank > Session.GetHabbo().Rank || (child.MinimumVIP > Session.GetHabbo().VIPRank))
                        continue;

                    WritePage(child, CalcTreeSize(Session, Pages, child.Id));

                    foreach (CatalogPage baby in Pages)
                    {
                        if (baby.ParentId != child.Id || baby.MinimumRank > Session.GetHabbo().Rank || (baby.MinimumVIP > Session.GetHabbo().VIPRank))
                            continue;

                        WritePage(baby, 0);
                    }
                }
            }

            base.WriteBoolean(false);
            base.WriteString("NORMAL");
        }

        public void WriteRootIndex(GameClient Session, ICollection<CatalogPage> Pages)
        {
            base.WriteBoolean(true);
            base.WriteInteger(0);
            base.WriteInteger(-1);
            base.WriteString("root");
            base.WriteString(string.Empty);
            base.WriteInteger(0);
            base.WriteInteger(CalcTreeSize(Session, Pages, -1));
        }

        public void WritePage(CatalogPage Page, int TreeSize)
        {
            base.WriteBoolean(Page.Visible);
            base.WriteInteger(Page.Icon);
            base.WriteInteger(Page.Id);
            base.WriteString(Page.PageLink);
            base.WriteString(Page.Caption);

            base.WriteInteger(Page.ItemOffers.Count);
            foreach (int i in Page.ItemOffers.Keys)
            {
                base.WriteInteger(i);
            }

            base.WriteInteger(TreeSize);
        }

        public int CalcTreeSize(GameClient Session, ICollection<CatalogPage> Pages, int ParentId)
        {
            int i = 0;
            foreach (CatalogPage Page in Pages)
            {
                if (Page.MinimumRank > Session.GetHabbo().Rank || (Page.MinimumVIP > Session.GetHabbo().VIPRank) || Page.ParentId != ParentId)
                    continue;

                if (Page.ParentId == ParentId)
                    i++;
            }

            return i;
        }
    }
}
 
EDIT:
I was just looking at this and found that we could actually get it to work.. no gaurante.. If someone wants to try this code and post if it works, we may be able to add another layer :D

Replace the composer with this
Code:
 public CatalogIndexComposer(GameClient Session, ICollection<CatalogPage> Pages, int Sub = 0)
            : base(ServerPacketHeader.CatalogIndexMessageComposer)
        {
            WriteRootIndex(Session, Pages);

            foreach (CatalogPage GrandParent in Pages)
            {
                if (GrandParent.ParentId != -1 || GrandParent.MinimumRank > Session.GetHabbo().Rank || (GrandParent.MinimumVIP > Session.GetHabbo().VIPRank))
                    continue;

                WritePage(GrandParent, CalcTreeSize(Session, Pages, GrandParent.Id));

                foreach (CatalogPage Parent in Pages)
                {
                    if (Parent.ParentId != Page.Id || Parent.MinimumRank > Session.GetHabbo().Rank || (Parent.MinimumVIP > Session.GetHabbo().VIPRank))
                        continue;

                    WritePage(Parent, CalcTreeSize(Session, Pages, Parent.Id));

                    foreach (CatalogPage Child in Pages)
                    {
                        if (Child.ParentId != Child.Id || Child.MinimumRank > Session.GetHabbo().Rank || (Child.MinimumVIP > Session.GetHabbo().VIPRank))
                            continue;

                        WritePage(Child, CalcTreeSize(Session, Pages, Child.Id));

                                foreach (CatalogPage baby in Pages) {
                        if (baby.ParentId != baby.Id || baby.MinimumRank > Session.GetHabbo().Rank || (baby.MinimumVIP > Session.GetHabbo().VIPRank))
                            continue;

                        WritePage(baby, 0);

                      }
                    }
                }
            }

            base.WriteBoolean(false);
            base.WriteString("NORMAL");
        }
 

Users who are viewing this thread

Top