diff --git a/endpoints/quest/quest.php b/endpoints/quest/quest.php index 4229fabf..9d3809e4 100644 --- a/endpoints/quest/quest.php +++ b/endpoints/quest/quest.php @@ -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 ($_) diff --git a/endpoints/quests/quests.php b/endpoints/quests/quests.php index 8dcfe081..16bd0f9a 100644 --- a/endpoints/quests/quests.php +++ b/endpoints/quests/quests.php @@ -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]]]; /*************/ diff --git a/endpoints/skill/skill.php b/endpoints/skill/skill.php index 40b5133a..74cc99a8 100644 --- a/endpoints/skill/skill.php +++ b/endpoints/skill/skill.php @@ -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()); diff --git a/endpoints/zone/zone.php b/endpoints/zone/zone.php index d7d11ced..eb2da5b8 100644 --- a/endpoints/zone/zone.php +++ b/endpoints/zone/zone.php @@ -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()); diff --git a/includes/dbtypes/quest.class.php b/includes/dbtypes/quest.class.php index 215657ff..49909d32 100644 --- a/includes/dbtypes/quest.class.php +++ b/includes/dbtypes/quest.class.php @@ -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 diff --git a/includes/game/misc.php b/includes/game/misc.php index f146ae48..c9504eca 100644 --- a/includes/game/misc.php +++ b/includes/game/misc.php @@ -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 diff --git a/setup/sql/01-db_structure.sql b/setup/sql/01-db_structure.sql index a2d8947d..f4cf0375 100644 --- a/setup/sql/01-db_structure.sql +++ b/setup/sql/01-db_structure.sql @@ -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, diff --git a/setup/sql/02-db_initial_data.sql b/setup/sql/02-db_initial_data.sql index 654f06fd..9b04fb55 100644 --- a/setup/sql/02-db_initial_data.sql +++ b/setup/sql/02-db_initial_data.sql @@ -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; diff --git a/setup/sql/updates/1767117346_01.sql b/setup/sql/updates/1767117346_01.sql new file mode 100644 index 00000000..5a565565 --- /dev/null +++ b/setup/sql/updates/1767117346_01.sql @@ -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 +; diff --git a/setup/tools/filegen/profiler.ss.php b/setup/tools/filegen/profiler.ss.php index 03ffa0c3..98cfb57f 100644 --- a/setup/tools/filegen/profiler.ss.php +++ b/setup/tools/filegen/profiler.ss.php @@ -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; diff --git a/setup/tools/sqlgen/quests.ss.php b/setup/tools/sqlgen/quests.ss.php index d2d8a6da..bbb9c9fe 100644 --- a/setup/tools/sqlgen/quests.ss.php +++ b/setup/tools/sqlgen/quests.ss.php @@ -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