summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmistry Haoyan <equinox1991@gmail.com>2019-07-21 05:04:29 +0800
committerHaru <haru@dotalux.com>2019-07-28 19:37:15 +0200
commit5ac507e88e116e6a11185beace600bde8896c534 (patch)
tree2ba9972ab9d077aff6e9702c4be8d7d065a80e86
parent9034007595aa0ef58d28f09253ba15f405a011ab (diff)
downloadhercules-5ac507e88e116e6a11185beace600bde8896c534.tar.gz
hercules-5ac507e88e116e6a11185beace600bde8896c534.tar.bz2
hercules-5ac507e88e116e6a11185beace600bde8896c534.tar.xz
hercules-5ac507e88e116e6a11185beace600bde8896c534.zip
Update Homunculus obtain EXP from master
- homunculus will obtain a portion or full EXP from master. - fixes #2313
-rw-r--r--conf/map/battle/homunc.conf3
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/homunculus.c6
-rw-r--r--src/map/pc.c5
5 files changed, 16 insertions, 0 deletions
diff --git a/conf/map/battle/homunc.conf b/conf/map/battle/homunc.conf
index 7ccaf8f8a..f2ed4d8d7 100644
--- a/conf/map/battle/homunc.conf
+++ b/conf/map/battle/homunc.conf
@@ -66,3 +66,6 @@ homunculus_max_level: 99
// Max level for Homunculus S
homunculus_S_max_level: 150
+
+// Bonus EXP homunculus received from master? (Note 2)
+hom_bonus_exp_from_master: 10
diff --git a/src/map/battle.c b/src/map/battle.c
index 7fa1567e7..abbaa549a 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -7437,6 +7437,7 @@ static const struct battle_data {
{ "hit_min_limit", &battle_config.hit_min, 1, 1, INT_MAX, },
{ "hit_max_limit", &battle_config.hit_max, SHRT_MAX, 1, INT_MAX, },
{ "autoloot_adjust", &battle_config.autoloot_adjust, 0, 0, 1, },
+ { "hom_bonus_exp_from_master", &battle_config.hom_bonus_exp_from_master, 10, 0, 100, },
};
static bool battle_set_value_sub(int index, int value)
diff --git a/src/map/battle.h b/src/map/battle.h
index 4f70c697b..779e360bf 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -478,6 +478,7 @@ struct Battle_Config {
int client_emblem_max_blank_percent;
int hom_max_level;
int hom_S_max_level;
+ int hom_bonus_exp_from_master;
// [BattleGround Settings]
int bg_update_interval;
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index f3a4c559a..d3e815872 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -552,6 +552,12 @@ static int homunculus_gainexp(struct homun_data *hd, unsigned int exp)
hd->homunculus.exp += exp;
+ if (hd->master->state.showexp && hd->exp_next > 0) {
+ char output[256];
+ sprintf(output, "Homunculus Experience Gained Base:%u (%.2f%%)", exp, ((float)exp / (float)hd->exp_next * (float)100));
+ clif_disp_onlyself(hd->master, output);
+ }
+
if(hd->homunculus.exp < hd->exp_next) {
clif->hominfo(hd->master,hd,0);
return 0;
diff --git a/src/map/pc.c b/src/map/pc.c
index 6caafa806..84d49e1db 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -7143,6 +7143,11 @@ static bool pc_gainexp(struct map_session_data *sd, struct block_list *src, uint
clif_disp_onlyself(sd, output);
}
+ // Share master EXP to homunculus
+ if (sd->hd != NULL && battle_config.hom_bonus_exp_from_master > 0) {
+ homun->gainexp(sd->hd, apply_percentrate((int)base_exp, battle_config.hom_bonus_exp_from_master, 100));
+ }
+
return true;
}