From fcba8a2161a392369db99ab9a516a24470c54796 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sun, 23 Jun 2013 16:35:42 -0300 Subject: Official Item Group/Package/Chain http://hercules.ws/board/topic/1244-official-item-grouppackagechain/ Also Further implemented itemdb.c/storage.c interfaces, and a minor update to db2sql plugin. Signed-off-by: shennetsind --- src/map/mob.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/map/mob.c') diff --git a/src/map/mob.c b/src/map/mob.c index 6bb40478f..3f282bf7e 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2330,7 +2330,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { if (md->db->dropitem[i].nameid <= 0) continue; - if ( !(it = itemdb_exists(md->db->dropitem[i].nameid)) ) + if ( !(it = itemdb->exists(md->db->dropitem[i].nameid)) ) continue; drop_rate = md->db->dropitem[i].p; if (drop_rate <= 0) { @@ -2394,9 +2394,11 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) } // Ore Discovery [Celest] - if (sd == mvp_sd && pc->checkskill(sd,BS_FINDINGORE)>0 && battle_config.finding_ore_rate/10 >= rnd()%10000) { - ditem = mob_setdropitem(itemdb_searchrandomid(IG_FINDINGORE), 1, NULL); - mob_item_drop(md, dlist, ditem, 0, battle_config.finding_ore_rate/10, homkillonly); + if (sd == mvp_sd && pc->checkskill(sd,BS_FINDINGORE) > 0) { + if( (temp = itemdb->chain_item(itemdb->chain_cache[ECC_ORE],&i)) ) { + ditem = mob_setdropitem(temp, 1, NULL); + mob_item_drop(md, dlist, ditem, 0, i, homkillonly); + } } if(sd) { @@ -2424,8 +2426,9 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) if (rnd()%10000 >= drop_rate) continue; - itemid = (sd->add_drop[i].id > 0) ? sd->add_drop[i].id : itemdb_searchrandomid(sd->add_drop[i].group); - mob_item_drop(md, dlist, mob_setdropitem(itemid,1,NULL), 0, drop_rate, homkillonly); + itemid = (sd->add_drop[i].id > 0) ? sd->add_drop[i].id : itemdb->chain_item(sd->add_drop[i].group,&drop_rate); + if( itemid ) + mob_item_drop(md, dlist, mob_setdropitem(itemid,1,NULL), 0, drop_rate, homkillonly); } } @@ -2504,7 +2507,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) struct item_data *data; if(mdrop_id[i] <= 0) continue; - if(! (data = itemdb_exists(mdrop_id[i])) ) + if(! (data = itemdb->exists(mdrop_id[i])) ) continue; temp = mdrop_p[i]; @@ -3785,7 +3788,7 @@ static bool mob_parse_dbrow(char** str) //calculate and store Max available drop chance of the MVP item if (db->mvpitem[i].p) { struct item_data *id; - id = itemdb_search(db->mvpitem[i].nameid); + id = itemdb->search(db->mvpitem[i].nameid); if (id->maxchance == -1 || (id->maxchance < db->mvpitem[i].p/10 + 1) ) { //item has bigger drop chance or sold in shops id->maxchance = db->mvpitem[i].p/10 + 1; //reduce MVP drop info to not spoil common drop rate @@ -3803,7 +3806,7 @@ static bool mob_parse_dbrow(char** str) db->dropitem[i].p = 0; //No drop. continue; } - id = itemdb_search(db->dropitem[i].nameid); + id = itemdb->search(db->dropitem[i].nameid); type = id->type; rate = atoi(str[k+1]); if( (class_ >= 1324 && class_ <= 1363) || (class_ >= 1938 && class_ <= 1946) ) @@ -4560,7 +4563,7 @@ static bool mob_readdb_itemratio(char* str[], int columns, int current) int nameid, ratio, i; nameid = atoi(str[0]); - if( itemdb_exists(nameid) == NULL ) + if( itemdb->exists(nameid) == NULL ) { ShowWarning("itemdb_read_itemratio: Invalid item id %d.\n", nameid); return false; -- cgit v1.2.3-70-g09d2