[8190] Update killing quest objectives base at creature_template KillCredit fields.

Note: for avoid double counting must be removed C++ scripts and EventAI scripts that do same thing in old way.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>

Also implement KillCreditN field check at loading.
This commit is contained in:
GriffonHeart 2009-07-17 03:35:59 +04:00 committed by VladimirMangos
parent ad67efefad
commit cbfbd13146
11 changed files with 49 additions and 17 deletions

View file

@ -13396,7 +13396,17 @@ void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count )
UpdateForQuestWorldObjects();
}
void Player::KilledMonster( uint32 entry, uint64 guid )
void Player::KilledMonster( CreatureInfo const* cInfo, uint64 guid )
{
if(cInfo->Entry)
KilledMonsterCredit(cInfo->Entry,guid);
for(int i = 0; i < MAX_KILL_CREDIT; ++i)
if(cInfo->KillCredit[i])
KilledMonsterCredit(cInfo->KillCredit[i],guid);
}
void Player::KilledMonsterCredit( uint32 entry, uint64 guid )
{
uint32 addkillcount = 1;
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, entry, addkillcount);
@ -18914,7 +18924,7 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
{
// normal creature (not pet/etc) can be only in !PvP case
if(pVictim->GetTypeId()==TYPEID_UNIT)
pGroupGuy->KilledMonster(pVictim->GetEntry(), pVictim->GetGUID());
pGroupGuy->KilledMonster(((Creature*)pVictim)->GetCreatureInfo(), pVictim->GetGUID());
}
}
}
@ -18939,7 +18949,7 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
// normal creature (not pet/etc) can be only in !PvP case
if(pVictim->GetTypeId()==TYPEID_UNIT)
KilledMonster(pVictim->GetEntry(),pVictim->GetGUID());
KilledMonster(((Creature*)pVictim)->GetCreatureInfo(), pVictim->GetGUID());
}
}
return xp || honored_kill;
@ -18963,11 +18973,11 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar
// quest objectives updated only for alive group member or dead but with not released body
if(pGroupGuy->isAlive()|| !pGroupGuy->GetCorpse())
pGroupGuy->KilledMonster(creature_id, creature_guid);
pGroupGuy->KilledMonsterCredit(creature_id, creature_guid);
}
}
else // if (!pGroup)
KilledMonster(creature_id, creature_guid);
KilledMonsterCredit(creature_id, creature_guid);
}
bool Player::IsAtGroupRewardDistance(WorldObject const* pRewardSource) const