Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
How to add catalog page under catalog page?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="JayC" data-source="post: 428966" data-attributes="member: 36373"><p>Communication --> Packets --> Outgoing --> Catalog --> CatalogIndexComposer.cs</p><p></p><p>Only supports 3 levels. As you can see here.. We can only have 3 levels of pages. It is in the habbo.swf so adding another page level, would not make it work unfortunately.</p><p></p><p>[CODE]using System.Collections.Generic;</p><p>using Plus.HabboHotel.Catalog;</p><p>using Plus.HabboHotel.GameClients;</p><p></p><p>namespace Plus.Communication.Packets.Outgoing.Catalog</p><p>{</p><p> public class CatalogIndexComposer : ServerPacket</p><p> {</p><p> public CatalogIndexComposer(GameClient Session, ICollection<CatalogPage> Pages, int Sub = 0)</p><p> : base(ServerPacketHeader.CatalogIndexMessageComposer)</p><p> {</p><p> WriteRootIndex(Session, Pages);</p><p></p><p> foreach (CatalogPage Page in Pages)</p><p> {</p><p> if (Page.ParentId != -1 || Page.MinimumRank > Session.GetHabbo().Rank || (Page.MinimumVIP > Session.GetHabbo().VIPRank))</p><p> continue;</p><p></p><p> WritePage(Page, CalcTreeSize(Session, Pages, Page.Id));</p><p></p><p> foreach (CatalogPage child in Pages)</p><p> {</p><p> if (child.ParentId != Page.Id || child.MinimumRank > Session.GetHabbo().Rank || (child.MinimumVIP > Session.GetHabbo().VIPRank))</p><p> continue;</p><p></p><p> WritePage(child, CalcTreeSize(Session, Pages, child.Id));</p><p></p><p> foreach (CatalogPage baby in Pages)</p><p> {</p><p> if (baby.ParentId != child.Id || baby.MinimumRank > Session.GetHabbo().Rank || (baby.MinimumVIP > Session.GetHabbo().VIPRank))</p><p> continue;</p><p></p><p> WritePage(baby, 0);</p><p> }</p><p> }</p><p> }</p><p></p><p> base.WriteBoolean(false);</p><p> base.WriteString("NORMAL");</p><p> }</p><p></p><p> public void WriteRootIndex(GameClient Session, ICollection<CatalogPage> Pages)</p><p> {</p><p> base.WriteBoolean(true);</p><p> base.WriteInteger(0);</p><p> base.WriteInteger(-1);</p><p> base.WriteString("root");</p><p> base.WriteString(string.Empty);</p><p> base.WriteInteger(0);</p><p> base.WriteInteger(CalcTreeSize(Session, Pages, -1));</p><p> }</p><p></p><p> public void WritePage(CatalogPage Page, int TreeSize)</p><p> {</p><p> base.WriteBoolean(Page.Visible);</p><p> base.WriteInteger(Page.Icon);</p><p> base.WriteInteger(Page.Id);</p><p> base.WriteString(Page.PageLink);</p><p> base.WriteString(Page.Caption);</p><p></p><p> base.WriteInteger(Page.ItemOffers.Count);</p><p> foreach (int i in Page.ItemOffers.Keys)</p><p> {</p><p> base.WriteInteger(i);</p><p> }</p><p></p><p> base.WriteInteger(TreeSize);</p><p> }</p><p></p><p> public int CalcTreeSize(GameClient Session, ICollection<CatalogPage> Pages, int ParentId)</p><p> {</p><p> int i = 0;</p><p> foreach (CatalogPage Page in Pages)</p><p> {</p><p> if (Page.MinimumRank > Session.GetHabbo().Rank || (Page.MinimumVIP > Session.GetHabbo().VIPRank) || Page.ParentId != ParentId)</p><p> continue;</p><p></p><p> if (Page.ParentId == ParentId)</p><p> i++;</p><p> }</p><p></p><p> return i;</p><p> }</p><p> }</p><p>}[/CODE]</p><p>[doublepost=1519522825,1519522489][/doublepost]<strong><u><span style="color: #330066">EDIT:</span></u></strong></p><p>I was just looking at this and found that we could actually get it to work.. no gaurante.. If someone wants to try this code and post if it works, we may be able to add another layer <img src="/styles/default/xenforo/smilies/emojione/biggrin.png" class="smilie" loading="lazy" alt=":D" title="Big Grin :D" data-shortname=":D" /></p><p></p><p>Replace the composer with this</p><p>[CODE] public CatalogIndexComposer(GameClient Session, ICollection<CatalogPage> Pages, int Sub = 0)</p><p> : base(ServerPacketHeader.CatalogIndexMessageComposer)</p><p> {</p><p> WriteRootIndex(Session, Pages);</p><p></p><p> foreach (CatalogPage GrandParent in Pages)</p><p> {</p><p> if (GrandParent.ParentId != -1 || GrandParent.MinimumRank > Session.GetHabbo().Rank || (GrandParent.MinimumVIP > Session.GetHabbo().VIPRank))</p><p> continue;</p><p></p><p> WritePage(GrandParent, CalcTreeSize(Session, Pages, GrandParent.Id));</p><p></p><p> foreach (CatalogPage Parent in Pages)</p><p> {</p><p> if (Parent.ParentId != Page.Id || Parent.MinimumRank > Session.GetHabbo().Rank || (Parent.MinimumVIP > Session.GetHabbo().VIPRank))</p><p> continue;</p><p></p><p> WritePage(Parent, CalcTreeSize(Session, Pages, Parent.Id));</p><p></p><p> foreach (CatalogPage Child in Pages)</p><p> {</p><p> if (Child.ParentId != Child.Id || Child.MinimumRank > Session.GetHabbo().Rank || (Child.MinimumVIP > Session.GetHabbo().VIPRank))</p><p> continue;</p><p></p><p> WritePage(Child, CalcTreeSize(Session, Pages, Child.Id));</p><p></p><p> foreach (CatalogPage baby in Pages) {</p><p> if (baby.ParentId != baby.Id || baby.MinimumRank > Session.GetHabbo().Rank || (baby.MinimumVIP > Session.GetHabbo().VIPRank))</p><p> continue;</p><p></p><p> WritePage(baby, 0);</p><p></p><p> }</p><p> }</p><p> }</p><p> }</p><p></p><p> base.WriteBoolean(false);</p><p> base.WriteString("NORMAL");</p><p> }[/CODE]</p></blockquote><p></p>
[QUOTE="JayC, post: 428966, member: 36373"] Communication --> Packets --> Outgoing --> Catalog --> CatalogIndexComposer.cs Only supports 3 levels. As you can see here.. We can only have 3 levels of pages. It is in the habbo.swf so adding another page level, would not make it work unfortunately. [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; } } }[/CODE] [doublepost=1519522825,1519522489][/doublepost][B][U][COLOR=#330066]EDIT:[/COLOR][/U][/B] I was just looking at this and found that we could actually get it to work.. no gaurante.. If someone wants to try this code and post if it works, we may be able to add another layer :D Replace the composer with this [CODE] public CatalogIndexComposer(GameClient Session, ICollection<CatalogPage> Pages, int Sub = 0) : base(ServerPacketHeader.CatalogIndexMessageComposer) { WriteRootIndex(Session, Pages); foreach (CatalogPage GrandParent in Pages) { if (GrandParent.ParentId != -1 || GrandParent.MinimumRank > Session.GetHabbo().Rank || (GrandParent.MinimumVIP > Session.GetHabbo().VIPRank)) continue; WritePage(GrandParent, CalcTreeSize(Session, Pages, GrandParent.Id)); foreach (CatalogPage Parent in Pages) { if (Parent.ParentId != Page.Id || Parent.MinimumRank > Session.GetHabbo().Rank || (Parent.MinimumVIP > Session.GetHabbo().VIPRank)) continue; WritePage(Parent, CalcTreeSize(Session, Pages, Parent.Id)); foreach (CatalogPage Child in Pages) { if (Child.ParentId != Child.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 != baby.Id || baby.MinimumRank > Session.GetHabbo().Rank || (baby.MinimumVIP > Session.GetHabbo().VIPRank)) continue; WritePage(baby, 0); } } } } base.WriteBoolean(false); base.WriteString("NORMAL"); }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
How to add catalog page under catalog page?
Top