summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-09 17:26:55 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-09 17:26:55 +0000
commit3a562499db31496d4595910760560743d55b478f (patch)
tree21fadbbf4e85cbfde48fbeac30b76171a3ebbef5 /src
parent97ef7dfb68da9a3abccb78add4666c648c668884 (diff)
downloadhercules-3a562499db31496d4595910760560743d55b478f.tar.gz
hercules-3a562499db31496d4595910760560743d55b478f.tar.bz2
hercules-3a562499db31496d4595910760560743d55b478f.tar.xz
hercules-3a562499db31496d4595910760560743d55b478f.zip
- Added setting max_exp_gain_rate which caps how much exp you can get from a single kill.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5239 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/pc.c23
3 files changed, 23 insertions, 3 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 354dc0d88..09b8d7439 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3752,6 +3752,7 @@ static const struct battle_data_short {
{ "manner_system", &battle_config.manner_system }, // [Komurka]
{ "pet_equip_required", &battle_config.pet_equip_required }, // [Valaris]
{ "multi_level_up", &battle_config.multi_level_up }, // [Valaris]
+ { "max_exp_gain_rate", &battle_config.max_exp_gain_rate }, // [Skotlex]
{ "backstab_bow_penalty", &battle_config.backstab_bow_penalty },
{ "night_at_start", &battle_config.night_at_start }, // added by [Yor]
{ "show_mob_hp", &battle_config.show_mob_hp }, // [Valaris]
@@ -4139,6 +4140,7 @@ void battle_set_defaults() {
battle_config.manner_system = 1; // [Valaris]
battle_config.pet_equip_required = 0; // [Valaris]
battle_config.multi_level_up = 0; // [Valaris]
+ battle_config.max_exp_gain_rate = 0; // [Skotlex]
battle_config.backstab_bow_penalty = 0; // Akaru
battle_config.night_at_start = 0; // added by [Yor]
battle_config.day_duration = 2*60*60*1000; // added by [Yor] (2 hours)
diff --git a/src/map/battle.h b/src/map/battle.h
index 353ba7bc1..5511f6bee 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -301,6 +301,7 @@ extern struct Battle_Config {
unsigned short equip_skill_break_rate; //Offensive skills break rate
unsigned short pet_equip_required;
unsigned short multi_level_up;
+ unsigned short max_exp_gain_rate; //Max amount of exp bar % you can get in one go.
unsigned short pk_mode;
unsigned short manner_system;
unsigned short show_mob_hp; // end additions [Valaris]
diff --git a/src/map/pc.c b/src/map/pc.c
index 66a14f9db..2d55bb46c 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4711,13 +4711,30 @@ int pc_gainexp(struct map_session_data *sd,unsigned int base_exp,unsigned int jo
base_exp-=guild_payexp(sd,base_exp);
}
- if(sd->state.showexp){
- nextb = pc_nextbaseexp(sd);
- nextj = pc_nextjobexp(sd);
+ nextb = pc_nextbaseexp(sd);
+ nextj = pc_nextjobexp(sd);
+
+
+ if(sd->state.showexp || battle_config.max_exp_gain_rate){
if (nextb > 0)
nextbp = (float) base_exp / (float) nextb;
if (nextj > 0)
nextjp = (float) job_exp / (float) nextj;
+
+ if(battle_config.max_exp_gain_rate) {
+ if (nextbp > battle_config.max_exp_gain_rate/1000.) {
+ //Note that this value should never be greater than the original
+ //base_exp, therefore no overflow checks are needed. [Skotlex]
+ base_exp = (unsigned int)(battle_config.max_exp_gain_rate/1000.*nextb);
+ if (sd->state.showexp)
+ nextbp = (float) base_exp / (float) nextb;
+ }
+ if (nextjp > battle_config.max_exp_gain_rate/1000.) {
+ job_exp = (unsigned int)(battle_config.max_exp_gain_rate/1000.*nextj);
+ if (sd->state.showexp)
+ nextjp = (float) job_exp / (float) nextj;
+ }
+ }
}
//Overflow checks... think we'll ever really need'em? [Skotlex]