PlusEMU Catalog Pages Min_VIP

Blasteh

big tits
Apr 3, 2013
1,156
521
Hello,
I'm trying to create a "VIP Shop" tab within the hotel. I have an updated Production from October that I am using. My problem is, I cannot make min_vip higher than the root category.

So if VIP Shop is min_vip = 3, then only subscription 3 can view it.
But, all VIP ranks have to be able to view this tab, so I set it at 1.

When it's at 1, it works. Now, sub-category wise, I have Bronze (1), Silver (2), Gold (3).
Whenever I set them to their min_vip values, the catalog does not load. I don't want to create 3 seperate headers for the catalog, anyone have a fix?
You must be registered for see images attach
 
Also, when you're above rank 5, you can view these pages fine.
 

Attachments

  • upload_2016-12-18_14-56-14.png
    upload_2016-12-18_14-56-14.png
    41.7 KB · Views: 11

Core

Member
Nov 10, 2016
356
138
I think the tab needs a page at all time so you should set min_vip > 1. Or is the default value for this column 0? Can't remember and on phone so can't download db or emu
 

Blasteh

big tits
Apr 3, 2013
1,156
521
I think the tab needs a page at all time so you should set min_vip > 1. Or is the default value for this column 0? Can't remember and on phone so can't download db or emu
It is min_vip 1, but I cannot set the sub-categories to anything higher than 1.
 

Core

Member
Nov 10, 2016
356
138
It is min_vip 1, but I cannot set the sub-categories to anything higher than 1.
I can't download the EMU to look at it but go to your CatalogIndexComposer and look at calctreesize (or something like that). Then check if it's counting for the min_vip in the if statement.
 

Blasteh

big tits
Apr 3, 2013
1,156
521
I can't download the EMU to look at it but go to your CatalogIndexComposer and look at calctreesize (or something like that). Then check if it's counting for the min_vip in the if statement.
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 || Page.MinimumRank > Session.GetHabbo().Rank || (Page.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 || Page.MinimumRank > Session.GetHabbo().Rank || (Page.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.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;
        }
    }
}
 

JayC

Always Learning
Aug 8, 2013
5,504
1,401
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 || Page.MinimumRank > Session.GetHabbo().Rank || (Page.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 || Page.MinimumRank > Session.GetHabbo().Rank || (Page.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.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;
        }
    }
}
Sure, I will save your ass for a 2nd time ;)
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;
        }
    }
}
 

Users who are viewing this thread

Top