From 2fbec282b9b3eb84f710d5537f70e6bc221187b3 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Wed, 31 Jul 2013 13:43:19 -0300 Subject: Fixed Bug #7602 @homlvup/@homlevel now functions for homun-s http://hercules.ws/board/tracker/issue-7602-homlevel-homlvup/ Also adjusted @makehomun so that it resurrects the homun when call isn't possible (for when used with -1), prior to this it'd do nothing when homun was dead and not vaporised. Signed-off-by: shennetsind --- src/map/atcommand.c | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) (limited to 'src/map/atcommand.c') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 8fd9e6043..367025f4f 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -6813,7 +6813,8 @@ ACMD(homlevel) { TBL_HOM * hd; int level = 0; - + enum homun_type htype; + nullpo_retr(-1, sd); if ( !message || !*message || ( level = atoi(message) ) < 1 ) { @@ -6827,11 +6828,35 @@ ACMD(homlevel) } hd = sd->hd; + + if((htype = homun->class2type(hd->homunculus.class_)) == -1) { + ShowError("atcommand_homlevel: invalid homun class %d (player %s)\n", hd->homunculus.class_,sd->status.name); + return false; + } + + switch( htype ) { + case HT_REG: + case HT_EVO: + if( hd->homunculus.level >= battle_config.hom_max_level ) { + snprintf(atcmd_output, sizeof(atcmd_output), msg_txt(1478), hd->homunculus.level); // Homun reached its maximum level of '%d' + clif->message(fd, atcmd_output); + return true; + } + break; + case HT_S: + if( hd->homunculus.level >= battle_config.hom_S_max_level ) { + snprintf(atcmd_output, sizeof(atcmd_output), msg_txt(1478), hd->homunculus.level); // Homun reached its maximum level of '%d' + clif->message(fd, atcmd_output); + return true; + } + break; + default: + ShowError("atcommand_homlevel: unknown htype '%d'\n",htype); + return false; + } - if ( battle_config.hom_max_level == hd->homunculus.level ) // Already reach maximum level - return true; - - do{ + + do { hd->homunculus.exp += hd->exp_next; } while( hd->homunculus.level < level && homun->levelup(hd) ); @@ -6903,7 +6928,10 @@ ACMD(makehomun) { homunid = atoi(message); if( homunid == -1 && sd->status.hom_id && !homun_alive(sd->hd) ) { - homun->call(sd); + if( !sd->hd->homunculus.vaporize ) + homun->ressurect(sd, 100, sd->bl.x, sd->bl.y); + else + homun->call(sd); return true; } -- cgit v1.2.3-70-g09d2