mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +00:00
[Commands] Fix Z on #spawnfix (#1647)
* Fix Z on spawnfix * Slight adjustment
This commit is contained in:
parent
5738958a2a
commit
f912814e13
@ -6469,21 +6469,27 @@ void command_npcspawn(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void command_spawnfix(Client *c, const Seperator *sep) {
|
void command_spawnfix(Client *c, const Seperator *sep) {
|
||||||
Mob *targetMob = c->GetTarget();
|
Mob *target_mob = c->GetTarget();
|
||||||
if (!targetMob || !targetMob->IsNPC()) {
|
if (!target_mob || !target_mob->IsNPC()) {
|
||||||
c->Message(Chat::White, "Error: #spawnfix: Need an NPC target.");
|
c->Message(Chat::White, "Error: #spawnfix: Need an NPC target.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Spawn2* s2 = targetMob->CastToNPC()->respawn2;
|
Spawn2* s2 = target_mob->CastToNPC()->respawn2;
|
||||||
|
|
||||||
if(!s2) {
|
if(!s2) {
|
||||||
c->Message(Chat::White, "#spawnfix FAILED -- cannot determine which spawn entry in the database this mob came from.");
|
c->Message(Chat::White, "#spawnfix FAILED -- cannot determine which spawn entry in the database this mob came from.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string query = StringFormat("UPDATE spawn2 SET x = '%f', y = '%f', z = '%f', heading = '%f' WHERE id = '%i'",
|
std::string query = StringFormat(
|
||||||
c->GetX(), c->GetY(), c->GetZ(), c->GetHeading(),s2->GetID());
|
"UPDATE spawn2 SET x = '%f', y = '%f', z = '%f', heading = '%f' WHERE id = '%i'",
|
||||||
|
c->GetX(),
|
||||||
|
c->GetY(),
|
||||||
|
target_mob->GetFixedZ(c->GetPosition()),
|
||||||
|
c->GetHeading(),
|
||||||
|
s2->GetID()
|
||||||
|
);
|
||||||
auto results = content_db.QueryDatabase(query);
|
auto results = content_db.QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
c->Message(Chat::Red, "Update failed! MySQL gave the following error:");
|
c->Message(Chat::Red, "Update failed! MySQL gave the following error:");
|
||||||
@ -6492,7 +6498,7 @@ void command_spawnfix(Client *c, const Seperator *sep) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c->Message(Chat::White, "Updating coordinates successful.");
|
c->Message(Chat::White, "Updating coordinates successful.");
|
||||||
targetMob->Depop(false);
|
target_mob->Depop(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void command_loc(Client *c, const Seperator *sep)
|
void command_loc(Client *c, const Seperator *sep)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user