EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Server Code Submissions (https://www.eqemulator.org/forums/forumdisplay.php?f=669)
-   -   Broken #npcedit qglobal. (https://www.eqemulator.org/forums/showthread.php?t=37480)

Kingly_Krab 11-06-2013 07:34 PM

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);
}


joligario 11-06-2013 10:14 PM

Good catch, thanks!

Kingly_Krab 11-06-2013 11:07 PM

No problem, I just found it annoying, didn't know if anyone else knew about it so I posted. :P


All times are GMT -4. The time now is 12:02 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.