Jump to content
  • 0

how to increase @whodrops max search list?


Question

Posted

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?
image.png.08e87f1066184dd1dc11d2d7abeb4f58.png

1 answer to this question

Recommended Posts

  • 1
Posted

\rathena\src\map\itemdb.hpp

Line 901

 

and

\rathena\src\map\mob.cpp

Line 6121 and 6123

 

Edit MAX_SEARCH to 30

 

image.png.cf77529162c364c7ad4c2fd65d9a5e93.png

  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...