diff options
author | TrullyONE <none@none> | 2008-12-19 05:02:51 +0200 |
---|---|---|
committer | TrullyONE <none@none> | 2008-12-19 05:02:51 +0200 |
commit | 222999c225f175b67091f1ad55f36cf58cb55da9 (patch) | |
tree | e4427bd2131d4b9fccb2cc48757153d61f2e5715 /src/game/Unit.cpp | |
parent | a1c00a8dc502675124d8206df504ecb3c4665c48 (diff) |
*Fixed creature initialize movement at respawn. Loot and tagging - correct set of dynamic flags.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index dba851c6fa7..0e820073dfd 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -585,7 +585,36 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa //Script Event damage taken if( pVictim->GetTypeId()== TYPEID_UNIT && ((Creature *)pVictim)->AI() ) - ((Creature *)pVictim)->AI()->DamageTaken(this, damage); + { + ((Creature *)pVictim)->AI()->DamageTaken(this, damage); + + // Set tagging + if(!pVictim->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER) && !((Creature*)pVictim)->isPet()) + { + //Set Loot + switch(GetTypeId()) + { + case TYPEID_PLAYER: + { + ((Creature *)pVictim)->SetLootRecipient(this); + //Set tagged + ((Creature *)pVictim)->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER); + break; + } + case TYPEID_UNIT: + { + if(((Creature*)this)->isPet()) + { + ((Creature *)pVictim)->SetLootRecipient(this->GetOwner()); + ((Creature *)pVictim)->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER); + } + break; + } + } + } + } + + if(!damage) //when will zero damage? need interrupt aura? { @@ -12637,7 +12666,7 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss) if(!cVictim->isPet()) { cVictim->DeleteThreatList(); - cVictim->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + cVictim->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); } // Call KilledUnit for creatures, this needs to be called after the lootable flag is set |