Plus Emu Catalog Min_rank FIX (NEW PRODUCTION)

Results 1 to 9 of 9
  1. #1
    Apprentice FunkyTuri is offline
    MemberRank
    May 2016 Join Date
    9Posts

    Plus Emu Catalog Min_rank FIX (NEW PRODUCTION)

    Idk if someone already posted it, here's the fix for the min_rank in plus emu:

    Replace CatalogIndexComposer.cs with:

    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;
            }
        }
    }
    Ok, now u can manage your catalog :)
    Last edited by FunkyTuri; 28-10-16 at 10:18 AM.


  2. #2
    iiiiiiiiiii Brought is offline
    MemberRank
    Aug 2013 Join Date
    469Posts

    Re: Plus Emu Catalog Min_rank FIX (NEW PRODUCTION)

    Yes, this has already been posted in it's appropriate section... under the PlusEMU Help thread/in the Production release thread(s). I don't see why another whole thread would be required, but I guess.

  3. #3
    Apprentice FunkyTuri is offline
    MemberRank
    May 2016 Join Date
    9Posts

    Re: Plus Emu Catalog Min_rank FIX (NEW PRODUCTION)

    Quote Originally Posted by Brought View Post
    Yes, this has already been posted in it's appropriate section... under the PlusEMU Help thread/in the Production release thread(s). I don't see why another whole thread would be required, but I guess.
    No,it's different, please check before posting

  4. #4
    iiiiiiiiiii Brought is offline
    MemberRank
    Aug 2013 Join Date
    469Posts

    Re: Plus Emu Catalog Min_rank FIX (NEW PRODUCTION)

    Quote Originally Posted by FunkyTuri View Post
    No,it's different, please check before posting
    No it's not lol it's the same exact fix. It doesn't require a thread, it's already been posted around the forum.

  5. #5
    Apprentice FunkyTuri is offline
    MemberRank
    May 2016 Join Date
    9Posts

    Re: Plus Emu Catalog Min_rank FIX (NEW PRODUCTION)

    Quote Originally Posted by Brought View Post
    No it's not lol it's the same exact fix. It doesn't require a thread, it's already been posted around the forum.
    You're noob. Please check all lines :)
    http://forum.ragezone.com/f353/crack...7/#post8674097

    Murphy code:
    Code:
    if(child.ParentId!= Page.Id|| Page.MinimumRank> Session.GetHabbo().Rank||(Page.MinimumVIP>Session.GetHabbo().VIPRank&& Session.GetHabbo().Rank==1))
    My code:
    Code:
    if (child.ParentId != Page.Id || child.MinimumRank > Session.GetHabbo().Rank || (child.MinimumVIP > Session.GetHabbo().VIPRank && Session.GetHabbo().Rank == 1))

  6. #6
    The **** Keiz is offline
    MemberRank
    Nov 2015 Join Date
    238Posts

    Re: Plus Emu Catalog Min_rank FIX (NEW PRODUCTION)

    Why cycle twice through pages?

    This is what I use,
    Code:
            public List<CatalogPage> GetPagesForParentId(GameClient Session, ICollection<CatalogPage> Pages, int ParentId)
            {
                
                List<CatalogPage> list = Pages.Where(x => x.ParentId == ParentId && Session.GetHabbo().Rank >= x.MinimumRank && Session.GetHabbo().VIPRank >= x.MinimumVIP).ToList();
    
    
                if (PlusStaticGameSettings.CatalogAlphabeticParents.Contains(ParentId))
                    return list.OrderBy(x => x.Caption).ToList();
    
    
                return list;
            }
    Note that I use a static integer array for checking if the catalog page's childs should be alphabetically ordered.

    So just use this function to get the pages, and instead of "GetTreeSize", use the returned pages' .Count() function.
    Code:
    List<CatalogPage> childpages = GetPagesForParentId(Session, Pages, Page.Id);
    int treesize = childpages.Count;

  7. #7
    Alpha Member Emily is offline
    MemberRank
    Oct 2012 Join Date
    The NetherlandsLocation
    2,408Posts

    Re: Plus Emu Catalog Min_rank FIX (NEW PRODUCTION)

    @Keiz Please do note that using LINQ isn't the best way as it reduces performance.

  8. #8
    The **** Keiz is offline
    MemberRank
    Nov 2015 Join Date
    238Posts

    Re: Plus Emu Catalog Min_rank FIX (NEW PRODUCTION)

    @Glaceon Def. true, I made a for loop instead. Either way, it's more efficient than cycling twice.

  9. #9
    Apprentice FunkyTuri is offline
    MemberRank
    May 2016 Join Date
    9Posts

    Re: Plus Emu Catalog Min_rank FIX (NEW PRODUCTION)

    Quote Originally Posted by Keiz View Post
    Why cycle twice through pages?This is what I use,
    Code:
            public List GetPagesForParentId(GameClient Session, ICollection Pages, int ParentId)        {                        List list = Pages.Where(x => x.ParentId == ParentId && Session.GetHabbo().Rank >= x.MinimumRank && Session.GetHabbo().VIPRank >= x.MinimumVIP).ToList();            if (PlusStaticGameSettings.CatalogAlphabeticParents.Contains(ParentId))                return list.OrderBy(x => x.Caption).ToList();            return list;        }
    Note that I use a static integer array for checking if the catalog page's childs should be alphabetically ordered.So just use this function to get the pages, and instead of "GetTreeSize", use the returned pages' .Count() function.
    Code:
    List childpages = GetPagesForParentId(Session, Pages, Page.Id);int treesize = childpages.Count;
    I only edited plus emu code



Advertisement