From df5609c5d94b7967b5fd7857b6a80be366821280 Mon Sep 17 00:00:00 2001 From: rud0lp20 Date: Tue, 30 Oct 2012 07:30:36 +0000 Subject: Fixed Level/Drop modifier based on level difference and created a db as suggested in pid:137564. (bugreport:6585) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16842 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/pc.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'src/map/pc.c') diff --git a/src/map/pc.c b/src/map/pc.c index 7dd648715..e827e760e 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -51,6 +51,9 @@ static unsigned int exp_table[CLASS_COUNT][2][MAX_LEVEL]; static unsigned int max_level[CLASS_COUNT][2]; static unsigned int statp[MAX_LEVEL+1]; +#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP) +static unsigned int level_penalty[3][RC_MAX][MAX_LEVEL*2+1]; +#endif // h-files are for declarations, not for implementations... [Shinomori] struct skill_tree_entry skill_tree[CLASS_COUNT][MAX_SKILL_TREE]; @@ -86,7 +89,6 @@ struct item_cd { short nameid[MAX_ITEMDELAYS];//skill id }; - //Converts a class to its array index for CLASS_COUNT defined arrays. //Note that it does not do a validity check for speed purposes, where parsing //player input make sure to use a pcdb_checkid first! @@ -9105,7 +9107,42 @@ int pc_del_talisman(struct map_session_data *sd,int count,int type) clif_talisman(sd, type); return 0; } +#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP) +/*========================================== + * Renewal EXP/Itemdrop rate modifier base on level penalty + * 1=exp 2=itemdrop + *------------------------------------------*/ +int pc_level_penalty_mod(struct map_session_data *sd, struct mob_data *md, int type) +{ + int diff, rate = 100, i; + + nullpo_ret(sd); + nullpo_ret(md); + + diff = md->level - sd->status.base_level; + + if( diff < 0 ) + diff = MAX_LEVEL + ( ~diff + 1 ); + + for(i=0; istatus.race != i ){ + if( md->status.mode&MD_BOSS && i < RC_BOSS ) + i = RC_BOSS; + else if( i <= RC_BOSS ) + continue; + } + + if( (tmp=level_penalty[type][i][diff]) > 0 ){ + rate = tmp; + break; + } + } + + return rate; +} +#endif int pc_split_str(char *str,char **val,int num) { int i; -- cgit v1.2.3-60-g2f50