summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-08 16:03:28 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-08 16:03:28 +0000
commitfdc56c485b839f78ae7d777f8a6e745825a8bc3d (patch)
treed5ce890bfabcc8e116fe058fc74e8bd017ef88f5 /src/map/atcommand.c
parent9ee5081a5ef7b8aa20cfdd992cad280665b5ed7f (diff)
downloadhercules-fdc56c485b839f78ae7d777f8a6e745825a8bc3d.tar.gz
hercules-fdc56c485b839f78ae7d777f8a6e745825a8bc3d.tar.bz2
hercules-fdc56c485b839f78ae7d777f8a6e745825a8bc3d.tar.xz
hercules-fdc56c485b839f78ae7d777f8a6e745825a8bc3d.zip
- Items now store the top MAX_SEARCH drops from mobs and lists them through the new atcommand @whodrops. All merged from my server, of course =D
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5515 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index f02f974c1..97682fc5d 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -266,6 +266,7 @@ ACMD_FUNC(shuffle); // by MouseJstr
ACMD_FUNC(rates); // by MouseJstr
ACMD_FUNC(iteminfo); // Lupus
+ACMD_FUNC(whodrops); //Skotlex
ACMD_FUNC(mapflag); // Lupus
ACMD_FUNC(me); //added by massdriller, code by lordalfa
ACMD_FUNC(monsterignore); // [Valaris]
@@ -577,6 +578,7 @@ static AtCommandInfo atcommand_info[] = {
{ AtCommand_ItemInfo, "@iteminfo", 1, atcommand_iteminfo }, // [Lupus]
{ AtCommand_ItemInfo, "@ii", 1, atcommand_iteminfo }, // [Lupus]
+ { AtCommand_WhoDrops, "@whodrops", 1, atcommand_whodrops }, // [Skotlex]
{ AtCommand_MapFlag, "@mapflag", 99, atcommand_mapflag }, // [Lupus]
{ AtCommand_Me, "@me", 20, atcommand_me }, //added by massdriller, code by lordalfa
@@ -9413,6 +9415,57 @@ int atcommand_iteminfo(
}
/*==========================================
+ * Show who drops the item.
+ *------------------------------------------
+ */
+int atcommand_whodrops(
+ const int fd, struct map_session_data* sd,
+ const char* command, const char* message)
+{
+ struct item_data *item_data, *item_array[MAX_SEARCH];
+ int i, count = 1;
+
+ if (!message || !*message) {
+ clif_displaymessage(fd, "Please, enter Item name or its ID (usage: @whodrops <item_name_or_ID>).");
+ return -1;
+ }
+ if ((item_array[0] = itemdb_exists(atoi(message))) == NULL)
+ count = itemdb_searchname_array(item_array, MAX_SEARCH, message);
+
+ if (!count) {
+ clif_displaymessage(fd, "Item not found.");
+ return -1;
+ }
+
+ if (count > MAX_SEARCH) {
+ sprintf(atcmd_output, msg_table[269], MAX_SEARCH, count);
+ clif_displaymessage(fd, atcmd_output);
+ count = MAX_SEARCH;
+ }
+ for (i = 0; i < MAX_SEARCH; i++) {
+ item_data = item_array[i];
+ sprintf(atcmd_output, "Item: '%s'[%d]",
+ item_data->jname,item_data->slot);
+ clif_displaymessage(fd, atcmd_output);
+
+ if (item_data->mob[0].chance == 0) {
+ strcpy(atcmd_output, " - Item is not dropped by mobs.");
+ clif_displaymessage(fd, atcmd_output);
+ } else {
+ sprintf(atcmd_output, "- Common mobs with highest drop chance (only max %d are listed):", MAX_SEARCH);
+ clif_displaymessage(fd, atcmd_output);
+
+ for (i=0; i < MAX_SEARCH && item_data->mob[i].chance > 0; i++)
+ {
+ sprintf(atcmd_output, "- %s (%02.02f%%)", mob_db(item_data->mob[i].id)->jname, item_data->mob[i].chance/100.);
+ clif_displaymessage(fd, atcmd_output);
+ }
+ }
+ }
+ return 0;
+}
+
+/*==========================================
* @adopt by [Veider]
*
* adopt a novice