From e2353a1c9f58a143581ed326e9b0600f90c24aeb Mon Sep 17 00:00:00 2001 From: sudlud Date: Sun, 15 Sep 2024 23:15:21 +0200 Subject: [PATCH] =?UTF-8?q?fix(Core/PlayerQuest):=20Introduce=20flag=20QUE?= =?UTF-8?q?ST=5FSPECIAL=5FFLAGS=5FNO=5FLOREMAST=E2=80=A6=20(#19962)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(Core/PlayerQuest): Introduce flag QUEST_SPECIAL_FLAGS_NO_LOREMASTER_COUNT - this allows flagging quests so that they will not count towards Loremaster achievement - update Corrupted Flower Quests in Felwood accordingly as a first use case * load Specialflags as uint32 from DB --- .../pending_db_world/rev_1726231075608295100.sql | 7 +++++++ src/server/game/Achievements/AchievementMgr.cpp | 2 +- src/server/game/Quests/QuestDef.cpp | 2 +- src/server/game/Quests/QuestDef.h | 13 +++++++------ 4 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1726231075608295100.sql diff --git a/data/sql/updates/pending_db_world/rev_1726231075608295100.sql b/data/sql/updates/pending_db_world/rev_1726231075608295100.sql new file mode 100644 index 000000000..ed9f2d7e8 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1726231075608295100.sql @@ -0,0 +1,7 @@ +-- implement QUEST_SPECIAL_FLAGS_NO_LOREMASTER_COUNT +-- extend column datatype from tinyint to int +ALTER TABLE `quest_template_addon` MODIFY COLUMN `SpecialFlags` INT UNSIGNED DEFAULT 0 NOT NULL; + +-- add flag to Corrupted Flower Quests in Felwood +UPDATE `quest_template_addon` SET `SpecialFlags` = (`SpecialFlags` | 256) +WHERE (`ID` IN (996, 998, 1514, 2523, 2878, 3363, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4221, 4222, 4343, 4401, 4403, 4443, 4444, 4445, 4446, 4447, 4448, 4461, 4462, 4464, 4465, 4466, 4467)); diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index a6b2f905f..697dd05a3 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -1087,7 +1087,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui for (RewardedQuestSet::const_iterator itr = rewQuests.begin(); itr != rewQuests.end(); ++itr) { Quest const* quest = sObjectMgr->GetQuestTemplate(*itr); - if (quest && quest->GetZoneOrSort() >= 0 && uint32(quest->GetZoneOrSort()) == achievementCriteria->complete_quests_in_zone.zoneID) + if (quest && quest->GetZoneOrSort() >= 0 && uint32(quest->GetZoneOrSort()) == achievementCriteria->complete_quests_in_zone.zoneID && !(quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_NO_LOREMASTER_COUNT))) ++counter; } SetCriteriaProgress(achievementCriteria, counter); diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index a4cf35b85..12edb29a2 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -187,7 +187,7 @@ void Quest::LoadQuestTemplateAddon(Field* fields) RequiredMaxRepValue = fields[14].Get(); StartItemCount = fields[15].Get(); RewardMailSenderEntry = fields[16].Get(); - SpecialFlags = fields[17].Get(); + SpecialFlags = fields[17].Get(); if ((SpecialFlags & QUEST_SPECIAL_FLAGS_AUTO_ACCEPT) && !sWorld->getBoolConfig(CONFIG_QUEST_IGNORE_AUTO_ACCEPT)) { diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index 84bbec84b..247ac1ec2 100644 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -165,17 +165,18 @@ enum QuestSpecialFlags QUEST_SPECIAL_FLAGS_CAST = 0x0020, // Set by 32 in SpecialFlags in DB if the quest requires RequiredOrNpcGo killcredit but NOT kill (a spell cast) QUEST_SPECIAL_FLAGS_NO_REP_SPILLOVER = 0x0040, // Set by 64 in SpecialFlags in DB if the quest does not share rewarded reputation with other allied factions QUEST_SPECIAL_FLAGS_CAN_FAIL_IN_ANY_STATE = 0x0080, // Set by 128 in SpecialFlags in DB if the quest is allowed to fail in Player::FailQuest() independant of its current state + QUEST_SPECIAL_FLAGS_NO_LOREMASTER_COUNT = 0x0100, // Set by 256 in SpecialFlags in DB if the quest should not count towards Loremaster Achievement // room for more custom flags QUEST_SPECIAL_FLAGS_DB_ALLOWED = QUEST_SPECIAL_FLAGS_REPEATABLE | QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT | QUEST_SPECIAL_FLAGS_AUTO_ACCEPT | QUEST_SPECIAL_FLAGS_DF_QUEST | QUEST_SPECIAL_FLAGS_MONTHLY | QUEST_SPECIAL_FLAGS_CAST | QUEST_SPECIAL_FLAGS_NO_REP_SPILLOVER | - QUEST_SPECIAL_FLAGS_CAN_FAIL_IN_ANY_STATE, + QUEST_SPECIAL_FLAGS_CAN_FAIL_IN_ANY_STATE | QUEST_SPECIAL_FLAGS_NO_LOREMASTER_COUNT, - QUEST_SPECIAL_FLAGS_DELIVER = 0x0100, // Internal flag computed only - QUEST_SPECIAL_FLAGS_SPEAKTO = 0x0200, // Internal flag computed only - QUEST_SPECIAL_FLAGS_KILL = 0x0400, // Internal flag computed only - QUEST_SPECIAL_FLAGS_TIMED = 0x0800, // Internal flag computed only - QUEST_SPECIAL_FLAGS_PLAYER_KILL = 0x1000 // Internal flag computed only + QUEST_SPECIAL_FLAGS_DELIVER = 0x0200, // Internal flag computed only + QUEST_SPECIAL_FLAGS_SPEAKTO = 0x0400, // Internal flag computed only + QUEST_SPECIAL_FLAGS_KILL = 0x0800, // Internal flag computed only + QUEST_SPECIAL_FLAGS_TIMED = 0x1000, // Internal flag computed only + QUEST_SPECIAL_FLAGS_PLAYER_KILL = 0x2000 // Internal flag computed only }; struct QuestLocale