diff options
author | shennetsind <ind@henn.et> | 2013-06-24 16:23:46 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-06-24 16:23:46 -0300 |
commit | 045c1a44df08c1472f5a95742628a2765c1be9d1 (patch) | |
tree | a36a593992dbe57198aa893e97f346949484acd5 /src/map | |
parent | ae69e16adc2030017cd8b409737e522162589790 (diff) | |
download | hercules-045c1a44df08c1472f5a95742628a2765c1be9d1.tar.gz hercules-045c1a44df08c1472f5a95742628a2765c1be9d1.tar.bz2 hercules-045c1a44df08c1472f5a95742628a2765c1be9d1.tar.xz hercules-045c1a44df08c1472f5a95742628a2765c1be9d1.zip |
Follow up fcba8a2161a392369db99ab9a516a24470c54796
Fixed "random" item package rates, special thanks to Beret.
Also, added the missing (+130) item package calls (special thanks to Streusel!)
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/itemdb.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 0ff991bad..6fd8b166c 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -199,7 +199,7 @@ void itemdb_package_item(struct map_session_data *sd, struct item_package *packa entry = &package->random_list[rnd()%package->random_qty]; - for( i = 0; i < package->random_qty; i++ ) { + while( 1 ) { if( rnd()%10000 >= entry->rate ) { entry = entry->next; continue; @@ -625,7 +625,7 @@ void itemdb_read_groups(void) { const char *itname; int i = 0, count = 0, c; unsigned int *gsize = NULL; - + if (conf_read_file(&item_group_conf, config_filename)) { ShowError("can't read %s\n", config_filename); return; @@ -760,7 +760,7 @@ void itemdb_read_packages(void) { int r = 0, m = 0; data->package = &itemdb->packages[count]; - + itemdb->packages[count].id = data->nameid; itemdb->packages[count].random_list = NULL; itemdb->packages[count].must_items = NULL; @@ -811,12 +811,16 @@ void itemdb_read_packages(void) { } else { if( prev ) prev->next = &itemdb->packages[count].random_list[r]; + itemdb->packages[count].random_list[r].id = data ? data->nameid : 0; itemdb->packages[count].random_list[r].qty = icount; + itemdb->packages[count].random_list[r].rate = rate; itemdb->packages[count].random_list[r].hours = expire; itemdb->packages[count].random_list[r].announce = announce == true ? 1 : 0; itemdb->packages[count].random_list[r].named = named == true ? 1 : 0; + prev = &itemdb->packages[count].random_list[r]; + r++; } @@ -825,6 +829,12 @@ void itemdb_read_packages(void) { if( prev ) prev->next = &itemdb->packages[count].random_list[0]; + if( itemdb->packages[count].random_qty == 1 ) { + //item packages dont stop looping until something comes out of them, so if you have only one item in it the drop is guaranteed. + ShowWarning("itemdb_read_packages: '%s' has only 1 random option, drop rate will be 100%!\n",itemdb_name(itemdb->packages[count].id)); + itemdb->packages[count].random_list[0].rate = 10000; + } + count++; } @@ -1625,7 +1635,6 @@ int itemdb_uid_load() { * read all item-related databases *------------------------------------*/ static void itemdb_read(void) { - if (iMap->db_use_sqldbs) itemdb_read_sqldb(); else @@ -1635,6 +1644,7 @@ static void itemdb_read(void) { itemdb->read_groups(); itemdb->read_chains(); itemdb->read_packages(); + sv->readdb(iMap->db_path, "item_avail.txt", ',', 2, 2, -1, &itemdb_read_itemavail); sv->readdb(iMap->db_path, DBPATH"item_trade.txt", ',', 3, 3, -1, &itemdb_read_itemtrade); sv->readdb(iMap->db_path, "item_delay.txt", ',', 2, 2, -1, &itemdb_read_itemdelay); |