mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-30 05:43:12 +01:00
Core/Entities: Fixed the "Move To" command for pets.
This commit is contained in:
@@ -1042,7 +1042,8 @@ enum CommandStates
|
||||
COMMAND_STAY = 0,
|
||||
COMMAND_FOLLOW = 1,
|
||||
COMMAND_ATTACK = 2,
|
||||
COMMAND_ABANDON = 3
|
||||
COMMAND_ABANDON = 3,
|
||||
COMMAND_MOVE_TO = 4
|
||||
};
|
||||
|
||||
#define UNIT_ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF)
|
||||
|
||||
@@ -102,7 +102,7 @@ void WorldSession::HandlePetAction(WorldPacket & recvData)
|
||||
return;
|
||||
|
||||
if (GetPlayer()->m_Controlled.size() == 1)
|
||||
HandlePetActionHelper(pet, guid1, spellid, flag, guid2);
|
||||
HandlePetActionHelper(pet, guid1, spellid, flag, guid2, x, y, z);
|
||||
else
|
||||
{
|
||||
//If a pet is dismissed, m_Controlled will change
|
||||
@@ -111,7 +111,7 @@ void WorldSession::HandlePetAction(WorldPacket & recvData)
|
||||
if ((*itr)->GetEntry() == pet->GetEntry() && (*itr)->isAlive())
|
||||
controlled.push_back(*itr);
|
||||
for (std::vector<Unit*>::iterator itr = controlled.begin(); itr != controlled.end(); ++itr)
|
||||
HandlePetActionHelper(*itr, guid1, spellid, flag, guid2);
|
||||
HandlePetActionHelper(*itr, guid1, spellid, flag, guid2, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ void WorldSession::HandlePetStopAttack(WorldPacket &recvData)
|
||||
pet->AttackStop();
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2)
|
||||
void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2, float x, float y, float z)
|
||||
{
|
||||
CharmInfo* charmInfo = pet->GetCharmInfo();
|
||||
if (!charmInfo)
|
||||
@@ -267,6 +267,18 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
|
||||
}
|
||||
}
|
||||
break;
|
||||
case COMMAND_MOVE_TO:
|
||||
pet->StopMoving();
|
||||
pet->GetMotionMaster()->Clear(false);
|
||||
pet->GetMotionMaster()->MovePoint(0, x, y, z);
|
||||
charmInfo->SetCommandState(COMMAND_MOVE_TO);
|
||||
|
||||
charmInfo->SetIsCommandAttack(false);
|
||||
charmInfo->SetIsAtStay(true);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->SetIsReturning(false);
|
||||
charmInfo->SaveStayPosition();
|
||||
break;
|
||||
default:
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
|
||||
}
|
||||
|
||||
@@ -764,7 +764,7 @@ class WorldSession
|
||||
//Pet
|
||||
void HandlePetAction(WorldPacket& recvData);
|
||||
void HandlePetStopAttack(WorldPacket& recvData);
|
||||
void HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2);
|
||||
void HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2, float x, float y, float z);
|
||||
void HandlePetNameQuery(WorldPacket& recvData);
|
||||
void HandlePetSetAction(WorldPacket& recvData);
|
||||
void HandlePetAbandon(WorldPacket& recvData);
|
||||
|
||||
Reference in New Issue
Block a user