*More fix about move flag.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-02-23 13:14:04 -06:00
parent e425ba5837
commit 34517a860f
24 changed files with 73 additions and 49 deletions
@@ -729,6 +729,12 @@ void ScriptedAI::DoModifyThreatPercent(Unit *pUnit, int32 pct)
m_creature->getThreatManager().modifyThreatPercent(pUnit, pct);
}
void ScriptedAI::DoTeleportTo(float x, float y, float z, uint32 time)
{
m_creature->Relocate(x,y,z);
m_creature->SendMonsterMove(x, y, z, time);
}
void ScriptedAI::DoTeleportPlayer(Unit* pUnit, float x, float y, float z, float o)
{
if(!pUnit || pUnit->GetTypeId() != TYPEID_PLAYER)
@@ -150,6 +150,8 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
float DoGetThreat(Unit *u);
void DoModifyThreatPercent(Unit *pUnit, int32 pct);
void DoTeleportTo(float x, float y, float z, uint32 time = 0);
//Teleports a player without dropping threat (only teleports to same map)
void DoTeleportPlayer(Unit* pUnit, float x, float y, float z, float o);
void DoTeleportAll(float x, float y, float z, float o);
@@ -192,8 +192,7 @@ struct TRINITY_DLL_DECL boss_talon_king_ikissAI : public ScriptedAI
float Y = target->GetPositionY();
float Z = target->GetPositionZ();
m_creature->Relocate(X,Y,Z);
m_creature->SendMonsterMove(X, Y, Z, 0, 0, 0);
DoTeleportTo(X,Y,Z);
DoCast(target,SPELL_BLINK_TELEPORT);
Blink = true;
@@ -1463,8 +1463,7 @@ struct TRINITY_DLL_DECL boss_maievAI : public ScriptedAI
m_creature->AttackStop();
m_creature->InterruptNonMeleeSpells(false);
m_creature->GetMotionMaster()->Clear(false);
m_creature->Relocate(x, y, z);
m_creature->SendMonsterMove(x, y, z, 0, 0, 0);
DoTeleportTo(x, y, z);
DoCast(m_creature, SPELL_TELEPORT_VISUAL, true);
}
@@ -1940,7 +1939,7 @@ void boss_illidan_stormrageAI::HandleTalkSequence()
Akama->GetMotionMaster()->Clear(false);
//Akama->GetMotionMaster()->MoveIdle();
Akama->Relocate(x, y, z);
Akama->SendMonsterMove(x, y, z, 0, 0, 0);//Illidan must not die until Akama arrives.
Akama->SendMonsterMove(x, y, z, 0);//Illidan must not die until Akama arrives.
Akama->GetMotionMaster()->MoveChase(m_creature);
}
}
@@ -306,8 +306,7 @@ struct TRINITY_DLL_DECL boss_victor_nefariusAI : public ScriptedAI
DoCast(m_creature,8149);
//Teleport self to a hiding spot (this causes errors in the Trinity log but no real issues)
m_creature->Relocate(HIDE_X,HIDE_Y,HIDE_Z,0);
m_creature->SendMonsterMove(HIDE_X,HIDE_Y,HIDE_Z,0,true,0);
DoTeleportTo(HIDE_X,HIDE_Y,HIDE_Z);
m_creature->addUnitState(UNIT_STAT_FLEEING);
//Spawn nef and have him attack a random target
@@ -402,8 +402,7 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI
Phase = 2;
m_creature->GetMotionMaster()->Clear();
m_creature->Relocate(MIDDLE_X, MIDDLE_Y, MIDDLE_Z);
m_creature->SendMonsterMove(MIDDLE_X, MIDDLE_Y, MIDDLE_Z, 0, 0, 0);
DoTeleportTo(MIDDLE_X, MIDDLE_Y, MIDDLE_Z);
Creature *pCreature;
for(uint8 i = 0; i < 4; i++)
@@ -815,8 +815,7 @@ struct TRINITY_DLL_DECL boss_yazzaiAI : public boss_priestess_guestAI
m_creature->GetPosition(x,y,z);
x = rand()%2 ? x+10+rand()%10 : x-10-rand()%10;
y = rand()%2 ? y+10+rand()%10 : y-10-rand()%10;
m_creature->Relocate(x,y,z);
m_creature->SendMonsterMove(x, y, m_creature->GetPositionZ(), 0,0,0);
DoTeleportTo(x, y, z);
}
Blink_Timer = 8000;
}else Blink_Timer -= diff;
@@ -95,10 +95,12 @@ struct TRINITY_DLL_DECL boss_shazzrahAI : public ScriptedAI
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM,0);
m_creature->Relocate(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(),0);
m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(),0,true,0);
if(target)
{
DoTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
DoCast(target,SPELL_ARCANEEXPLOSION);
DoResetThreat();
}
Blink_Timer = 45000;
}else Blink_Timer -= diff;
@@ -870,8 +870,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI
m_creature->StopMoving();
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
m_creature->Relocate(GRAVITY_X, GRAVITY_Y, GRAVITY_Z, 0);
m_creature->SendMonsterMove(GRAVITY_X, GRAVITY_Y,GRAVITY_Z, 0, 0, 0);
DoTeleportTo(GRAVITY_X, GRAVITY_Y, GRAVITY_Z);
m_creature->InterruptNonMeleeSpells(false);
DoCast(m_creature, SPELL_FULLPOWER);
@@ -935,8 +934,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI
m_creature->StopMoving();
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
m_creature->Relocate(GRAVITY_X, GRAVITY_Y, GRAVITY_Z, 0);
m_creature->SendMonsterMove(GRAVITY_X, GRAVITY_Y, GRAVITY_Z, 0, 0, 0);
DoTeleportTo(GRAVITY_X, GRAVITY_Y, GRAVITY_Z);
// 1) Kael'thas will portal the whole raid right into his body
for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end();++i)
{
@@ -176,7 +176,7 @@ struct TRINITY_DLL_DECL boss_vemAI : public ScriptedAI
if(target)
{
DoCast(target, SPELL_CHARGE);
m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1);
//m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1);
AttackStart(target);
}
@@ -103,8 +103,7 @@ struct TRINITY_DLL_DECL boss_ouroAI : public ScriptedAI
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM,0);
m_creature->Relocate(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1);
DoTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
ChangeTarget_Timer = 10000 + rand()%10000;
}else ChangeTarget_Timer -= diff;
@@ -86,7 +86,7 @@ struct TRINITY_DLL_DECL npc_lady_sylvanas_windrunnerAI : public ScriptedAI
{
if( Unit* target = Unit::GetUnit(*summoned,targetGUID) )
{
target->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), myZ+15.0,0,0,0);
target->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), myZ+15.0,0);
target->Relocate(target->GetPositionX(), target->GetPositionY(), myZ+15.0);
summoned->CastSpell(target, SPELL_RIBBON_OF_SOULS, false);
}
@@ -311,7 +311,7 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI
if (target)
{
target->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING);
target->SendMonsterMove(x,y,m_creature->GetPositionZ()+15,0,0,0);
target->SendMonsterMove(x,y,m_creature->GetPositionZ()+15,0);
}
Unit *Cloud = m_creature->SummonTrigger(x, y, m_creature->GetPositionZ()+16, 0, 15000);
if(Cloud)
@@ -365,8 +365,7 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI
m_creature->AttackStop();
m_creature->GetMotionMaster()->Clear();
m_creature->Relocate(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2],0);
m_creature->SendMonsterMove(JanalainPos[0][0], JanalainPos[0][1],JanalainPos[0][2],0,0,0);
DoTeleportTo(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2]);
m_creature->StopMoving();
m_creature->CastSpell(m_creature, SPELL_FIRE_BOMB_CHANNEL, false);
//DoTeleportPlayer(m_creature, JanalainPos[0][0], JanalainPos[0][1],JanalainPos[0][2], 0);
@@ -399,8 +398,7 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI
m_creature->AttackStop();
m_creature->GetMotionMaster()->Clear();
m_creature->Relocate(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2],0);
m_creature->SendMonsterMove(JanalainPos[0][0], JanalainPos[0][1],JanalainPos[0][2],0,0,0);
DoTeleportTo(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2]);
m_creature->StopMoving();
m_creature->CastSpell(m_creature, SPELL_HATCH_ALL, false);
HatchAllEggs(2);
@@ -338,8 +338,7 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI
case 2:
case 3:
case 4:
m_creature->Relocate(CENTER_X, CENTER_Y, CENTER_Z,0);
m_creature->SendMonsterMove(CENTER_X, CENTER_Y, CENTER_Z,0,0,100);
DoTeleportTo(CENTER_X, CENTER_Y, CENTER_Z, 100);
DoResetThreat();
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 0);
m_creature->RemoveAurasDueToSpell(Transform[Phase].unaura);
@@ -106,9 +106,6 @@ struct TRINITY_DLL_DECL boss_jeklikAI : public ScriptedAI
if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0))
{
DoCast(target,SPELL_CHARGE);
m_creature->Relocate(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1);
AttackStart(target);
}
@@ -165,7 +165,7 @@ struct TRINITY_DLL_DECL boss_mandokirAI : public ScriptedAI
else
{
DoCast(pUnit,SPELL_CHARGE);
m_creature->SendMonsterMove(pUnit->GetPositionX(), pUnit->GetPositionY(), pUnit->GetPositionZ(), 0, true,1);
//m_creature->SendMonsterMove(pUnit->GetPositionX(), pUnit->GetPositionY(), pUnit->GetPositionZ(), 0, true,1);
AttackStart(pUnit);
}
}
@@ -83,8 +83,7 @@ struct TRINITY_DLL_DECL boss_renatakiAI : public ScriptedAI
target = SelectUnit(SELECT_TARGET_RANDOM,0);
if (target)
{
m_creature->Relocate(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1);
DoTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
DoCast(target,SPELL_AMBUSH);
}
@@ -194,7 +194,6 @@ struct TRINITY_DLL_DECL boss_thekalAI : public ScriptedAI
if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0))
{
DoCast(target,SPELL_CHARGE);
m_creature->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true,1);
DoResetThreat();
AttackStart(target);
}
+1 -1
View File
@@ -1154,7 +1154,7 @@ void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint3
m_startMove = getMSTime();
m_moveTime = time;*/
SendMonsterMove(x, y, z, type, MovementFlags, time);
SendMonsterMove(x, y, z, time);
}
Player *Creature::GetLootRecipient() const
+1 -1
View File
@@ -107,7 +107,7 @@ template<>
inline void Traveller<Player>::MoveTo(float x, float y, float z, uint32 t)
{
//Only send MOVEMENTFLAG_WALK_MODE, client has strange issues with other move flags
i_traveller.SendMonsterMove(x, y, z, 0, MOVEMENTFLAG_WALK_MODE, t);
i_traveller.SendMonsterMove(x, y, z, t);
}
typedef Traveller<Creature> CreatureTraveller;
+37 -9
View File
@@ -362,10 +362,41 @@ void Unit::SendMonsterMoveWithSpeed(float x, float y, float z, uint32 MovementFl
transitTime = static_cast<uint32>(dist / speed + 0.5);
}
//float orientation = (float)atan2((double)dy, (double)dx);
SendMonsterMove(x, y, z, 0, MovementFlags, transitTime, player);
SendMonsterMove(x, y, z, transitTime, player);
}
void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player)
void Unit::SendMonsterStop()
{
WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) );
data.append(GetPackGUID());
data << GetPositionX() << GetPositionY() << GetPositionZ();
data << getMSTime();
data << uint8(1);
SendMessageToSet(&data, true);
}
void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 Time, Player* player)
{
WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) );
data.append(GetPackGUID());
data << GetPositionX() << GetPositionY() << GetPositionZ();
data << getMSTime();
data << uint8(0);
data << uint32((GetUnitMovementFlags() & MOVEMENTFLAG_LEVITATING) ? MOVEFLAG_FLY : MOVEFLAG_WALK);
data << Time; // Time in between points
data << uint32(1); // 1 single waypoint
data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B
if(player)
player->GetSession()->SendPacket(&data);
else
SendMessageToSet( &data, true );
}
/*void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player)
{
WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) );
data.append(GetPackGUID());
@@ -404,9 +435,9 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 ty
player->GetSession()->SendPacket(&data);
else
SendMessageToSet( &data, true );
}
}*/
void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, uint32 MovementFlags)
void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end)
{
uint32 traveltime = uint32(path.GetTotalLength(start, end) * 32);
@@ -418,13 +449,10 @@ void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, uin
data << GetPositionY();
data << GetPositionZ();
// unknown field - unrelated to orientation
// seems to increment about 1000 for every 1.7 seconds
// for now, we'll just use mstime
data << getMSTime();
data << uint8( 0 );
data << uint32( MovementFlags );
data << uint32((GetUnitMovementFlags() & MOVEMENTFLAG_LEVITATING) ? MOVEFLAG_FLY : MOVEFLAG_WALK);
data << uint32( traveltime );
data << uint32( pathSize );
data.append( (char*)path.GetNodes(start), pathSize * 4 * 3 );
@@ -11992,7 +12020,7 @@ void Unit::StopMoving()
// Relocate(GetPositionX(), GetPositionY(), z);
Relocate(GetPositionX(), GetPositionY(),GetPositionZ());
SendMonsterMove(GetPositionX(), GetPositionY(), GetPositionZ(), 0, true, 0);
SendMonsterStop();
// update position and orientation;
WorldPacket data;
+4 -2
View File
@@ -1036,8 +1036,10 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void SendSpellNonMeleeDamageLog(Unit *target,uint32 SpellID,uint32 Damage, SpellSchoolMask damageSchoolMask,uint32 AbsorbedDamage, uint32 Resist,bool PhysicalDamage, uint32 Blocked, bool CriticalHit = false);
void SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo);
void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);
void SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, uint32 MovementFlags);
void SendMonsterStop();
void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 Time, Player* player = NULL);
//void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);
void SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end);
void SendMonsterMoveWithSpeed(float x, float y, float z, uint32 MovementFlags, uint32 transitTime = 0, Player* player = NULL);
void SendMonsterMoveWithSpeedToCurrentDestination(Player* player = NULL);
+1 -1
View File
@@ -249,7 +249,7 @@ FlightPathMovementGenerator::Initialize(Player &player)
// do not send movement, it was sent already
i_destinationHolder.SetDestination(traveller, i_path[i_currentNode].x, i_path[i_currentNode].y, i_path[i_currentNode].z, false);
player.SendMonsterMoveByPath(GetPath(),GetCurrentNode(),GetPathAtMapEnd(),MOVEMENTFLAG_WALK_MODE|MOVEMENTFLAG_ONTRANSPORT);
player.SendMonsterMoveByPath(GetPath(),GetCurrentNode(),GetPathAtMapEnd());
}
void FlightPathMovementGenerator::Finalize(Player & player)