Quests/Fixup

* rename columns of quests table to avoid name collisions
   and to match the dbc they are referencing
 * fixes #463
This commit is contained in:
Sarjuuk 2025-12-30 19:15:06 +01:00
parent c44bf4f575
commit eec21c2763
11 changed files with 35 additions and 29 deletions

View file

@ -117,11 +117,11 @@ class QuestBaseResponse extends TemplateResponse implements ICache
}
// loremaster (i dearly hope those flags cover every case...)
if ($this->subject->getField('zoneOrSortBak') > 0 && !$this->subject->isRepeatable())
if ($this->subject->getField('questSortIdBak') > 0 && !$this->subject->isRepeatable())
{
$conditions = array(
['ac.type', ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE],
['ac.value1', $this->subject->getField('zoneOrSortBak')],
['ac.value1', $this->subject->getField('questSortIdBak')],
['a.faction', $_side, '&']
);
$loremaster = new AchievementList($conditions);
@ -153,7 +153,7 @@ class QuestBaseResponse extends TemplateResponse implements ICache
else if ($_specialFlags & QUEST_FLAG_SPECIAL_MONTHLY)
$_[] = Lang::quest('monthly');
if ($t = $this->subject->getField('type'))
if ($t = $this->subject->getField('questInfoId'))
$_[] = Lang::quest('questInfo', $t);
if ($_)

View file

@ -74,9 +74,9 @@ class QuestsBaseResponse extends TemplateResponse implements ICache
$conditions[] = $_;
if (isset($this->category[1]))
$conditions[] = ['zoneOrSort', $this->category[1]];
$conditions[] = ['questSortId', $this->category[1]];
else if (isset($this->category[0]))
$conditions[] = ['zoneOrSort', $this->validCats[$this->category[0]]];
$conditions[] = ['questSortId', $this->validCats[$this->category[0]]];
/*************/

View file

@ -337,7 +337,7 @@ class SkillBaseResponse extends TemplateResponse implements ICache
if ($sort)
{
$quests = new QuestList(array(['zoneOrSort', -$sort]));
$quests = new QuestList(array(['questSortId', -$sort]));
if (!$quests->error)
{
$this->extendGlobalData($quests->getJSGlobals());

View file

@ -327,7 +327,7 @@ class ZoneBaseResponse extends TemplateResponse implements ICache
// store data for misc tabs
foreach ($started->getListviewData() as $id => $data)
{
if ($started->getField('zoneOrSort') > 0 && !in_array($started->getField('zoneOrSort'), $relQuestZOS))
if ($started->getField('questSortId') > 0 && !in_array($started->getField('questSortId'), $relQuestZOS))
continue;
if (!empty($started->rewards[$id][Type::ITEM]))
@ -424,7 +424,7 @@ class ZoneBaseResponse extends TemplateResponse implements ICache
// store data for misc tabs
foreach ($started->getListviewData() as $id => $data)
{
if ($started->getField('zoneOrSort') > 0 && !in_array($started->getField('zoneOrSort'), $relQuestZOS))
if ($started->getField('questSortId') > 0 && !in_array($started->getField('questSortId'), $relQuestZOS))
continue;
if (!empty($started->rewards[$id][Type::ITEM]))
@ -643,7 +643,7 @@ class ZoneBaseResponse extends TemplateResponse implements ICache
$this->lvTabs->addListviewTab(new Listview($tabData, GameObjectList::$brickFile));
}
$quests = new QuestList(array(['zoneOrSort', $this->typeId]));
$quests = new QuestList(array(['questSortId', $this->typeId]));
if (!$quests->error)
{
$this->extendGlobalData($quests->getJSGlobals());

View file

@ -33,7 +33,7 @@ class QuestList extends DBTypeList
// post processing
foreach ($this->iterate() as $id => &$_curTpl)
{
$_curTpl['cat1'] = $_curTpl['zoneOrSort']; // should probably be in a method...
$_curTpl['cat1'] = $_curTpl['questSortId']; // should probably be in a method...
$_curTpl['cat2'] = 0;
foreach (Game::QUEST_CLASSES as $k => $arr)
@ -138,7 +138,7 @@ class QuestList extends DBTypeList
// by TC definition
public function isSeasonal() : bool
{
return in_array($this->getField('zoneOrSortBak'), [-22, -284, -366, -369, -370, -376, -374]) && !$this->isRepeatable();
return in_array($this->getField('questSortIdBak'), [-22, -284, -366, -369, -370, -376, -374]) && !$this->isRepeatable();
}
public function getSourceData(int $id = 0) : array
@ -225,7 +225,7 @@ class QuestList extends DBTypeList
if ($_ = $this->curTpl['rewardTitleId'])
$data[$this->id]['titlereward'] = $_;
if ($_ = $this->curTpl['type'])
if ($_ = $this->curTpl['questInfoId'])
$data[$this->id]['type'] = $_;
if ($_ = $this->curTpl['reqClassMask'])
@ -548,9 +548,9 @@ class QuestListFilter extends Filter
};
}
// type [list]
// questInfoId [list]
if ($_v['ty'] !== null)
$parts[] = ['type', $_v['ty']];
$parts[] = ['questInfoId', $_v['ty']];
return $parts;
}
@ -650,9 +650,9 @@ class QuestListFilter extends Filter
return null;
if ($crs)
return ['AND', ['zoneOrSort', 0, '>'], [['flags', QUEST_FLAG_DAILY | QUEST_FLAG_WEEKLY | QUEST_FLAG_REPEATABLE, '&'], 0], [['specialFlags', QUEST_FLAG_SPECIAL_REPEATABLE | QUEST_FLAG_SPECIAL_MONTHLY, '&'], 0]];
return ['AND', ['questSortId', 0, '>'], [['flags', QUEST_FLAG_DAILY | QUEST_FLAG_WEEKLY | QUEST_FLAG_REPEATABLE, '&'], 0], [['specialFlags', QUEST_FLAG_SPECIAL_REPEATABLE | QUEST_FLAG_SPECIAL_MONTHLY, '&'], 0]];
else
return ['OR', ['zoneOrSort', 0, '<'], ['flags', QUEST_FLAG_DAILY | QUEST_FLAG_WEEKLY | QUEST_FLAG_REPEATABLE, '&'], ['specialFlags', QUEST_FLAG_SPECIAL_REPEATABLE | QUEST_FLAG_SPECIAL_MONTHLY, '&']];
return ['OR', ['questSortId', 0, '<'], ['flags', QUEST_FLAG_DAILY | QUEST_FLAG_WEEKLY | QUEST_FLAG_REPEATABLE, '&'], ['specialFlags', QUEST_FLAG_SPECIAL_REPEATABLE | QUEST_FLAG_SPECIAL_MONTHLY, '&']];
}
protected function cbSpellRewards(int $cr, int $crs, string $crv) : ?array

View file

@ -46,7 +46,7 @@ class Game
10 => [ 65, 66, 67, 210, 394, 495, 2817, 3537, 3711, 4024, 4197, 4395, 4742]
);
// zoneorsort for quests need updating
// questSortId for quests need updating
// partially points non-instanced area with identical name for instance quests
public static array $questSortFix = array(
-221 => 440, // Treasure Map => Tanaris

View file

@ -2047,13 +2047,13 @@ DROP TABLE IF EXISTS `aowow_quests`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `aowow_quests` (
`id` mediumint(8) unsigned NOT NULL DEFAULT 0,
`method` tinyint(3) unsigned NOT NULL DEFAULT 2,
`questType` tinyint(3) unsigned NOT NULL DEFAULT 2,
`level` smallint(6) NOT NULL DEFAULT 1,
`minLevel` tinyint(3) unsigned NOT NULL DEFAULT 0,
`maxLevel` tinyint(3) unsigned NOT NULL DEFAULT 0,
`zoneOrSort` smallint(6) NOT NULL DEFAULT 0,
`zoneOrSortBak` smallint(6) NOT NULL DEFAULT 0,
`type` smallint(5) unsigned NOT NULL DEFAULT 0,
`questSortId` smallint(6) NOT NULL DEFAULT 0,
`questSortIdBak` smallint(6) NOT NULL DEFAULT 0,
`questInfoId` smallint(5) unsigned NOT NULL DEFAULT 0,
`suggestedPlayers` tinyint(3) unsigned NOT NULL DEFAULT 0,
`timeLimit` int(10) unsigned NOT NULL DEFAULT 0,
`eventId` smallint(5) unsigned NOT NULL DEFAULT 0,

View file

@ -71,7 +71,7 @@ UNLOCK TABLES;
LOCK TABLES `aowow_dbversion` WRITE;
/*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */;
INSERT INTO `aowow_dbversion` VALUES (1767026730,0,NULL,NULL);
INSERT INTO `aowow_dbversion` VALUES (1767117347,0,NULL,NULL);
/*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */;
UNLOCK TABLES;

View file

@ -0,0 +1,6 @@
ALTER TABLE aowow_quests
CHANGE COLUMN `method` `questType` tinyint(3) unsigned NOT NULL DEFAULT 2,
CHANGE COLUMN `zoneOrSort` `questSortId` smallint(6) NOT NULL DEFAULT 0,
CHANGE COLUMN `zoneOrSortBak` `questSortIdBak` smallint(6) NOT NULL DEFAULT 0,
CHANGE COLUMN `type` `questInfoId` smallint(5) unsigned NOT NULL DEFAULT 0
;

View file

@ -67,7 +67,7 @@ CLISetup::registerSetup("build", new class extends SetupScript
if ($cat2 < 0)
continue;
$cond = array_merge($condition, [['zoneOrSort', $cat]]);
$cond = array_merge($condition, [['questSortId', $cat]]);
$questz = new QuestList($cond);
if ($questz->error)
continue;

View file

@ -29,8 +29,8 @@ CLISetup::registerSetup("sql", new class extends SetupScript
MinLevel,
IFNULL(qa.MaxLevel, 0),
QuestSortID,
QuestSortID AS zoneOrSortBak, -- ZoneOrSortBak
QuestInfoID, -- QuestType
QuestSortID AS questSortIdBak,
QuestInfoID,
SuggestedGroupNum,
TimeAllowed,
IFNULL(gesqr.eventEntry, 0) AS eventId,
@ -193,7 +193,7 @@ CLISetup::registerSetup("sql", new class extends SetupScript
// 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 `questSortId` = ?d WHERE `questSortIdBak` = ?d', $parent, $child);
// move quests linked to holidays into appropirate quests-sorts. create dummy sorts as needed
@ -207,14 +207,14 @@ 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 `questSortId` = ?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 `questSortId` = ?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 `questSortId` = ?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