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
[PLUSEMU] Sub-categorie Catalogo
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="Valentinuzzu1" data-source="post: 444011" data-attributes="member: 78678"><p>Hi, I have a problem in the catalog, I can not make the sub-categories work I'll post the code I hope you can help me</p><p>CatalogIndexComposer.cs</p><p>[CODE=csharp]using System.Collections.Generic;</p><p>using Yezz.HabboHotel.Catalog;</p><p>using Yezz.HabboHotel.GameClients;</p><p>using Yezz.Communication.Packets.Outgoing;</p><p></p><p>namespace Yezz.Communication.Packets.Outgoing.Catalog</p><p>{</p><p> public class CatalogIndexComposer : ServerPacket</p><p> {</p><p> public CatalogIndexComposer(GameClient Session, ICollection<CatalogPage> Pages, string Mode, int Sub = 0)</p><p> : base(ServerPacketHeader.CatalogIndexMessageComposer)</p><p> {</p><p> WriteRootIndex(Session, Pages);</p><p> foreach (CatalogPage Parent in Pages)</p><p> {</p><p> if (Parent.ParentId != -1 || Parent.MinimumRank > Session.GetHabbo().Rank || (Parent.MinimumVIP > Session.GetHabbo().VIPRank && Session.GetHabbo().Rank == 1))</p><p> continue;</p><p> WritePage(Parent, CalcTreeSize(Session, Pages, Parent.Id));</p><p> foreach (CatalogPage child in Pages)</p><p> {</p><p> if (child.ParentId != Parent.Id || child.MinimumRank > Session.GetHabbo().Rank || (child.MinimumVIP > Session.GetHabbo().VIPRank && Session.GetHabbo().Rank == 1))</p><p> continue;</p><p> if (child.Enabled)</p><p> WritePage(child, CalcTreeSize(Session, Pages, child.Id));</p><p> else</p><p> WriteNodeIndex(child, CalcTreeSize(Session, Pages, child.Id));</p><p></p><p> foreach (CatalogPage SubChild in Pages)</p><p> {</p><p> if (SubChild.ParentId != child.Id || SubChild.MinimumRank > Session.GetHabbo().Rank)</p><p> continue;</p><p> WritePage(SubChild, 0);</p><p> }</p><p> }</p><p> }</p><p> base.WriteBoolean(false);</p><p> base.WriteString(Mode);</p><p> }</p><p> public CatalogIndexComposer(GameClient Session, ICollection<BCCatalogPage> Pages, string Mode, int Sub = 0)</p><p> : base(ServerPacketHeader.CatalogIndexMessageComposer)</p><p> {</p><p> WriteRootIndex(Session, Pages);</p><p> foreach (BCCatalogPage Parent in Pages)</p><p> {</p><p> if (Parent.ParentId != -1 || Parent.MinimumRank > Session.GetHabbo().Rank || (Parent.MinimumVIP > Session.GetHabbo().VIPRank && Session.GetHabbo().Rank == 1))</p><p> continue;</p><p> WritePage(Parent, CalcTreeSize(Session, Pages, Parent.Id));</p><p> foreach (BCCatalogPage child in Pages)</p><p> {</p><p> if (child.ParentId != Parent.Id || child.MinimumRank > Session.GetHabbo().Rank || (child.MinimumVIP > Session.GetHabbo().VIPRank && Session.GetHabbo().Rank == 1))</p><p> continue;</p><p> if (child.Enabled)</p><p> WritePage(child, CalcTreeSize(Session, Pages, child.Id));</p><p> else</p><p> WriteNodeIndex(child, CalcTreeSize(Session, Pages, child.Id));</p><p></p><p> foreach (BCCatalogPage SubChild in Pages)</p><p> {</p><p> if (SubChild.ParentId != child.Id || SubChild.MinimumRank > Session.GetHabbo().Rank)</p><p> continue;</p><p> WritePage(SubChild, 0);</p><p> }</p><p> }</p><p> }</p><p> base.WriteBoolean(false);</p><p> base.WriteString(Mode);</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> public void WriteNodeIndex(CatalogPage page, int treeSize)</p><p> {</p><p> base.WriteBoolean(page.Visible);</p><p> base.WriteInteger(page.Icon);</p><p> base.WriteInteger(-1);</p><p> base.WriteString(page.PageLink);</p><p> base.WriteString(page.Caption);</p><p> base.WriteInteger(0);</p><p> base.WriteInteger(treeSize);</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> 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> base.WriteInteger(treeSize);</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 && Session.GetHabbo().Rank == 1) || Page.ParentId != ParentId)</p><p> continue;</p><p> if (Page.ParentId == ParentId)</p><p> i++;</p><p> }</p><p> return i;</p><p> }</p><p> public void WriteRootIndex(GameClient session, ICollection<BCCatalogPage> 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> public void WriteNodeIndex(BCCatalogPage page, int treeSize)</p><p> {</p><p> base.WriteBoolean(page.Visible);</p><p> base.WriteInteger(page.Icon);</p><p> base.WriteInteger(-1);</p><p> base.WriteString(page.PageLink);</p><p> base.WriteString(page.Caption);</p><p> base.WriteInteger(0);</p><p> base.WriteInteger(treeSize);</p><p> }</p><p> public void WritePage(BCCatalogPage 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> 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> base.WriteInteger(treeSize);</p><p> }</p><p> public int CalcTreeSize(GameClient Session, ICollection<BCCatalogPage> Pages, int ParentId)</p><p> {</p><p> int i = 0;</p><p> foreach (BCCatalogPage Page in Pages)</p><p> {</p><p> if (Page.MinimumRank > Session.GetHabbo().Rank || (Page.MinimumVIP > Session.GetHabbo().VIPRank && Session.GetHabbo().Rank == 1) || Page.ParentId != ParentId)</p><p> continue;</p><p> if (Page.ParentId == ParentId)</p><p> i++;</p><p> }</p><p> return i;</p><p> }</p><p> }</p><p>}[/CODE]</p></blockquote><p></p>
[QUOTE="Valentinuzzu1, post: 444011, member: 78678"] Hi, I have a problem in the catalog, I can not make the sub-categories work I'll post the code I hope you can help me CatalogIndexComposer.cs [CODE=csharp]using System.Collections.Generic; using Yezz.HabboHotel.Catalog; using Yezz.HabboHotel.GameClients; using Yezz.Communication.Packets.Outgoing; namespace Yezz.Communication.Packets.Outgoing.Catalog { public class CatalogIndexComposer : ServerPacket { public CatalogIndexComposer(GameClient Session, ICollection<CatalogPage> Pages, string Mode, int Sub = 0) : base(ServerPacketHeader.CatalogIndexMessageComposer) { WriteRootIndex(Session, Pages); foreach (CatalogPage Parent in Pages) { if (Parent.ParentId != -1 || Parent.MinimumRank > Session.GetHabbo().Rank || (Parent.MinimumVIP > Session.GetHabbo().VIPRank && Session.GetHabbo().Rank == 1)) continue; WritePage(Parent, CalcTreeSize(Session, Pages, Parent.Id)); foreach (CatalogPage child in Pages) { if (child.ParentId != Parent.Id || child.MinimumRank > Session.GetHabbo().Rank || (child.MinimumVIP > Session.GetHabbo().VIPRank && Session.GetHabbo().Rank == 1)) continue; if (child.Enabled) WritePage(child, CalcTreeSize(Session, Pages, child.Id)); else WriteNodeIndex(child, CalcTreeSize(Session, Pages, child.Id)); foreach (CatalogPage SubChild in Pages) { if (SubChild.ParentId != child.Id || SubChild.MinimumRank > Session.GetHabbo().Rank) continue; WritePage(SubChild, 0); } } } base.WriteBoolean(false); base.WriteString(Mode); } public CatalogIndexComposer(GameClient Session, ICollection<BCCatalogPage> Pages, string Mode, int Sub = 0) : base(ServerPacketHeader.CatalogIndexMessageComposer) { WriteRootIndex(Session, Pages); foreach (BCCatalogPage Parent in Pages) { if (Parent.ParentId != -1 || Parent.MinimumRank > Session.GetHabbo().Rank || (Parent.MinimumVIP > Session.GetHabbo().VIPRank && Session.GetHabbo().Rank == 1)) continue; WritePage(Parent, CalcTreeSize(Session, Pages, Parent.Id)); foreach (BCCatalogPage child in Pages) { if (child.ParentId != Parent.Id || child.MinimumRank > Session.GetHabbo().Rank || (child.MinimumVIP > Session.GetHabbo().VIPRank && Session.GetHabbo().Rank == 1)) continue; if (child.Enabled) WritePage(child, CalcTreeSize(Session, Pages, child.Id)); else WriteNodeIndex(child, CalcTreeSize(Session, Pages, child.Id)); foreach (BCCatalogPage SubChild in Pages) { if (SubChild.ParentId != child.Id || SubChild.MinimumRank > Session.GetHabbo().Rank) continue; WritePage(SubChild, 0); } } } base.WriteBoolean(false); base.WriteString(Mode); } 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 WriteNodeIndex(CatalogPage page, int treeSize) { base.WriteBoolean(page.Visible); base.WriteInteger(page.Icon); base.WriteInteger(-1); base.WriteString(page.PageLink); base.WriteString(page.Caption); base.WriteInteger(0); base.WriteInteger(treeSize); } 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; } public void WriteRootIndex(GameClient session, ICollection<BCCatalogPage> 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 WriteNodeIndex(BCCatalogPage page, int treeSize) { base.WriteBoolean(page.Visible); base.WriteInteger(page.Icon); base.WriteInteger(-1); base.WriteString(page.PageLink); base.WriteString(page.Caption); base.WriteInteger(0); base.WriteInteger(treeSize); } public void WritePage(BCCatalogPage 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<BCCatalogPage> Pages, int ParentId) { int i = 0; foreach (BCCatalogPage 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; } } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
[PLUSEMU] Sub-categorie Catalogo
Top