fix: use badge icon file pattern to exclude badge items from audit and repair
Previously identified badge items by interaction_type='badge', but clone-imported badges have interaction_type='default'. Now checks for badge_<code>_icon.png file existence instead.
This commit is contained in:
1 parent
40da24bd8c
commit
1167a48344
2 files changed
+8
-17
No files matched your search
@@ -154,18 +154,16 @@ export async function runCatalogAudit(
|
|||||||
item_name: string;
|
item_name: string;
|
||||||
public_name: string;
|
public_name: string;
|
||||||
type: string;
|
type: string;
|
||||||
interaction_type: string;
|
|
||||||
}>;
|
}>;
|
||||||
try {
|
try {
|
||||||
const [rows] = (await db.execute(sql`
|
const [rows] = (await db.execute(sql`
|
||||||
SELECT id, item_name, public_name, type, interaction_type FROM items_base ORDER BY id
|
SELECT id, item_name, public_name, type FROM items_base ORDER BY id
|
||||||
`)) as unknown as [
|
`)) as unknown as [
|
||||||
Array<{
|
Array<{
|
||||||
id: number;
|
id: number;
|
||||||
item_name: string;
|
item_name: string;
|
||||||
public_name: string;
|
public_name: string;
|
||||||
type: string;
|
type: string;
|
||||||
interaction_type: string;
|
|
||||||
}>,
|
}>,
|
||||||
unknown,
|
unknown,
|
||||||
];
|
];
|
||||||
@@ -246,7 +244,7 @@ export async function runCatalogAudit(
|
|||||||
// entry for a furni without a bundle would be un-placeable in-game.
|
// entry for a furni without a bundle would be un-placeable in-game.
|
||||||
// Badge items use .gif files, not .nitro bundles.
|
// Badge items use .gif files, not .nitro bundles.
|
||||||
if (
|
if (
|
||||||
item.interaction_type !== "badge" &&
|
!iconSet.has(`badge_${item.item_name}_icon.png`) &&
|
||||||
nitroSet.has(`${item.item_name}.nitro`)
|
nitroSet.has(`${item.item_name}.nitro`)
|
||||||
) {
|
) {
|
||||||
missingCatalogEntries.push({
|
missingCatalogEntries.push({
|
||||||
@@ -318,7 +316,7 @@ export async function runCatalogAudit(
|
|||||||
for (let i = 0; i < items.length; i++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
const item = items[i];
|
const item = items[i];
|
||||||
// Badge items use .gif files, not .nitro bundles.
|
// Badge items use .gif files, not .nitro bundles.
|
||||||
if (item.interaction_type === "badge") continue;
|
if (iconSet.has(`badge_${item.item_name}_icon.png`)) continue;
|
||||||
if (!nitroSet.has(`${item.item_name}.nitro`)) {
|
if (!nitroSet.has(`${item.item_name}.nitro`)) {
|
||||||
missingNitroClassnames.push(item.item_name);
|
missingNitroClassnames.push(item.item_name);
|
||||||
issues.push({
|
issues.push({
|
||||||
|
|||||||
@@ -136,14 +136,11 @@ export async function repairMissingNitros(
|
|||||||
...targets.mirrorDirs.map((d) => d.nitroDir),
|
...targets.mirrorDirs.map((d) => d.nitroDir),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let items: Array<{ id: number; item_name: string; interaction_type: string }>;
|
let items: Array<{ id: number; item_name: string }>;
|
||||||
try {
|
try {
|
||||||
const [rows] = (await db.execute(sql`
|
const [rows] = (await db.execute(sql`
|
||||||
SELECT id, item_name, interaction_type FROM items_base ORDER BY id
|
SELECT id, item_name FROM items_base ORDER BY id
|
||||||
`)) as unknown as [
|
`)) as unknown as [Array<{ id: number; item_name: string }>, unknown];
|
||||||
Array<{ id: number; item_name: string; interaction_type: string }>,
|
|
||||||
unknown,
|
|
||||||
];
|
|
||||||
items = rows;
|
items = rows;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
onEvent?.({
|
onEvent?.({
|
||||||
@@ -156,11 +153,7 @@ export async function repairMissingNitros(
|
|||||||
const total = items.length;
|
const total = items.length;
|
||||||
onEvent?.({ type: "started", total });
|
onEvent?.({ type: "started", total });
|
||||||
|
|
||||||
const processItem = async (classname: string, interactionType: string) => {
|
const processItem = async (classname: string) => {
|
||||||
// Badge items use .gif files, not .nitro bundles.
|
|
||||||
if (interactionType === "badge") {
|
|
||||||
return { status: "skipped" } as const;
|
|
||||||
}
|
|
||||||
const fileName = `${classname}.nitro`;
|
const fileName = `${classname}.nitro`;
|
||||||
|
|
||||||
const presentDirs = nitroDirs.filter((dir) =>
|
const presentDirs = nitroDirs.filter((dir) =>
|
||||||
@@ -266,7 +259,7 @@ export async function repairMissingNitros(
|
|||||||
|
|
||||||
await runPool(items, REPAIR_CONCURRENCY, async (item, i) => {
|
await runPool(items, REPAIR_CONCURRENCY, async (item, i) => {
|
||||||
const classname = item.item_name;
|
const classname = item.item_name;
|
||||||
const result = await processItem(classname, item.interaction_type);
|
const result = await processItem(classname);
|
||||||
if (result.status === "skipped") {
|
if (result.status === "skipped") {
|
||||||
skipped++;
|
skipped++;
|
||||||
onEvent?.({
|
onEvent?.({
|
||||||
|
|||||||
Reference in new issue
Block a user