mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
fix(Scripts/Commands): quest complate kill reward (#9926)
This commit is contained in:
committed by
GitHub
parent
666aca2a63
commit
75fc2d1b2d
@@ -1961,19 +1961,22 @@ void Player::KilledMonsterCredit(uint32 entry, ObjectGuid guid)
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
if (!questid)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
|
||||
if (!qInfo)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// just if !ingroup || !noraidgroup || raidgroup
|
||||
QuestStatusData& q_status = m_QuestStatus[questid];
|
||||
if (q_status.Status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid(GetMap()->GetDifficulty())))
|
||||
@@ -1981,27 +1984,44 @@ void Player::KilledPlayerCredit()
|
||||
// Xinef: PvP Killing quest require player to be in same zone as quest zone (only 2 quests so no doubt, can be extended to conditions in cata ;s)
|
||||
if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_PLAYER_KILL) && (qInfo->GetZoneOrSort() >= 0 && GetZoneId() == uint32(qInfo->GetZoneOrSort())))
|
||||
{
|
||||
uint32 reqkill = qInfo->GetPlayersSlain();
|
||||
uint16 curkill = q_status.PlayerCount;
|
||||
|
||||
if (curkill < reqkill)
|
||||
{
|
||||
q_status.PlayerCount = curkill + addkillcount;
|
||||
|
||||
m_QuestStatusSave[questid] = true;
|
||||
|
||||
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()] = true;
|
||||
|
||||
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