mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
command_setfaction converted to QueryDatabase
This commit is contained in:
parent
e753685ceb
commit
4d768474e8
@ -815,17 +815,18 @@ void command_version(Client *c, const Seperator *sep)
|
||||
|
||||
void command_setfaction(Client *c, const Seperator *sep)
|
||||
{
|
||||
if((sep->arg[1][0] == 0 || strcasecmp(sep->arg[1],"*")==0) || ((c->GetTarget()==0) || (c->GetTarget()->IsClient())))
|
||||
if((sep->arg[1][0] == 0 || strcasecmp(sep->arg[1],"*")==0) || ((c->GetTarget()==0) || (c->GetTarget()->IsClient()))) {
|
||||
c->Message(0, "Usage: #setfaction [faction number]");
|
||||
else
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
c->Message(15,"Setting NPC %u to faction %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->argplus[1]));
|
||||
database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set npc_faction_id=%i where id=%i",atoi(sep->argplus[1]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf);
|
||||
c->LogSQL(query);
|
||||
safe_delete_array(query);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
auto npcTypeID = c->GetTarget()->CastToNPC()->GetNPCTypeID();
|
||||
c->Message(15,"Setting NPC %u to faction %i", npcTypeID, atoi(sep->argplus[1]));
|
||||
|
||||
std::string query = StringFormat("UPDATE npc_types SET npc_faction_id = %i WHERE id = %i",
|
||||
atoi(sep->argplus[1]), npcTypeID);
|
||||
database.QueryDatabase(query);
|
||||
c->LogSQL(query.c_str());
|
||||
}
|
||||
|
||||
void command_serversidename(Client *c, const Seperator *sep)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user