clydelion Posted November 24, 2012 Posted November 24, 2012 Hello, we have @homevolve, and I don't see why we wouldn't want to have this.. This is basically a port from Xantara's scriptcommand. Index: atcommand.c =================================================================== --- atcommand.c (revision 16920) +++ atcommand.c (working copy) @@ -8786,6 +8786,41 @@ #undef MC_CART_MDFY } +/*========================================== + * ported from Xantara's homunculus_mutate + * scriptcommand [clydelion] + *------------------------------------------*/ +ACMD_FUNC(hommutate) +{ + int homun_id, m_class = 0, m_id; + int homun_array[5] = {6048,6049,6050,6051,6052}; + nullpo_retr(-1, sd); + + if ( !merc_is_hom_active(sd->hd) ) { + clif_displaymessage(fd, msg_txt(1254)); // You do not have a homunculus. + return -1; + } + + if( sd == NULL ) + return -1; + if (!message || !*message) + homun_id = homun_array[rnd() % 5]; + else + homun_id = atoi(message); + + m_class = hom_class2mapid(sd->hd->homunculus.class_); + m_id = hom_class2mapid(homun_id); + + if ( m_class != -1 && m_id != -1 && m_class&HOM_EVO && m_id&HOM_S && sd->hd->homunculus.level >= 99 ) + hom_mutate(sd->hd, homun_id); + else + { + clif_displaymessage(fd, "Your homunculus must be level 99 to mutate."); + clif_emotion(&sd->hd->bl, E_SWT); + } + return 0; +} + /** * Fills the reference of available commands in atcommand DBMap **/ @@ -8796,6 +8831,7 @@ * Command reference list, place the base of your commands here **/ AtCommandInfo atcommand_base[] = { + ACMD_DEF(hommutate), ACMD_DEF2("warp", mapmove), ACMD_DEF(where), ACMD_DEF(jumpto), Usage: @hommutate <homid> PS: I was thinking to merge this to the current @homevolve instead of making a new command, but it's called mutate now so... Cheers! homunculus_mutate_atcommand.diff
Lighta Posted November 24, 2012 Posted November 24, 2012 Agree with this suggestion and we could also add homreset, found it usefull for some test. I don't like too much code duplicate so when it's use in 2 interface I think we better put the generic in homon, and reduce the call in atcommand and script. nb : if( sd == NULL ) is useless, you already check it with nullpo, and at this place it would have been wrong since you used it before =)
clydelion Posted November 24, 2012 Author Posted November 24, 2012 Agree with this suggestion and we could also add homreset, found it usefull for some test. I don't like too much code duplicate so when it's use in 2 interface I think we better put the generic in homon, and reduce the call in atcommand and script. nb : if( sd == NULL ) is useless, you already check it with nullpo, and at this place it would have been wrong since you used it before =) Ahh yes. I overlooked this when I ported the scriptcommand. I was in a hurry back then and didnt bother removing those useless parts. But you got what I meant.
Recommended Posts