xabbo-scripts/GetOfferID.csx
Administrator b6c31a7feb Add 165 scripts from desktop collection + update README
Added scripts from C:\Users\ploet\Desktop\Habbo\Xabbo Scripte:
- 39 KI/Chatbot scripts (ChatGPT, Gemini, Grok, DeepSeek, Ollama)
- Game solvers (Domino, Dodgeball, Obsidian Maze, IceBall)
- Collision avoidance bots (5 versions)
- Plant/breeding automation (12 scripts)
- Trading tools, packet debuggers, room utilities
- Navigation & teleport helpers

Removed: 9 files (3 empty, 2 trivial, 4 cross-duplicates)
Updated README with full categorized index of all 230+ scripts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 09:47:56 +01:00

59 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
var catalog = GetBcCatalog();
var nodes = catalog.Where(x => x.Id > 0).ToArray();
var pages = new List<(ICatalogPageNode Node, ICatalogPage Page)>();
for (int i = 0; i < nodes.Length; i++)
{
var node = nodes[i];
Status($"Loading page {i + 1}/{nodes.Length}...");
pages.Add((node, GetCatalogPage(node)));
}
var regexPattern = @"bc_standinghalfcylinder\*\d{1,2}";
var furniData = await FetchFurniDataAsync();
string json = JsonSerializer.Serialize(
pages.SelectMany(x => x.Page.Offers)
.SelectMany(offer => offer.Products.Select(product => new { Product = product, OfferId = offer.Id }))
.Where(item => IsFurni(item.Product) && Regex.IsMatch(item.Product.GetIdentifier(), regexPattern))
.Select(item => new
{
Identifier = item.Product.GetIdentifier(),
OfferId = item.OfferId,
Color = furniData.GetValueOrDefault(item.Product.GetIdentifier())
}),
new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
WriteIndented = true
}
);
Directory.CreateDirectory("Bc_Block_Data");
File.WriteAllText($"Bc_Block_Data/Bc_Block_Data.json", json);
static async Task<Dictionary<string, string>> FetchFurniDataAsync()
{
using var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36");
var response = await httpClient.GetStringAsync("https://www.habbo.com/gamedata/furnidata_json/0");
using var jsonDoc = JsonDocument.Parse(response);
return jsonDoc.RootElement.GetProperty("roomitemtypes").GetProperty("furnitype").EnumerateArray()
.Where(furni => furni.TryGetProperty("partcolors", out var partColors) && partColors.TryGetProperty("color", out var colors) && colors.GetArrayLength() > 1)
.ToDictionary(
furni => furni.GetProperty("classname").GetString(),
furni => furni.GetProperty("partcolors").GetProperty("color")[1].GetString()
);
}
static bool IsFurni(IItem it) => it.Type == ItemType.Floor || it.Type == ItemType.Wall;