View Single Post
  #1  
Old 11-06-2013, 07:34 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,603
Default Broken #npcedit qglobal.

Okay, so currently #npcedit qlobal does this: http://prntscr.com/22etq5

The current code is broken to pieces (Lines 6982-6990):
Code:
else if(strcasecmp(sep->arg[1], "qglobal") == 0)
{
	char errbuf[MYSQL_ERRMSG_SIZE];
	char *query = 0;
	c->Message(15,"Quest globals have been %d for NPCID %u",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2])==0?"disabled":"enabled");
	database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set qglobal=%i where id=%i",atoi(sep->argplus[2])==0?0:1,c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf);
	c->LogSQL(query);
	safe_delete_array(query);
}
See how it's pulling the NPC's ID in the incorrect spot, here is my proposed fix, it calls the NPC's ID in the correct spot.
Code:
else if(strcasecmp(sep->arg[1], "qglobal") == 0)
{
	char errbuf[MYSQL_ERRMSG_SIZE];
	char *query = 0;
	c->Message(15,"Quest globals have been %s for NPCID %u",atoi(sep->arg[2])==0?"disabled":"enabled",c->GetTarget()->CastToNPC()->GetNPCTypeID());
	database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set qglobal=%i where id=%i",atoi(sep->argplus[2])==0?0:1,c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf);
	c->LogSQL(query);
	safe_delete_array(query);
}
Reply With Quote