[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:
Schmoozerd 2012-08-10 22:55:35 +02:00 committed by Antz
parent 27fefb1e96
commit aacb838e60
3 changed files with 10 additions and 3 deletions

View file

@ -1254,7 +1254,12 @@ void ScriptAction::HandleScriptStep()
}
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
pPlayer->KilledMonsterCredit(creatureEntry, pRewardSource ? pRewardSource->GetObjectGuid() : ObjectGuid());