mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[0063] Fix a bug with SCRIPT_COMMAND_KILL_CREDIT
This bug can happen if a (group) kill credit is provided without involved creature. Thanks to Atari for pointing!
This commit is contained in:
parent
27fefb1e96
commit
aacb838e60
3 changed files with 10 additions and 3 deletions
|
|
@ -21229,6 +21229,8 @@ void Player::RewardSinglePlayerAtKill(Unit* pVictim)
|
||||||
|
|
||||||
void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource)
|
void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource)
|
||||||
{
|
{
|
||||||
|
MANGOS_ASSERT((!GetGroup() || pRewardSource) && "Player::RewardPlayerAndGroupAtEvent called for Group-Case but no source for range searching provided");
|
||||||
|
|
||||||
ObjectGuid creature_guid = pRewardSource && pRewardSource->GetTypeId() == TYPEID_UNIT ? pRewardSource->GetObjectGuid() : ObjectGuid();
|
ObjectGuid creature_guid = pRewardSource && pRewardSource->GetTypeId() == TYPEID_UNIT ? pRewardSource->GetObjectGuid() : ObjectGuid();
|
||||||
|
|
||||||
// prepare data for near group iteration
|
// prepare data for near group iteration
|
||||||
|
|
@ -21241,7 +21243,7 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!pGroupGuy->IsAtGroupRewardDistance(pRewardSource))
|
if (!pGroupGuy->IsAtGroupRewardDistance(pRewardSource))
|
||||||
continue; // member (alive or dead) or his corpse at req. distance
|
continue; // member (alive or dead) or his corpse at req. distance
|
||||||
|
|
||||||
// quest objectives updated only for alive group member or dead but with not released body
|
// quest objectives updated only for alive group member or dead but with not released body
|
||||||
if (pGroupGuy->isAlive() || !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
|
if (pGroupGuy->isAlive() || !pGroupGuy->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
|
||||||
|
|
|
||||||
|
|
@ -1254,7 +1254,12 @@ void ScriptAction::HandleScriptStep()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_script->killCredit.isGroupCredit)
|
if (m_script->killCredit.isGroupCredit)
|
||||||
pPlayer->RewardPlayerAndGroupAtEvent(creatureEntry, pRewardSource);
|
{
|
||||||
|
WorldObject* pSearcher = pRewardSource ? pRewardSource : (pSource ? pSource : pTarget);
|
||||||
|
if (pSearcher != pRewardSource)
|
||||||
|
sLog.outDebug(" DB-SCRIPTS: Process table `%s` id %u, SCRIPT_COMMAND_KILL_CREDIT called for groupCredit without creature as searcher, script might need adjustment.", m_table, m_script->id);
|
||||||
|
pPlayer->RewardPlayerAndGroupAtEvent(creatureEntry, pSearcher);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
pPlayer->KilledMonsterCredit(creatureEntry, pRewardSource ? pRewardSource->GetObjectGuid() : ObjectGuid());
|
pPlayer->KilledMonsterCredit(creatureEntry, pRewardSource ? pRewardSource->GetObjectGuid() : ObjectGuid());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "0062"
|
#define REVISION_NR "0063"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue