Skip to content

Commit

Permalink
Add state for GM command completed quests. Thanks H0zen for assistance
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1arm committed Nov 22, 2017
1 parent deeea41 commit cb51c9e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/game/ChatCommands/Level3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5112,7 +5112,7 @@ bool ChatHandler::HandleQuestCompleteCommand(char* args)
if (ReqOrRewMoney < 0)
{ player->ModifyMoney(-ReqOrRewMoney); }

player->CompleteQuest(entry);
player->CompleteQuest(entry, QUEST_STATUS_FORCE_COMPLETE);
return true;
}

Expand Down
10 changes: 7 additions & 3 deletions src/game/Object/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13042,11 +13042,11 @@ void Player::AddQuest(Quest const* pQuest, Object* questGiver)
UpdateForQuestWorldObjects();
}

void Player::CompleteQuest(uint32 quest_id)
void Player::CompleteQuest(uint32 quest_id, QuestStatus status)
{
if (quest_id)
{
SetQuestStatus(quest_id, QUEST_STATUS_COMPLETE);
SetQuestStatus(quest_id, status);

uint16 log_slot = FindQuestSlot(quest_id);
if (log_slot < MAX_QUEST_LOG_SIZE)
Expand Down Expand Up @@ -13689,7 +13689,11 @@ QuestStatus Player::GetQuestStatus(uint32 quest_id) const
{
QuestStatusMap::const_iterator itr = mQuestStatus.find(quest_id);
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;
}
Expand Down
10 changes: 5 additions & 5 deletions src/game/Object/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -1050,8 +1050,8 @@ class Player : public Unit
void SetGMVisible(bool on);
void SetPvPDeath(bool on)
{
if (on) { m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; }
else { m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }
if (on) { m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; }
else { m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }
}

// 0 = own auction, -1 = enemy auction, 1 = goblin auction
Expand Down Expand Up @@ -1136,12 +1136,12 @@ class Player : public Unit
void Say(const std::string& text, const uint32 language);
void Yell(const std::string& text, const uint32 language);
void TextEmote(const std::string& text);
/**
/**
* 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
* in the table characters.character_whispers and includes to/from, text and when the whisper
* was sent.
*
*
* @param text the text that was sent
* @param receiver guid of the receiver of the message
* \see WhisperLoggingLevels
Expand Down Expand Up @@ -1355,7 +1355,7 @@ class Player : public Unit
bool CanRewardQuest(Quest const* pQuest, bool msg) const;
bool CanRewardQuest(Quest const* pQuest, uint32 reward, bool msg) const;
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 RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver, bool announce = true);

Expand Down
1 change: 1 addition & 0 deletions src/game/WorldHandlers/QuestDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ enum QuestStatus
QUEST_STATUS_INCOMPLETE = 3,
QUEST_STATUS_AVAILABLE = 4, // unused in fact
QUEST_STATUS_FAILED = 5,
QUEST_STATUS_FORCE_COMPLETE = 6,
MAX_QUEST_STATUS
};

Expand Down

0 comments on commit cb51c9e

Please sign in to comment.