Setup/Fixups

* sanity check slot / invtype realtion on setup (and hide offenders)
 * hide internal/unused items by name part
 * always truncate table to get rid of old data
 * fixing one->many relation revealed by replacing REPLACE with INSERT in creature setup
This commit is contained in:
Sarjuuk
2023-04-23 19:45:44 +02:00
parent 1130581152
commit e916deaafc
4 changed files with 30 additions and 7 deletions

View File

@@ -19,7 +19,7 @@ SqlGen::register(new class extends SetupScript
$baseQuery = '
SELECT
ct.entry,
IF(ie.entry IS NULL, 0, ?d) AS cuFlags, -- cuFlags
IF(ie.creditEntry IS NULL, 0, ?d) AS cuFlags, -- cuFlags
difficulty_entry_1, difficulty_entry_2, difficulty_entry_3,
KillCredit1, KillCredit2,
modelid1, modelid2, modelid3, modelid4,
@@ -91,7 +91,7 @@ SqlGen::register(new class extends SetupScript
LEFT JOIN
creature_template_locale ctl8 ON ct.entry = ctl8.entry AND ctl8.`locale` = "ruRU"
LEFT JOIN
instance_encounters ie ON ie.creditEntry = ct.entry AND ie.creditType = 0
(SELECT creditEntry FROM instance_encounters WHERE creditType = 0 GROUP BY creditEntry) ie ON ie.creditEntry = ct.entry
LEFT JOIN
creature_template_spell cts0 ON ct.entry = cts0.CreatureID AND cts0.Index = 0
LEFT JOIN
@@ -157,12 +157,13 @@ SqlGen::register(new class extends SetupScript
c.humanoid = IF(cdie.id IS NULL, 0, 1)';
$i = 0;
DB::Aowow()->query('TRUNCATE ?_creature');
while ($npcs = DB::World()->select($baseQuery, NPC_CU_INSTANCE_BOSS, $ids ?: DBSIMPLE_SKIP, SqlGen::$sqlBatchSize * $i, SqlGen::$sqlBatchSize))
{
CLI::write(' * batch #' . ++$i . ' (' . count($npcs) . ')');
foreach ($npcs as $npc)
DB::Aowow()->query('REPLACE INTO ?_creature VALUES (?a)', array_values($npc));
DB::Aowow()->query('INSERT INTO ?_creature VALUES (?a)', array_values($npc));
}
// apply "textureString", "modelId" and "iconSring"