Core/Quests: Implemented QUEST_OBJECTIVE_FLAG_KILL_PLAYERS_SAME_FACTION

This commit is contained in:
Shauren
2021-05-11 12:32:22 +02:00
parent 254d5af7c2
commit 2ffedf30a9
3 changed files with 9 additions and 4 deletions

View File

@@ -193,7 +193,7 @@ void KillRewarder::_RewardPlayer(Player* player, bool isDungeon)
_RewardHonor(player);
// 4.1.1 Send player killcredit for quests with PlayerSlain
if (_victim->GetTypeId() == TYPEID_PLAYER)
player->KilledPlayerCredit();
player->KilledPlayerCredit(_victim->GetGUID());
}
// Give XP only in PvE or in battlegrounds.
// Give reputation and kill credit only in PvE.

View File

@@ -16804,9 +16804,9 @@ void Player::KilledMonsterCredit(uint32 entry, ObjectGuid guid /*= ObjectGuid::E
UpdateQuestObjectiveProgress(QUEST_OBJECTIVE_MONSTER, entry, 1, guid);
}
void Player::KilledPlayerCredit()
void Player::KilledPlayerCredit(ObjectGuid victimGuid)
{
UpdateQuestObjectiveProgress(QUEST_OBJECTIVE_PLAYERKILLS, 0, 1);
UpdateQuestObjectiveProgress(QUEST_OBJECTIVE_PLAYERKILLS, 0, 1, victimGuid);
}
void Player::KillCreditGO(uint32 entry, ObjectGuid guid)
@@ -16867,6 +16867,11 @@ void Player::UpdateQuestObjectiveProgress(QuestObjectiveType objectiveType, int3
bool objectiveIsNowComplete = false;
if (objective.IsStoringValue())
{
if (objectiveType == QUEST_OBJECTIVE_PLAYERKILLS && objective.Flags & QUEST_OBJECTIVE_FLAG_KILL_PLAYERS_SAME_FACTION)
if (Player const* victim = ObjectAccessor::GetPlayer(GetMap(), victimGuid))
if (victim->GetTeam() != GetTeam())
continue;
int32 currentProgress = GetQuestSlotObjectiveData(logSlot, objective);
if (addCount > 0 ? (currentProgress < objective.Amount) : (currentProgress > 0))
{

View File

@@ -1532,7 +1532,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void ItemRemovedQuestCheck(uint32 entry, uint32 count);
void KilledMonster(CreatureTemplate const* cInfo, ObjectGuid guid);
void KilledMonsterCredit(uint32 entry, ObjectGuid guid = ObjectGuid::Empty);
void KilledPlayerCredit();
void KilledPlayerCredit(ObjectGuid victimGuid);
void KillCreditGO(uint32 entry, ObjectGuid guid = ObjectGuid::Empty);
void TalkedToCreature(uint32 entry, ObjectGuid guid);
void KillCreditCriteriaTreeObjective(QuestObjective const& questObjective);