fix(Core/DungeonFinder): Dead players should be able to get XP reward from random dungeon. (#9319)

Fixes #9082
This commit is contained in:
UltraNix
2021-12-01 11:04:41 +01:00
committed by GitHub
parent fc4b5a93a0
commit 8668a03e14
4 changed files with 16 additions and 8 deletions

View File

@@ -2233,7 +2233,7 @@ namespace lfg
// if we can take the quest, means that we haven't done this kind of "run", IE: First Heroic Random of Day.
if (player->CanRewardQuest(quest, false))
player->RewardQuest(quest, 0, nullptr, false);
player->RewardQuest(quest, 0, nullptr, false, true);
else
{
done = true;
@@ -2241,7 +2241,7 @@ namespace lfg
if (!quest)
continue;
// we give reward without informing client (retail does this)
player->RewardQuest(quest, 0, nullptr, false);
player->RewardQuest(quest, 0, nullptr, false, true);
}
// Give rewards

View File

@@ -2295,19 +2295,27 @@ void Player::SendLogXPGain(uint32 GivenXP, Unit* victim, uint32 BonusXP, bool re
GetSession()->SendPacket(&data);
}
void Player::GiveXP(uint32 xp, Unit* victim, float group_rate)
void Player::GiveXP(uint32 xp, Unit* victim, float group_rate, bool isLFGReward)
{
if (xp < 1)
{
return;
}
if (!IsAlive() && !GetBattlegroundId())
if (!IsAlive() && !GetBattlegroundId() && !isLFGReward)
{
return;
}
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN))
{
return;
}
if (victim && victim->GetTypeId() == TYPEID_UNIT && !victim->ToCreature()->hasLootRecipient())
{
return;
}
uint8 level = getLevel();

View File

@@ -1132,7 +1132,7 @@ public:
void SetHas310Flyer(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_HAS_310_FLYER; else m_ExtraFlags &= ~PLAYER_EXTRA_HAS_310_FLYER; }
void SetPvPDeath(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }
void GiveXP(uint32 xp, Unit* victim, float group_rate = 1.0f);
void GiveXP(uint32 xp, Unit* victim, float group_rate = 1.0f, bool isLFGReward = false);
void GiveLevel(uint8 level);
void InitStatsForLevel(bool reapplyMods = false);
@@ -1383,7 +1383,7 @@ public:
void AbandonQuest(uint32 quest_id);
void CompleteQuest(uint32 quest_id);
void IncompleteQuest(uint32 quest_id);
void RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, bool announce = true);
void RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, bool announce = true, bool isLFGReward = false);
void FailQuest(uint32 quest_id);
bool SatisfyQuestSkill(Quest const* qInfo, bool msg) const;
bool SatisfyQuestLevel(Quest const* qInfo, bool msg) const;

View File

@@ -655,7 +655,7 @@ void Player::IncompleteQuest(uint32 quest_id)
}
}
void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, bool announce)
void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, bool announce, bool isLFGReward)
{
//this THING should be here to protect code from quest, which cast on player far teleport as a reward
//should work fine, cause far teleport will be executed in Player::Update()
@@ -750,7 +750,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
}
else
{
GiveXP(XP, nullptr);
GiveXP(XP, nullptr, isLFGReward);
}
// Give player extra money if GetRewOrReqMoney > 0 and get ReqMoney if negative