mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-02 20:56:37 +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
+31
@@ -0,0 +1,31 @@
|
||||
#include "../client.h"
|
||||
|
||||
void command_viewpetition(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (sep->arg[1][0] == 0) {
|
||||
c->Message(Chat::White, "Usage: #viewpetition (petition number) Type #listpetition for a list");
|
||||
return;
|
||||
}
|
||||
|
||||
c->Message(Chat::Red, " ID : Character Name , Petition Text");
|
||||
|
||||
std::string query = "SELECT petid, charname, petitiontext FROM petitions ORDER BY petid";
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return;
|
||||
}
|
||||
|
||||
LogInfo("View petition request from [{}], petition number: [{}]", c->GetName(), atoi(sep->argplus[1]));
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
c->Message(Chat::Red, "There was an error in your request: ID not found! Please check the Id and try again.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
if (strcasecmp(row[0], sep->argplus[1]) == 0) {
|
||||
c->Message(Chat::Yellow, " %s: %s , %s ", row[0], row[1], row[2]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user