aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNay <dnpd.dd@gmail.com>2013-08-11 16:36:36 +0100
committerNay <dnpd.dd@gmail.com>2013-08-11 16:36:36 +0100
commit2abaf6224e96920956d003e1894cc96382f18d0f (patch)
treed7f730bed79bb2d4dbadcda1170735de48882e41
parent3d1c549aa42aff4d146350b6936d90a5adb859ef (diff)
Core/Player: Add debug log when SendCanTakeQuestResponse(INVALIDREASON_*) is used
Intent is to find broken quest chains Requested by Aokromes
-rw-r--r--src/server/game/Entities/Player/Player.cpp63
-rw-r--r--src/server/game/Entities/Player/Player.h27
-rw-r--r--src/server/game/Quests/QuestDef.h2
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp2
4 files changed, 76 insertions, 18 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index ed08e5f55e7..d1b42151e0a 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -15384,7 +15384,10 @@ bool Player::SatisfyQuestSkill(Quest const* qInfo, bool msg) const
if (GetSkillValue(skill) < qInfo->GetRequiredSkillValue())
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestSkill: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required skill value.", qInfo->GetQuestId());
+ }
return false;
}
@@ -15397,13 +15400,19 @@ bool Player::SatisfyQuestLevel(Quest const* qInfo, bool msg)
if (getLevel() < qInfo->GetMinLevel())
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_QUEST_FAILED_LOW_LEVEL);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestLevel: Sent INVALIDREASON_QUEST_FAILED_LOW_LEVEL (questId: %u) because player does not have required (min) level.", qInfo->GetQuestId());
+ }
return false;
}
else if (qInfo->GetMaxLevel() > 0 && getLevel() > qInfo->GetMaxLevel())
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); // There doesn't seem to be a specific response for too high player level
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestLevel: Sent INVALIDREASON_QUEST_FAILED_LOW_LEVEL (questId: %u) because player does not have required (max) level.", qInfo->GetQuestId());
+ }
return false;
}
return true;
@@ -15460,11 +15469,14 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg)
if (exclude_Id == prevId)
continue;
- // alternative quest from group also must be completed and rewarded(reported)
+ // alternative quest from group also must be completed and rewarded (reported)
if (m_RewardedQuests.find(exclude_Id) == m_RewardedQuests.end())
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestPreviousQuest: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required quest (1).", qInfo->GetQuestId());
+ }
return false;
}
}
@@ -15497,7 +15509,11 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg)
if (GetQuestStatus(exclude_Id) != QUEST_STATUS_NONE)
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestPreviousQuest: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required quest (2).", qInfo->GetQuestId());
+
+ }
return false;
}
}
@@ -15509,7 +15525,10 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg)
// Has only positive prev. quests in non-rewarded state
// and negative prev. quests in non-active state
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestPreviousQuest: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required quest (3).", qInfo->GetQuestId());
+ }
return false;
}
@@ -15524,7 +15543,10 @@ bool Player::SatisfyQuestClass(Quest const* qInfo, bool msg) const
if ((reqClass & getClassMask()) == 0)
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestClass: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required class.", qInfo->GetQuestId());
+ }
return false;
}
@@ -15540,7 +15562,11 @@ bool Player::SatisfyQuestRace(Quest const* qInfo, bool msg)
if ((reqraces & getRaceMask()) == 0)
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_QUEST_FAILED_WRONG_RACE);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestRace: Sent INVALIDREASON_QUEST_FAILED_WRONG_RACE (questId: %u) because player does not have required race.", qInfo->GetQuestId());
+
+ }
return false;
}
return true;
@@ -15552,7 +15578,10 @@ bool Player::SatisfyQuestReputation(Quest const* qInfo, bool msg)
if (fIdMin && GetReputationMgr().GetReputation(fIdMin) < qInfo->GetRequiredMinRepValue())
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestReputation: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required reputation (min).", qInfo->GetQuestId());
+ }
return false;
}
@@ -15560,7 +15589,10 @@ bool Player::SatisfyQuestReputation(Quest const* qInfo, bool msg)
if (fIdMax && GetReputationMgr().GetReputation(fIdMax) >= qInfo->GetRequiredMaxRepValue())
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestReputation: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required reputation (max).", qInfo->GetQuestId());
+ }
return false;
}
@@ -15570,7 +15602,10 @@ bool Player::SatisfyQuestReputation(Quest const* qInfo, bool msg)
if (fIdObj && GetReputationMgr().GetReputation(fIdObj) >= qInfo->GetRepObjectiveValue2())
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestReputation: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required reputation (ReputationObjective2).", qInfo->GetQuestId());
+ }
return false;
}
@@ -15582,7 +15617,10 @@ bool Player::SatisfyQuestStatus(Quest const* qInfo, bool msg)
if (GetQuestStatus(qInfo->GetQuestId()) != QUEST_STATUS_NONE)
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_QUEST_ALREADY_ON);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestStatus: Sent INVALIDREASON_QUEST_ALREADY_ON (questId: %u) because player quest status is not NONE.", qInfo->GetQuestId());
+ }
return false;
}
return true;
@@ -15594,7 +15632,10 @@ bool Player::SatisfyQuestConditions(Quest const* qInfo, bool msg)
if (!sConditionMgr->IsObjectMeetToConditions(this, conditions))
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestConditions: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not meet conditions.", qInfo->GetQuestId());
+ }
TC_LOG_DEBUG(LOG_FILTER_CONDITIONSYS, "Player::SatisfyQuestConditions: conditions not met for quest %u", qInfo->GetQuestId());
return false;
}
@@ -15606,7 +15647,10 @@ bool Player::SatisfyQuestTimed(Quest const* qInfo, bool msg)
if (!m_timedquests.empty() && qInfo->HasFlag(QUEST_TRINITY_FLAGS_TIMED))
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_QUEST_ONLY_ONE_TIMED);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestTimed: Sent INVALIDREASON_QUEST_ONLY_ONE_TIMED (questId: %u) because player is already on a timed quest.", qInfo->GetQuestId());
+ }
return false;
}
return true;
@@ -15636,7 +15680,10 @@ bool Player::SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg)
if (!SatisfyQuestDay(Nquest, false) || !SatisfyQuestWeek(Nquest, false) || !SatisfyQuestSeasonal(Nquest, false))
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestExclusiveGroup: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did daily quests in exclusive group.", qInfo->GetQuestId());
+ }
return false;
}
@@ -15645,7 +15692,10 @@ bool Player::SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg)
if (GetQuestStatus(exclude_Id) != QUEST_STATUS_NONE || (!(qInfo->IsRepeatable() && Nquest->IsRepeatable()) && (m_RewardedQuests.find(exclude_Id) != m_RewardedQuests.end())))
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestExclusiveGroup: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did quest in exclusive group.", qInfo->GetQuestId());
+ }
return false;
}
}
@@ -15662,7 +15712,10 @@ bool Player::SatisfyQuestNextChain(Quest const* qInfo, bool msg)
if (GetQuestStatus(nextQuest) != QUEST_STATUS_NONE) // GetQuestStatus returns QUEST_STATUS_COMPLETED for rewarded quests
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestNextChain: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did or started next quest in chain.", qInfo->GetQuestId());
+ }
return false;
}
@@ -15686,7 +15739,10 @@ bool Player::SatisfyQuestPrevChain(Quest const* qInfo, bool msg)
if (itr != m_QuestStatus.end() && itr->second.Status != QUEST_STATUS_NONE)
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestNextChain: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did or started next quest in chain.", qInfo->GetQuestId());
+ }
return false;
}
@@ -15727,7 +15783,10 @@ bool Player::SatisfyQuestDay(Quest const* qInfo, bool msg)
if (!have_slot)
{
if (msg)
+ {
SendCanTakeQuestResponse(INVALIDREASON_DAILY_QUESTS_REMAINING);
+ TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestDay: Sent INVALIDREASON_DAILY_QUESTS_REMAINING (questId: %u) because player already did all possible quests today.", qInfo->GetQuestId());
+ }
return false;
}
@@ -16619,7 +16678,7 @@ void Player::SendQuestTimerFailed(uint32 quest_id)
}
}
-void Player::SendCanTakeQuestResponse(uint32 msg) const
+void Player::SendCanTakeQuestResponse(QuestFailedReason msg) const
{
WorldPacket data(SMSG_QUESTGIVER_QUEST_INVALID, 4);
data << uint32(msg);
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index c26d2d80336..2cdf89dce75 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1420,31 +1420,30 @@ class Player : public Unit, public GridObject<Player>
void MoneyChanged(uint32 value);
void ReputationChanged(FactionEntry const* factionEntry);
void ReputationChanged2(FactionEntry const* factionEntry);
- bool HasQuestForItem(uint32 itemid) const;
- bool HasQuestForGO(int32 GOId) const;
+ bool HasQuestForItem(uint32 itemId) const;
+ bool HasQuestForGO(int32 goId) const;
void UpdateForQuestWorldObjects();
- bool CanShareQuest(uint32 quest_id) const;
+ bool CanShareQuest(uint32 questId) const;
- void SendQuestComplete(uint32 quest_id);
+ void SendQuestComplete(uint32 questId);
void SendQuestReward(Quest const* quest, uint32 XP);
void SendQuestFailed(uint32 questId, InventoryResult reason = EQUIP_ERR_OK);
- void SendQuestTimerFailed(uint32 quest_id);
- void SendCanTakeQuestResponse(uint32 msg) const;
+ void SendQuestTimerFailed(uint32 questId);
+ void SendCanTakeQuestResponse(QuestFailedReason msg) const;
void SendQuestConfirmAccept(Quest const* quest, Player* pReceiver);
void SendPushToPartyResponse(Player* player, uint8 msg);
- void SendQuestUpdateAddItem(Quest const* quest, uint32 item_idx, uint16 count);
- void SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uint32 creatureOrGO_idx, uint16 old_count, uint16 add_count);
- void SendQuestUpdateAddPlayer(Quest const* quest, uint16 old_count, uint16 add_count);
+ void SendQuestUpdateAddItem(Quest const* quest, uint32 itemIdx, uint16 count);
+ void SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uint32 creatureOrGOIdx, uint16 oldCount, uint16 addCount);
+ void SendQuestUpdateAddPlayer(Quest const* quest, uint16 oldCount, uint16 addCount);
- uint64 GetDivider() { return m_divider; }
+ uint64 GetDivider() const { return m_divider; }
void SetDivider(uint64 guid) { m_divider = guid; }
- uint32 GetInGameTime() { return m_ingametime; }
-
+ uint32 GetInGameTime() const { return m_ingametime; }
void SetInGameTime(uint32 time) { m_ingametime = time; }
- void AddTimedQuest(uint32 quest_id) { m_timedquests.insert(quest_id); }
- void RemoveTimedQuest(uint32 quest_id) { m_timedquests.erase(quest_id); }
+ void AddTimedQuest(uint32 questId) { m_timedquests.insert(questId); }
+ void RemoveTimedQuest(uint32 questId) { m_timedquests.erase(questId); }
bool HasPvPForcingQuest() const;
diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h
index a447f4a8f52..8c2bbc192b8 100644
--- a/src/server/game/Quests/QuestDef.h
+++ b/src/server/game/Quests/QuestDef.h
@@ -43,7 +43,7 @@ class ObjectMgr;
#define QUEST_EMOTE_COUNT 4
#define QUEST_PVP_KILL_SLOT 0
-enum QuestFailedReasons
+enum QuestFailedReason
{
INVALIDREASON_DONT_HAVE_REQ = 0,
INVALIDREASON_QUEST_FAILED_LOW_LEVEL = 1, // You are not high enough level for that quest.
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index f6ee0faaa31..c01a8e95559 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -505,7 +505,7 @@ public:
static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler* handler, char const* args)
{
- uint32 msg = atol((char*)args);
+ QuestFailedReason msg = static_cast<QuestFailedReason>(atol((char*)args));
handler->GetSession()->GetPlayer()->SendCanTakeQuestResponse(msg);
return true;
}