*Fix the bug that escorted creatures return to their spawnpoint after engaging combat.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-07-14 20:15:47 +02:00
parent 87ca52c2a9
commit 8898e9f420
4 changed files with 43 additions and 3 deletions
@@ -61,6 +61,8 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI
void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; } void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; }
float GetMaxPlayerDistance() { return MaxPlayerDistance; } float GetMaxPlayerDistance() { return MaxPlayerDistance; }
bool IsEscorted() {return IsBeingEscorted;}
void SetCanMelee(bool usemelee) { CanMelee = usemelee; } void SetCanMelee(bool usemelee) { CanMelee = usemelee; }
void SetDespawnAtEnd(bool despawn) { DespawnAtEnd = despawn; } void SetDespawnAtEnd(bool despawn) { DespawnAtEnd = despawn; }
void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; } void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; }
+1
View File
@@ -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) // Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc)
//virtual void AttackedBy(Unit* attacker); //virtual void AttackedBy(Unit* attacker);
virtual bool IsEscorted () {return false;}
// Called when creature is spawned or respawned (for reseting variables) // Called when creature is spawned or respawned (for reseting variables)
virtual void JustRespawned() { Reset(); } virtual void JustRespawned() { Reset(); }
+36
View File
@@ -3193,6 +3193,42 @@ void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real, bool changeAmoun
sLog.outError("Auras: Unknown Shapeshift Type: %u", GetMiscValue()); 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 // remove polymorph before changing display id to keep new display id
switch ( form ) switch ( form )
{ {
+4 -3
View File
@@ -10536,9 +10536,10 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
if(GetTypeId() != TYPEID_PLAYER) if(GetTypeId() != TYPEID_PLAYER)
{ {
//if(GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_IDLE) != IDLE_MOTION_TYPE) // Set home position at place of engaging combat for escorted creatures
//if (((Creature *)this)->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) if(((Creature*)this)->IsAIEnabled)
//((Creature*)this)->SetHomePosition(GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); if (((Creature *)this)->AI()->IsEscorted())
((Creature*)this)->SetHomePosition(GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
if(enemy) if(enemy)
{ {
if(((Creature*)this)->IsAIEnabled) if(((Creature*)this)->IsAIEnabled)