mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[9612] Add to SendMonsterMove var args for optional values.
Also drop currently unused Unit::m_InteractionObject
This commit is contained in:
parent
e0dc4d60c4
commit
1186577b56
3 changed files with 19 additions and 13 deletions
|
|
@ -50,6 +50,7 @@
|
||||||
#include "MovementGenerator.h"
|
#include "MovementGenerator.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <varargs.h>
|
||||||
|
|
||||||
float baseMoveSpeed[MAX_MOVE_TYPE] =
|
float baseMoveSpeed[MAX_MOVE_TYPE] =
|
||||||
{
|
{
|
||||||
|
|
@ -343,8 +344,12 @@ bool Unit::haveOffhandWeapon() const
|
||||||
return false;
|
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;
|
float moveTime = (float)Time;
|
||||||
|
|
||||||
WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) );
|
WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) );
|
||||||
|
|
@ -359,18 +364,21 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, SplineTy
|
||||||
case SPLINETYPE_NORMAL: // normal packet
|
case SPLINETYPE_NORMAL: // normal packet
|
||||||
break;
|
break;
|
||||||
case SPLINETYPE_STOP: // stop packet (raw pos?)
|
case SPLINETYPE_STOP: // stop packet (raw pos?)
|
||||||
|
va_end(vargs);
|
||||||
SendMessageToSet( &data, true );
|
SendMessageToSet( &data, true );
|
||||||
return;
|
return;
|
||||||
case SPLINETYPE_FACINGSPOT: // facing spot, not used currently
|
case SPLINETYPE_FACINGSPOT: // facing spot, not used currently
|
||||||
data << float(0);
|
{
|
||||||
data << float(0);
|
data << float(va_arg(vargs,float));
|
||||||
data << float(0);
|
data << float(va_arg(vargs,float));
|
||||||
|
data << float(va_arg(vargs,float));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SPLINETYPE_FACINGTARGET:
|
case SPLINETYPE_FACINGTARGET:
|
||||||
data << uint64(m_InteractionObject); // set in SetFacingToObject()
|
data << uint64(va_arg(vargs,uint64));
|
||||||
break;
|
break;
|
||||||
case SPLINETYPE_FACINGANGLE: // not used currently
|
case SPLINETYPE_FACINGANGLE: // not used currently
|
||||||
data << float(0); // facing angle
|
data << float(va_arg(vargs,float)); // facing angle
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -384,6 +392,8 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, SplineTy
|
||||||
data << uint32(1); // 1 single waypoint
|
data << uint32(1); // 1 single waypoint
|
||||||
data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B
|
data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B
|
||||||
|
|
||||||
|
va_end(vargs);
|
||||||
|
|
||||||
if(player)
|
if(player)
|
||||||
player->GetSession()->SendPacket(&data);
|
player->GetSession()->SendPacket(&data);
|
||||||
else
|
else
|
||||||
|
|
@ -3515,12 +3525,10 @@ void Unit::SetFacingToObject(WorldObject* pObject)
|
||||||
if (!IsStopped())
|
if (!IsStopped())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_InteractionObject = pObject->GetGUID();
|
|
||||||
|
|
||||||
// TODO: figure out under what conditions creature will move towards object instead of facing it where it currently is.
|
// TODO: figure out under what conditions creature will move towards object instead of facing it where it currently is.
|
||||||
|
|
||||||
SetOrientation(GetAngle(pObject));
|
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
|
bool Unit::isInAccessablePlaceFor(Creature const* c) const
|
||||||
|
|
|
||||||
|
|
@ -1376,7 +1376,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
void MonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime = 0);
|
void MonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime = 0);
|
||||||
|
|
||||||
// recommend use MonsterMove/MonsterMoveWithSpeed for most case that correctly work with movegens
|
// recommend use MonsterMove/MonsterMoveWithSpeed for most case that correctly work with movegens
|
||||||
void SendMonsterMove(float x, float y, float z, SplineType type, SplineFlags flags, uint32 Time, Player* player = NULL);
|
void SendMonsterMove(float x, float y, float z, SplineType type, SplineFlags flags, uint32 Time, Player* player = NULL, ...);
|
||||||
void SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, SplineFlags flags);
|
void SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, SplineFlags flags);
|
||||||
void SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime = 0, Player* player = NULL);
|
void SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime = 0, Player* player = NULL);
|
||||||
|
|
||||||
|
|
@ -1852,8 +1852,6 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
uint32 m_regenTimer;
|
uint32 m_regenTimer;
|
||||||
uint32 m_lastManaUseTimer;
|
uint32 m_lastManaUseTimer;
|
||||||
|
|
||||||
uint64 m_InteractionObject;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CleanupDeletedAuras();
|
void CleanupDeletedAuras();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9611"
|
#define REVISION_NR "9612"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue