From 321c9ba7f4125bb035786d82e1bb27d6c3cf9f6a Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Mon, 15 Aug 2016 00:03:46 +0200 Subject: [PATCH] Setup/Sqlgen * fixed setup skipping custom data if it was >stepSize away from the last entry --- localization/locale_frfr.php | 2 +- setup/tools/sqlgen/creature.func.php | 17 ++++++++++------- setup/tools/sqlgen/items.func.php | 17 ++++++++++------- setup/tools/sqlgen/objects.func.php | 17 ++++++++++------- setup/tools/sqlgen/quests.func.php | 17 ++++++++++------- setup/tools/sqlgen/spell.func.php | 28 ++++++++++++++++++---------- 6 files changed, 59 insertions(+), 39 deletions(-) diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php index 4f27f418..1fc72e27 100644 --- a/localization/locale_frfr.php +++ b/localization/locale_frfr.php @@ -301,7 +301,7 @@ $lang = array( 'groups' => array( -1 => "None", "Testeur", "Administrateur", "Éditeur", "Modérateur", "Bureaucrate", "Développeur", "VIP", "Bloggeur", "Premium", "Traducteur", "Agent de ventes", - "Gestionnaire de capture d'écran","Gestionnaire de vidéos" "Partenaire API", "En attente" + "Gestionnaire de capture d'écran","Gestionnaire de vidéos", "Partenaire API", "En attente" ), // signIn 'doSignIn' => "Connexion à votre compte Aowow", diff --git a/setup/tools/sqlgen/creature.func.php b/setup/tools/sqlgen/creature.func.php index 7548a7c3..ad12bb70 100644 --- a/setup/tools/sqlgen/creature.func.php +++ b/setup/tools/sqlgen/creature.func.php @@ -91,12 +91,13 @@ function creature(array $ids = []) 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 - { WHERE - ct.entry IN (?a) + ct.entry > ?d + { + AND ct.entry IN (?a) } LIMIT - ?d, ?d'; + ?d'; $dummyQuery = ' UPDATE @@ -124,12 +125,14 @@ function creature(array $ids = []) c.modelId = cdi.modelId, c.iconString = cdi.iconString'; - $offset = 0; - while ($npcs = DB::World()->select($baseQuery, NPC_CU_INSTANCE_BOSS, $ids ?: DBSIMPLE_SKIP, $offset, SqlGen::$stepSize)) + $lastMax = 0; + while ($npcs = DB::World()->select($baseQuery, NPC_CU_INSTANCE_BOSS, $lastMax, $ids ?: DBSIMPLE_SKIP, SqlGen::$stepSize)) { - CLISetup::log(' * sets '.($offset + 1).' - '.($offset + count($npcs))); + $newMax = max(array_column($npcs, 'entry')); - $offset += SqlGen::$stepSize; + CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax); + + $lastMax = $newMax; foreach ($npcs as $npc) DB::Aowow()->query('REPLACE INTO ?_creature VALUES (?a)', array_values($npc)); diff --git a/setup/tools/sqlgen/items.func.php b/setup/tools/sqlgen/items.func.php index 73635b67..27cfaf56 100644 --- a/setup/tools/sqlgen/items.func.php +++ b/setup/tools/sqlgen/items.func.php @@ -116,19 +116,22 @@ function items(array $ids = []) spell_group sg ON sg.spell_id = it.spellid_1 AND it.class = 0 AND it.subclass = 2 AND sg.id IN (1, 2) LEFT JOIN game_event ge ON ge.holiday = it.HolidayId AND it.HolidayId > 0 - { WHERE - ct.entry IN (?a) + it.entry > ?d + { + AND it.entry IN (?a) } LIMIT - ?d, ?d'; + ?d'; - $offset = 0; - while ($items = DB::World()->select($baseQuery, $ids ?: DBSIMPLE_SKIP, $offset, SqlGen::$stepSize)) + $lastMax = 0; + while ($items = DB::World()->select($baseQuery, $lastMax, $ids ?: DBSIMPLE_SKIP, $offset, SqlGen::$stepSize)) { - CLISetup::log(' * sets '.($offset + 1).' - '.($offset + count($items))); + $newMax = max(array_column($items, 'entry')); - $offset += SqlGen::$stepSize; + CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax); + + $lastMax = $newMax; foreach ($items as $item) DB::Aowow()->query('REPLACE INTO ?_items VALUES (?a)', array_values($item)); diff --git a/setup/tools/sqlgen/objects.func.php b/setup/tools/sqlgen/objects.func.php index fdbf10cb..c58f7d62 100644 --- a/setup/tools/sqlgen/objects.func.php +++ b/setup/tools/sqlgen/objects.func.php @@ -75,14 +75,15 @@ function objects(array $ids = []) gameobject_template_locale gtl8 ON go.entry = gtl8.entry AND gtl8.`locale` = "ruRU" LEFT JOIN gameobject_questitem gqi ON gqi.GameObjectEntry = go.entry - { WHERE - go.entry IN (?a) + go.entry > ?d + { + AND go.entry IN (?a) } GROUP BY go.entry LIMIT - ?d, ?d'; + ?d'; $updateQuery = ' UPDATE @@ -100,12 +101,14 @@ function objects(array $ids = []) o.id IN (?a) }'; - $offset = 0; - while ($objects = DB::World()->select($baseQuery, $ids ?: DBSIMPLE_SKIP, $offset, SqlGen::$stepSize)) + $lastMax = 0; + while ($objects = DB::World()->select($baseQuery, $lastMax, $ids ?: DBSIMPLE_SKIP, SqlGen::$stepSize)) { - CLISetup::log(' * sets '.($offset + 1).' - '.($offset + count($objects))); + $newMax = max(array_column($objects, 'entry')); - $offset += SqlGen::$stepSize; + CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax); + + $lastMax = $newMax; foreach ($objects as $o) DB::Aowow()->query('REPLACE INTO ?_objects VALUES (?a)', array_values($o)); diff --git a/setup/tools/sqlgen/quests.func.php b/setup/tools/sqlgen/quests.func.php index 789a5e4f..547d14d7 100644 --- a/setup/tools/sqlgen/quests.func.php +++ b/setup/tools/sqlgen/quests.func.php @@ -101,12 +101,13 @@ function quests(array $ids = []) locales_quest lq ON q.ID = lq.Id LEFT JOIN game_event_seasonal_questrelation gesqr ON gesqr.questId = q.ID - { WHERE - q.ID IN (?a) + q.Id > ?d + { + AND q.Id IN (?a) } LIMIT - ?d, ?d'; + ?d'; $xpQuery = ' UPDATE @@ -140,12 +141,14 @@ function quests(array $ids = []) }'; - $offset = 0; - while ($quests = DB::World()->select($baseQuery, $ids ?: DBSIMPLE_SKIP, $offset, SqlGen::$stepSize)) + $lastMax = 0; + while ($quests = DB::World()->select($baseQuery, $lastMax, $ids ?: DBSIMPLE_SKIP, SqlGen::$stepSize)) { - CLISetup::log(' * sets '.($offset + 1).' - '.($offset + count($quests))); + $newMax = max(array_column($quests, 'Id')); - $offset += SqlGen::$stepSize; + CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax); + + $lastMax = $newMax; foreach ($quests as $q) DB::Aowow()->query('REPLACE INTO ?_quests VALUES (?a)', array_values($q)); diff --git a/setup/tools/sqlgen/spell.func.php b/setup/tools/sqlgen/spell.func.php index 8590c2ad..9888be36 100644 --- a/setup/tools/sqlgen/spell.func.php +++ b/setup/tools/sqlgen/spell.func.php @@ -110,8 +110,10 @@ function spell() 0 AS spellDifficulty FROM spell_dbc + WHERE + Id > ?d LIMIT - ?d, ?d'; + ?d'; $baseQuery = ' SELECT @@ -209,19 +211,23 @@ function spell() dbc_spellradius sr2 ON s.effect2RadiusId = sr2.Id LEFT JOIN dbc_spellradius sr3 ON s.effect3RadiusId = sr3.Id + WHERE + s.Id > ?d LIMIT - ?d, ?d'; + ?d'; $serverside = []; // merge serverside spells into dbc_spell (should not affect other scripts) - $offset = 0; + $lastMax = 0; CLISetup::log(' - merging serverside spells into spell.dbc'); - while ($spells = DB::World()->select($ssQuery, $offset, SqlGen::$stepSize)) + while ($spells = DB::World()->select($ssQuery, $lastMax, SqlGen::$stepSize)) { - CLISetup::log(' * sets '.($offset + 1).' - '.($offset + count($spells))); + $newMax = max(array_column($spells, 'Id')); - $offset += SqlGen::$stepSize; + CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax); + + $lastMax = $newMax; foreach ($spells as $id => $spell) { @@ -231,13 +237,15 @@ function spell() } // merge everything into aowow_spell - $offset = 0; + $lastMax = 0; CLISetup::log(' - filling aowow_spell'); - while ($spells = DB::Aowow()->select($baseQuery, $offset, SqlGen::$stepSize)) + while ($spells = DB::Aowow()->select($baseQuery, $lastMax, SqlGen::$stepSize)) { - CLISetup::log(' * sets '.($offset + 1).' - '.($offset + count($spells))); + $newMax = max(array_column($spells, 'Id')); - $offset += SqlGen::$stepSize; + CLISetup::log(' * sets '.($lastMax + 1).' - '.$newMax); + + $lastMax = $newMax; foreach ($spells as $spell) DB::Aowow()->query('REPLACE INTO ?_spell VALUES (?a)', array_values($spell));