[Pets] Client Pet summoned by NPC should not change guard location. (#2967)

* [Pets] Client Pet summoned by NPC should not change guard location.

* Update mob.cpp

---------

Co-authored-by: Alex King <89047260+Kinglykrab@users.noreply.github.com>
This commit is contained in:
Paul Coene 2023-02-19 16:56:34 -05:00 committed by GitHub
parent c13f9f80d9
commit 51f6108aab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 7 deletions

View File

@ -2374,14 +2374,14 @@ void Mob::ShowBuffList(Client* client) {
}
}
void Mob::GMMove(float x, float y, float z, float heading) {
void Mob::GMMove(float x, float y, float z, float heading, bool save_guard_spot) {
m_Position.x = x;
m_Position.y = y;
m_Position.z = z;
SetHeading(heading);
mMovementManager->SendCommandToClients(this, 0.0, 0.0, 0.0, 0.0, 0, ClientRangeAny);
if (IsNPC()) {
if (IsNPC() && save_guard_spot) {
CastToNPC()->SaveGuardSpot(glm::vec4(x, y, z, heading));
}
}
@ -3714,10 +3714,32 @@ bool Mob::HateSummon() {
// probably should be like half melee range, but we can't get melee range nicely because reasons :)
new_pos = target->TryMoveAlong(new_pos, 5.0f, angle);
if (target->IsClient())
target->CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), new_pos.x, new_pos.y, new_pos.z, new_pos.w, 0, SummonPC);
else
target->GMMove(new_pos.x, new_pos.y, new_pos.z, new_pos.w);
if (target->IsClient()) {
target->CastToClient()->MovePC(
zone->GetZoneID(),
zone->GetInstanceID(),
new_pos.x,
new_pos.y,
new_pos.z,
new_pos.w,
0,
SummonPC
);
} else {
bool target_is_client_pet = (
target->IsPet() &&
target->IsPetOwnerClient()
);
bool set_new_guard_spot = !(IsNPC() && target_is_client_pet);
target->GMMove(
new_pos.x,
new_pos.y,
new_pos.z,
new_pos.w,
set_new_guard_spot
);
}
return true;
} else if(summon_level == 2) {

View File

@ -686,7 +686,7 @@ public:
float GetMovespeed() const { return IsRunning() ? GetRunspeed() : GetWalkspeed(); }
bool IsRunning() const { return m_is_running; }
void SetRunning(bool val) { m_is_running = val; }
virtual void GMMove(float x, float y, float z, float heading = 0.01);
virtual void GMMove(float x, float y, float z, float heading = 0.01, bool save_guard_spot = true);
virtual void GMMove(const glm::vec4 &position);
void SetDelta(const glm::vec4& delta);
void MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct* spu);