Quests/Series

* apply cuFlags to quest series
 * implement firstquestseries, lastquestseries, partseries filters using said flags
This commit is contained in:
Sarjuuk
2025-06-22 19:14:48 +02:00
parent 7c527e6144
commit e173de9a97
4 changed files with 66 additions and 25 deletions

View File

@@ -345,13 +345,16 @@ define('ITEM_CU_OT_OBJECTLOOT', 0x02);
define('EMOTE_CU_MISSING_CMD', 0x01); // no alias in Globalstrings.lua and thus unusable
// as seen in wFlags
define('QUEST_CU_REPEATABLE', 0x01);
define('QUEST_CU_DAILY', 0x02);
define('QUEST_CU_WEEKLY', 0x04);
define('QUEST_CU_SEASONAL', 0x08);
define('QUEST_CU_SKIP_LOG', 0x10);
define('QUEST_CU_AUTO_ACCEPT', 0x20);
define('QUEST_CU_PVP_ENABLED', 0x40);
define('QUEST_CU_REPEATABLE', 0x0001);
define('QUEST_CU_DAILY', 0x0002);
define('QUEST_CU_WEEKLY', 0x0004);
define('QUEST_CU_SEASONAL', 0x0008);
define('QUEST_CU_SKIP_LOG', 0x0010);
define('QUEST_CU_AUTO_ACCEPT', 0x0020);
define('QUEST_CU_PVP_ENABLED', 0x0040);
define('QUEST_CU_FIRST_SERIES', 0x0080);
define('QUEST_CU_LAST_SERIES', 0x0100);
define('QUEST_CU_PART_OF_SERIES', 0x0200);
define('PROFILER_CU_PUBLISHED', 0x01);
define('PROFILER_CU_PINNED', 0x02);

View File

@@ -447,12 +447,12 @@ class QuestListFilter extends Filter
4 => [parent::CR_CALLBACK, 'cbSpellRewards', null, null], // spellrewarded [yn]
5 => [parent::CR_FLAG, 'flags', QUEST_FLAG_SHARABLE ], // sharable
6 => [parent::CR_NUMERIC, 'timeLimit', NUM_CAST_INT ], // timer
7 => [parent::CR_NYI_PH, null, 1 ], // firstquestseries
7 => [parent::CR_FLAG, 'cuFlags', QUEST_CU_FIRST_SERIES ], // firstquestseries
9 => [parent::CR_CALLBACK, 'cbEarnReputation', null, null], // objectiveearnrepwith [enum]
10 => [parent::CR_CALLBACK, 'cbReputation', '<', null], // decreasesrepwith
11 => [parent::CR_NUMERIC, 'suggestedPlayers', NUM_CAST_INT ], // suggestedplayers
15 => [parent::CR_NYI_PH, null, 1 ], // lastquestseries
16 => [parent::CR_NYI_PH, null, 1 ], // partseries
15 => [parent::CR_FLAG, 'cuFlags', QUEST_CU_LAST_SERIES ], // lastquestseries
16 => [parent::CR_FLAG, 'cuFlags', QUEST_CU_PART_OF_SERIES ], // partseries
18 => [parent::CR_FLAG, 'cuFlags', CUSTOM_HAS_SCREENSHOT ], // hasscreenshots
19 => [parent::CR_CALLBACK, 'cbQuestRelation', 0x1, null], // startsfrom [enum]
21 => [parent::CR_CALLBACK, 'cbQuestRelation', 0x2, null], // endsat [enum]

View File

@@ -126,6 +126,7 @@ CLISetup::registerSetup("sql", new class extends SetupScript
DB::Aowow()->query('INSERT INTO ?_quests VALUES (?a)', array_values($quest));
}
/*
just some random thoughts here ..
quest-custom-flags are derived from flags and specialFlags
@@ -134,36 +135,69 @@ CLISetup::registerSetup("sql", new class extends SetupScript
same with QUEST_FLAG_UNAVAILABLE => CUSTOM_EXCLUDE_FOR_LISTVIEW
*/
CLI::write(' * unpacking XP rewards (1/4)', CLI::LOG_BLANK, true, true);
// unpack XP-reward
DB::Aowow()->query(
'UPDATE ?_quests q, dbc_questxp xp
SET rewardXP = (CASE rewardXP
WHEN 0 THEN xp.Field1 WHEN 1 THEN xp.Field2 WHEN 2 THEN xp.Field3 WHEN 3 THEN xp.Field4 WHEN 4 THEN xp.Field5
WHEN 5 THEN xp.Field6 WHEN 6 THEN xp.Field7 WHEN 7 THEN xp.Field8 WHEN 8 THEN xp.Field9 WHEN 9 THEN xp.Field10
SET `rewardXP` = (CASE `rewardXP`
WHEN 0 THEN xp.`Field1` WHEN 1 THEN xp.`Field2` WHEN 2 THEN xp.`Field3` WHEN 3 THEN xp.`Field4` WHEN 4 THEN xp.`Field5`
WHEN 5 THEN xp.`Field6` WHEN 6 THEN xp.`Field7` WHEN 7 THEN xp.`Field8` WHEN 8 THEN xp.`Field9` WHEN 9 THEN xp.`Field10`
ELSE 0 END)
WHERE xp.id = q.level { AND q.id IN (?a) }',
WHERE xp.`id` = q.`level` { AND q.`id` IN (?a) }',
$ids ?: DBSIMPLE_SKIP
);
CLI::write(' * unpacking reputation gains (2/4)', CLI::LOG_BLANK, true, true);
// unpack Rep-rewards
for ($i = 1; $i < 6; $i++)
DB::Aowow()->query(
'UPDATE ?_quests q
LEFT JOIN dbc_questfactionreward rep ON rep.id = IF(rewardFactionValue?d > 0, 1, 2)
LEFT JOIN dbc_questfactionreward rep ON rep.`id` = IF(rewardFactionValue?d > 0, 1, 2)
SET rewardFactionValue?d = (CASE ABS(rewardFactionValue?d)
WHEN 0 THEN rep.Field1 WHEN 1 THEN rep.Field2 WHEN 2 THEN rep.Field3 WHEN 3 THEN rep.Field4 WHEN 4 THEN rep.Field5
WHEN 5 THEN rep.Field6 WHEN 6 THEN rep.Field7 WHEN 7 THEN rep.Field8 WHEN 8 THEN rep.Field9 WHEN 9 THEN rep.Field10
WHEN 0 THEN rep.`Field1` WHEN 1 THEN rep.`Field2` WHEN 2 THEN rep.`Field3` WHEN 3 THEN rep.`Field4` WHEN 4 THEN rep.`Field5`
WHEN 5 THEN rep.`Field6` WHEN 6 THEN rep.`Field7` WHEN 7 THEN rep.`Field8` WHEN 8 THEN rep.`Field9` WHEN 9 THEN rep.`Field10`
ELSE 0 END)
WHERE ABS(rewardFactionValue?d) BETWEEN 1 AND 10 { AND q.id IN (?a) }',
WHERE ABS(rewardFactionValue?d) BETWEEN 1 AND 10 { AND q.`id` IN (?a) }',
$i, $i, $i, $i,
$ids ?: DBSIMPLE_SKIP
);
CLI::write(' * flagging quests series (3/4)', CLI::LOG_BLANK, true, true);
// set series flags
DB::Aowow()->query(
'UPDATE ?_quests q
LEFT JOIN ?_quests q2 ON q2.`NextQuestIdChain` = q.id
SET q.`cuFlags` = q.`cuFlags` | ?d
WHERE q.`NextQuestIdChain` > 0 AND q2.`id` IS NULL',
QUEST_CU_FIRST_SERIES | QUEST_CU_PART_OF_SERIES
);
DB::Aowow()->query(
'UPDATE ?_quests q
JOIN ?_quests q2 ON q2.`NextQuestIdChain` = q.id
SET q.`cuFlags` = q.`cuFlags` | ?d
WHERE q.`NextQuestIdChain` = 0',
QUEST_CU_LAST_SERIES | QUEST_CU_PART_OF_SERIES
);
DB::Aowow()->query('UPDATE ?_quests SET `cuFlags` = `cuFlags` | ?d WHERE `NextQuestIdChain` > 0', QUEST_CU_PART_OF_SERIES);
CLI::write(' * applying fixes (4/4)', CLI::LOG_BLANK, true, true);
// fix questSorts for instance quests
foreach (Game::$questSortFix as $child => $parent)
DB::Aowow()->query('UPDATE ?_quests SET zoneOrSort = ?d WHERE zoneOrSortBak = ?d', $parent, $child);
DB::Aowow()->query('UPDATE ?_quests SET `zoneOrSort` = ?d WHERE `zoneOrSortBak` = ?d', $parent, $child);
// move quests linked to holidays into appropirate quests-sorts. create dummy sorts as needed
$eventSet = DB::World()->selectCol('SELECT holiday AS ARRAY_KEY, eventEntry FROM game_event WHERE holiday <> 0');
$eventSet = DB::World()->selectCol('SELECT `holiday` AS ARRAY_KEY, `eventEntry` FROM game_event WHERE `holiday` <> 0');
$holidaySorts = array(
141 => -1001, 181 => -374, 201 => -1002, // Winter Veil Noblegarden Childrens Week
321 => -1005, 324 => -1003, 404 => -375, // Harvest Fest. Hallows End Pilgrims Bounty
@@ -173,14 +207,17 @@ CLISetup::registerSetup("sql", new class extends SetupScript
foreach ($holidaySorts as $hId => $sort)
if (!empty($eventSet[$hId]))
DB::Aowow()->query('UPDATE ?_quests SET zoneOrSort = ?d WHERE eventId = ?d{ AND id IN (?a)}', $sort, $eventSet[$hId], $ids ?: DBSIMPLE_SKIP);
DB::Aowow()->query('UPDATE ?_quests SET `zoneOrSort` = ?d WHERE `eventId` = ?d{ AND `id` IN (?a)}', $sort, $eventSet[$hId], $ids ?: DBSIMPLE_SKIP);
// 'special' special cases
// fishing quests to stranglethorn extravaganza
DB::Aowow()->query('UPDATE ?_quests SET zoneOrSort = ?d WHERE id IN (?a){ AND id IN (?a)}', -101, [8228, 8229], $ids ?: DBSIMPLE_SKIP);
DB::Aowow()->query('UPDATE ?_quests SET `zoneOrSort` = ?d WHERE `id` IN (?a){ AND `id` IN (?a)}', -101, [8228, 8229], $ids ?: DBSIMPLE_SKIP);
// dungeon quests to Misc/Dungeon Finder
DB::Aowow()->query('UPDATE ?_quests SET zoneOrSort = ?d WHERE (specialFlags & ?d OR id IN (?a)){ AND id IN (?a)}', -1010, QUEST_FLAG_SPECIAL_DUNGEON_FINDER, [24789, 24791, 24923], $ids ?: DBSIMPLE_SKIP);
DB::Aowow()->query('UPDATE ?_quests SET `zoneOrSort` = ?d WHERE (`specialFlags` & ?d OR `id` IN (?a)){ AND `id` IN (?a)}', -1010, QUEST_FLAG_SPECIAL_DUNGEON_FINDER, [24789, 24791, 24923], $ids ?: DBSIMPLE_SKIP);
// flag internal/unsued quests as unsearchable
DB::Aowow()->query(
'UPDATE ?_quests
SET `cuFlags` = `cuFlags` | ?d

View File

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