[10606] Fix loot for victims being creature type critter

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-10-14 09:40:38 +02:00
parent 4c5c6c46a1
commit df4563e653
2 changed files with 17 additions and 5 deletions

View file

@ -572,18 +572,30 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
pVictim->RemoveSpellbyDamageTaken(SPELL_AURA_MOD_ROOT, damage);
// no xp,health if type 8 /critters/
if(pVictim->GetTypeId() != TYPEID_PLAYER && pVictim->GetCreatureType() == CREATURE_TYPE_CRITTER)
if (pVictim->GetTypeId() == TYPEID_UNIT && pVictim->GetCreatureType() == CREATURE_TYPE_CRITTER)
{
// TODO: fix this part
// Critter may not die of damage taken, instead expect it to run away (no fighting back)
// If (this) is TYPEID_PLAYER, (this) will enter combat w/victim, but after some time, automatically leave combat.
// It is unclear how it should work for other cases.
((Creature*)pVictim)->SetLootRecipient(this);
pVictim->setDeathState(JUST_DIED);
pVictim->SetHealth(0);
// allow loot only if has loot_id in creature_template
((Creature*)pVictim)->PrepareBodyLootState();
((Creature*)pVictim)->AllLootRemovedFromCorpse();
// some critters required for quests (need normal entry instead possible heroic in any cases)
if(GetTypeId() == TYPEID_PLAYER)
if(CreatureInfo const* normalInfo = ObjectMgr::GetCreatureTemplate(pVictim->GetEntry()))
((Player*)this)->KilledMonster(normalInfo,pVictim->GetObjectGuid());
if (GetTypeId() == TYPEID_PLAYER)
{
if (CreatureInfo const* normalInfo = ObjectMgr::GetCreatureTemplate(pVictim->GetEntry()))
((Player*)this)->KilledMonster(normalInfo, pVictim->GetObjectGuid());
}
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE, "DealDamage critter, critter dies");
return damage;
}