xabbo-scripts/ExportCurrentRoomFloor.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

98 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
string Safe(string s)
{
return string.IsNullOrWhiteSpace(s) ? "" : s.Replace("\r", " ").Replace("\n", " ").Trim();
}
int GetKind(dynamic item)
{
try { return (int)item.Kind; }
catch { return -1; }
}
int GetState(dynamic item)
{
try { return int.Parse(item.State?.ToString() ?? "0", CultureInfo.InvariantCulture); }
catch { return 0; }
}
int GetDir(dynamic item)
{
try { return (int)item.Direction; }
catch { return 0; }
}
string GetNameSafe(dynamic item)
{
try { return Safe(item.GetName()); }
catch { return ""; }
}
string EscCsv(string s)
{
s = s ?? "";
if (s.Contains(",") || s.Contains("\"") || s.Contains("\n"))
return "\"" + s.Replace("\"", "\"\"") + "\"";
return s;
}
var rows = new List<string>();
rows.Add("id,kind,name,x,y,z,state,dir");
int count = 0;
foreach (var item in FloorItems)
{
if (item == null) continue;
count++;
long id = item.Id;
int kind = GetKind(item);
string name = GetNameSafe(item);
int x = item.Location.X;
int y = item.Location.Y;
double z = item.Location.Z;
int state = GetState(item);
int dir = GetDir(item);
rows.Add(string.Join(",", new[] {
id.ToString(CultureInfo.InvariantCulture),
kind.ToString(CultureInfo.InvariantCulture),
EscCsv(name),
x.ToString(CultureInfo.InvariantCulture),
y.ToString(CultureInfo.InvariantCulture),
z.ToString("0.###", CultureInfo.InvariantCulture),
state.ToString(CultureInfo.InvariantCulture),
dir.ToString(CultureInfo.InvariantCulture)
}));
}
if (count == 0)
{
Log("ERROR: No floor items found.");
return;
}
string roomName = "room";
try { roomName = Safe(Room?.Name ?? "room"); } catch { roomName = "room"; }
if (string.IsNullOrWhiteSpace(roomName)) roomName = "room";
var invalid = Path.GetInvalidFileNameChars();
foreach (char c in invalid) roomName = roomName.Replace(c, '_');
string stamp = DateTime.Now.ToString("yyyyMMdd_HHmmss", CultureInfo.InvariantCulture);
string exportDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "HabboFloorExports");
Directory.CreateDirectory(exportDir);
string filePath = Path.Combine(exportDir, $"{roomName}_floor_{stamp}.csv");
File.WriteAllText(filePath, string.Join(Environment.NewLine, rows), Encoding.UTF8);
Log("=== Floor Export Complete ===");
Log($"Items exported: {count}");
Log($"File: {filePath}");