Mobs fleeing and getting assistance feature implementaion. Author: Neo2003

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-21 10:48:00 -05:00
parent b7053ecc0d
commit 67c84b1f3d
20 changed files with 245 additions and 97 deletions
+1 -1
View File
@@ -114,7 +114,7 @@ Params are always read from Param1, then Param2, then Param3.
22 ACTION_T_SET_PHASE Phase Sets the current phase to (param1)
23 ACTION_T_INC_PHASE Value Increments the phase by (param1). May be negative to decrement phase but should not be 0.
24 ACTION_T_EVADE No Params Forces the creature to evade. Wiping all threat and dropping combat.
25 ACTION_T_FLEE No Params Causes the .creature to flee. Please use this action instead of directly casting this spell so we may change this when a more correct approach is found.
25 ACTION_T_FLEE_FOR_ASSIST No Params Causes the creature to flee for assistence (at low helth mostly).
26 ACTION_T_QUEST_EVENT_ALL QuestId Calls GroupEventHappens with (param1). Only used if it's _expected_ event should complete for all players in current party
27 ACTION_T_CASTCREATUREGO_ALL QuestId, SpellId Calls CastedCreatureOrGo for all players on the threat list with QuestID(Param1) and SpellId(Param2)
28 ACTION_T_REMOVEAURASFROMSPELL Target, Spellid Removes all auras on Target caused by Spellid
+39 -19
View File
@@ -139,6 +139,7 @@ m_gossipOptionLoaded(false),
m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_AlreadyCallAssistance(false),
m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),
m_creatureInfo(NULL), m_reactState(REACT_AGGRESSIVE), m_formation(NULL), m_summonMask(SUMMON_MASK_NONE)
, m_AlreadySearchedAssistance(false)
{
m_regenTimer = 200;
m_valuesCount = UNIT_END;
@@ -611,6 +612,41 @@ void Creature::RegenerateHealth()
ModifyHealth(addvalue);
}
void Creature::DoFleeToGetAssistance()
{
if (!getVictim())
return;
if(HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
return;
float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS);
if (radius >0)
{
Creature* pCreature = NULL;
CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY()));
Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
MaNGOS::NearestAssistCreatureInCreatureRangeCheck u_check(this, getVictim(), radius);
MaNGOS::CreatureLastSearcher<MaNGOS::NearestAssistCreatureInCreatureRangeCheck> searcher(this, pCreature, u_check);
TypeContainerVisitor<MaNGOS::CreatureLastSearcher<MaNGOS::NearestAssistCreatureInCreatureRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, grid_creature_searcher, *GetMap());
SetNoSearchAssistance(true);
if(!pCreature)
//SetFeared(true, getVictim()->GetGUID(), 0 ,sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
//TODO: use 31365
SetControlled(true, UNIT_STAT_FLEEING);
else
GetMotionMaster()->MoveSeekAssistance(pCreature->GetPositionX(), pCreature->GetPositionY(), pCreature->GetPositionZ());
}
}
bool Creature::AIM_Initialize(CreatureAI* ai)
{
// make sure nothing can change the AI during AI update
@@ -1676,6 +1712,7 @@ void Creature::setDeathState(DeathState s)
if (canFly() && FallGround())
return;
SetNoSearchAssistance(false);
Unit::setDeathState(CORPSE);
//Dismiss group if is leader
@@ -1919,22 +1956,6 @@ bool Creature::IsVisibleInGridForPlayer(Player const* pl) const
return false;
}
void Creature::DoFleeToGetAssistance(float radius) // Optional parameter
{
if (!getVictim())
return;
Creature* pCreature = NULL;
Trinity::NearestAssistCreatureInCreatureRangeCheck u_check(this,getVictim(),radius);
Trinity::CreatureLastSearcher<Trinity::NearestAssistCreatureInCreatureRangeCheck> searcher(this, pCreature, u_check);
VisitNearbyGridObject(radius, searcher);
if(!pCreature)
SetControlled(true, UNIT_STAT_FLEEING);
else
GetMotionMaster()->MovePoint(0,pCreature->GetPositionX(),pCreature->GetPositionY(),pCreature->GetPositionZ());
}
Unit* Creature::SelectNearestTarget(float dist) const
{
CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY()));
@@ -1959,14 +1980,13 @@ Unit* Creature::SelectNearestTarget(float dist) const
return target;
}
void Creature::CallAssistance(float radius)
void Creature::CallAssistance()
{
if( !m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed())
{
SetNoCallAssistance(true);
if(!radius)
radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
if(radius > 0)
{
+5 -2
View File
@@ -634,9 +634,11 @@ class TRINITY_DLL_SPEC Creature : public Unit
float GetAttackDistance(Unit const* pl) const;
Unit* SelectNearestTarget(float dist = 0) const;
void CallAssistance(float radius = 0);
void DoFleeToGetAssistance();
void CallAssistance();
void SetNoCallAssistance(bool val) { m_AlreadyCallAssistance = val; }
void DoFleeToGetAssistance(float radius = 50);
void SetNoSearchAssistance(bool val) { m_AlreadySearchedAssistance = val; }
bool HasSearchedAssistance() { return m_AlreadySearchedAssistance; }
bool CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction = true) const;
MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; }
@@ -746,6 +748,7 @@ class TRINITY_DLL_SPEC Creature : public Unit
uint32 m_equipmentId;
bool m_AlreadyCallAssistance;
bool m_AlreadySearchedAssistance;
bool m_regenHealth;
bool m_AI_locked;
bool m_isDeadByDefault;
+2 -30
View File
@@ -130,8 +130,6 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c)
AttackDistance = 0;
AttackAngle = 0.0f;
IsFleeing = false;
//Handle Spawned Events
if (!bEmptyList)
{
@@ -617,12 +615,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
case ACTION_T_EVADE:
EnterEvadeMode();
break;
case ACTION_T_FLEE:
if(me->HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
break;
TimetoFleeLeft = 8000;
me->DoFleeToGetAssistance();
IsFleeing = true;
case ACTION_T_FLEE_FOR_ASSIST:
m_creature->DoFleeToGetAssistance();
break;
case ACTION_T_QUEST_EVENT_ALL:
if (pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER)
@@ -808,7 +802,6 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
void CreatureEventAI::JustRespawned()
{
IsFleeing = false;
Reset();
if (bEmptyList)
@@ -827,9 +820,6 @@ void CreatureEventAI::Reset()
EventUpdateTime = EVENT_UPDATE_TIME;
EventDiff = 0;
TimetoFleeLeft = 0;
IsFleeing = false;
if (bEmptyList)
return;
@@ -888,7 +878,6 @@ void CreatureEventAI::EnterEvadeMode()
void CreatureEventAI::JustDied(Unit* killer)
{
IsFleeing = false;
Reset();
if (bEmptyList)
@@ -1033,23 +1022,6 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
if (!m_creature->isAlive())
return;
if (IsFleeing)
{
if(TimetoFleeLeft < diff)
{
me->SetControlled(false, UNIT_STAT_FLEEING);
me->SetNoCallAssistance(false);
me->CallAssistance();
if(me->getVictim())
me->GetMotionMaster()->MoveChase(me->getVictim());
IsFleeing = false;
}
else
TimetoFleeLeft -= diff;
return;
}
if (!bEmptyList)
{
//Events are only updated once every EVENT_UPDATE_TIME ms to prevent lag with large amount of events
+1 -5
View File
@@ -28,7 +28,6 @@ class Player;
class WorldObject;
#define EVENT_UPDATE_TIME 500
#define SPELL_RUN_AWAY 8225
#define MAX_ACTIONS 3
#define MAX_PHASE 32
@@ -88,7 +87,7 @@ enum EventAI_ActionType
ACTION_T_SET_PHASE = 22, // Phase
ACTION_T_INC_PHASE = 23, // Value (may be negative to decrement phase, should not be 0)
ACTION_T_EVADE = 24, // No Params
ACTION_T_FLEE = 25, // No Params
ACTION_T_FLEE_FOR_ASSIST = 25, // No Params
ACTION_T_QUEST_EVENT_ALL = 26, // QuestID
ACTION_T_CAST_EVENT_ALL = 27, // CreatureId, SpellId
ACTION_T_REMOVEAURASFROMSPELL = 28, // Target, Spellid
@@ -580,8 +579,5 @@ class TRINITY_DLL_SPEC CreatureEventAI : public CreatureAI
bool MeleeEnabled; //If we allow melee auto attack
uint32 AttackDistance; //Distance to attack from
float AttackAngle; //Angle of attack
uint32 TimetoFleeLeft;
bool IsFleeing;
};
#endif
+1 -1
View File
@@ -626,7 +626,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.update_template.creatureId);
break;
case ACTION_T_EVADE: //No Params
case ACTION_T_FLEE: //No Params
case ACTION_T_FLEE_FOR_ASSIST: //No Params
case ACTION_T_DIE: //No Params
case ACTION_T_ZONE_COMBAT_PULSE: //No Params
case ACTION_T_AUTO_ATTACK: //AllowAttackState (0 = stop attack, anything else means continue attacking)
+30
View File
@@ -19,6 +19,7 @@
*/
#include "Creature.h"
#include "CreatureAI.h"
#include "MapManager.h"
#include "FleeingMovementGenerator.h"
#include "DestinationHolderImp.h"
@@ -410,3 +411,32 @@ template void FleeingMovementGenerator<Creature>::Reset(Creature &);
template bool FleeingMovementGenerator<Player>::Update(Player &, const uint32 &);
template bool FleeingMovementGenerator<Creature>::Update(Creature &, const uint32 &);
void TimedFleeingMovementGenerator::Finalize(Unit &owner)
{
owner.clearUnitState(UNIT_STAT_FLEEING);
if (Unit* victim = owner.getVictim())
{
if (owner.isAlive())
{
owner.AttackStop();
((Creature*)&owner)->AI()->AttackStart(victim);
}
}
}
bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32 & time_diff)
{
if( !owner.isAlive() )
return false;
if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED) )
return true;
i_totalFleeTime.Update(time_diff);
if (i_totalFleeTime.Passed())
return false;
// This calls grant-parent Update method hiden by FleeingMovementGenerator::Update(Creature &, const uint32 &) version
// This is done instead of casting Unit& to Creature& and call parent method, then we can use Unit directly
return MovementGeneratorMedium< Creature, FleeingMovementGenerator<Creature> >::Update(owner, time_diff);
}
+17
View File
@@ -61,5 +61,22 @@ class TRINITY_DLL_SPEC FleeingMovementGenerator
DestinationHolder< Traveller<T> > i_destinationHolder;
};
class MANGOS_DLL_SPEC TimedFleeingMovementGenerator
: public FleeingMovementGenerator<Creature>
{
public:
TimedFleeingMovementGenerator(uint64 fright, uint32 time) :
FleeingMovementGenerator<Creature>(fright),
i_totalFleeTime(time) {}
MovementGeneratorType GetMovementGeneratorType() { return TIMED_FLEEING_MOTION_TYPE; }
bool Update(Unit &, const uint32 &);
void Finalize(Unit &);
private:
TimeTracker i_totalFleeTime;
};
#endif
+32 -25
View File
@@ -950,31 +950,6 @@ namespace Trinity
NearestHostileUnitInAttackDistanceCheck(NearestHostileUnitInAttackDistanceCheck const&);
};
class NearestAssistCreatureInCreatureRangeCheck
{
public:
NearestAssistCreatureInCreatureRangeCheck(Creature* obj,Unit* enemy, float range)
: i_obj(obj), i_enemy(enemy), i_range(range) {}
bool operator()(Creature* u)
{
if(u->getFaction() == i_obj->getFaction() && !u->isInCombat() && !u->GetCharmerOrOwnerGUID() && u->IsHostileTo(i_enemy) && u->isAlive()&& i_obj->IsWithinDistInMap(u, i_range) && i_obj->IsWithinLOSInMap(u))
{
i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
return true;
}
return false;
}
float GetLastRange() const { return i_range; }
private:
Creature* const i_obj;
Unit* const i_enemy;
float i_range;
// prevent clone this object
NearestAssistCreatureInCreatureRangeCheck(NearestAssistCreatureInCreatureRangeCheck const&);
};
class AnyAssistCreatureInRangeCheck
{
public:
@@ -1006,6 +981,38 @@ namespace Trinity
float i_range;
};
class NearestAssistCreatureInCreatureRangeCheck
{
public:
NearestAssistCreatureInCreatureRangeCheck(Creature* obj, Unit* enemy, float range)
: i_obj(obj), i_enemy(enemy), i_range(range) {}
bool operator()(Creature* u)
{
if(u == i_obj)
return false;
if(!u->CanAssistTo(i_obj,i_enemy))
return false;
if(!i_obj->IsWithinDistInMap(u, i_range))
return false;
if(!i_obj->IsWithinLOSInMap(u))
return false;
i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
return true;
}
float GetLastRange() const { return i_range; }
private:
Creature* const i_obj;
Unit* const i_enemy;
float i_range;
// prevent clone this object
NearestAssistCreatureInCreatureRangeCheck(NearestAssistCreatureInCreatureRangeCheck const&);
};
// Success at unit in range, range update for next check (this can be use with CreatureLastSearcher to find nearest creature)
class NearestCreatureEntryWithLiveStateInObjectRangeCheck
{
+15 -1
View File
@@ -19,7 +19,8 @@
*/
#include "IdleMovementGenerator.h"
#include "Unit.h"
#include "CreatureAI.h"
#include "Creature.h"
IdleMovementGenerator si_idleMovement;
@@ -60,3 +61,16 @@ DistractMovementGenerator::Update(Unit& owner, const uint32& time_diff)
return true;
}
void
AssistanceDistractMovementGenerator::Finalize(Unit &unit)
{
unit.clearUnitState(UNIT_STAT_DISTRACTED);
if (Unit* victim = unit.getVictim())
{
if (unit.isAlive())
{
unit.AttackStop();
((Creature*)&unit)->AI()->AttackStart(victim);
}
}
}
+10
View File
@@ -51,5 +51,15 @@ class TRINITY_DLL_SPEC DistractMovementGenerator : public MovementGenerator
uint32 m_timer;
};
class MANGOS_DLL_SPEC AssistanceDistractMovementGenerator : public DistractMovementGenerator
{
public:
AssistanceDistractMovementGenerator(uint32 timer) :
DistractMovementGenerator(timer) {}
MovementGeneratorType GetMovementGeneratorType() { return ASSISTANCE_DISTRACT_MOTION_TYPE; }
void Finalize(Unit& unit);
};
#endif
+38 -4
View File
@@ -365,7 +365,37 @@ MotionMaster::MoveCharge(float x, float y, float z, float speed)
}
void
MotionMaster::MoveFleeing(Unit* enemy)
MotionMaster::MoveSeekAssistance(float x, float y, float z)
{
if(i_owner->GetTypeId()==TYPEID_PLAYER)
{
sLog.outError("Player (GUID: %u) attempt to seek assistance",i_owner->GetGUIDLow());
}
else
{
DEBUG_LOG("Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)",
i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z );
Mutate(new AssistanceMovementGenerator(x,y,z), MOTION_SLOT_ACTIVE);
}
}
void
MotionMaster::MoveSeekAssistanceDistract(uint32 time)
{
if(i_owner->GetTypeId()==TYPEID_PLAYER)
{
sLog.outError("Player (GUID: %u) attempt to call distract after assistance",i_owner->GetGUIDLow());
}
else
{
DEBUG_LOG("Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)",
i_owner->GetEntry(), i_owner->GetGUIDLow(), time );
Mutate(new AssistanceDistractMovementGenerator(time), MOTION_SLOT_ACTIVE);
}
}
void
MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
{
if(!enemy)
return;
@@ -382,11 +412,15 @@ MotionMaster::MoveFleeing(Unit* enemy)
}
else
{
DEBUG_LOG("Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)",
DEBUG_LOG("Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s",
i_owner->GetEntry(), i_owner->GetGUIDLow(),
enemy->GetTypeId()==TYPEID_PLAYER ? "player" : "creature",
enemy->GetTypeId()==TYPEID_PLAYER ? enemy->GetGUIDLow() : ((Creature*)enemy)->GetDBTableGUIDLow() );
Mutate(new FleeingMovementGenerator<Creature>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
enemy->GetTypeId()==TYPEID_PLAYER ? enemy->GetGUIDLow() : ((Creature*)enemy)->GetDBTableGUIDLow(),
time ? " for a limited time" : "");
if (time)
Mutate(new TimedFleeingMovementGenerator(enemy->GetGUID(), time), MOTION_SLOT_CONTROLLED);
else
Mutate(new FleeingMovementGenerator<Creature>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
}
}
+7 -2
View File
@@ -45,7 +45,10 @@ enum MovementGeneratorType
POINT_MOTION_TYPE = 8, // PointMovementGenerator.h
FLEEING_MOTION_TYPE = 9, // FleeingMovementGenerator.h
DISTRACT_MOTION_TYPE = 10, // IdleMovementGenerator.h
NULL_MOTION_TYPE = 11,
ASSISTANCE_MOTION_TYPE= 11, // PointMovementGenerator.h (first part of flee for assistance)
ASSISTANCE_DISTRACT_MOTION_TYPE = 12, // IdleMovementGenerator.h (second part of flee for assistance)
TIMED_FLEEING_MOTION_TYPE = 13, // FleeingMovementGenerator.h (alt.second part of flee for assistance)
NULL_MOTION_TYPE = 14,
};
enum MovementSlot
@@ -138,12 +141,14 @@ class TRINITY_DLL_SPEC MotionMaster //: private std::stack<MovementGenerator *>
void MoveFollow(Unit* target, float dist, float angle, MovementSlot slot = MOTION_SLOT_ACTIVE);
void MoveChase(Unit* target, float dist = 0.0f, float angle = 0.0f);
void MoveConfused();
void MoveFleeing(Unit* enemy);
void MoveFleeing(Unit* enemy, uint32 time = 0);
void MovePoint(uint32 id, float x,float y,float z);
void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE);
void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ);
void MoveJumpTo(float angle, float speedXY, float speedZ);
void MoveJump(float x, float y, float z, float speedXY, float speedZ);
void MoveSeekAssistance(float x,float y,float z);
void MoveSeekAssistanceDistract(uint32 timer);
void MoveTaxiFlight(uint32 path, uint32 pathnode);
void MoveDistract(uint32 time);
void MovePath(uint32 path_id, bool repeatable);
+9
View File
@@ -23,6 +23,7 @@
#include "Creature.h"
#include "CreatureAI.h"
#include "DestinationHolderImp.h"
#include "World.h"
//----- Point Movement Generator
template<class T>
@@ -92,3 +93,11 @@ template void PointMovementGenerator<Player>::Finalize(Player&);
template void PointMovementGenerator<Creature>::Initialize(Creature&);
template bool PointMovementGenerator<Creature>::Update(Creature&, const uint32 &diff);
template void PointMovementGenerator<Creature>::Finalize(Creature&);
void AssistanceMovementGenerator::Finalize(Unit &unit)
{
((Creature*)&unit)->SetNoCallAssistance(false);
((Creature*)&unit)->CallAssistance();
if (unit.isAlive())
unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY));
}
+12
View File
@@ -51,5 +51,17 @@ class TRINITY_DLL_SPEC PointMovementGenerator
DestinationHolder< Traveller<T> > i_destinationHolder;
bool arrived;
};
class MANGOS_DLL_SPEC AssistanceMovementGenerator
: public PointMovementGenerator<Creature>
{
public:
AssistanceMovementGenerator(float _x, float _y, float _z) :
PointMovementGenerator<Creature>(0, _x, _y, _z) {}
MovementGeneratorType GetMovementGeneratorType() { return ASSISTANCE_MOTION_TYPE; }
void Finalize(Unit &);
};
#endif
+4 -1
View File
@@ -94,7 +94,10 @@ template<class T>
void
TargetedMovementGenerator<T>::Initialize(T &owner)
{
owner.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->HasSearchedAssistance())
owner.AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
else
owner.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->canFly())
owner.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2);
+6 -5
View File
@@ -8085,10 +8085,11 @@ bool Unit::AttackStop()
InterruptSpell(CURRENT_MELEE_SPELL);
if( GetTypeId()==TYPEID_UNIT )
// reset only at real combat stop
if(GetTypeId()==TYPEID_UNIT )
{
// reset call assistance
((Creature*)this)->SetNoCallAssistance(false);
((Creature*)this)->SetNoSearchAssistance(false);
}
SendAttackStop(victim);
@@ -12321,7 +12322,7 @@ void Unit::SendMovementFlagUpdate()
}
/*
void Unit::SetFeared(bool apply, uint64 casterGUID, uint32 spellID)
void Unit::SetFeared(bool apply, uint64 casterGUID, uint32 spellID, uint32 time)
{
if( apply )
{
@@ -12335,7 +12336,7 @@ void Unit::SetFeared(bool apply, uint64 casterGUID, uint32 spellID)
Unit* caster = ObjectAccessor::GetUnit(*this,casterGUID);
GetMotionMaster()->MoveFleeing(caster); // caster==NULL processed in MoveFleeing
GetMotionMaster()->MoveFleeing(caster, time); // caster==NULL processed in MoveFleeing
}
else
{
@@ -13332,7 +13333,7 @@ void Unit::SetFeared(bool apply)
caster = ObjectAccessor::GetUnit(*this, fearAuras.front()->GetCasterGUID());
if(!caster)
caster = getAttackerForHelper();
GetMotionMaster()->MoveFleeing(caster); // caster==NULL processed in MoveFleeing
GetMotionMaster()->MoveFleeing(caster, fearAuras.empty() ? sWorld.getConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY) : 0); // caster==NULL processed in MoveFleeing
}
else
{
+2
View File
@@ -909,8 +909,10 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_EVENT_ANNOUNCE] = sConfig.GetIntDefault("Event.Announce",0);
m_configs[CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS] = sConfig.GetIntDefault("CreatureFamilyFleeAssistanceRadius",30);
m_configs[CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS] = sConfig.GetIntDefault("CreatureFamilyAssistanceRadius",10);
m_configs[CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY] = sConfig.GetIntDefault("CreatureFamilyAssistanceDelay",1500);
m_configs[CONFIG_CREATURE_FAMILY_FLEE_DELAY] = sConfig.GetIntDefault("CreatureFamilyFleeDelay",7000);
m_configs[CONFIG_WORLD_BOSS_LEVEL_DIFF] = sConfig.GetIntDefault("WorldBossLevelDiff",3);
+2
View File
@@ -169,8 +169,10 @@ enum WorldConfigs
CONFIG_CHATFLOOD_MESSAGE_DELAY,
CONFIG_CHATFLOOD_MUTE_TIME,
CONFIG_EVENT_ANNOUNCE,
CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS,
CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS,
CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY,
CONFIG_CREATURE_FAMILY_FLEE_DELAY,
CONFIG_WORLD_BOSS_LEVEL_DIFF,
CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF,
CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF,
+12 -1
View File
@@ -819,8 +819,13 @@ TalentsInspecting = 1
# 1.5 - 150%
# 0 - off (0%)
#
# CreatureFamilyFleeAssistanceRadius
# Radius which creature will use to seek for a near creature for assistance. Creature will flee to this creature.
# Default: 30
# 0 - off
#
# CreatureFamilyAssistanceRadius
# Creature family assistance radius
# Radius which creature will use to call assistance without moving
# Default: 10
# 0 - off
#
@@ -828,6 +833,10 @@ TalentsInspecting = 1
# Reaction time for creature assistance call
# Default: 1500 (1.5s)
#
# CreatureFamilyFleeDelay
# Time during which creature can flee when no assistant found
# Default: 7000 (7s)
#
# WorldBossLevelDiff
# Difference for boss dynamic level with target
# Default: 3
@@ -884,8 +893,10 @@ TalentsInspecting = 1
ThreatRadius = 60
Rate.Creature.Aggro = 1
CreatureFamilyFleeAssistanceRadius = 30
CreatureFamilyAssistanceRadius = 10
CreatureFamilyAssistanceDelay = 1500
CreatureFamilyFleeDelay = 7000
WorldBossLevelDiff = 3
Corpse.Decay.NORMAL = 60
Corpse.Decay.RARE = 300