Jump to content
Sign in to follow this  
Ind

item_group rate : unused.

Recommended Posts

Why are item groups not taking into account the item's individual rate?

The code is the same on Hercules/eA/rA:

int itemdb_searchrandomid(int group){	if(group<1 || group>=MAX_ITEMGROUP) {		ShowError("itemdb_searchrandomid: Invalid group id %dn", group);		return UNKNOWN_ITEM_ID;	}	if (itemgroup_db[group].qty)		return itemgroup_db[group].nameid[rnd()%itemgroup_db[group].qty];		ShowError("itemdb_searchrandomid: No item entries for group id %dn", group);	return UNKNOWN_ITEM_ID;}
it randomly gets a item from the stack, rate doesn't play at all on it (in fact they're not even stored when the file is read).

jAthena's equivalent (horribly looking but still you can see the rate takes a part in it)

int itemdb_searchrandomid(int flags){	int nameid=0,i,index,count;	struct random_item_data *list=NULL;	struct {		int nameid,count;		struct random_item_data *list;	} data[21];	// for BCC32 compile error	data[0].nameid = 0;							data[0].count = 0; 						data[0].list = NULL;	data[1].nameid = blue_box_default;			data[1].count = blue_box_count;			data[1].list = blue_box;	data[2].nameid = violet_box_default;		data[2].count = violet_box_count;		data[2].list = violet_box;	data[3].nameid = card_album_default;		data[3].count = card_album_count;		data[3].list = card_album;	data[4].nameid = gift_box_default;			data[4].count = gift_box_count;			data[4].list = gift_box;	data[5].nameid = scroll_default;			data[5].count = scroll_count;			data[5].list = scroll;	data[6].nameid = finding_ore_default;		data[6].count = finding_ore_count;		data[6].list = finding_ore;	data[7].nameid = arrow_quiver_default;		data[7].count = arrow_quiver_count;		data[7].list = arrow_quiver;	data[8].nameid = diamond_weapon_default;	data[8].count = diamond_weapon_count;	data[8].list = diamond_weapon;	data[9].nameid = diamond_armor_default;		data[9].count = diamond_armor_count;	data[9].list = diamond_armor;	data[10].nameid = diamond_hood_default;		data[10].count = diamond_hood_count;	data[10].list = diamond_hood;	data[11].nameid = diamond_helm_default;		data[11].count = diamond_helm_count;	data[11].list = diamond_helm;	data[12].nameid = diamond_shoes_default;	data[12].count = diamond_shoes_count;	data[12].list = diamond_shoes;	data[13].nameid = diamond_shield_default;	data[13].count = diamond_shield_count;	data[13].list = diamond_shield;	data[14].nameid = jewel_box_default;		data[14].count = jewel_box_count;		data[14].list = jewel_box;	data[15].nameid = meiji_almond_default;		data[15].count = meiji_almond_count;	data[15].list = meiji_almond;	data[16].nameid = pet_box_default;			data[16].count = pet_box_count;			data[16].list = pet_box;	data[17].nameid = mask_default;				data[17].count = mask_count;			data[17].list = mask;	data[18].nameid = fabox_default;			data[18].count = fabox_count;			data[18].list = fabox;	data[19].nameid = food_default;				data[19].count = food_count;			data[19].list = food;	data[20].nameid = rjc2006_default;			data[20].count = rjc2006_count;			data[20].list = rjc2006;		if(flags>=1 && flags<=20){		nameid=data[flags].nameid;		count=data[flags].count;		list=data[flags].list;		if(count > 0) {			for(i=0;i<1000;i++) {				index = atn_rand()%count;				if(	atn_rand()00000 < list[index].per) {					nameid = list[index].nameid;					break;				}			}		}	}	return nameid;}

Share this post


Link to post
Share on other sites

It's working as intended.

 

Item entries with high chance are put into struct item_groupdb[group_id] multiple times. See itemdb_read_itemgroup_sub

		k = atoi(str[2]);		if (itemgroup_db[groupid].qty+k >= MAX_RANDITEM) {			ShowWarning("itemdb_read_itemgroup: Group %d is full (%d entries) in %s:%dn", groupid, MAX_RANDITEM, filename, ln);			continue;		}		for(j=0;j<k;j++)			itemgroup_db[groupid].nameid[itemgroup_db[groupid].qty++] = nameid;

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.