I've coded the function the way you requested.
Shot:
Code:
1/ Add the prototype in the command.h
Code:
void command_showdrops(Client *c, const Seperator *sep);
2/ In command.cpp
2.1/ Find the line:
Code:
command_add("refundaa", "Refunds your target's AA points, will disconnect them in the process as well.", 100, command_refundaa)
2.2/Replace by
Code:
command_add("refundaa", "Refunds your target's AA points, will disconnect them in the process as well.", 100, command_refundaa) ||
command_add("showdrops"," Usage #showdrops [itemID]", 100, command_showdrops)
2.3/At the end of the file, 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)))
{
npc_numbers++;
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 loottable where 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]));
}
}
}
}
}
}
if(npc_numbers == 0)
c->Message(0,"0 NPC found. 0 Loottable found.");
else
c->Message(0,"%i NPC(s) found.",npc_numbers);
}
Have fun,
Mag