/** Party EXP and Zeny sharing * @param p Party data * @param src EXP source (for renewal level penalty) * @param base_exp Base EXP gained from killed mob * @param job_exp Job EXP gained from killed mob * @param zeny Zeny gained from killed mob * @author Valaris **/ void party_exp_share(struct party_data* p, struct block_list* src, unsigned int base_exp, unsigned int job_exp, int zeny) { struct map_session_data* sd[MAX_PARTY]; unsigned int i, c; #ifdef RENEWAL_EXP TBL_MOB *md = BL_CAST(BL_MOB, src); if (!md) return; #endif nullpo_retv(p); // count the number of players eligible for exp sharing for (i = c = 0; i < MAX_PARTY; i++) { if( (sd[c] = p->data[i].sd) == NULL || sd[c]->bl.m != src->m || pc_isdead(sd[c]) || (battle_config.idle_no_share && pc_isidle(sd[c])) ) continue; c++; } if (c < 1) return; base_exp/=c; job_exp/=c; zeny/=c; if (battle_config.party_even_share_bonus && c > 1) { double bonus = 100 + battle_config.party_even_share_bonus*(c-1); if (base_exp) base_exp = (unsigned int) cap_value(base_exp * bonus/100, 0, UINT_MAX); if (job_exp) job_exp = (unsigned int) cap_value(job_exp * bonus/100, 0, UINT_MAX); if (zeny) zeny = (unsigned int) cap_value(zeny * bonus/100, INT_MIN, INT_MAX); } for (i = 0; i < c; i++) { #ifdef RENEWAL_EXP uint32 base_gained = base_exp, job_gained = job_exp; if (base_exp || job_exp) { int rate = pc_level_penalty_mod(md->level - sd[i]->status.base_level, md->db->status.class_, md->db->status.mode, 1); if (rate != 100) { if (base_exp) base_gained = (unsigned int)cap_value(apply_rate(base_exp, rate), 1, UINT_MAX); if (job_exp) job_gained = (unsigned int)cap_value(apply_rate(job_exp, rate), 1, UINT_MAX); } } pc_gainexp(sd[i], src, base_gained, job_gained, 0); #else pc_gainexp(sd[i], src, base_exp, job_exp, 0); #endif if (zeny) // zeny from mobs [Valaris] pc_getzeny(sd[i],zeny,LOG_TYPE_PICKDROP_MONSTER,NULL); } }
// exp share and added zeny share [Valaris] int party_exp_share(struct party *p,int map,int base_exp,int job_exp,int zeny) { struct map_session_data* sd[MAX_PARTY]; int i; short c, bonus =100; // modified [Valaris] unsigned long base, job; nullpo_retr(0, p); for (i = c = 0; i < MAX_PARTY; i++) if ((sd[c] = p->member[i].sd)!=NULL && sd[c]->bl.m == map && !pc_isdead(sd[c])) { if (battle_config.idle_no_share && (pc_issit(sd[c]) || sd[c]->chatID || (sd[c]->idletime < (last_tick - battle_config.idle_no_share)))) continue; c++; } if (c < 1) return 0; if (battle_config.party_even_share_bonus) //Valaris's even share exp bonus equation. bonus += (battle_config.party_even_share_bonus*c*(c-1)/10); //Changed Valaris's bonus switch to an equation [Skotlex] else //Official kRO/iRO sites state that the even share bonus is 10% per additional party member. bonus += (c-1)*10; base = (unsigned long)(base_exp/c)*bonus/100; job = (unsigned long)(job_exp/c)*bonus/100; if (base > 0x7fffffff) base = 0x7fffffff; if (job > 0x7fffffff) job = 0x7fffffff; for (i = 0; i < c; i++) { pc_gainexp(sd[i], base, job); if (battle_config.zeny_from_mobs) // zeny from mobs [Valaris] pc_getzeny(sd[i],bonus*zeny/(c*100)); } return 0; }
//Exp share and added zeny share [Valaris] int party_exp_share(struct party_data *p, struct block_list *src, unsigned int base_exp, unsigned int job_exp, int zeny) { struct map_session_data *sd[MAX_PARTY]; unsigned int i, c; #ifdef RENEWAL_EXP uint32 base_exp_bonus, job_exp_bonus; #endif nullpo_ret(p); //Count the number of players eligible for exp sharing for (i = c = 0; i < MAX_PARTY; i++) { if ((sd[c] = p->data[i].sd) == NULL || sd[c]->bl.m != src->m || pc_isdead(sd[c]) || (battle_config.idle_no_share && pc_isidle(sd[c]))) continue; c++; } if (c < 1) return 0; base_exp /= c; job_exp /= c; zeny /= c; if (battle_config.party_even_share_bonus && c > 1) { double bonus = 100 + battle_config.party_even_share_bonus * (c - 1); if (base_exp) base_exp = (unsigned int)cap_value(base_exp * bonus / 100, 0, UINT_MAX); if (job_exp) job_exp = (unsigned int)cap_value(job_exp * bonus / 100, 0, UINT_MAX); if (zeny) zeny = (unsigned int)cap_value(zeny * bonus / 100, INT_MIN, INT_MAX); } #ifdef RENEWAL_EXP base_exp_bonus = base_exp; job_exp_bonus = job_exp; #endif for (i = 0; i < c; i++) { #ifdef RENEWAL_EXP if (!(src && src->type == BL_MOB && ((TBL_MOB *)src)->db->mexp)) { TBL_MOB *md = BL_CAST(BL_MOB, src); int rate = 0; if (!md) return 0; rate = pc_level_penalty_mod(sd[i], md->db->lv, md->db->status.class_, 1); base_exp = (unsigned int)cap_value(base_exp_bonus * rate / 100, 1, UINT_MAX); job_exp = (unsigned int)cap_value(job_exp_bonus * rate / 100, 1, UINT_MAX); } #endif pc_gainexp(sd[i], src, base_exp, job_exp, false); if (zeny) //Zeny from mobs [Valaris] pc_getzeny(sd[i],zeny,LOG_TYPE_PICKDROP_MONSTER,NULL); } return 0; }
// exp share and added zeny share [Valaris] int party_exp_share(struct party_data* p, struct block_list* src, unsigned int base_exp, unsigned int job_exp, int zeny) { struct map_session_data* sd[MAX_PARTY]; unsigned int i, c; nullpo_retr(0, p); // count the number of players eligible for exp sharing for( i = c = 0; i < MAX_PARTY; i++ ) { if( (sd[c] = p->data[i].sd) == NULL || sd[c]->bl.m != src->m || pc_isdead(sd[c]) || (battle_config.idle_no_share && pc_isidle(sd[c])) ) continue; c++; } if( c < 1 ) return 0; base_exp /= c; job_exp /= c; zeny /= c; if( battle_config.renewal_system_enable && c > 2 ) { int rbonus = 100 + (10 * (c - 2)); // 10% ~ 100% if( base_exp ) base_exp = (unsigned int) cap_value(base_exp * rbonus/100, 0, UINT_MAX); if( job_exp ) job_exp = (unsigned int) cap_value(job_exp * rbonus/100, 0, UINT_MAX); } if( battle_config.party_even_share_bonus && c > 1 ) { double bonus = 100 + battle_config.party_even_share_bonus*(c-1); if (base_exp) base_exp = (unsigned int) cap_value(base_exp * bonus/100, 0, UINT_MAX); if (job_exp) job_exp = (unsigned int) cap_value(job_exp * bonus/100, 0, UINT_MAX); if (zeny) zeny = (unsigned int) cap_value(zeny * bonus/100, INT_MIN, INT_MAX); } for( i = 0; i < c; i++ ) { pc_gainexp(sd[i],src,base_exp,job_exp,false); if( zeny ) // zeny from mobs [Valaris] pc_getzeny(sd[i],zeny); } return 0; }
// exp share and added zeny share [Valaris] int party_exp_share(struct party_data* p, struct block_list* src, unsigned int base_exp, unsigned int job_exp, int zeny) { struct map_session_data* sd[MAX_PARTY]; unsigned int i, c; nullpo_ret(p); // count the number of players eligible for exp sharing for( i = c = 0; i < MAX_PARTY; i++ ) { if( (sd[c] = p->data[i].sd) == NULL || sd[c]->bl.m != src->m || pc_isdead(sd[c]) || (battle_config.idle_no_share && pc_isidle(sd[c])) ) continue; c++; } if(c < 1) return 0; if (battle_config.renewal_party_exp_nerf) { int nerf; if (c == 2) { nerf = 50; } else if (c == 3) { nerf = 37; } else if (c == 4) { nerf = 30; } else if (c == 5) { nerf = 26; } else if (c == 6) { nerf = 23; } else if (c == 7) { nerf = 21; } else if (c == 8) { nerf = 20; } else if (c == 9) { nerf = 19; } else if (c == 10) { nerf = 18; } else if (c == 11) { nerf = 17; } else if (c == 12) { nerf = 17; } else { nerf = 0; } if (nerf) { base_exp = base_exp * nerf / 100; job_exp = job_exp * nerf / 100; zeny = zeny * nerf / 100; } } else { base_exp /= c; job_exp /= c; zeny /= c; } if( battle_config.party_even_share_bonus && c > 1 ) { double bonus = 100 + battle_config.party_even_share_bonus*(c-1); if (base_exp) base_exp = (unsigned int) cap_value(base_exp * bonus/100, 0, UINT_MAX); if (job_exp) job_exp = (unsigned int) cap_value(job_exp * bonus/100, 0, UINT_MAX); if (zeny) zeny = (unsigned int) cap_value(zeny * bonus/100, INT_MIN, INT_MAX); } for( i = 0; i < c; i++ ) { pc_gainexp(sd[i], src, base_exp, job_exp, false); if( zeny ) // zeny from mobs [Valaris] pc_getzeny(sd[i],zeny); } return 0; }