diff options
-rw-r--r-- | conf/messages.conf | 3 | ||||
-rw-r--r-- | src/map/homunculus.c | 28 | ||||
-rw-r--r-- | src/map/homunculus.h | 1 |
3 files changed, 22 insertions, 10 deletions
diff --git a/conf/messages.conf b/conf/messages.conf index bff4829c8..f616335fa 100644 --- a/conf/messages.conf +++ b/conf/messages.conf @@ -442,8 +442,9 @@ 432: change the sex of 433: This character has been banned until 434: Char-server has been asked to %s the character '%.*s'. -//435-449 FREE +//435-448 FREE // Homunculus messages +449: Homunculus Experience Gained Base:%u (%.2f%%) 450: You already have a homunculus // Return pet to egg message diff --git a/src/map/homunculus.c b/src/map/homunculus.c index 31744f479..bb940fd44 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -525,6 +525,21 @@ static bool homunculus_mutate(struct homun_data *hd, int homun_id) return true; } +static int homunculus_gainexp_real(struct homun_data *hd, unsigned int exp) +{ + nullpo_ret(hd); + nullpo_ret(hd->master); + + hd->homunculus.exp += exp; + + if (hd->master->state.showexp && hd->exp_next > 0) { + char output[256]; + sprintf(output, msg_fd(hd->master->fd, 449), exp, ((float)exp / (float)hd->exp_next * (float)100)); + clif_disp_onlyself(hd->master, output); + } + return 1; +} + static int homunculus_gainexp(struct homun_data *hd, unsigned int exp) { enum homun_type htype; @@ -550,16 +565,10 @@ static int homunculus_gainexp(struct homun_data *hd, unsigned int exp) break; } - 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); - } + homun->gainexp_real(hd, exp); - if(hd->homunculus.exp < hd->exp_next) { - clif->hominfo(hd->master,hd,0); + if (hd->homunculus.exp < hd->exp_next) { + clif->hominfo(hd->master, hd, 0); return 0; } @@ -1439,6 +1448,7 @@ void homunculus_defaults(void) homun->evolve = homunculus_evolve; homun->mutate = homunculus_mutate; homun->gainexp = homunculus_gainexp; + homun->gainexp_real = homunculus_gainexp_real; homun->add_intimacy = homunculus_add_intimacy; homun->consume_intimacy = homunculus_consume_intimacy; homun->healed = homunculus_healed; diff --git a/src/map/homunculus.h b/src/map/homunculus.h index 745c7cd84..502fb0b7f 100644 --- a/src/map/homunculus.h +++ b/src/map/homunculus.h @@ -178,6 +178,7 @@ struct homunculus_interface { bool (*evolve) (struct homun_data *hd); bool (*mutate) (struct homun_data *hd, int homun_id); int (*gainexp) (struct homun_data *hd, unsigned int exp); + int (*gainexp_real) (struct homun_data *hd, unsigned int exp); unsigned int (*add_intimacy) (struct homun_data * hd, unsigned int value); unsigned int (*consume_intimacy) (struct homun_data *hd, unsigned int value); void (*healed) (struct homun_data *hd); |