mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 12:47:07 +00:00
fix(Core/DungeonFinder): Dead players should be able to get XP reward from random dungeon. (#9319)
Fixes #9082
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user