diff options
author | Haru <haru@dotalux.com> | 2013-11-10 05:38:48 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-11-10 05:45:20 +0100 |
commit | 122c4915e54fa4a28c57faad35af33eeaaae8cdb (patch) | |
tree | 0831dbccf4f0cbc897b656fdeb3890bd78f741b9 /src | |
parent | dd05ae388d69e7df1dffcd393cea5e4cdc605e75 (diff) | |
download | hercules-122c4915e54fa4a28c57faad35af33eeaaae8cdb.tar.gz hercules-122c4915e54fa4a28c57faad35af33eeaaae8cdb.tar.bz2 hercules-122c4915e54fa4a28c57faad35af33eeaaae8cdb.tar.xz hercules-122c4915e54fa4a28c57faad35af33eeaaae8cdb.zip |
Fixed item chain drop rate processing algorithm
- This corrects the absurdly high drop rate the Blacksmith skill Ore
Discovery was granting, to its correct values (and processing
algorithm) from Aegis.
- Special thanks to Ind.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/map/itemdb.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index d7d117574..82f316828 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -138,7 +138,6 @@ int itemdb_searchname_array(struct item_data** data, int size, const char *str, /* [Ind/Hercules] */ int itemdb_chain_item(unsigned short chain_id, int *rate) { struct item_chain_entry *entry; - int i = 0; if( chain_id >= itemdb->chain_count ) { ShowError("itemdb_chain_item: unknown chain id %d\n", chain_id); @@ -147,18 +146,12 @@ int itemdb_chain_item(unsigned short chain_id, int *rate) { entry = &itemdb->chains[chain_id].items[ rnd()%itemdb->chains[chain_id].qty ]; - for( i = 0; i < itemdb->chains[chain_id].qty; i++ ) { - if( rnd()%10000 >= entry->rate ) { - entry = entry->next; - continue; - } else { - if( rate ) - rate[0] = entry->rate; - return entry->id; - } - } - - return 0; + if( rnd()%10000 >= entry->rate ) + return 0; + + if( rate ) + rate[0] = entry->rate; + return entry->id; } /* [Ind/Hercules] */ void itemdb_package_item(struct map_session_data *sd, struct item_package *package) { |