EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Feature Requests (https://www.eqemulator.org/forums/forumdisplay.php?f=612)
-   -   Request for new # command please (https://www.eqemulator.org/forums/showthread.php?t=23727)

John Adams 11-02-2007 07:25 AM

Thank you, Magoth! If for nothing else, a little tutorial on how to play with commands. :)

gernblan 11-02-2007 01:30 PM

THANK YOU! SO MUCH!

Will play with this and if it works great, maybe it can get added to the tree :)

gernblan 11-02-2007 01:45 PM

Ok this is FLAT OUT incredible!

THANK YOU.

And yes, I too learned something about how new commands are made. THANKS on all counts!

Now, I can only pray this gets into the tree so that I do not have to diff it every build... :)

You posting that like that really helps out those of us who can "read the language but not speak the language that well (yet)" understand this stuff at a whole new level.

So, thank you for your time.

Can you tell I am grateful? lol

gernblan 11-02-2007 01:54 PM

One more thing:

THANK YOU AGAIN

(lol)

gernblan 11-02-2007 05:42 PM

Won't let me post code for some reason BUT it's bombimg out on the compile... vs. build 1052.

Will double check and see if it's me or not.

gernblan 11-02-2007 05:51 PM

Ok this:

Code:

command_add("showdrops"," Usage #showdrops [itemID]", 100, command_showdrops)
...needs to be this...

Code:

command_add("showdrops"," Usage #showdrops [itemID]", 100, command_showdrops) ||

gernblan 11-02-2007 06:37 PM

It's also showing the loot table name instead of the NPC name for some reason.

Please see screenshot:

http://media.buttwrenching.com/loot.jpg

Magoth78 11-02-2007 09:31 PM

If you want to see the name of the NPC showed instead of the name of the Lootable, then change the 2.3 of my previous answer to:

2.3/At the end of the file (command.cpp), add the function's code
Code:

void command_showdrops(Client *c, const Seperator *sep)
{
    if(sep->arg[1][0] == '\0'){
        c->Message(10, "Bad argument, usage #showdrops [itemID].");
        return;
    }
 
    int itemID = atoi(sep->arg[1]);
 
    char errbuf[MYSQL_ERRMSG_SIZE];
    char *query = 0;
 
    MYSQL_RES *result_lootdrop_id;
    MYSQL_RES *result_lootdtable_id;
    MYSQL_RES *result_npc_name;
 
    MYSQL_ROW row_lootdrop;
    MYSQL_ROW row_loottable;
    MYSQL_ROW row_npc_name;
 
    int npc_numbers=0;
 
    c->Message(0,"Item %i drops:", itemID);
 
    if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT lootdrop_id from lootdrop_entries where item_id=%i",itemID), errbuf, &result_lootdrop_id))
    {
        while ((row_lootdrop = mysql_fetch_row(result_lootdrop_id)))
        { 
            if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT loottable_id from loottable_entries where lootdrop_id=%i",atoi(row_lootdrop[0])), errbuf, &result_lootdtable_id))
            {
 
                while ((row_loottable = mysql_fetch_row(result_lootdtable_id)))
                {
                  if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT name from npc_types where loottable_id=%i",atoi(row_loottable[0])), errbuf, &result_npc_name))
                  {
                        while ((row_npc_name = mysql_fetch_row(result_npc_name)))
                        {
                            c->Message(0, "NPC- %s -- Loottable: %i",row_npc_name[0],atoi(row_loottable[0]));
                            npc_numbers++;
                        }
                  }
                }
            }
        }
    }
    if(npc_numbers == 0)
        c->Message(0,"0 NPC found. 0 Loottable found.");
    else
        c->Message(0,"%i NPC(s) found.",npc_numbers);
 
}

Mag

gernblan 11-02-2007 09:44 PM

Thank you very much!!

This is perfect :)

No clue how I could ever live without this now. I hope it makes it into the tree.

gernblan 11-17-2007 12:54 AM

Been using this for two weeks now, it's incredible, still :) SO useful.

Please, someone, stick it in the tree hehe.

Just set the command for 200+ status or whatever.

bruise 12-21-2011 10:24 PM

I apologize for reviving an old thread but I was hoping someone could get this to work. I added the code exactly as shown and compiled it successfully but it's not working. I very well could have compiled it incorrectly though.

Edited the command.h and the command.cpp files located in
Quote:

c:\EQEmuServerFiles\trunk\EQEmuServer\Zone
Saved those changes, then I opened Visual C++ 2008 Express Edition, opened the server.sln project. Highlighted "zone" then Build>Project Only>Rebuild only Zone and it completes successfully. I start up the server and nada, doesn't work. Am I missing something?

trevius 12-21-2011 10:52 PM

Did you make sure to copy the newly created files to your server folder after you compiled?

bruise 12-21-2011 11:14 PM

I just editted the files in the "c:\EQEmuServerFiles\trunk\EQEmuServer\Zone" directory and saved them there. Should I copy them to c:\eqemu folder or something?

bruise 12-22-2011 01:16 AM

Oh what a glorious day.. I figured it out thanks to your sentence structure lol.
Quote:

newly created files
.. THAT'S what I wasn't doing! I had no clue how compiling worked and really was just taking guesses. I thought once you click "rebuild solution" that you could then start up your server and bam, you're all set! The KEY was then copying over the newly modified file (zones.exe in my case) to my server folder and wham, bam, thank you Trevius! Again, 1,000 thanks for your help!


All times are GMT -4. The time now is 07:01 PM.

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