*Fixed creature initialize movement at respawn. Loot and tagging - correct set of dynamic flags.
--HG-- branch : trunk
This commit is contained in:
+12
-8
@@ -407,9 +407,8 @@ void Creature::Update(uint32 diff)
|
||||
UpdateEntry(m_originalEntry);
|
||||
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
|
||||
SelectLevel(cinfo);
|
||||
SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
|
||||
SelectLevel(cinfo);
|
||||
|
||||
if (m_isDeadByDefault)
|
||||
{
|
||||
setDeathState(JUST_DIED);
|
||||
@@ -504,8 +503,14 @@ void Creature::Update(uint32 diff)
|
||||
if (m_regenTimer != 0)
|
||||
break;
|
||||
|
||||
if (!isInCombat() || IsPolymorphed())
|
||||
RegenerateHealth();
|
||||
if (!isInCombat())
|
||||
{
|
||||
if(HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER))
|
||||
SetUInt32Value(UNIT_DYNAMIC_FLAGS, GetCreatureInfo()->dynamicflags);
|
||||
RegenerateHealth();
|
||||
}
|
||||
else if(IsPolymorphed())
|
||||
RegenerateHealth();
|
||||
|
||||
RegenerateMana();
|
||||
|
||||
@@ -1655,12 +1660,11 @@ void Creature::setDeathState(DeathState s)
|
||||
SetLootRecipient(NULL);
|
||||
Unit::setDeathState(ALIVE);
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
|
||||
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
||||
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
||||
AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
|
||||
SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag);
|
||||
clearUnitState(UNIT_STAT_ALL_STATE);
|
||||
i_motionMaster.Clear();
|
||||
i_motionMaster.Initialize();
|
||||
SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool));
|
||||
LoadCreaturesAddon(true);
|
||||
}
|
||||
|
||||
+31
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user