summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--conf-tmpl/battle/exp.conf6
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/pc.c23
5 files changed, 31 insertions, 3 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index cf377d528..5bbfadf0d 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -6,6 +6,8 @@ GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALAR
2006/02/09
+ * Added setting max_exp_gain_rate which caps how much exp you can get from
+ a single kill. See battle/exp.txt for details. [Skotlex]
* pc_readdb will now cap experience required per level to UINT_MAX, it will
warn if the exp table has exp values above said limit. [Skotlex]
* Changed the default of skill_delay_attack_enable to no. [Skotlex]
diff --git a/conf-tmpl/battle/exp.conf b/conf-tmpl/battle/exp.conf
index 494081d08..b9d5708aa 100644
--- a/conf-tmpl/battle/exp.conf
+++ b/conf-tmpl/battle/exp.conf
@@ -38,6 +38,12 @@ job_exp_rate: 100
// Turn this on to allow a player to level up more than once from a kill. (Note 1)
multi_level_up: no
+// Setting this can cap the max experience one can get per kill specified as a
+// % of the current exp bar. (Every 10 = 1.0%)
+// For example, set it to 500 and no matter how much exp the mob gives,
+// it can never give you above half of your current exp bar.
+max_exp_gain_rate: 0
+
//Method of calculating earned experience when defeating a monster:
//0 - jAthena's (uses damage given / total damage as damage ratio)
//1 - eAthena's (uses damage given / max_hp as damage ratio)
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]