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

@@ -270,16 +270,10 @@ DROP TABLE IF EXISTS `aowow_achievementcategory`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `aowow_achievementcategory` (
`id` int(11) unsigned NOT NULL,
`parentCategory` mediumint(9) NOT NULL,
`name_loc0` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_loc2` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_loc3` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_loc4` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_loc6` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`name_loc8` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `idx_achievement` (`parentCategory`)
`id` smallint(5) unsigned NOT NULL DEFAULT '0',
`parentCat` smallint(5) unsigned NOT NULL DEFAULT '0',
`parentCat2` smallint(5) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -3138,7 +3132,7 @@ UNLOCK TABLES;
LOCK TABLES `aowow_dbversion` WRITE;
/*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */;
INSERT INTO `aowow_dbversion` VALUES (1590687330,0,NULL,NULL);
INSERT INTO `aowow_dbversion` VALUES (1591223186,0,NULL,NULL);
/*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */;
UNLOCK TABLES;

View File

@@ -42,7 +42,7 @@ class DBC
{
private $_formats = array( // locales block for copy pasta: sxsssxsxsxxxxxxxx | xxxxxxxxxxxxxxxxx
'achievement' => 'niiisxsssxsxsxxxxxxxxsxsssxsxsxxxxxxxxiiiiisxsssxsxsxxxxxxxxii',
'achievement_category' => 'nisxsssxsxsxxxxxxxxx',
'achievement_category' => 'nixxxxxxxxxxxxxxxxxx',
'achievement_criteria' => 'niiiiiiiisxsssxsxsxxxxxxxxiixii',
'areatable' => 'niixixxiiixsxsssxsxsxxxxxxxxixxxxxxx',
'areatrigger' => 'niffxxxxxf',
@@ -100,6 +100,7 @@ class DBC
'overridespelldata' => 'niiiixixxxxx',
'powerdisplay' => 'nisbbb',
'questfactionreward' => 'niiiiiiiiii',
'questsort' => 'nsxsssxsxsxxxxxxxx',
'questxp' => 'niiiiiiiiii',
'randproppoints' => 'niiiiiiiiiiiiiii',
'scalingstatdistribution' => 'niiiiiiiiiiiiiiiiiiiii',
@@ -144,7 +145,7 @@ class DBC
private $_fields = array(
'achievement' => 'id,faction,map,previous,name_loc0,name_loc2,name_loc3,name_loc4,name_loc6,name_loc8,description_loc0,description_loc2,description_loc3,description_loc4,description_loc6,description_loc8,category,points,orderInGroup,flags,iconId,reward_loc0,reward_loc2,reward_loc3,reward_loc4,reward_loc6,reward_loc8,reqCriteriaCount,refAchievement',
'achievement_category' => 'id,parentCategory,name_loc0,name_loc2,name_loc3,name_loc4,name_loc6,name_loc8',
'achievement_category' => 'id,parentCategory',
'achievement_criteria' => 'id,refAchievementId,type,value1,value2,value3,value4,value5,value6,name_loc0,name_loc2,name_loc3,name_loc4,name_loc6,name_loc8,completionFlags,groupFlags,timeLimit,order',
'areatable' => 'id,mapId,areaTable,flags,soundAmbience,zoneMusic,zoneIntroMusic,name_loc0,name_loc2,name_loc3,name_loc4,name_loc6,name_loc8,factionGroupMask',
'areatrigger' => 'id,mapId,posY,posX,orientation',
@@ -202,6 +203,7 @@ class DBC
'overridespelldata' => 'id,spellId1,spellId2,spellId3,spellId4,spellId5',
'powerdisplay' => 'id,realType,globalString,r,g,b',
'questfactionreward' => 'id,field1,field2,field3,field4,field5,field6,field7,field8,field9,field10',
'questsort' => 'id,name_loc0,name_loc2,name_loc3,name_loc4,name_loc6,name_loc8',
'questxp' => 'id,field1,field2,field3,field4,field5,field6,field7,field8,field9,field10',
'randproppoints' => 'id,epic1,epic2,epic3,epic4,epic5,rare1,rare2,rare3,rare4,rare5,uncommon1,uncommon2,uncommon3,uncommon4,uncommon5',
'scalingstatdistribution' => 'id,statMod1,statMod2,statMod3,statMod4,statMod5,statMod6,statMod7,statMod8,statMod9,statMod10,modifier1,modifier2,modifier3,modifier4,modifier5,modifier6,modifier7,modifier8,modifier9,modifier10,maxLevel',

View File

@@ -313,7 +313,7 @@ if (!CLI)
if (!$buff)
{
// this behaviour is intended, do not create an error
CLI::write('profiler - file datasets/'.User::$localeString.'/p-recipes-'.$file.' has no content => skipping', CLI::LOG_WARN);
CLI::write('profiler - file datasets/'.User::$localeString.'/p-recipes-'.$file.' has no content => skipping', CLI::LOG_INFO);
continue;
}

View File

@@ -103,7 +103,7 @@ class SqlGen
self::$mode = $mode;
}
public static function register(SetupScript $ssRef) : bool
public static function register(SetupScript $ssRef) : void
{
// if dependancies haven't been stored yet, put aside for later use
foreach ($ssRef->getDependancies(true) as $d)
@@ -112,13 +112,13 @@ class SqlGen
continue;
self::$tmpStore[] = $ssRef;
return false;
return;
}
if (isset(self::$tables[$ssRef->getName()]))
{
CLI::write('a SetupScript named '.CLI::bold($ssRef->getName()).' was already registered. Skipping...', CLI::LOG_WARN);
return false;
return;
}
self::$tables[$ssRef->getName()] = $ssRef;
@@ -142,8 +142,6 @@ class SqlGen
unset(self::$tmpStore[$idx]);
}
}
return true;
}
private static function handleCLIOpts(&$doTbls) : void

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'];
});
?>

View File

@@ -0,0 +1,9 @@
DROP TABLE IF EXISTS `aowow_achievementcategory`;
CREATE TABLE `aowow_achievementcategory` (
`id` smallint(5) unsigned NOT NULL DEFAULT '0',
`parentCat` smallint(5) unsigned NOT NULL DEFAULT '0',
`parentCat2` smallint(5) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
UPDATE aowow_dbversion SET `sql` = CONCAT(IFNULL(`sql`, ''), ' achievements');