fix: harden furni import pipeline for production
- importSingleFurni: actually update an existing item instead of failing on a primary key INSERT collision; refuse to reassign a spriteId owned by a different classname - reconcileFurniDataWithItemsBase: also sync each entry's offerid to the DB sprite id, not just the id - Move the full-table interaction_modes_count verification out of the per-item import hot path and run it once per batch/single import - clone-import: apply the auto-detected interaction_type (was hardcoded 'default'), set FurnitureData offerid and catalog_items.offer_id to the new local sprite id (was the source hotel's id / -1) - clone batch route: run the same post-import reconcile/verify/ownership/RCON consolidation as the furni batch route - upload-import: set offer_id to the allocated id in both the direct insert and the generated SQL migration (was -1) - generateCatalogSql: use the classname as catalog_name and the item id as offer_id so rows match the app-managed import convention - stats + missing-nitro endpoints: match catalog membership via item_ids instead of the catalog_name join, so translated display names no longer break counts - deleteImportedItem/rollback: delete catalog rows by the canonical item_ids link only - classifyFurni: wall items always classify as 'walls' before prefix rules (rare_/val_/xmas_) can misfile them
This commit is contained in:
1 parent
2b9a015afb
commit
6021a91ef7
9 files changed
+162
-66
No files matched your search
@@ -383,6 +383,10 @@ export async function cloneSingleFurni(params: {
|
||||
animationStates: nitroAnimationStatesCount(clonedNitroJson),
|
||||
});
|
||||
const interactionModesCount = autoInteraction.interactionModesCount;
|
||||
// The auto-detected interaction type (wired/gate/teleport/…) is real data
|
||||
// (source furnidata + cloned .nitro), never a keyword guess — apply it so
|
||||
// wired and mechanical furniture actually work on the emulator.
|
||||
const interactionType = autoInteraction.interactionType;
|
||||
|
||||
let newId: number;
|
||||
try {
|
||||
@@ -393,7 +397,7 @@ export async function cloneSingleFurni(params: {
|
||||
allow_stack, allow_sit, allow_lay, allow_walk, interaction_type, interaction_modes_count, customparams)
|
||||
VALUES
|
||||
(${nextId}, ${nextId}, ${entry.name}, ${classname}, ${itemType}, ${entry.xdim}, ${entry.ydim}, ${stackHeight},
|
||||
${allowStack}, ${entry.cansiton ? "1" : "0"}, ${entry.canlayon ? "1" : "0"}, ${entry.canstandon ? "1" : "0"}, 'default', ${interactionModesCount}, ${entry.customparams})`);
|
||||
${allowStack}, ${entry.cansiton ? "1" : "0"}, ${entry.canlayon ? "1" : "0"}, ${entry.canstandon ? "1" : "0"}, ${interactionType}, ${interactionModesCount}, ${entry.customparams})`);
|
||||
return nextId;
|
||||
});
|
||||
} catch (err) {
|
||||
@@ -412,9 +416,15 @@ export async function cloneSingleFurni(params: {
|
||||
};
|
||||
}
|
||||
|
||||
// FurnitureData entry — reuse the source's furnitype object, with our id.
|
||||
// FurnitureData entry — reuse the source's furnitype object, but with our id
|
||||
// AND our offerid. The source's offerid points at the source hotel's sprite
|
||||
// ids, which would silently break the emulator's catalog offer lookup.
|
||||
onProgress?.("writing_furnidata");
|
||||
const furniDataEntry = { ...entry, id: newId } as Record<string, unknown>;
|
||||
const furniDataEntry = {
|
||||
...entry,
|
||||
id: newId,
|
||||
offerid: newId,
|
||||
} as Record<string, unknown>;
|
||||
if (deferFurniData) {
|
||||
// Batch mode: the caller collects entries and appends them once at the end.
|
||||
} else {
|
||||
@@ -436,7 +446,7 @@ export async function cloneSingleFurni(params: {
|
||||
await allocateCatalogItemId(async (nextCatalogId) => {
|
||||
await db.execute(sql`
|
||||
INSERT INTO catalog_items (id, page_id, item_ids, catalog_name, cost_credits, cost_points, points_type, amount, order_number, offer_id, extradata)
|
||||
VALUES (${nextCatalogId}, ${String(pageId)}, ${String(newId)}, ${classname}, ${price.credits}, ${price.points}, ${price.pointsType}, 1, 1, '-1', '')`);
|
||||
VALUES (${nextCatalogId}, ${String(pageId)}, ${String(newId)}, ${classname}, ${price.credits}, ${price.points}, ${price.pointsType}, 1, 1, ${newId}, '')`);
|
||||
return nextCatalogId;
|
||||
});
|
||||
} catch (err) {
|
||||
|
||||
Reference in new issue
Block a user