Catalogue permissions?

Zlimon

Member
Aug 3, 2015
76
5
I have done some editing in the catalogue, and came across this problem for default users:
E6fvJ9x.png


It does not happen for those who have atleast permission id above 4 though...
 

Haid

Member
Dec 20, 2011
363
448
One of your catalog pages has a min_rank higher than the parent page. From what you said search for catalog_pages with a parent_id of -1 and min_rank of 4, then check the sub pages for that parent page and make sure none have higher.
 

Haid

Member
Dec 20, 2011
363
448
I think this should work but its 2am so!

Code:
SELECT *
FROM catalog_pages d1
WHERE (parent_id = "-1"
      AND min_rank = 4)
  OR (
        (SELECT parent_id
         FROM catalog_pages d2
         WHERE d1.id = d2.id) IN
        (SELECT id
         FROM catalog_pages
         WHERE min_rank = 4));

Show me the results.
 

Zlimon

Member
Aug 3, 2015
76
5
I think this should work but its 2am so!

Code:
SELECT *
FROM catalog_pages d1
WHERE (parent_id = "-1"
      AND min_rank = 6)
  OR (
        (SELECT parent_id
         FROM catalog_pages d2
         WHERE d1.id = d2.id) IN
        (SELECT id
         FROM catalog_pages
         WHERE min_rank = 6));

Show me the results.
I got this result, but i guess thats because i have to change "peakrp.catalog_pages" to "catalog_pages"? I dont know, but i want to make sure :p

You must be registered for see images attach
 

Zlimon

Member
Aug 3, 2015
76
5
I think this should work but its 2am so!

Code:
SELECT *
FROM catalog_pages d1
WHERE (parent_id = "-1"
      AND min_rank = 4)
  OR (
        (SELECT parent_id
         FROM catalog_pages d2
         WHERE d1.id = d2.id) IN
        (SELECT id
         FROM catalog_pages
         WHERE min_rank = 4));

Show me the results.

You must be registered for see images attach


Still the same results... The left one is rank id 9 = Owner, and the right one is rank id 4 = trial mod.
You must be registered for see images attach
 

yoyok

Member
Apr 24, 2013
197
24
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;
        }
    }
Replace your CatalogIndexComposer.cs with this:
 

Zlimon

Member
Aug 3, 2015
76
5
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;
        }
    }
Replace your CatalogIndexComposer.cs with this:

What specifically does it do? As I have only edited the catalogue in the database, I am skeptical in editing .cs files :/
 

Haid

Member
Dec 20, 2011
363
448
You must be registered for see images attach

Still the same results... The left one is rank id 9 = Owner, and the right one is rank id 4 = trial mod.
You must be registered for see images attach
You'll need to change the "= 4" in the query to 9.

His fix might work, modifying it to show the child pages regardless but I don't see the need in editing the source when you don't have experience; it can be fixed by correcting the database mistake. Haven't look or tested it myself though so as always be wary with editing the source when you're unsure.
 

Zlimon

Member
Aug 3, 2015
76
5
You'll need to change the "= 4" in the query to 9.

His fix might work, modifying it to show the child pages regardless but I don't see the need in editing the source when you don't have experience; it can be fixed by correcting the database mistake.

What do you mean with change the = 4? As in changing the rank id 4 to rank id 9? I can mention that I have performed some editing in the ranks as well:
You must be registered for see images attach
 

Haid

Member
Dec 20, 2011
363
448
What do you mean with change the = 4? As in changing the rank id 4 to rank id 9? I can mention that I have performed some editing in the ranks as well:
You must be registered for see images attach
You're going to need to do some investigation into your staff catalog_pages.
In short, you cannot have a child page where the min_rank is higher than the parent; I've mistakenly done this myself before and it does exactly what you're experiencing as it's just not meant to be done like that.

Example.
Rares (min_rank 6)
Classic Rares (min_rank 7)
Customs (min_rank 6)
That will break your whole catalog.
If you have teamviewer I can take a look and fix it for you quicker if you're struggling.
 

Zlimon

Member
Aug 3, 2015
76
5
You're going to need to do some investigation into your staff catalog_pages.
In short, you cannot have a child page where the min_rank is higher than the parent; I've mistakenly done this myself before and it does exactly what you're experiencing as it's just not meant to be done like that.

Example.
Rares (min_rank 6)
Classic Rares (min_rank 7)
Customs (min_rank 6)
That will break your whole catalog.
If you have teamviewer I can take a look and fix it for you quicker if you're struggling.

Sure, go ahead. I will install it now :)
 

Users who are viewing this thread

Top