Scripts/Commands: Fix .quest complete to properly work with PvP kill quests. Closes #16321.
This commit is contained in:
1 parent
b355c67994
commit
8bb732b951
3 files changed
+35
-20
No files matched your search
@@ -16379,10 +16379,8 @@ void Player::KilledMonsterCredit(uint32 entry, ObjectGuid guid /*= ObjectGuid::E
|
||||
}
|
||||
}
|
||||
|
||||
void Player::KilledPlayerCredit()
|
||||
void Player::KilledPlayerCredit(uint16 count)
|
||||
{
|
||||
uint16 addkillcount = 1;
|
||||
|
||||
for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
|
||||
{
|
||||
uint32 questid = GetQuestSlotQuestId(i);
|
||||
@@ -16398,27 +16396,38 @@ void Player::KilledPlayerCredit()
|
||||
{
|
||||
if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_PLAYER_KILL))
|
||||
{
|
||||
uint32 reqkill = qInfo->GetPlayersSlain();
|
||||
uint16 curkill = q_status.PlayerCount;
|
||||
|
||||
if (curkill < reqkill)
|
||||
{
|
||||
q_status.PlayerCount = curkill + addkillcount;
|
||||
|
||||
m_QuestStatusSave[questid] = QUEST_DEFAULT_SAVE_TYPE;
|
||||
|
||||
SendQuestUpdateAddPlayer(qInfo, curkill, addkillcount);
|
||||
}
|
||||
|
||||
if (CanCompleteQuest(questid))
|
||||
CompleteQuest(questid);
|
||||
|
||||
break;
|
||||
KilledPlayerCreditForQuest(count, qInfo);
|
||||
break; // there is only one quest per zone
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::KilledPlayerCreditForQuest(uint16 count, Quest const* quest)
|
||||
{
|
||||
uint32 const questId = quest->GetQuestId();
|
||||
auto it = m_QuestStatus.find(questId);
|
||||
if (it == m_QuestStatus.end())
|
||||
return;
|
||||
QuestStatusData& questStatus = it->second;
|
||||
|
||||
uint16 curKill = questStatus.PlayerCount;
|
||||
uint32 reqKill = quest->GetPlayersSlain();
|
||||
|
||||
if (curKill < reqKill)
|
||||
{
|
||||
count = std::min<uint16>(reqKill - curKill, count);
|
||||
questStatus.PlayerCount = curKill + count;
|
||||
|
||||
m_QuestStatusSave[quest->GetQuestId()] = QUEST_DEFAULT_SAVE_TYPE;
|
||||
|
||||
SendQuestUpdateAddPlayer(quest, curKill, count);
|
||||
}
|
||||
|
||||
if (CanCompleteQuest(questId))
|
||||
CompleteQuest(questId);
|
||||
}
|
||||
|
||||
void Player::KillCreditGO(uint32 entry, ObjectGuid guid)
|
||||
{
|
||||
uint16 addCastCount = 1;
|
||||
|
||||
Reference in new issue
Block a user