*Fix the bug that escorted creatures return to their spawnpoint after engaging combat.
--HG-- branch : trunk
This commit is contained in:
@@ -61,6 +61,8 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI
|
||||
void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; }
|
||||
float GetMaxPlayerDistance() { return MaxPlayerDistance; }
|
||||
|
||||
bool IsEscorted() {return IsBeingEscorted;}
|
||||
|
||||
void SetCanMelee(bool usemelee) { CanMelee = usemelee; }
|
||||
void SetDespawnAtEnd(bool despawn) { DespawnAtEnd = despawn; }
|
||||
void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; }
|
||||
|
||||
@@ -115,6 +115,7 @@ class TRINITY_DLL_SPEC CreatureAI : public UnitAI
|
||||
|
||||
// Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc)
|
||||
//virtual void AttackedBy(Unit* attacker);
|
||||
virtual bool IsEscorted () {return false;}
|
||||
|
||||
// Called when creature is spawned or respawned (for reseting variables)
|
||||
virtual void JustRespawned() { Reset(); }
|
||||
|
||||
@@ -3193,6 +3193,42 @@ void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real, bool changeAmoun
|
||||
sLog.outError("Auras: Unknown Shapeshift Type: %u", GetMiscValue());
|
||||
}
|
||||
|
||||
Unit::AuraEffectList const& mDummy = m_target->GetAurasByType(SPELL_AURA_DUMMY);
|
||||
for(Unit::AuraEffectList::const_iterator i = mDummy.begin(); i != mDummy.end(); ++i)
|
||||
{
|
||||
int32 mastervalue = 0;
|
||||
uint32 trigg_id = 0;
|
||||
|
||||
if ((*i)->GetSpellProto()->Id == 48411 || (*i)->GetSpellProto()->Id == 48412)
|
||||
{
|
||||
mastervalue = (*i)->GetAmount();
|
||||
|
||||
switch (form)
|
||||
{
|
||||
case FORM_BEAR:
|
||||
case FORM_DIREBEAR:
|
||||
trigg_id = 48418;
|
||||
break;
|
||||
case FORM_CAT:
|
||||
trigg_id = 48420;
|
||||
break;
|
||||
case FORM_MOONKIN:
|
||||
trigg_id = 48421;
|
||||
break;
|
||||
case FORM_TREE:
|
||||
trigg_id = 48422;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (trigg_id)
|
||||
m_target->CastCustomSpell(m_target, trigg_id, &mastervalue, NULL, NULL, true);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// remove polymorph before changing display id to keep new display id
|
||||
switch ( form )
|
||||
{
|
||||
|
||||
+4
-3
@@ -10536,9 +10536,10 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
|
||||
|
||||
if(GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
//if(GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_IDLE) != IDLE_MOTION_TYPE)
|
||||
//if (((Creature *)this)->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
||||
//((Creature*)this)->SetHomePosition(GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
|
||||
// Set home position at place of engaging combat for escorted creatures
|
||||
if(((Creature*)this)->IsAIEnabled)
|
||||
if (((Creature *)this)->AI()->IsEscorted())
|
||||
((Creature*)this)->SetHomePosition(GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
|
||||
if(enemy)
|
||||
{
|
||||
if(((Creature*)this)->IsAIEnabled)
|
||||
|
||||
Reference in New Issue
Block a user