summaryrefslogtreecommitdiff
path: root/src/map/itemdb.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-11-10 05:38:48 +0100
committerHaru <haru@dotalux.com>2013-11-10 05:45:20 +0100
commit122c4915e54fa4a28c57faad35af33eeaaae8cdb (patch)
tree0831dbccf4f0cbc897b656fdeb3890bd78f741b9 /src/map/itemdb.c
parentdd05ae388d69e7df1dffcd393cea5e4cdc605e75 (diff)
downloadhercules-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/map/itemdb.c')
-rw-r--r--src/map/itemdb.c19
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) {