Skip to content

Commit

Permalink
fix(Core/PlayerQuest): Introduce flag QUEST_SPECIAL_FLAGS_NO_LOREMAST… (
Browse files Browse the repository at this point in the history
#19962)

* 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
  • Loading branch information
sudlud committed Sep 15, 2024
1 parent 1df989f commit e2353a1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
7 changes: 7 additions & 0 deletions data/sql/updates/pending_db_world/rev_1726231075608295100.sql
Original file line number Diff line number Diff line change
@@ -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));
2 changes: 1 addition & 1 deletion src/server/game/Achievements/AchievementMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Quests/QuestDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ void Quest::LoadQuestTemplateAddon(Field* fields)
RequiredMaxRepValue = fields[14].Get<int32>();
StartItemCount = fields[15].Get<uint8>();
RewardMailSenderEntry = fields[16].Get<uint32>();
SpecialFlags = fields[17].Get<uint8>();
SpecialFlags = fields[17].Get<uint32>();

if ((SpecialFlags & QUEST_SPECIAL_FLAGS_AUTO_ACCEPT) && !sWorld->getBoolConfig(CONFIG_QUEST_IGNORE_AUTO_ACCEPT))
{
Expand Down
13 changes: 7 additions & 6 deletions src/server/game/Quests/QuestDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e2353a1

Please sign in to comment.