mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[8533] Not remove timed quest and correctly fail when time runs out.
Add function to remove timed quest instead of direct access to set. Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
1bf0678ebd
commit
38aac1a77a
4 changed files with 16 additions and 14 deletions
|
|
@ -12602,9 +12602,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
DestroyItemCount( pQuest->ReqItemId[i], pQuest->ReqItemCount[i], true);
|
||||
}
|
||||
|
||||
//if( qInfo->HasSpecialFlag( QUEST_FLAGS_TIMED ) )
|
||||
// SetTimedQuest( 0 );
|
||||
m_timedquests.erase(pQuest->GetQuestId());
|
||||
RemoveTimedQuest(quest_id);
|
||||
|
||||
if (pQuest->GetRewChoiceItemsCount() > 0)
|
||||
{
|
||||
|
|
@ -12811,6 +12809,7 @@ void Player::FailQuest(uint32 questId)
|
|||
{
|
||||
QuestStatusData& q_status = mQuestStatus[questId];
|
||||
|
||||
RemoveTimedQuest(questId);
|
||||
q_status.m_timer = 0;
|
||||
|
||||
SendQuestTimerFailed(questId);
|
||||
|
|
@ -13036,12 +13035,13 @@ bool Player::SatisfyQuestStatus( Quest const* qInfo, bool msg )
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Player::SatisfyQuestTimed( Quest const* qInfo, bool msg )
|
||||
bool Player::SatisfyQuestTimed(Quest const* qInfo, bool msg)
|
||||
{
|
||||
if ( (find(m_timedquests.begin(), m_timedquests.end(), qInfo->GetQuestId()) != m_timedquests.end()) && qInfo->HasFlag(QUEST_MANGOS_FLAGS_TIMED) )
|
||||
if (!m_timedquests.empty() && qInfo->HasFlag(QUEST_MANGOS_FLAGS_TIMED))
|
||||
{
|
||||
if( msg )
|
||||
SendCanTakeQuestResponse( INVALIDREASON_QUEST_ONLY_ONE_TIMED );
|
||||
if (msg)
|
||||
SendCanTakeQuestResponse(INVALIDREASON_QUEST_ONLY_ONE_TIMED);
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -13269,12 +13269,6 @@ void Player::SetQuestStatus(uint32 quest_id, QuestStatus status)
|
|||
{
|
||||
if (Quest const* qInfo = objmgr.GetQuestTemplate(quest_id))
|
||||
{
|
||||
if (status == QUEST_STATUS_NONE || status == QUEST_STATUS_INCOMPLETE || status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_FAILED)
|
||||
{
|
||||
if (qInfo->HasFlag(QUEST_MANGOS_FLAGS_TIMED))
|
||||
m_timedquests.erase(qInfo->GetQuestId());
|
||||
}
|
||||
|
||||
QuestStatusData& q_status = mQuestStatus[quest_id];
|
||||
|
||||
q_status.m_status = status;
|
||||
|
|
|
|||
|
|
@ -1363,6 +1363,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
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); }
|
||||
|
||||
/*********************************************************/
|
||||
/*** LOAD SYSTEM ***/
|
||||
|
|
@ -2249,6 +2250,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
/*** QUEST SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
||||
//We allow only one timed quest active at the same time. Below can then be simple value instead of set.
|
||||
std::set<uint32> m_timedquests;
|
||||
|
||||
uint64 m_divider;
|
||||
|
|
|
|||
|
|
@ -350,6 +350,12 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recv_data)
|
|||
if(!_player->TakeQuestSourceItem( quest, true ))
|
||||
return; // can't un-equip some items, reject quest cancel
|
||||
|
||||
if (const Quest *pQuest = objmgr.GetQuestTemplate(quest))
|
||||
{
|
||||
if (pQuest->HasFlag(QUEST_MANGOS_FLAGS_TIMED))
|
||||
_player->RemoveTimedQuest(quest);
|
||||
}
|
||||
|
||||
_player->SetQuestStatus( quest, QUEST_STATUS_NONE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8532"
|
||||
#define REVISION_NR "8533"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue