mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[GM Commands] Split GM Commands Into Separate Files (#1766)
* Split GM commands into their own files * Code cleanup
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#include "../client.h"
|
||||
|
||||
void command_spawnfix(Client *c, const Seperator *sep)
|
||||
{
|
||||
Mob *target_mob = c->GetTarget();
|
||||
if (!target_mob || !target_mob->IsNPC()) {
|
||||
c->Message(Chat::White, "Error: #spawnfix: Need an NPC target.");
|
||||
return;
|
||||
}
|
||||
|
||||
Spawn2 *s2 = target_mob->CastToNPC()->respawn2;
|
||||
|
||||
if (!s2) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
"#spawnfix FAILED -- cannot determine which spawn entry in the database this mob came from."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string query = StringFormat(
|
||||
"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);
|
||||
if (!results.Success()) {
|
||||
c->Message(Chat::Red, "Update failed! MySQL gave the following error:");
|
||||
c->Message(Chat::Red, results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
c->Message(Chat::White, "Updating coordinates successful.");
|
||||
target_mob->Depop(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user