From f8cfcf9c55cdacc09fa73ef1169f93286595c8ef Mon Sep 17 00:00:00 2001 From: Andrew <47818697+Nyeriah@users.noreply.github.com> Date: Sun, 15 Feb 2026 11:35:02 -0300 Subject: [PATCH] fix(Core/Commands): Add detailed quest availability info to .quest info (#24721) Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> --- .../rev_1771157757057970557.sql | 25 ++++++ src/server/game/Miscellaneous/Language.h | 23 ++++- src/server/scripts/Commands/cs_quest.cpp | 83 ++++++++++++++++++- 3 files changed, 128 insertions(+), 3 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1771157757057970557.sql diff --git a/data/sql/updates/pending_db_world/rev_1771157757057970557.sql b/data/sql/updates/pending_db_world/rev_1771157757057970557.sql new file mode 100644 index 000000000..b3f9d02aa --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1771157757057970557.sql @@ -0,0 +1,25 @@ +-- +DELETE FROM `acore_string` WHERE `entry` IN (5089, 5090, 5091, 5092, 5093, 5094, 5095, 5096, 5097, 5098, 5099, 5100, 5101, 5102, 5103, 5104, 5105, 5106, 5107, 5108, 5109, 5110); +INSERT INTO `acore_string` (`entry`, `content_default`) VALUES +(5089, 'Quest {} cannot be taken. Reasons:'), +(5090, ' - Quest is disabled.'), +(5091, ' - Quest has already been taken or completed.'), +(5092, ' - Class requirement not met.'), +(5093, ' - Race requirement not met.'), +(5094, ' - Player level too low (required: {}).'), +(5095, ' - Player level too high (max: {}).'), +(5096, ' - Skill requirement not met.'), +(5097, ' - Reputation requirement not met.'), +(5098, ' - Previous quest in chain not completed.'), +(5099, ' - Already on a timed quest.'), +(5100, ' - Exclusive group quest conflict.'), +(5101, ' - Next quest in chain already started.'), +(5102, ' - Previous chain quest still active.'), +(5103, ' - Breadcrumb quest conflict.'), +(5104, ' - Daily quest not available today.'), +(5105, ' - Weekly quest already completed this week.'), +(5106, ' - Monthly quest already completed this month.'), +(5107, ' - Seasonal quest already completed this season.'), +(5108, ' - Condition requirements not met:'), +(5109, ' - Quest log is full.'), +(5110, ' - Condition not met: type {} value1: {} value2: {} value3: {}'); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 7f972a0a9..31ae7965a 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -1161,8 +1161,29 @@ enum AcoreStrings LANG_CMD_QUEST_STATUS = 5088, LANG_CMD_QUEST_UNAVAILABLE = 5089, + LANG_CMD_QUEST_STATUS_DISABLED = 5090, + LANG_CMD_QUEST_STATUS_ALREADY_DONE = 5091, + LANG_CMD_QUEST_STATUS_CLASS = 5092, + LANG_CMD_QUEST_STATUS_RACE = 5093, + LANG_CMD_QUEST_STATUS_LOW_LEVEL = 5094, + LANG_CMD_QUEST_STATUS_HIGH_LEVEL = 5095, + LANG_CMD_QUEST_STATUS_SKILL = 5096, + LANG_CMD_QUEST_STATUS_REPUTATION = 5097, + LANG_CMD_QUEST_STATUS_PREV_QUEST = 5098, + LANG_CMD_QUEST_STATUS_TIMED = 5099, + LANG_CMD_QUEST_STATUS_EXCLUSIVE = 5100, + LANG_CMD_QUEST_STATUS_NEXT_CHAIN = 5101, + LANG_CMD_QUEST_STATUS_PREV_CHAIN = 5102, + LANG_CMD_QUEST_STATUS_BREADCRUMB = 5103, + LANG_CMD_QUEST_STATUS_DAY = 5104, + LANG_CMD_QUEST_STATUS_WEEK = 5105, + LANG_CMD_QUEST_STATUS_MONTH = 5106, + LANG_CMD_QUEST_STATUS_SEASONAL = 5107, + LANG_CMD_QUEST_STATUS_CONDITION = 5108, + LANG_CMD_QUEST_STATUS_LOG_FULL = 5109, + LANG_CMD_QUEST_STATUS_COND_DETAIL = 5110, - // Room for more strings 5090-9999 + // Room for more strings 5111-9999 // Level requirement notifications LANG_SAY_REQ = 6604, diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index 9730b3221..daee0c91c 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -17,6 +17,8 @@ #include "Chat.h" #include "CommandScript.h" +#include "ConditionMgr.h" +#include "DisableMgr.h" #include "GameTime.h" #include "ObjectMgr.h" #include "Player.h" @@ -766,8 +768,85 @@ public: handler->PSendSysMessage(LANG_CMD_QUEST_STATUS, quest->GetTitle(), entry, status); - if (!player->CanTakeQuest(quest, true)) - handler->PSendSysMessage(LANG_CMD_QUEST_UNAVAILABLE, entry, status); + if (!player->CanTakeQuest(quest, false)) + { + handler->PSendSysMessage(LANG_CMD_QUEST_UNAVAILABLE, entry); + + if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_QUEST, entry, player)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_DISABLED); + + if (!player->SatisfyQuestStatus(quest, false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_ALREADY_DONE); + + if (!player->SatisfyQuestClass(quest, false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_CLASS); + + if (!player->SatisfyQuestRace(quest, false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_RACE); + + if (player->GetLevel() < quest->GetMinLevel()) + handler->PSendSysMessage(LANG_CMD_QUEST_STATUS_LOW_LEVEL, quest->GetMinLevel()); + + if (quest->GetMaxLevel() > 0 && player->GetLevel() > quest->GetMaxLevel()) + handler->PSendSysMessage(LANG_CMD_QUEST_STATUS_HIGH_LEVEL, quest->GetMaxLevel()); + + if (!player->SatisfyQuestSkill(quest, false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_SKILL); + + if (!player->SatisfyQuestReputation(quest, false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_REPUTATION); + + if (!player->SatisfyQuestPreviousQuest(quest, false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_PREV_QUEST); + + if (!player->SatisfyQuestTimed(quest, false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_TIMED); + + if (!player->SatisfyQuestExclusiveGroup(quest, false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_EXCLUSIVE); + + if (!player->SatisfyQuestNextChain(quest, false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_NEXT_CHAIN); + + if (!player->SatisfyQuestPrevChain(quest, false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_PREV_CHAIN); + + if (!player->SatisfyQuestBreadcrumb(quest, false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_BREADCRUMB); + + if (!player->SatisfyQuestDay(quest, false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_DAY); + + if (!player->SatisfyQuestWeek(quest, false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_WEEK); + + if (!player->SatisfyQuestMonth(quest, false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_MONTH); + + if (!player->SatisfyQuestSeasonal(quest, false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_SEASONAL); + + if (!player->SatisfyQuestConditions(quest, false)) + { + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_CONDITION); + + ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_AVAILABLE, entry); + ConditionSourceInfo srcInfo = ConditionSourceInfo(player); + for (Condition* cond : conditions) + { + if (!cond->Meets(srcInfo)) + handler->PSendSysMessage(LANG_CMD_QUEST_STATUS_COND_DETAIL, uint32(cond->ConditionType), cond->ConditionValue1, cond->ConditionValue2, cond->ConditionValue3); + } + } + + if (!player->SatisfyQuestLog(false)) + handler->SendSysMessage(LANG_CMD_QUEST_STATUS_LOG_FULL); + } + } + else + { + handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND); + return false; } return true;