EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Server Code Submissions (https://www.eqemulator.org/forums/forumdisplay.php?f=669)
-   -   #NPCEdit loottable (https://www.eqemulator.org/forums/showthread.php?t=23816)

TheLieka 10-25-2007 11:16 AM

#NPCEdit loottable
 
There's a typo in the command.cpp source that prevents #npcedit loottable (loottable_id) from working.

Fix:
.\zone\command.cpp
Code:

void command_npcedit(Client *c, const Seperator *sep)
{
if (!c->GetTarget() || !c->GetTarget()->IsNPC())
                {
                        c->Message(0, "Error: Must have NPC targeted");
                        return;
                }
...

      c->Message(0, "#npcedit Hpregen - Sets an NPCs hitpoint regen rate per tick");
      c->Message(0, "#npcedit Manaregen - Sets an NPCs mana regen rate per tick");
      c->Message(0, "#npcedit Loottable - Sets the lootable ID for an NPC "); //Lieka Edit:  Correct typo "Loottable" rather than "Lootable"
      c->Message(0, "#npcedit Merchantid - Sets the merchant ID for an NPC");

...
  {
      char errbuf[MYSQL_ERRMSG_SIZE];
      char *query = 0;
      c->Message(15,"NPCID %u now regens %i mana per tick",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
      database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set mana_regen_rate=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf);
      c->LogSQL(query);
      safe_delete_array(query);
  }
//Start Lieka Edit:  Fix Loottable Typo
  else if ( strcasecmp( sep->arg[1], "loottable" ) == 0 )
  {
      char errbuf[MYSQL_ERRMSG_SIZE];
      char *query = 0;
      c->Message(15,"NPCID %u is now on loottable_id %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));
      database.RunQuery(query, MakeAnyLenString(&query, "update npc_types set loottable_id=%i where id=%i",atoi(sep->argplus[2]),c->GetTarget()->CastToNPC()->GetNPCTypeID()), errbuf);
      c->LogSQL(query);
      safe_delete_array(query);
//End Lieka Edit
  }
  else if ( strcasecmp( sep->arg[1], "merchantid" ) == 0 )
  {
      char errbuf[MYSQL_ERRMSG_SIZE];
      char *query = 0;
      c->Message(15,"NPCID %u now is merchant_id %i",c->GetTarget()->CastToNPC()->GetNPCTypeID(),atoi(sep->arg[2]));

....


gernblan 10-25-2007 10:40 PM

This is the fixed code? Please, can you point out the typo and what was fixed?

WildcardX 10-25-2007 10:47 PM

I'll look at this in the coming days to validate the code.

TheLieka 10-26-2007 09:08 AM

This is the fixed code. The parts in red are where it was changed. I'll post the broken code tonight.

Dax

WildcardX 10-26-2007 11:16 AM

I have validated your code and understand that your fix here is largely correcting a type, changing "lootable" to "loottable". I will commit your proposed change to the server code base.

Thank you for your contribution.


All times are GMT -4. The time now is 10:18 AM.

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