*Merge.
--HG-- branch : trunk
This commit is contained in:
@@ -65,6 +65,9 @@ ConfusedMovementGenerator<T>::Initialize(T &unit)
|
|||||||
i_waypoints[idx][2] = z;
|
i_waypoints[idx][2] = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unit.SetUInt64Value(UNIT_FIELD_TARGET, 0);
|
||||||
|
unit.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
|
||||||
|
unit.CastStop();
|
||||||
unit.StopMoving();
|
unit.StopMoving();
|
||||||
unit.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
|
unit.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
|
||||||
unit.addUnitState(UNIT_STAT_CONFUSED);
|
unit.addUnitState(UNIT_STAT_CONFUSED);
|
||||||
@@ -144,7 +147,10 @@ template<class T>
|
|||||||
void
|
void
|
||||||
ConfusedMovementGenerator<T>::Finalize(T &unit)
|
ConfusedMovementGenerator<T>::Finalize(T &unit)
|
||||||
{
|
{
|
||||||
|
unit.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
|
||||||
unit.clearUnitState(UNIT_STAT_CONFUSED);
|
unit.clearUnitState(UNIT_STAT_CONFUSED);
|
||||||
|
if(unit.GetTypeId() == TYPEID_UNIT && unit.getVictim())
|
||||||
|
unit.SetUInt64Value(UNIT_FIELD_TARGET, unit.getVictim()->GetGUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
template void ConfusedMovementGenerator<Player>::Initialize(Player &player);
|
template void ConfusedMovementGenerator<Player>::Initialize(Player &player);
|
||||||
|
|||||||
+2
-10
@@ -1871,18 +1871,10 @@ void Creature::DoFleeToGetAssistance(float radius) // Optional parameter
|
|||||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||||
cell_lock->Visit(cell_lock, grid_creature_searcher, *(GetMap()));
|
cell_lock->Visit(cell_lock, grid_creature_searcher, *(GetMap()));
|
||||||
|
|
||||||
if(!GetMotionMaster()->empty() && (GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE))
|
if(!pCreature)
|
||||||
GetMotionMaster()->Clear(false);
|
|
||||||
if(pCreature == NULL)
|
|
||||||
{
|
|
||||||
GetMotionMaster()->MoveIdle();
|
|
||||||
GetMotionMaster()->MoveFleeing(getVictim());
|
GetMotionMaster()->MoveFleeing(getVictim());
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
GetMotionMaster()->MoveIdle();
|
|
||||||
GetMotionMaster()->MovePoint(0,pCreature->GetPositionX(),pCreature->GetPositionY(),pCreature->GetPositionZ());
|
GetMotionMaster()->MovePoint(0,pCreature->GetPositionX(),pCreature->GetPositionY(),pCreature->GetPositionZ());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit* Creature::SelectNearestTarget(float dist) const
|
Unit* Creature::SelectNearestTarget(float dist) const
|
||||||
@@ -2142,7 +2134,7 @@ bool Creature::HasSpellCooldown(uint32 spell_id) const
|
|||||||
|
|
||||||
bool Creature::IsInEvadeMode() const
|
bool Creature::IsInEvadeMode() const
|
||||||
{
|
{
|
||||||
return !i_motionMaster.empty() && i_motionMaster.GetCurrentMovementGeneratorType() == HOME_MOTION_TYPE;
|
return /*!i_motionMaster.empty() &&*/ i_motionMaster.GetCurrentMovementGeneratorType() == HOME_MOTION_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Creature::HasSpell(uint32 spellID) const
|
bool Creature::HasSpell(uint32 spellID) const
|
||||||
|
|||||||
@@ -306,6 +306,10 @@ FleeingMovementGenerator<T>::Initialize(T &owner)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_Init(owner);
|
_Init(owner);
|
||||||
|
owner.CastStop();
|
||||||
|
owner.addUnitState(UNIT_STAT_FLEEING);
|
||||||
|
owner.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
|
||||||
|
owner.SetUInt64Value(UNIT_FIELD_TARGET, 0);
|
||||||
owner.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
|
owner.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
|
||||||
i_caster_x = fright->GetPositionX();
|
i_caster_x = fright->GetPositionX();
|
||||||
i_caster_y = fright->GetPositionY();
|
i_caster_y = fright->GetPositionY();
|
||||||
@@ -323,7 +327,7 @@ FleeingMovementGenerator<Creature>::_Init(Creature &owner)
|
|||||||
{
|
{
|
||||||
if(!&owner)
|
if(!&owner)
|
||||||
return;
|
return;
|
||||||
owner.SetUInt64Value(UNIT_FIELD_TARGET, 0);
|
|
||||||
is_water_ok = owner.canSwim();
|
is_water_ok = owner.canSwim();
|
||||||
is_land_ok = owner.canWalk();
|
is_land_ok = owner.canWalk();
|
||||||
}
|
}
|
||||||
@@ -340,7 +344,10 @@ template<class T>
|
|||||||
void
|
void
|
||||||
FleeingMovementGenerator<T>::Finalize(T &owner)
|
FleeingMovementGenerator<T>::Finalize(T &owner)
|
||||||
{
|
{
|
||||||
|
owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
|
||||||
owner.clearUnitState(UNIT_STAT_FLEEING);
|
owner.clearUnitState(UNIT_STAT_FLEEING);
|
||||||
|
if(owner.GetTypeId() == TYPEID_UNIT && owner.getVictim())
|
||||||
|
owner.SetUInt64Value(UNIT_FIELD_TARGET, owner.getVictim()->GetGUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|||||||
+1
-1
@@ -4021,7 +4021,7 @@ bool ChatHandler::HandleNpcUnFollowCommand(const char* /*args*/)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (creature->GetMotionMaster()->empty() ||
|
if (/*creature->GetMotionMaster()->empty() ||*/
|
||||||
creature->GetMotionMaster()->GetCurrentMovementGeneratorType ()!=TARGETED_MOTION_TYPE)
|
creature->GetMotionMaster()->GetCurrentMovementGeneratorType ()!=TARGETED_MOTION_TYPE)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU);
|
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU);
|
||||||
|
|||||||
+13
-7
@@ -5727,9 +5727,15 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
|
|||||||
PSendSysMessage(LANG_MOVEGENS_LIST,(unit->GetTypeId()==TYPEID_PLAYER ? "Player" : "Creature" ),unit->GetGUIDLow());
|
PSendSysMessage(LANG_MOVEGENS_LIST,(unit->GetTypeId()==TYPEID_PLAYER ? "Player" : "Creature" ),unit->GetGUIDLow());
|
||||||
|
|
||||||
MotionMaster* mm = unit->GetMotionMaster();
|
MotionMaster* mm = unit->GetMotionMaster();
|
||||||
for(MotionMaster::const_iterator itr = mm->begin(); itr != mm->end(); ++itr)
|
for(int i = 0; i < MAX_MOTION_SLOT; ++i)
|
||||||
{
|
{
|
||||||
switch((*itr)->GetMovementGeneratorType())
|
MovementGenerator* mg = mm->GetMotionSlot(i);
|
||||||
|
if(!mg)
|
||||||
|
{
|
||||||
|
SendSysMessage("Empty");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
switch(mg->GetMovementGeneratorType())
|
||||||
{
|
{
|
||||||
case IDLE_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_IDLE); break;
|
case IDLE_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_IDLE); break;
|
||||||
case RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_RANDOM); break;
|
case RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_RANDOM); break;
|
||||||
@@ -5740,7 +5746,7 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
|
|||||||
{
|
{
|
||||||
if(unit->GetTypeId()==TYPEID_PLAYER)
|
if(unit->GetTypeId()==TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
TargetedMovementGenerator<Player> const* mgen = static_cast<TargetedMovementGenerator<Player> const*>(*itr);
|
TargetedMovementGenerator<Player> const* mgen = static_cast<TargetedMovementGenerator<Player> const*>(mg);
|
||||||
Unit* target = mgen->GetTarget();
|
Unit* target = mgen->GetTarget();
|
||||||
if(target)
|
if(target)
|
||||||
PSendSysMessage(LANG_MOVEGENS_TARGETED_PLAYER,target->GetName(),target->GetGUIDLow());
|
PSendSysMessage(LANG_MOVEGENS_TARGETED_PLAYER,target->GetName(),target->GetGUIDLow());
|
||||||
@@ -5749,7 +5755,7 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TargetedMovementGenerator<Creature> const* mgen = static_cast<TargetedMovementGenerator<Creature> const*>(*itr);
|
TargetedMovementGenerator<Creature> const* mgen = static_cast<TargetedMovementGenerator<Creature> const*>(mg);
|
||||||
Unit* target = mgen->GetTarget();
|
Unit* target = mgen->GetTarget();
|
||||||
if(target)
|
if(target)
|
||||||
PSendSysMessage(LANG_MOVEGENS_TARGETED_CREATURE,target->GetName(),target->GetGUIDLow());
|
PSendSysMessage(LANG_MOVEGENS_TARGETED_CREATURE,target->GetName(),target->GetGUIDLow());
|
||||||
@@ -5762,7 +5768,7 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
|
|||||||
if(unit->GetTypeId()==TYPEID_UNIT)
|
if(unit->GetTypeId()==TYPEID_UNIT)
|
||||||
{
|
{
|
||||||
float x,y,z;
|
float x,y,z;
|
||||||
(*itr)->GetDestination(x,y,z);
|
mg->GetDestination(x,y,z);
|
||||||
PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE,x,y,z);
|
PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE,x,y,z);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -5772,14 +5778,14 @@ bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
|
|||||||
case POINT_MOTION_TYPE:
|
case POINT_MOTION_TYPE:
|
||||||
{
|
{
|
||||||
float x,y,z;
|
float x,y,z;
|
||||||
(*itr)->GetDestination(x,y,z);
|
mg->GetDestination(x,y,z);
|
||||||
PSendSysMessage(LANG_MOVEGENS_POINT,x,y,z);
|
PSendSysMessage(LANG_MOVEGENS_POINT,x,y,z);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FLEEING_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_FEAR); break;
|
case FLEEING_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_FEAR); break;
|
||||||
case DISTRACT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_DISTRACT); break;
|
case DISTRACT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_DISTRACT); break;
|
||||||
default:
|
default:
|
||||||
PSendSysMessage(LANG_MOVEGENS_UNKNOWN,(*itr)->GetMovementGeneratorType());
|
PSendSysMessage(LANG_MOVEGENS_UNKNOWN,mg->GetMovementGeneratorType());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1286,25 +1286,6 @@ float Map::GetVmapHeight(float x, float y, float z, bool useMaps) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint16 Map::GetAreaFlag(float x, float y, float z) const
|
uint16 Map::GetAreaFlag(float x, float y, float z) const
|
||||||
{
|
|
||||||
float mapHeight;
|
|
||||||
float vmapHeight;
|
|
||||||
if (useMaps)
|
|
||||||
{
|
|
||||||
mapHeight = GetHeight(x, y, z, false);
|
|
||||||
if (fabs(mapHeight - z) < 0.1)
|
|
||||||
return mapHeight;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
mapHeight = INVALID_HEIGHT;
|
|
||||||
VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
|
||||||
if (vmgr->isLineOfSightCalcEnabled())
|
|
||||||
bool result = vmgr->getObjectHitPos(GetId(), x, y, z + 2.0f, x, y, mapHeight, x, y, vmapHeight, 0);
|
|
||||||
else
|
|
||||||
return INVALID_HEIGHT;
|
|
||||||
return vmapHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
//local x,y coords
|
//local x,y coords
|
||||||
float lx,ly;
|
float lx,ly;
|
||||||
|
|||||||
@@ -155,8 +155,8 @@ void MotionMaster::MoveIdle(MovementSlot slot)
|
|||||||
void
|
void
|
||||||
MotionMaster::MoveTargetedHome()
|
MotionMaster::MoveTargetedHome()
|
||||||
{
|
{
|
||||||
if(i_owner->hasUnitState(UNIT_STAT_FLEEING))
|
//if(i_owner->hasUnitState(UNIT_STAT_FLEEING))
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
Clear(false);
|
Clear(false);
|
||||||
|
|
||||||
@@ -230,8 +230,6 @@ MotionMaster::MoveChase(Unit* target, float dist, float angle)
|
|||||||
void
|
void
|
||||||
MotionMaster::MoveFollow(Unit* target, float dist, float angle)
|
MotionMaster::MoveFollow(Unit* target, float dist, float angle)
|
||||||
{
|
{
|
||||||
Clear();
|
|
||||||
|
|
||||||
// ignore movement request if target not exist
|
// ignore movement request if target not exist
|
||||||
if(!target)
|
if(!target)
|
||||||
return;
|
return;
|
||||||
@@ -276,6 +274,9 @@ MotionMaster::MoveFleeing(Unit* enemy)
|
|||||||
if(!enemy)
|
if(!enemy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(i_owner->HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
|
||||||
|
return;
|
||||||
|
|
||||||
if(i_owner->GetTypeId()==TYPEID_PLAYER)
|
if(i_owner->GetTypeId()==TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("Player (GUID: %u) flee from %s (GUID: %u)", i_owner->GetGUIDLow(),
|
DEBUG_LOG("Player (GUID: %u) flee from %s (GUID: %u)", i_owner->GetGUIDLow(),
|
||||||
@@ -312,6 +313,9 @@ MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
|
|||||||
void
|
void
|
||||||
MotionMaster::MoveDistract(uint32 timer)
|
MotionMaster::MoveDistract(uint32 timer)
|
||||||
{
|
{
|
||||||
|
if(Impl[MOTION_SLOT_CONTROLLED])
|
||||||
|
return;
|
||||||
|
|
||||||
if(i_owner->GetTypeId()==TYPEID_PLAYER)
|
if(i_owner->GetTypeId()==TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
DEBUG_LOG("Player (GUID: %u) distracted (timer: %u)", i_owner->GetGUIDLow(), timer);
|
DEBUG_LOG("Player (GUID: %u) distracted (timer: %u)", i_owner->GetGUIDLow(), timer);
|
||||||
@@ -388,7 +392,10 @@ void MotionMaster::propagateSpeedChange()
|
|||||||
(*it)->unitSpeedChanged();
|
(*it)->unitSpeedChanged();
|
||||||
}*/
|
}*/
|
||||||
for(int i = 0; i <= i_top; ++i)
|
for(int i = 0; i <= i_top; ++i)
|
||||||
|
{
|
||||||
|
if(Impl[i])
|
||||||
Impl[i]->unitSpeedChanged();
|
Impl[i]->unitSpeedChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const
|
MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const
|
||||||
|
|||||||
@@ -63,20 +63,25 @@ class TRINITY_DLL_SPEC MotionMaster //: private std::stack<MovementGenerator *>
|
|||||||
_Ty Impl[MAX_MOTION_SLOT];
|
_Ty Impl[MAX_MOTION_SLOT];
|
||||||
int i_top;
|
int i_top;
|
||||||
|
|
||||||
int size() const { return i_top + 1; }
|
|
||||||
bool empty() const { return i_top < 0; }
|
bool empty() const { return i_top < 0; }
|
||||||
void pop() { Impl[i_top] = NULL; --i_top; }
|
void pop() { Impl[i_top] = NULL; --i_top; }
|
||||||
void push(_Ty _Val) { ++i_top; Impl[i_top] = _Val; }
|
void push(_Ty _Val) { ++i_top; Impl[i_top] = _Val; }
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit MotionMaster(Unit *unit) : i_owner(unit), i_top(-1) {}
|
explicit MotionMaster(Unit *unit) : i_owner(unit), i_top(-1)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < MAX_MOTION_SLOT; ++i)
|
||||||
|
Impl[i] = NULL;
|
||||||
|
}
|
||||||
~MotionMaster();
|
~MotionMaster();
|
||||||
|
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
||||||
//MovementGenerator* operator->(void) { return top(); }
|
//MovementGenerator* operator->(void) { return top(); }
|
||||||
|
|
||||||
|
int size() const { return i_top + 1; }
|
||||||
_Ty top() const { return Impl[i_top]; }
|
_Ty top() const { return Impl[i_top]; }
|
||||||
|
_Ty GetMotionSlot(int slot) { return Impl[slot]; }
|
||||||
/*using Impl::top;
|
/*using Impl::top;
|
||||||
using Impl::empty;
|
using Impl::empty;
|
||||||
|
|
||||||
|
|||||||
+30
-71
@@ -2656,7 +2656,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
|
|||||||
Unit::AuraList const& mReflectSpellsSchool = pVictim->GetAurasByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
|
Unit::AuraList const& mReflectSpellsSchool = pVictim->GetAurasByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
|
||||||
for(Unit::AuraList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
|
for(Unit::AuraList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
|
||||||
if((*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spell))
|
if((*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spell))
|
||||||
reflectchance = (*i)->GetModifier()->m_amount;
|
reflectchance += (*i)->GetModifier()->m_amount;
|
||||||
if (reflectchance > 0 && roll_chance_i(reflectchance))
|
if (reflectchance > 0 && roll_chance_i(reflectchance))
|
||||||
{
|
{
|
||||||
// Start triggers for remove charges if need (trigger only for victim, and mark as active spell)
|
// Start triggers for remove charges if need (trigger only for victim, and mark as active spell)
|
||||||
@@ -3294,11 +3294,8 @@ int32 Unit::GetMaxPositiveAuraModifier(AuraType auratype) const
|
|||||||
|
|
||||||
AuraList const& mTotalAuraList = GetAurasByType(auratype);
|
AuraList const& mTotalAuraList = GetAurasByType(auratype);
|
||||||
for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
|
for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
|
||||||
{
|
if ((*i)->GetModifier()->m_amount > modifier)
|
||||||
int32 amount = (*i)->GetModifier()->m_amount;
|
modifier = (*i)->GetModifier()->m_amount;
|
||||||
if (amount > modifier)
|
|
||||||
modifier = amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
return modifier;
|
return modifier;
|
||||||
}
|
}
|
||||||
@@ -3309,11 +3306,8 @@ int32 Unit::GetMaxNegativeAuraModifier(AuraType auratype) const
|
|||||||
|
|
||||||
AuraList const& mTotalAuraList = GetAurasByType(auratype);
|
AuraList const& mTotalAuraList = GetAurasByType(auratype);
|
||||||
for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
|
for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
|
||||||
{
|
if ((*i)->GetModifier()->m_amount < modifier)
|
||||||
int32 amount = (*i)->GetModifier()->m_amount;
|
modifier = (*i)->GetModifier()->m_amount;
|
||||||
if (amount < modifier)
|
|
||||||
modifier = amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
return modifier;
|
return modifier;
|
||||||
}
|
}
|
||||||
@@ -3327,7 +3321,7 @@ int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask)
|
|||||||
{
|
{
|
||||||
Modifier* mod = (*i)->GetModifier();
|
Modifier* mod = (*i)->GetModifier();
|
||||||
if (mod->m_miscvalue & misc_mask)
|
if (mod->m_miscvalue & misc_mask)
|
||||||
modifier += (*i)->GetModifier()->m_amount;
|
modifier += mod->m_amount;
|
||||||
}
|
}
|
||||||
return modifier;
|
return modifier;
|
||||||
}
|
}
|
||||||
@@ -3341,7 +3335,7 @@ float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask
|
|||||||
{
|
{
|
||||||
Modifier* mod = (*i)->GetModifier();
|
Modifier* mod = (*i)->GetModifier();
|
||||||
if (mod->m_miscvalue & misc_mask)
|
if (mod->m_miscvalue & misc_mask)
|
||||||
multiplier *= (100.0f + (*i)->GetModifier()->m_amount)/100.0f;
|
multiplier *= (100.0f + mod->m_amount)/100.0f;
|
||||||
}
|
}
|
||||||
return multiplier;
|
return multiplier;
|
||||||
}
|
}
|
||||||
@@ -3354,9 +3348,8 @@ int32 Unit::GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_
|
|||||||
for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
|
for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
|
||||||
{
|
{
|
||||||
Modifier* mod = (*i)->GetModifier();
|
Modifier* mod = (*i)->GetModifier();
|
||||||
int32 amount = (*i)->GetModifier()->m_amount;
|
if (mod->m_miscvalue & misc_mask && mod->m_amount > modifier)
|
||||||
if (mod->m_miscvalue & misc_mask && amount > modifier)
|
modifier = mod->m_amount;
|
||||||
modifier = amount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return modifier;
|
return modifier;
|
||||||
@@ -3370,9 +3363,8 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_
|
|||||||
for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
|
for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
|
||||||
{
|
{
|
||||||
Modifier* mod = (*i)->GetModifier();
|
Modifier* mod = (*i)->GetModifier();
|
||||||
int32 amount = (*i)->GetModifier()->m_amount;
|
if (mod->m_miscvalue & misc_mask && mod->m_amount < modifier)
|
||||||
if (mod->m_miscvalue & misc_mask && amount < modifier)
|
modifier = mod->m_amount;
|
||||||
modifier = amount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return modifier;
|
return modifier;
|
||||||
@@ -3387,7 +3379,7 @@ int32 Unit::GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value)
|
|||||||
{
|
{
|
||||||
Modifier* mod = (*i)->GetModifier();
|
Modifier* mod = (*i)->GetModifier();
|
||||||
if (mod->m_miscvalue == misc_value)
|
if (mod->m_miscvalue == misc_value)
|
||||||
modifier += (*i)->GetModifier()->m_amount;
|
modifier += mod->m_amount;
|
||||||
}
|
}
|
||||||
return modifier;
|
return modifier;
|
||||||
}
|
}
|
||||||
@@ -3401,7 +3393,7 @@ float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_valu
|
|||||||
{
|
{
|
||||||
Modifier* mod = (*i)->GetModifier();
|
Modifier* mod = (*i)->GetModifier();
|
||||||
if (mod->m_miscvalue == misc_value)
|
if (mod->m_miscvalue == misc_value)
|
||||||
multiplier *= (100.0f + (*i)->GetModifier()->m_amount)/100.0f;
|
multiplier *= (100.0f + mod->m_amount)/100.0f;
|
||||||
}
|
}
|
||||||
return multiplier;
|
return multiplier;
|
||||||
}
|
}
|
||||||
@@ -3414,9 +3406,8 @@ int32 Unit::GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_
|
|||||||
for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
|
for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
|
||||||
{
|
{
|
||||||
Modifier* mod = (*i)->GetModifier();
|
Modifier* mod = (*i)->GetModifier();
|
||||||
int32 amount = (*i)->GetModifier()->m_amount;
|
if (mod->m_miscvalue == misc_value && mod->m_amount > modifier)
|
||||||
if (mod->m_miscvalue == misc_value && amount > modifier)
|
modifier = mod->m_amount;
|
||||||
modifier = amount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return modifier;
|
return modifier;
|
||||||
@@ -3430,9 +3421,8 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_
|
|||||||
for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
|
for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
|
||||||
{
|
{
|
||||||
Modifier* mod = (*i)->GetModifier();
|
Modifier* mod = (*i)->GetModifier();
|
||||||
int32 amount = (*i)->GetModifier()->m_amount;
|
if (mod->m_miscvalue == misc_value && mod->m_amount < modifier)
|
||||||
if (mod->m_miscvalue == misc_value && amount < modifier)
|
modifier = mod->m_amount;
|
||||||
modifier = amount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return modifier;
|
return modifier;
|
||||||
@@ -3997,9 +3987,6 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
|||||||
sLog.outDebug("Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode);
|
sLog.outDebug("Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode);
|
||||||
assert(!Aur->IsInUse());
|
assert(!Aur->IsInUse());
|
||||||
Aur->ApplyModifier(false,true);
|
Aur->ApplyModifier(false,true);
|
||||||
|
|
||||||
Aur->SetStackAmount(0);
|
|
||||||
|
|
||||||
Aur->_RemoveAura();
|
Aur->_RemoveAura();
|
||||||
delete Aur;
|
delete Aur;
|
||||||
|
|
||||||
@@ -7406,7 +7393,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
|||||||
(*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0 )
|
(*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0 )
|
||||||
// 0 == any inventory type (not wand then)
|
// 0 == any inventory type (not wand then)
|
||||||
{
|
{
|
||||||
DoneTotalMod *= ((*i)->GetModifier()->m_amount +100.0f)/100.0f;
|
DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7414,13 +7401,13 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
|||||||
AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
|
AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
|
||||||
for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i)
|
for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i)
|
||||||
if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue))
|
if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue))
|
||||||
DoneTotalMod *= ((*i)->GetModifier()->m_amount +100.0f)/100.0f;
|
DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
|
||||||
|
|
||||||
// ..taken
|
// ..taken
|
||||||
AuraList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
|
AuraList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
|
||||||
for(AuraList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i)
|
for(AuraList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i)
|
||||||
if( (*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto) )
|
if( (*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto) )
|
||||||
TakenTotalMod *= ((*i)->GetModifier()->m_amount +100.0f)/100.0f;
|
TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
|
||||||
|
|
||||||
// .. taken pct: scripted (increases damage of * against targets *)
|
// .. taken pct: scripted (increases damage of * against targets *)
|
||||||
AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
||||||
@@ -8343,13 +8330,13 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
|
|||||||
AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
|
AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
|
||||||
for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i)
|
for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i)
|
||||||
if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue))
|
if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue))
|
||||||
DoneTotalMod *= ((*i)->GetModifier()->m_amount +100.0f)/100.0f;
|
DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
|
||||||
|
|
||||||
// ..taken
|
// ..taken
|
||||||
AuraList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
|
AuraList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
|
||||||
for(AuraList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i)
|
for(AuraList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i)
|
||||||
if((*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask())
|
if((*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask())
|
||||||
TakenTotalMod *= ((*i)->GetModifier()->m_amount +100.0f)/100.0f;
|
TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
|
||||||
|
|
||||||
// .. taken pct: dummy auras
|
// .. taken pct: dummy auras
|
||||||
AuraList const& mDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY);
|
AuraList const& mDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY);
|
||||||
@@ -8407,13 +8394,13 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
|
|||||||
{
|
{
|
||||||
AuraList const& mModMeleeDamageTakenPercent = pVictim->GetAurasByType(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT);
|
AuraList const& mModMeleeDamageTakenPercent = pVictim->GetAurasByType(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT);
|
||||||
for(AuraList::const_iterator i = mModMeleeDamageTakenPercent.begin(); i != mModMeleeDamageTakenPercent.end(); ++i)
|
for(AuraList::const_iterator i = mModMeleeDamageTakenPercent.begin(); i != mModMeleeDamageTakenPercent.end(); ++i)
|
||||||
TakenTotalMod *= ((*i)->GetModifier()->m_amount +100.0f)/100.0f;
|
TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AuraList const& mModRangedDamageTakenPercent = pVictim->GetAurasByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT);
|
AuraList const& mModRangedDamageTakenPercent = pVictim->GetAurasByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT);
|
||||||
for(AuraList::const_iterator i = mModRangedDamageTakenPercent.begin(); i != mModRangedDamageTakenPercent.end(); ++i)
|
for(AuraList::const_iterator i = mModRangedDamageTakenPercent.begin(); i != mModRangedDamageTakenPercent.end(); ++i)
|
||||||
TakenTotalMod *= ((*i)->GetModifier()->m_amount +100.0f)/100.0f;
|
TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float tmpDamage = float(int32(*pdamage) + DoneFlatBenefit) * DoneTotalMod;
|
float tmpDamage = float(int32(*pdamage) + DoneFlatBenefit) * DoneTotalMod;
|
||||||
@@ -11575,13 +11562,6 @@ void Unit::SetFeared(bool apply)
|
|||||||
{
|
{
|
||||||
if(apply)
|
if(apply)
|
||||||
{
|
{
|
||||||
if(HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
|
|
||||||
return;
|
|
||||||
|
|
||||||
SetUInt64Value(UNIT_FIELD_TARGET, 0);
|
|
||||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
|
|
||||||
CastStop();
|
|
||||||
//GetMotionMaster()->MovementExpired(false);
|
|
||||||
Unit *caster = NULL;
|
Unit *caster = NULL;
|
||||||
Unit::AuraList const& fearAuras = GetAurasByType(SPELL_AURA_MOD_FEAR);
|
Unit::AuraList const& fearAuras = GetAurasByType(SPELL_AURA_MOD_FEAR);
|
||||||
if(!fearAuras.empty())
|
if(!fearAuras.empty())
|
||||||
@@ -11590,17 +11570,8 @@ void Unit::SetFeared(bool apply)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
|
if(isAlive() && GetMotionMaster()->GetCurrentMovementGeneratorType() == FLEEING_MOTION_TYPE)
|
||||||
if(isAlive())
|
GetMotionMaster()->MovementExpired();
|
||||||
{
|
|
||||||
if( GetTypeId() != TYPEID_PLAYER && getVictim())
|
|
||||||
{
|
|
||||||
SetUInt64Value(UNIT_FIELD_TARGET, getVictim()->GetGUID());
|
|
||||||
GetMotionMaster()->MoveChase(getVictim());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
GetMotionMaster()->Initialize();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetTypeId() == TYPEID_PLAYER)
|
if (GetTypeId() == TYPEID_PLAYER)
|
||||||
@@ -11611,24 +11582,12 @@ void Unit::SetConfused(bool apply)
|
|||||||
{
|
{
|
||||||
if(apply)
|
if(apply)
|
||||||
{
|
{
|
||||||
SetUInt64Value(UNIT_FIELD_TARGET, 0);
|
|
||||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
|
|
||||||
CastStop();
|
|
||||||
GetMotionMaster()->MoveConfused();
|
GetMotionMaster()->MoveConfused();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
|
if(isAlive() && GetMotionMaster()->GetCurrentMovementGeneratorType() == CONFUSED_MOTION_TYPE)
|
||||||
if(isAlive())
|
GetMotionMaster()->MovementExpired();
|
||||||
{
|
|
||||||
if( GetTypeId() != TYPEID_PLAYER && getVictim())
|
|
||||||
{
|
|
||||||
SetUInt64Value(UNIT_FIELD_TARGET, getVictim()->GetGUID());
|
|
||||||
GetMotionMaster()->MoveChase(getVictim());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
GetMotionMaster()->Initialize();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GetTypeId() == TYPEID_PLAYER)
|
if(GetTypeId() == TYPEID_PLAYER)
|
||||||
@@ -11702,7 +11661,7 @@ void Unit::SetCharmedOrPossessedBy(Unit* charmer, bool possess)
|
|||||||
if(possess)
|
if(possess)
|
||||||
{
|
{
|
||||||
addUnitState(UNIT_STAT_POSSESSED);
|
addUnitState(UNIT_STAT_POSSESSED);
|
||||||
//SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_24);
|
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_24);
|
||||||
AddPlayerToVision((Player*)charmer);
|
AddPlayerToVision((Player*)charmer);
|
||||||
((Player*)charmer)->SetClientControl(this, 1);
|
((Player*)charmer)->SetClientControl(this, 1);
|
||||||
((Player*)charmer)->SetMover(this);
|
((Player*)charmer)->SetMover(this);
|
||||||
@@ -11754,7 +11713,7 @@ void Unit::RemoveCharmedOrPossessedBy(Unit *charmer)
|
|||||||
if(possess)
|
if(possess)
|
||||||
{
|
{
|
||||||
clearUnitState(UNIT_STAT_POSSESSED);
|
clearUnitState(UNIT_STAT_POSSESSED);
|
||||||
//RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_24);
|
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_24);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GetTypeId() == TYPEID_UNIT)
|
if(GetTypeId() == TYPEID_UNIT)
|
||||||
|
|||||||
+1
-1
@@ -381,7 +381,7 @@ enum UnitState
|
|||||||
UNIT_STAT_ATTACK_PLAYER = 0x00004000,
|
UNIT_STAT_ATTACK_PLAYER = 0x00004000,
|
||||||
UNIT_STAT_CASTING = 0x00008000,
|
UNIT_STAT_CASTING = 0x00008000,
|
||||||
UNIT_STAT_POSSESSED = 0x00010000,
|
UNIT_STAT_POSSESSED = 0x00010000,
|
||||||
UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING),
|
UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FOLLOW),
|
||||||
UNIT_STAT_LOST_CONTROL = (UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING),
|
UNIT_STAT_LOST_CONTROL = (UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING),
|
||||||
UNIT_STAT_SIGHTLESS = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING),
|
UNIT_STAT_SIGHTLESS = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CHASE | UNIT_STAT_SEARCHING),
|
||||||
UNIT_STAT_CANNOT_AUTOATTACK = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CASTING),
|
UNIT_STAT_CANNOT_AUTOATTACK = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CASTING),
|
||||||
|
|||||||
Reference in New Issue
Block a user