Add state for GM command completed quests. Thanks H0zen for assistance

This commit is contained in:
Antz 2017-11-22 18:57:03 +00:00
parent 30dcb16d8f
commit 04d887d6b2
4 changed files with 15 additions and 10 deletions

View File

@ -5004,7 +5004,7 @@ bool ChatHandler::HandleQuestCompleteCommand(char* args)
if (ReqOrRewMoney < 0) if (ReqOrRewMoney < 0)
{ player->ModifyMoney(-ReqOrRewMoney); } { player->ModifyMoney(-ReqOrRewMoney); }
player->CompleteQuest(entry); player->CompleteQuest(entry, QUEST_STATUS_FORCE_COMPLETE);
return true; return true;
} }

View File

@ -12528,11 +12528,11 @@ void Player::AddQuest(Quest const* pQuest, Object* questGiver)
UpdateForQuestWorldObjects(); UpdateForQuestWorldObjects();
} }
void Player::CompleteQuest(uint32 quest_id) void Player::CompleteQuest(uint32 quest_id, QuestStatus status)
{ {
if (quest_id) if (quest_id)
{ {
SetQuestStatus(quest_id, QUEST_STATUS_COMPLETE); SetQuestStatus(quest_id, status);
uint16 log_slot = FindQuestSlot(quest_id); uint16 log_slot = FindQuestSlot(quest_id);
if (log_slot < MAX_QUEST_LOG_SIZE) if (log_slot < MAX_QUEST_LOG_SIZE)
@ -13123,7 +13123,11 @@ QuestStatus Player::GetQuestStatus(uint32 quest_id) const
{ {
QuestStatusMap::const_iterator itr = mQuestStatus.find(quest_id); QuestStatusMap::const_iterator itr = mQuestStatus.find(quest_id);
if (itr != mQuestStatus.end()) if (itr != mQuestStatus.end())
{ return itr->second.m_status; } {
if (itr->second.m_status == QUEST_STATUS_FORCE_COMPLETE)
return QUEST_STATUS_COMPLETE;
return itr->second.m_status;
}
} }
return QUEST_STATUS_NONE; return QUEST_STATUS_NONE;
} }

View File

@ -1032,8 +1032,8 @@ class Player : public Unit
void SetGMVisible(bool on); void SetGMVisible(bool on);
void SetPvPDeath(bool on) void SetPvPDeath(bool on)
{ {
if (on) { m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; } if (on) { m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; }
else { m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; } else { m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }
} }
// 0 = own auction, -1 = enemy auction, 1 = goblin auction // 0 = own auction, -1 = enemy auction, 1 = goblin auction
@ -1116,12 +1116,12 @@ class Player : public Unit
void Say(const std::string& text, const uint32 language); void Say(const std::string& text, const uint32 language);
void Yell(const std::string& text, const uint32 language); void Yell(const std::string& text, const uint32 language);
void TextEmote(const std::string& text); void TextEmote(const std::string& text);
/** /**
* This will log a whisper depending on the setting LogWhispers in mangosd.conf, for a list * This will log a whisper depending on the setting LogWhispers in mangosd.conf, for a list
* of available levels please see \ref WhisperLoggingLevels. The logging is done to database * of available levels please see \ref WhisperLoggingLevels. The logging is done to database
* in the table characters.character_whispers and includes to/from, text and when the whisper * in the table characters.character_whispers and includes to/from, text and when the whisper
* was sent. * was sent.
* *
* @param text the text that was sent * @param text the text that was sent
* @param receiver guid of the receiver of the message * @param receiver guid of the receiver of the message
* \see WhisperLoggingLevels * \see WhisperLoggingLevels
@ -1337,7 +1337,7 @@ class Player : public Unit
// The returned quest can then be used by AddQuest( ) to add to the character_queststatus table // The returned quest can then be used by AddQuest( ) to add to the character_queststatus table
Quest const* GetQuestTemplate(uint32 quest_id); Quest const* GetQuestTemplate(uint32 quest_id);
void AddQuest(Quest const* pQuest, Object* questGiver); void AddQuest(Quest const* pQuest, Object* questGiver);
void CompleteQuest(uint32 quest_id); void CompleteQuest(uint32 quest_id, QuestStatus status = QUEST_STATUS_FORCE_COMPLETE);
void IncompleteQuest(uint32 quest_id); void IncompleteQuest(uint32 quest_id);
void RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver, bool announce = true); void RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver, bool announce = true);
@ -1360,7 +1360,7 @@ class Player : public Unit
bool GetQuestRewardStatus(uint32 quest_id) const; bool GetQuestRewardStatus(uint32 quest_id) const;
QuestStatus GetQuestStatus(uint32 quest_id) const; QuestStatus GetQuestStatus(uint32 quest_id) const;
void SetQuestStatus(uint32 quest_id, QuestStatus status); void SetQuestStatus(uint32 quest_id, QuestStatus status);
// This is used to change the quest's rewarded state // This is used to change the quest's rewarded state
void SetQuestRewarded(uint32 quest_id, bool rewarded); void SetQuestRewarded(uint32 quest_id, bool rewarded);
uint16 FindQuestSlot(uint32 quest_id) const; uint16 FindQuestSlot(uint32 quest_id) const;

View File

@ -99,6 +99,7 @@ enum QuestStatus
QUEST_STATUS_INCOMPLETE = 3, QUEST_STATUS_INCOMPLETE = 3,
QUEST_STATUS_AVAILABLE = 4, // unused in fact QUEST_STATUS_AVAILABLE = 4, // unused in fact
QUEST_STATUS_FAILED = 5, QUEST_STATUS_FAILED = 5,
QUEST_STATUS_FORCE_COMPLETE = 6,
MAX_QUEST_STATUS MAX_QUEST_STATUS
}; };