mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 06:21:28 +00:00
[Bug Fix] Fix NPCs routing to 0.0, 0.0 on #summon (#3780)
# Notes - Resolves #2474.
This commit is contained in:
parent
286479198f
commit
d3b46becd0
@ -3,19 +3,16 @@
|
||||
|
||||
extern WorldServer worldserver;
|
||||
|
||||
#include "../corpse.h"
|
||||
|
||||
void command_summon(Client *c, const Seperator *sep)
|
||||
{
|
||||
int arguments = sep->argnum;
|
||||
const int arguments = sep->argnum;
|
||||
if (!arguments && !c->GetTarget()) {
|
||||
c->Message(Chat::White, "Usage: #summon - Summon your target, if you have one, to your position");
|
||||
c->Message(Chat::White, "Usage: #summon [Character Name] - Summon a character by name to your position");
|
||||
c->Message(Chat::White, "Note: You may also summon your target if you have one.");
|
||||
return;
|
||||
}
|
||||
|
||||
Mob* t = c;
|
||||
Mob *t = c;
|
||||
|
||||
if (arguments == 1) {
|
||||
std::string character_name = sep->arg[1];
|
||||
@ -31,9 +28,9 @@ void command_summon(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
auto search_client = entity_list.GetClientByName(character_name.c_str());
|
||||
if (search_client) {
|
||||
t = search_client->CastToMob();
|
||||
Client *s = entity_list.GetClientByName(character_name.c_str());
|
||||
if (s) {
|
||||
t = s->CastToMob();
|
||||
} else {
|
||||
if (!worldserver.Connected()) {
|
||||
c->Message(Chat::White, "World server is currently disconnected.");
|
||||
@ -42,15 +39,18 @@ void command_summon(Client *c, const Seperator *sep)
|
||||
|
||||
auto pack = new ServerPacket(ServerOP_ZonePlayer, sizeof(ServerZonePlayer_Struct));
|
||||
auto szp = (ServerZonePlayer_Struct *) pack->pBuffer;
|
||||
|
||||
strn0cpy(szp->adminname, c->GetName(), sizeof(szp->adminname));
|
||||
szp->adminrank = c->Admin();
|
||||
szp->ignorerestrictions = 2;
|
||||
strn0cpy(szp->name, character_name.c_str(), sizeof(szp->name));
|
||||
strn0cpy(szp->zone, zone->GetShortName(), sizeof(szp->zone));
|
||||
szp->x_pos = c->GetX();
|
||||
szp->y_pos = c->GetY();
|
||||
szp->z_pos = c->GetZ();
|
||||
szp->instance_id = zone->GetInstanceID();
|
||||
|
||||
szp->adminrank = c->Admin();
|
||||
szp->ignorerestrictions = 2;
|
||||
szp->instance_id = zone->GetInstanceID();
|
||||
szp->x_pos = c->GetX();
|
||||
szp->y_pos = c->GetY();
|
||||
szp->z_pos = c->GetZ();
|
||||
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
return;
|
||||
@ -97,9 +97,4 @@ void command_summon(Client *c, const Seperator *sep)
|
||||
}
|
||||
|
||||
t->GMMove(c->GetPosition());
|
||||
|
||||
if (t->IsNPC()) {
|
||||
t->CastToNPC()->SaveGuardSpot(glm::vec4(0.0f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3511,14 +3511,14 @@ void Mob::GMMove(float x, float y, float z, float heading, bool save_guard_spot)
|
||||
}
|
||||
}
|
||||
|
||||
void Mob::GMMove(const glm::vec4 &position) {
|
||||
void Mob::GMMove(const glm::vec4 &position, bool save_guard_spot) {
|
||||
m_Position.x = position.x;
|
||||
m_Position.y = position.y;
|
||||
m_Position.z = position.z;
|
||||
SetHeading(position.w);
|
||||
mMovementManager->SendCommandToClients(this, 0.0, 0.0, 0.0, 0.0, 0, ClientRangeAny);
|
||||
|
||||
if (IsNPC()) {
|
||||
if (IsNPC() && save_guard_spot) {
|
||||
CastToNPC()->SaveGuardSpot(position);
|
||||
}
|
||||
}
|
||||
|
||||
@ -714,7 +714,7 @@ public:
|
||||
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, bool save_guard_spot = true);
|
||||
virtual void GMMove(const glm::vec4 &position);
|
||||
virtual void GMMove(const glm::vec4 &position, bool save_guard_spot = true);
|
||||
void SetDelta(const glm::vec4& delta);
|
||||
void MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct* spu);
|
||||
void MakeSpawnUpdate(PlayerPositionUpdateServer_Struct* spu);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user