Setup/Source

* generally flag items of quality artifact as unavailable
 * 04f3aa7a82 caused some items transformed by spell to be 'available'
This commit is contained in:
Sarjuuk
2025-11-15 19:56:11 +01:00
parent f5654ae21f
commit 82f36fd342
2 changed files with 9 additions and 2 deletions

View File

@@ -0,0 +1 @@
UPDATE `aowow_dbversion` SET `sql` = CONCAT(IFNULL(`sql`, ''), ' source');

View File

@@ -183,9 +183,15 @@ CLISetup::registerSetup("sql", new class extends SetupScript
!empty($this->disables[Type::SPELL]) ? array_values($this->disables[Type::SPELL]) : DBSIMPLE_SKIP
);
// flagging aowow_items for source (note: this is not exact! creatures dropping items may not be spawnd, quests granting items may be disabled)
// flagging aowow_items for source (note: this is not exact! creatures dropping items may not be spawned, etc.)
DB::Aowow()->query('UPDATE ?_items SET `cuFlags` = `cuFlags` & ?d', ~CUSTOM_UNAVAILABLE);
DB::Aowow()->query('UPDATE ?_items i LEFT JOIN ?_source s ON s.`typeId` = i.`id` AND s.`type` = ?d SET i.`cuFlags` = i.`cuFlags` | ?d WHERE s.`typeId` IS NULL AND i.`id` NOT IN (?a)', Type::ITEM, CUSTOM_UNAVAILABLE, $itemSpellSource);
DB::Aowow()->query(
'UPDATE ?_items i
LEFT JOIN ?_source s ON s.`typeId` = i.`id` AND s.`type` = ?d
SET i.`cuFlags` = i.`cuFlags` | ?d
WHERE (s.`typeId` IS NULL AND i.`id` NOT IN (?a)) OR i.`quality` = ?d',
Type::ITEM, CUSTOM_UNAVAILABLE, $itemSpellSource, ITEM_QUALITY_ARTIFACT
);
return true;
}