[Commands] Add #npcedit set_grid [Grid ID] to #npcedit (#4004)

* [Commands] Add #npcedit grid_id to #npcedit

# Notes
- Adds `#npcedit grid_id [Grid ID]` to `#npcedit`.

* set_grid
This commit is contained in:
Alex King 2024-01-22 17:49:18 -05:00 committed by GitHub
parent f6148b9b8d
commit 26769f40d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 1 deletions

View File

@ -1645,6 +1645,31 @@ void command_npcedit(Client *c, const Seperator *sep)
);
return;
}
} else if (!strcasecmp(sep->arg[1], "set_grid")) {
if (sep->IsNumber(2)) {
const uint32 grid_id = Strings::ToUnsignedInt(sep->arg[2]);
if (grid_id) {
d = fmt::format(
"{} now has a Grid ID of {} on Spawn Group ID {}.",
npc_id_string,
grid_id,
Strings::Commify(std::to_string(t->GetSpawnGroupId()))
);
auto query = fmt::format(
"UPDATE spawn2 SET pathgrid = {} WHERE spawngroupID = {} AND version = {}",
grid_id,
t->GetSpawnGroupId(),
zone->GetInstanceVersion()
);
content_db.QueryDatabase(query);
} else {
c->Message(Chat::White, "Grid ID must be greater than 0.");
return;
}
} else {
c->Message(Chat::White, "Usage: #npcedit set_grid [Grid ID] - Sets an NPC's Grid ID");
return;
}
} else {
SendNPCEditSubCommands(c);
return;
@ -1768,4 +1793,5 @@ void SendNPCEditSubCommands(Client *c)
c->Message(Chat::White, "Usage: #npcedit keeps_sold_items [Flag] - Sets an NPC's Keeps Sold Items Flag [0 = False, 1 = True]");
c->Message(Chat::White, "Usage: #npcedit setanimation [Animation ID] - Sets an NPC's Animation on Spawn (Stored in spawn2 table)");
c->Message(Chat::White, "Usage: #npcedit respawntime [Respawn Time] - Sets an NPC's Respawn Timer in Seconds (Stored in spawn2 table)");
c->Message(Chat::White, "Usage: #npcedit set_grid [Grid ID] - Sets an NPC's Grid ID");
}