Achievements/Category

* moved names from db to locale files
This commit is contained in:
Sarjuuk
2020-06-04 00:44:25 +02:00
parent 8e14e4a9f3
commit 321f28d35c
15 changed files with 332 additions and 58 deletions

View File

@@ -23,6 +23,21 @@ SqlGen::register(new class extends SetupScript
public function generate(array $ids = []) : bool
{
/**************/
/* categories */
/**************/
CLI::write(' - resolving categories');
DB::Aowow()->query('REPLACE INTO ?_achievementcategory SELECT ac.id, IFNULL(ac.parentcategory, 0), IFNULL(ac1.parentcategory, 0)
FROM dbc_achievement_category ac LEFT JOIN dbc_achievement_category ac1 ON ac1.id = ac.parentCategory');
/************/
/* dbc data */
/************/
CLI::write(' - basic dbc data');
DB::Aowow()->query('
REPLACE INTO
?_achievement
@@ -57,7 +72,13 @@ SqlGen::register(new class extends SetupScript
{ WHERE a.id IN (?a) }
', $ids ?: DBSIMPLE_SKIP);
// serverside achievements
/*******************/
/* serverside data */
/*******************/
CLI::write(' - serverside achievement data');
$serverAchievements = DB::World()->select('SELECT ID, IF(requiredFaction = -1, 3, IF(requiredFaction = 0, 2, 1)) AS "faction", mapID, points, flags, count, refAchievement FROM achievement_dbc{ WHERE id IN (?a)}',
$ids ?: DBSIMPLE_SKIP
);
@@ -67,10 +88,13 @@ SqlGen::register(new class extends SetupScript
'Serverside - #'.$sa['ID'], 'Serverside - #'.$sa['ID'], 'Serverside - #'.$sa['ID'], 'Serverside - #'.$sa['ID'], 'Serverside - #'.$sa['ID'], 'Serverside - #'.$sa['ID']
);
if ($ids)
return true;
// create chain of achievements
/********************************/
/* create chain of achievements */
/********************************/
CLI::write(' - linking achievements to chain');
$chainIdx = 0;
$parents = DB::Aowow()->selectCol('SELECT a.id FROM dbc_achievement a JOIN dbc_achievement b ON b.previous = a.id WHERE a.previous = 0');
foreach ($parents as $chainId => $next)
@@ -93,7 +117,13 @@ SqlGen::register(new class extends SetupScript
}
}
// apply disables
/*********************/
/* applying disables */
/*********************/
CLI::write(' - disabling disabled achievements from table disables');
if ($criteria = DB::World()->selectCol('SELECT entry FROM disables WHERE sourceType = 4'))
DB::Aowow()->query('UPDATE aowow_achievement a JOIN aowow_achievementcriteria ac ON a.id = ac.refAchievementId SET a.cuFlags = ?d WHERE ac.id IN (?a)', CUSTOM_DISABLED, $criteria);

View File

@@ -1,18 +0,0 @@
<?php
if (!defined('AOWOW_REVISION'))
die('illegal access');
if (!CLI)
die('not in cli mode');
SqlGen::register(new class extends SetupScript
{
use TrDBCcopy;
protected $command = 'achievementcategory';
protected $dbcSourceFiles = ['achievement_category'];
});
?>