Skip to content

Commit 691ee63

Browse files
SubvShauren
authored andcommitted
Core/Quest:
Fixed self-completing quests without NPCs no, wait Fixed self-completing quests without NPCs, and fixed some issues with the AUTOCOMPLETE quest flag (cherry picked from commit f53045a)
1 parent 8712a47 commit 691ee63

4 files changed

Lines changed: 25 additions & 12 deletions

File tree

src/server/game/Entities/Player/Player.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14487,7 +14487,7 @@ void Player::SendPreparedQuest(ObjectGuid guid)
1448714487
if (quest->IsAutoAccept() && CanAddQuest(quest, true) && CanTakeQuest(quest, true))
1448814488
AddQuestAndCheckCompletion(quest, object);
1448914489

14490-
if ((quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly()) || quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE))
14490+
if (quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly())
1449114491
PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, CanCompleteRepeatableQuest(quest), true);
1449214492
else
1449314493
PlayerTalkClass->SendQuestGiverQuestDetails(quest, guid, true);
@@ -14629,7 +14629,7 @@ bool Player::CanCompleteQuest(uint32 quest_id)
1462914629
return false; // not allow re-complete quest
1463014630

1463114631
// auto complete quest
14632-
if ((qInfo->IsAutoComplete() || qInfo->GetFlags() & QUEST_FLAGS_AUTOCOMPLETE) && CanTakeQuest(qInfo, false))
14632+
if (qInfo->IsAutoComplete() && CanTakeQuest(qInfo, false))
1463314633
return true;
1463414634

1463514635
QuestStatusMap::iterator itr = m_QuestStatus.find(quest_id);
@@ -14713,7 +14713,7 @@ bool Player::CanRewardQuest(Quest const* quest, bool msg)
1471314713
return false;
1471414714

1471514715
// not auto complete quest and not completed quest (only cheating case, then ignore without message)
14716-
if (!quest->IsDFQuest() && !quest->IsAutoComplete() && !(quest->GetFlags() & QUEST_FLAGS_AUTOCOMPLETE) && GetQuestStatus(quest->GetQuestId()) != QUEST_STATUS_COMPLETE)
14716+
if (!quest->IsDFQuest() && !quest->IsAutoComplete() && GetQuestStatus(quest->GetQuestId()) != QUEST_STATUS_COMPLETE)
1471714717
return false;
1471814718

1471914719
// daily quest can't be rewarded (25 daily quest already completed)

src/server/game/Handlers/QuestHandler.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -503,17 +503,30 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData)
503503
return;
504504

505505
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
506-
if (!object || !object->hasInvolvedQuest(questId))
507-
return;
508506

509-
// some kind of WPE protection
510-
if (!_player->CanInteractWithQuestGiver(object))
507+
if (!object)
511508
return;
512509

510+
if (!quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE))
511+
{
512+
if (!object->hasInvolvedQuest(questId))
513+
return;
514+
515+
// some kind of WPE protection
516+
if (!_player->CanInteractWithQuestGiver(object))
517+
return;
518+
}
519+
else
520+
{
521+
// Do not allow completing quests on other players.
522+
if (guid != _player->GetGUID())
523+
return;
524+
}
525+
513526
if (!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE)
514527
{
515-
TC_LOG_ERROR("entities.player.cheat", "Possible hacking attempt: Player {} {} tried to complete quest [entry: {}] without being in possession of the quest!",
516-
_player->GetName(), _player->GetGUID().ToString(), questId);
528+
TC_LOG_ERROR("entities.player.cheat", "Possible hacking attempt: Player {} [{}] tried to complete quest [entry: {}] without being in possession of the quest!",
529+
_player->GetName(), _player->GetGUID().ToString(), questId);
517530
return;
518531
}
519532

@@ -614,7 +627,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
614627

615628
sender->SendPushToPartyResponse(receiver, QUEST_PARTY_MSG_SHARING_QUEST);
616629

617-
if ((quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly()) || quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE))
630+
if (quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly())
618631
receiver->PlayerTalkClass->SendQuestGiverRequestItems(quest, sender->GetGUID(), receiver->CanCompleteRepeatableQuest(quest), true);
619632
else
620633
{

src/server/game/Quests/QuestDef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ enum QuestFlags
146146
QUEST_FLAGS_FLAGS_PVP = 0x00002000, // Having this quest in log forces PvP flag
147147
QUEST_FLAGS_UNAVAILABLE = 0x00004000, // Used on quests that are not generically available
148148
QUEST_FLAGS_WEEKLY = 0x00008000,
149-
QUEST_FLAGS_AUTOCOMPLETE = 0x00010000, // auto complete
149+
QUEST_FLAGS_AUTOCOMPLETE = 0x00010000, // Quests with this flag cause the client to automatically send CMSG_QUESTGIVER_COMPLETE_QUEST after accepting if the quest has any objectives and they are completed before accepting (none of 3.3.5a quests fit this criteria)
150150
QUEST_FLAGS_DISPLAY_ITEM_IN_TRACKER = 0x00020000, // Displays usable item in quest tracker
151151
QUEST_FLAGS_OBJ_TEXT = 0x00040000, // use Objective text as Complete text
152152
QUEST_FLAGS_AUTO_ACCEPT = 0x00080000, // The client recognizes this flag as auto-accept. However, NONE of the current quests (3.3.5a) have this flag. Maybe blizz used to use it, or will use it in the future.

src/server/game/Server/Packets/QuestPackets.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ WorldPacket const* WorldPackets::Quest::QueryQuestInfoResponse::Write()
5454
_worldPacket << uint32(Info.RewardHonor);
5555
_worldPacket << float(Info.RewardKillHonor);
5656
_worldPacket << uint32(Info.StartItem);
57-
_worldPacket << uint32(Info.Flags & 0xFFFF);
57+
_worldPacket << uint32(Info.Flags);
5858
_worldPacket << uint32(Info.RewardTitleId);
5959
_worldPacket << uint32(Info.RequiredPlayerKills);
6060
_worldPacket << uint32(Info.RewardTalents);

0 commit comments

Comments
 (0)