using System;
using System.Collections.Generic;
using Ion.HabboHotel.Catalog;
namespace Ion.HabboHotel.Client
{
public partial class ClientMessageHandler
{
///
/// 101 - "Ae"
///
private void GetCatalogIndex()
{
Response.Initialize(ResponseOpcodes.CatalogIndex);
// Add all visible pages to the index response
List pages = IonEnvironment.GetHabboHotel().GetCatalog().GetPages();
foreach (CatalogPage page in pages)
{
Response.AppendBoolean(page.Visible);
Response.AppendInt32((int)page.IconColor);
Response.AppendInt32((int)page.IconImage);
Response.AppendUInt32(page.ID);
Response.AppendString(page.Name);
Response.AppendBoolean(page.ComingSoon);
Response.AppendUInt32(page.TreeID);
}
SendResponse();
}
///
/// 102 = "A?"
///
private void GetCatalogPage()
{
uint pageID = Request.PopWireduint();
Response.Initialize(ResponseOpcodes.CatalogPage);
CatalogPage page = IonEnvironment.GetHabboHotel().GetCatalog().GetPage(pageID);
if (page != null)
{
Response.AppendObject(page);
List products = IonEnvironment.GetHabboHotel().GetCatalog().GetProducts(pageID);
foreach (CatalogProduct product in products)
{
Response.AppendObject(product);
}
}
SendResponse();
}
///
/// Registers handlers that have to do with the ingame Catalog.
///
public void RegisterCatalog()
{
mRequestHandlers[101] = new RequestHandler(GetCatalogIndex);
mRequestHandlers[102] = new RequestHandler(GetCatalogPage);
}
}
}