PlusEMU Catalogue upgrade to sub catagorys?

Status
Not open for further replies.

Stee

Oh hot damn. This is my jam.
Jun 28, 2011
285
158
Hi I was wondering if it was possible to use the icons for the pages that are showen in the photo? Just think it'd clean it up a bit?
 

Attachments

  • Screenshot_3.png
    Screenshot_3.png
    36.3 KB · Views: 16

JayC

Always Learning
Aug 8, 2013
5,493
1,398
You just set the icon for the page? It's under catalog_pages database table.

The icons are found in your swf folder under c_images/catalogue
 

Stee

Oh hot damn. This is my jam.
Jun 28, 2011
285
158
You just set the icon for the page? It's under catalog_pages database table.

The icons are found in your swf folder under c_images/catalogue

All of they pages have icons I just fon't think they're coded in?

You just set the icon for the page? It's under catalog_pages database table.

The icons are found in your swf folder under c_images/catalogue

All of they pages have icons I just fon't think they're coded in?

I've took the time to clean up one of the worst written composers in Plus, which causes alot of problems for people adding sub pages to categories in the catalog, or sub pages of sub pages. This "fix" or clean up code allows you to add as many sub pages as you like, as well as not foreaching the catalog pages multiple times (for counts ext.). But enough of that, let's get cleaning :D.

Firstly in CatalogManager.cs find this code:
Code:
public ICollection<CatalogPage> GetPages()
{
    return _pages.Values;
}

Changing it to this:
Code:
public ICollection<CatalogPage> GetPages(GameClient session, int pageId)
{
    List<CatalogPage> pages = new List<CatalogPage>();
    foreach (CatalogPage page in this._pages.Values)
    {
        if (page.ParentId != pageId || page.MinimumRank > session.GetHabbo().Rank || (page.MinimumVIP > session.GetHabbo().VIPRank && session.GetHabbo().Rank == 1))
        {
            continue;
        }
        pages.Add(page);
    }
    return pages;
}


Secondly in GetCatalogIndexEvent.cs find this code:
Code:
session.SendPacket(new CatalogIndexComposer(session, PlusEnvironment.GetGame().GetCatalog().GetPages()));

Changing it to this:
Code:
session.SendPacket(new CatalogIndexComposer(session, PlusEnvironment.GetGame().GetCatalog().GetPages(session, -1)));


And lastly in CatalogIndexComposer.cs replace the entire class with this:
Code:
public class CatalogIndexComposer : ServerPacket
{
    public CatalogIndexComposer(GameClient session, ICollection<CatalogPage> pages)
        : base(ServerPacketHeader.CatalogIndexMessageComposer)
    {
        base.WriteBoolean(true);
        base.WriteInteger(0);
        base.WriteInteger(-1);
        base.WriteString("root");
        base.WriteString("");
        base.WriteInteger(0);

        base.WriteInteger(pages.Count);
        foreach (CatalogPage page in pages)
        {
            Append(session, page);
        }

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

    public void Append(GameClient session, CatalogPage page)
    {
        ICollection<CatalogPage> pages = PlusEnvironment.GetGame().GetCatalog().GetPages(session, page.Id);

        base.WriteBoolean(page.Visible);
        base.WriteInteger(page.Icon);
        base.WriteInteger(page.Enabled ? page.Id : -1);
        base.WriteString(page.PageLink);
        base.WriteString(page.Caption);

        base.WriteInteger(page.ItemOffers.Count);
        foreach (int key in page.ItemOffers.Keys)
        {
            base.WriteInteger(key);
        }

        base.WriteInteger(pages.Count);
        foreach (CatalogPage nextPage in pages)
        {
            Append(session, nextPage);
        }
    }
}


Now we're all done, enjoy, love you all, peace, dab emoji.
@Muff for helping test.
@Dolan for requesting this in the first place.
@JynX cause he's just sexy.
 
Status
Not open for further replies.

Users who are viewing this thread

Top