/*==========================================
* Puts homunculus into morph state
* and gives ITEMID_STRANGE_EMBRYO.
*------------------------------------------*/
BUILDIN_FUNC(morphembryo)
{
struct item item_tmp;
int m_class, i=0;
TBL_PC *sd;
sd = script_rid2sd(st);
if( sd == NULL || sd->hd == NULL )
return 0;
if( merc_is_hom_active(sd->hd) ) {
m_class = hom_class2mapid(sd->hd->homunculus.class_);
if ( m_class != -1 && m_class&HOM_EVO && sd->hd->homunculus.level >= 99 ) {
memset(&item_tmp, 0, sizeof(item_tmp));
item_tmp.nameid = ITEMID_STRANGE_EMBRYO;
item_tmp.identify = 1;
if( item_tmp.nameid == 0 || (i = pc_additem(sd, &item_tmp, 1, LOG_TYPE_SCRIPT)) ) {
clif_additem(sd, 0, 0, i);
clif_emotion(&sd->bl, E_SWT); // Fail to avoid item drop exploit.
} else {
merc_hom_vaporize(sd, HOM_ST_MORPH);
script_pushint(st, 1);
return 0;
}
} else
clif_emotion(&sd->hd->bl, E_SWT);
} else
clif_emotion(&sd->bl, E_SWT);
script_pushint(st, 0);
return 0;
}
BUILDIN_FUNC(checkhomcall)
{
TBL_PC *sd = script_rid2sd(st);
TBL_HOM *hd;
if( sd == NULL )
return 0;
hd = sd->hd;
if( !hd )
script_pushint(st, -1);
else
script_pushint(st, hd->homunculus.vaporize);
return 0;
}