Hi,
By default, only the top 5 will be display if we use @whodrops. I want to increase this, to 30 or maybe just 20.
then i tried to modify this command in atcommand.c and changed MAX_SEARCH to 30.
/*==========================================
* Show who drops the item.
*------------------------------------------*/
ACMD_FUNC(whodrops)
{
//struct item_data *item_data, *item_array[MAX_SEARCH];
struct item_data *item_data, *item_array[30];
int i,j, count = 1;
if (!message || !*message) {
clif_displaymessage(fd, msg_txt(sd,1284)); // Please enter item name/ID (usage: @whodrops <item name/ID>).
return -1;
}
if ((item_array[0] = itemdb_exists(strtoul(message, nullptr, 10))) == nullptr)
//count = itemdb_searchname_array(item_array, MAX_SEARCH, message);
count = itemdb_searchname_array(item_array, 30, message);
if (!count) {
clif_displaymessage(fd, msg_txt(sd,19)); // Invalid item ID or name.
return -1;
}
//if (count == MAX_SEARCH) {
if (count == 30) {
//sprintf(atcmd_output, msg_txt(sd,269), MAX_SEARCH); // Displaying first %d matches
sprintf(atcmd_output, msg_txt(sd,269), 30); // Displaying first %d matches
clif_displaymessage(fd, atcmd_output);
}
for (i = 0; i < count; i++) {
item_data = item_array[i];
sprintf(atcmd_output, msg_txt(sd,1285), item_data->ename.c_str(), item_data->slots, item_data->nameid); // Item: '%s'[%d] (ID:%u)
clif_displaymessage(fd, atcmd_output);
if (item_data->mob[0].chance == 0) {
strcpy(atcmd_output, msg_txt(sd,1286)); // - Item is not dropped by mobs.
clif_displaymessage(fd, atcmd_output);
} else {
//sprintf(atcmd_output, msg_txt(sd,1287), MAX_SEARCH); // - Common mobs with highest drop chance (only max %d are listed):
sprintf(atcmd_output, msg_txt(sd,1287), 30); // - Common mobs with highest drop chance (only max %d are listed):
clif_displaymessage(fd, atcmd_output);
//for (j=0; j < MAX_SEARCH && item_data->mob[j].chance > 0; j++)
for (j=0; j < 30 && item_data->mob[j].chance > 0; j++)
{
int dropchance = item_data->mob[j].chance;
std::shared_ptr<s_mob_db> mob = mob_db.find(item_data->mob[j].id);
if(!mob) continue;
#ifdef RENEWAL_DROP
if( battle_config.atcommand_mobinfo_type ) {
dropchance = dropchance * pc_level_penalty_mod( sd, PENALTY_DROP, mob ) / 100;
if (dropchance <= 0 && !battle_config.drop_rate0item)
dropchance = 1;
}
#endif
if (pc_isvip(sd)) // Display item rate increase for VIP
dropchance += (dropchance * battle_config.vip_drop_increase) / 100;
sprintf(atcmd_output, "- %s (%d): %02.02f%%", mob->jname.c_str(), item_data->mob[j].id, dropchance/100.);
clif_displaymessage(fd, atcmd_output);
}
}
}
return 0;
}
however, after the changes above, it is still showing top 5.
is there any other source code that i need to modify?