mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
Merge remote branch 'origin/master' into 330
This commit is contained in:
commit
292f6189ea
50 changed files with 363 additions and 318 deletions
|
|
@ -50,12 +50,13 @@
|
|||
#include "MovementGenerator.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <varargs.h>
|
||||
|
||||
float baseMoveSpeed[MAX_MOVE_TYPE] =
|
||||
{
|
||||
2.5f, // MOVE_WALK
|
||||
7.0f, // MOVE_RUN
|
||||
1.25f, // MOVE_RUN_BACK
|
||||
2.5f, // MOVE_RUN_BACK
|
||||
4.722222f, // MOVE_SWIM
|
||||
4.5f, // MOVE_SWIM_BACK
|
||||
3.141594f, // MOVE_TURN_RATE
|
||||
|
|
@ -343,8 +344,12 @@ bool Unit::haveOffhandWeapon() const
|
|||
return false;
|
||||
}
|
||||
|
||||
void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, SplineType type, SplineFlags flags, uint32 Time, Player* player)
|
||||
void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, SplineType type, SplineFlags flags, uint32 Time, Player* player, ...)
|
||||
{
|
||||
|
||||
va_list vargs;
|
||||
va_start(vargs,player);
|
||||
|
||||
float moveTime = (float)Time;
|
||||
|
||||
WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) );
|
||||
|
|
@ -359,30 +364,36 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, SplineTy
|
|||
case SPLINETYPE_NORMAL: // normal packet
|
||||
break;
|
||||
case SPLINETYPE_STOP: // stop packet (raw pos?)
|
||||
va_end(vargs);
|
||||
SendMessageToSet( &data, true );
|
||||
return;
|
||||
case SPLINETYPE_FACINGSPOT: // facing spot, not used currently
|
||||
data << float(0);
|
||||
data << float(0);
|
||||
data << float(0);
|
||||
{
|
||||
data << float(va_arg(vargs,float));
|
||||
data << float(va_arg(vargs,float));
|
||||
data << float(va_arg(vargs,float));
|
||||
break;
|
||||
}
|
||||
case SPLINETYPE_FACINGTARGET:
|
||||
data << uint64(m_InteractionObject); // set in SetFacingToObject()
|
||||
data << uint64(va_arg(vargs,uint64));
|
||||
break;
|
||||
case SPLINETYPE_FACINGANGLE: // not used currently
|
||||
data << float(0); // facing angle
|
||||
data << float(va_arg(vargs,float)); // facing angle
|
||||
break;
|
||||
}
|
||||
|
||||
data << uint32(flags);
|
||||
|
||||
if(flags & SPLINEFLAG_WALKMODE)
|
||||
moveTime *= 1.05f;
|
||||
// enable me if things goes wrong or looks ugly, it is however an old hack
|
||||
// if(flags & SPLINEFLAG_WALKMODE)
|
||||
// moveTime *= 1.05f;
|
||||
|
||||
data << uint32(moveTime); // Time in between points
|
||||
data << uint32(1); // 1 single waypoint
|
||||
data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B
|
||||
|
||||
va_end(vargs);
|
||||
|
||||
if(player)
|
||||
player->GetSession()->SendPacket(&data);
|
||||
else
|
||||
|
|
@ -3514,12 +3525,10 @@ void Unit::SetFacingToObject(WorldObject* pObject)
|
|||
if (!IsStopped())
|
||||
return;
|
||||
|
||||
m_InteractionObject = pObject->GetGUID();
|
||||
|
||||
// TODO: figure out under what conditions creature will move towards object instead of facing it where it currently is.
|
||||
|
||||
SetOrientation(GetAngle(pObject));
|
||||
SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(), SPLINETYPE_FACINGTARGET, ((Creature*)this)->GetSplineFlags(), 0);
|
||||
SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(), SPLINETYPE_FACINGTARGET, ((Creature*)this)->GetSplineFlags(), 0, NULL, pObject->GetGUID());
|
||||
}
|
||||
|
||||
bool Unit::isInAccessablePlaceFor(Creature const* c) const
|
||||
|
|
@ -10288,6 +10297,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
|
|||
|
||||
if (creatureNotInCombat)
|
||||
{
|
||||
// should probably be removed for the attacked (+ it's party/group) only, not global
|
||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
||||
|
||||
if (((Creature*)this)->AI())
|
||||
|
|
@ -11185,11 +11195,13 @@ bool Unit::SelectHostileTarget()
|
|||
// No taunt aura or taunt aura caster is dead standart target selection
|
||||
target = m_ThreatManager.getHostileTarget();
|
||||
|
||||
if(target)
|
||||
if (target)
|
||||
{
|
||||
if(!hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_DIED))
|
||||
if (!hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_DIED))
|
||||
{
|
||||
SetInFront(target);
|
||||
((Creature*)this)->AI()->AttackStart(target);
|
||||
((Creature*)this)->AI()->AttackStart(target);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue