SELECT *
FROM catalog_pages d1
WHERE (parent_id = "-1"
AND min_rank = 4)
OR (
(SELECT parent_id
FROM catalog_pages d2
WHERE d1.id = d2.id) IN
(SELECT id
FROM catalog_pages
WHERE min_rank = 4));
I got this result, but i guess thats because i have to change "peakrp.catalog_pages" to "catalog_pages"? I dont know, but i want to make sureI think this should work but its 2am so!
Code:SELECT * FROM catalog_pages d1 WHERE (parent_id = "-1" AND min_rank = 6) OR ( (SELECT parent_id FROM catalog_pages d2 WHERE d1.id = d2.id) IN (SELECT id FROM catalog_pages WHERE min_rank = 6));
Show me the results.
Ya generated it on my own db, fixed in my original postI got this result, but i guess thats because i have to change "peakrp.catalog_pages" to "catalog_pages"? I dont know, but i want to make sure
You must be registered for see images attach
I think this should work but its 2am so!
Code:SELECT * FROM catalog_pages d1 WHERE (parent_id = "-1" AND min_rank = 4) OR ( (SELECT parent_id FROM catalog_pages d2 WHERE d1.id = d2.id) IN (SELECT id FROM catalog_pages WHERE min_rank = 4));
Show me the results.
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;
}
}
Replace your CatalogIndexComposer.cs with this: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; } }
You'll need to change the "= 4" in the query to 9.You must be registered for see images attach
Still the same results... The left one is rank id 9 = Owner, and the right one is rank id 4 = trial mod.
You must be registered for see images attach
You'll need to change the "= 4" in the query to 9.
His fix might work, modifying it to show the child pages regardless but I don't see the need in editing the source when you don't have experience; it can be fixed by correcting the database mistake.
You're going to need to do some investigation into your staff catalog_pages.What do you mean with change the = 4? As in changing the rank id 4 to rank id 9? I can mention that I have performed some editing in the ranks as well:
You must be registered for see images attach
You're going to need to do some investigation into your staff catalog_pages.
In short, you cannot have a child page where the min_rank is higher than the parent; I've mistakenly done this myself before and it does exactly what you're experiencing as it's just not meant to be done like that.
Example.
Rares (min_rank 6)
Classic Rares (min_rank 7)That will break your whole catalog.
Customs (min_rank 6)
If you have teamviewer I can take a look and fix it for you quicker if you're struggling.