PlusEMU Sub categories in the catalog

Results 1 to 7 of 7
  1. #1
    Newbie Scurq is offline
    MemberRank
    May 2014 Join Date
    2Posts

    PlusEMU Sub categories in the catalog

    Hi!
    I'm pretty new to running Habbo Retros and it's my first time setting up everything. I'm planning to make a very organized and well structured database when it comes to furniture. (Basically catalog_items, catalog_pages and furniture.)
    I ran into a problem when organizing the catalog, though. Habboon's catalog has a very interesting feature, where there are "sub sub categories" as shown in this image:
    Spoiler:

    I've looked at the code in the emulator, but I can't figure out why this won't work on any other hotel. Changing the parent_id to the sub category's id doesn't work.
    If you know how to change the code in CatalogIndexComposer.cs or something similar, please let me know, because this is something everyone should be able to do on their own hotel!


  2. #2
    Death from above! The General is offline
    DeveloperRank
    Aug 2011 Join Date
    9,195Posts

    Re: PlusEMU Sub categories in the catalog

    Its probably because they are not appended recursively in the packet.

    I'm unfamilar with Plus emulator but Arcturus emulator does have this enabled.
    If you are using Arcturus, contact me
    Skype: wesley.jabbo
    Discord: TheGeneral#0063

  3. #3
    Newbie Scurq is offline
    MemberRank
    May 2014 Join Date
    2Posts

    Re: PlusEMU Sub categories in the catalog

    Quote Originally Posted by The General View Post
    Its probably because they are not appended recursively in the packet.

    I'm unfamilar with Plus emulator but Arcturus emulator does have this enabled.
    Unfortunalety, I didn't understand any of that :(

    Maybe it would help if I post my CatalogIndexComposer.cs:
    Spoiler:
    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 &&Session.GetHabbo().Rank == 1))
    • 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 && Session.GetHabbo().Rank == 1))
    • 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 && Session.GetHabbo().Rank == 1))
    • 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.Enabled ? -1 : 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 && Session.GetHabbo().Rank ==1) || Page.ParentId != ParentId)
    • continue;
    • if (Page.ParentId == ParentId)
    • i++;
    • }
    • return i;
    • }
    • }
    • }


    EDIT: I solved it myself, the problem was that the fifth level of categories was missing entirely from the code. By changing this in the CatalogIndexComposer.cs:
    Code:
    • foreach (CatalogPage SubChild in Pages)
    • {
    • if (SubChild.ParentId != child.Id || SubChild.MinimumRank > Session.GetHabbo().Rank)
    • continue;
    • WritePage(SubChild, 0);
    • }
    to this
    Code:
    • foreach (CatalogPage SubChild in Pages)
    • {
    • if (SubChild.ParentId != child.Id || SubChild.MinimumRank > Session.GetHabbo().Rank)
    • continue;
    • if (SubChild.Enabled)
    • WritePage(SubChild, CalcTreeSize(Session, Pages, SubChild.Id));
    • else
    • WriteNodeIndex(SubChild, CalcTreeSize(Session, Pages, SubChild.Id));
    • foreach (CatalogPage SubSubChild in Pages)
    • {
    • if (SubSubChild.ParentId != SubChild.Id || SubSubChild.MinimumRank > Session.GetHabbo().Rank)
    • continue;
    • WritePage(SubSubChild, 0);
    • }
    it will work!
    Last edited by Scurq; 10-09-17 at 10:07 PM.

  4. #4
    ttyl Dominic is offline
      V.I.P  Rank
    Aug 2012 Join Date
    DenmarkLocation
    586Posts

    Re: PlusEMU Sub categories in the catalog

    Bump, I'm confused about this too?
    As far as I can see my Plus edit already contains triple categorizing?

    https://hastebin.com/ubinoqowic.php



    EDIT:
    Hmm, I seem to have figured out what's causing this.
    @The General - if the mode is NOT normal, then what's the mode?

  5. #5
    Newbie Lmaurice is offline
    MemberRank
    May 2018 Join Date
    LondonLocation
    2Posts

    Re: PlusEMU Sub categories in the catalog

    Quote Originally Posted by Scurq View Post
    Unfortunalety, I didn't understand any of that :(

    Maybe it would help if I post my CatalogIndexComposer.cs:
    Spoiler:
    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 &&Session.GetHabbo().Rank == 1))
    • 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 && Session.GetHabbo().Rank == 1))
    • 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 && Session.GetHabbo().Rank == 1))
    • 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.Enabled ? -1 : 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 && Session.GetHabbo().Rank ==1) || Page.ParentId != ParentId)
    • continue;
    • if (Page.ParentId == ParentId)
    • i++;
    • }
    • return i;
    • }
    • }
    • }


    EDIT: I solved it myself, the problem was that the fifth level of categories was missing entirely from the code. By changing this in the CatalogIndexComposer.cs:
    Code:
    • foreach (CatalogPage SubChild in Pages)
    • {
    • if (SubChild.ParentId != child.Id || SubChild.MinimumRank > Session.GetHabbo().Rank)
    • continue;
    • WritePage(SubChild, 0);
    • }
    to this
    Code:
    • foreach (CatalogPage SubChild in Pages)
    • {
    • if (SubChild.ParentId != child.Id || SubChild.MinimumRank > Session.GetHabbo().Rank)
    • continue;
    • if (SubChild.Enabled)
    • WritePage(SubChild, CalcTreeSize(Session, Pages, SubChild.Id));
    • else
    • WriteNodeIndex(SubChild, CalcTreeSize(Session, Pages, SubChild.Id));
    • foreach (CatalogPage SubSubChild in Pages)
    • {
    • if (SubSubChild.ParentId != SubChild.Id || SubSubChild.MinimumRank > Session.GetHabbo().Rank)
    • continue;
    • WritePage(SubSubChild, 0);
    • }
    it will work!
    Hiya Scurq!

    I have replaced the code with that one, but it still won't work.

    Am I required to create a new column in the cataloge_pages-table? And if so, what should I name it?


    Much thankful for help!

  6. #6
    Member Kyle Betts is offline
    MemberRank
    Jan 2016 Join Date
    Summoner's RiftLocation
    57Posts

    Re: PlusEMU Sub categories in the catalog

    I found that, idk if is spam or not! PlusEMU fix Sub-pages and Clean Up Catalog Index


    If is spam, I'll remove the link, but I think this is the solution to your problem. :)

  7. #7
    Newbie Lmaurice is offline
    MemberRank
    May 2018 Join Date
    LondonLocation
    2Posts

    Re: PlusEMU Sub categories in the catalog

    Quote Originally Posted by Kyle Betts View Post
    I found that, idk if is spam or not! PlusEMU fix Sub-pages and Clean Up Catalog Index


    If is spam, I'll remove the link, but I think this is the solution to your problem. :)
    Thank you sir!

    It is a link to a other forum tho, so you should delete it.



Advertisement