From 432cfb3f42c628834d9b6cc5653c78ffbfda037c Mon Sep 17 00:00:00 2001 From: skotlex Date: Fri, 4 Aug 2006 20:04:16 +0000 Subject: - Changed function itemdb_group to itemdb_group_bonus, it now calculates the total group bonuses of a player for a given item. - Changed itemhealrate to itemgrouphealrate, added a structure itemhealrate to allow storing item-healing bonuses per item. - Modified bAddItemHealRate so it can receive both item-id and item-group values (since the first item-id is +500, there's no risk of mixing them up). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8136 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/itemdb.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'src/map/itemdb.c') diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 728ea0108..f3d462002 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -111,36 +111,25 @@ int itemdb_searchrandomid(int group) ShowError("itemdb_searchrandomid: No item entries for group id %d\n", group); return UNKNOWN_ITEM_ID; } - /*========================================== - * Returns the group this item belongs to. - * Skips general random item givers (gift/blue/violet box) + * Calculates total item-group related bonuses for the given item. [Skotlex] *------------------------------------------ */ -int itemdb_group (int nameid) +int itemdb_group_bonus(struct map_session_data *sd, int itemid) { - int i, j; + int bonus = 0, i, j; for (i=0; i < MAX_ITEMGROUP; i++) { - switch (i) { - case IG_BLUEBOX: - case IG_VIOLETBOX: - case IG_CARDALBUM: - case IG_GIFTBOX: - case IG_COOKIEBAG: - case IG_GIFTBOX_1: - case IG_GIFTBOX_2: - case IG_GIFTBOX_3: - case IG_GIFTBOX_4: - case IG_GIFTBOXCHINA: - continue; - } - + if (!sd->itemgrouphealrate[i]) + continue; for (j=0; j < itemgroup_db[i].qty; j++) { - if (itemgroup_db[i].id[j] == nameid) - return i; + if (itemgroup_db[i].id[j] == itemid) + { + bonus += sd->itemgrouphealrate[i]; + continue; + } } } - return -1; + return bonus; } /*========================================== -- cgit v1.2.3-60-g2f50