summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2019-07-28 21:29:47 +0200
committerGitHub <noreply@github.com>2019-07-28 21:29:47 +0200
commitcd04fd96954ccb9fbbe33d05ad1eb3e2f7ce98c5 (patch)
treef5af9a63a5158dc890b3b5a2ecbc90e5e98e66b5
parent1fe63a8d4b286a4d7981b96882dab495c57dffc6 (diff)
parent5ac507e88e116e6a11185beace600bde8896c534 (diff)
downloadhercules-cd04fd96954ccb9fbbe33d05ad1eb3e2f7ce98c5.tar.gz
hercules-cd04fd96954ccb9fbbe33d05ad1eb3e2f7ce98c5.tar.bz2
hercules-cd04fd96954ccb9fbbe33d05ad1eb3e2f7ce98c5.tar.xz
hercules-cd04fd96954ccb9fbbe33d05ad1eb3e2f7ce98c5.zip
Merge pull request #2507 from Emistry/homun_exp
Update Homunculus obtain EXP from master
-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 3cb7c9a93..37fc03bca 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -7449,6 +7449,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;
}