int merc_call_homunculus(struct map_session_data *sd) { struct homun_data *hd; if( sd->sc.data[SC__GROOMY] ) return 0; if( map[sd->bl.m].flag.ancient ) return 0; // Cannot call homunculus on Ancient WoE if (!sd->status.hom_id) //Create a new homun. return merc_create_homunculus_request(sd, HM_CLASS_BASE + rand(0, 7)) ; // If homunc not yet loaded, load it if (!sd->hd) return intif_homunculus_requestload(sd->status.account_id, sd->status.hom_id); hd = sd->hd; if (!hd->homunculus.vaporize) return 0; //Can't use this if homun wasn't vaporized. merc_hom_init_timers(hd); hd->homunculus.vaporize = 0; if (hd->bl.prev == NULL) { //Spawn him hd->bl.x = sd->bl.x; hd->bl.y = sd->bl.y; hd->bl.m = sd->bl.m; map_addblock(&hd->bl); clif_spawn(&hd->bl); clif_send_homdata(sd,SP_ACK,0); clif_hominfo(sd,hd,1); clif_hominfo(sd,hd,0); // send this x2. dunno why, but kRO does that [blackhole89] clif_homskillinfoblock(sd); if (battle_config.slaves_inherit_speed&1) status_calc_bl(&hd->bl, SCB_SPEED); merc_save(hd); } else //Warp him to master. unit_warp(&hd->bl,sd->bl.m, sd->bl.x, sd->bl.y,CLR_OUTSIGHT); return 1; }
/** * Make a player spawn a homonculus (call) * @param sd * @return False:failure, True:sucess */ bool hom_call(struct map_session_data *sd) { struct homun_data *hd; if (!sd->status.hom_id) //Create a new homun. return hom_create_request(sd, HM_CLASS_BASE + rnd_value(0, 7)) ; // If homunc not yet loaded, load it if (!sd->hd) return intif_homunculus_requestload(sd->status.account_id, sd->status.hom_id); hd = sd->hd; if (!hd->homunculus.vaporize) return false; //Can't use this if homun wasn't vaporized. if (hd->homunculus.vaporize == HOM_ST_MORPH) return false; // Can't call homunculus (morph state). hom_init_timers(hd); hd->homunculus.vaporize = HOM_ST_ACTIVE; if (hd->bl.prev == NULL) { //Spawn him hd->bl.x = sd->bl.x; hd->bl.y = sd->bl.y; hd->bl.m = sd->bl.m; if(map_addblock(&hd->bl)) return false; clif_spawn(&hd->bl); clif_send_homdata(sd,SP_ACK,0); clif_hominfo(sd,hd,1); clif_hominfo(sd,hd,0); // send this x2. dunno why, but kRO does that [blackhole89] clif_homskillinfoblock(sd); if (battle_config.slaves_inherit_speed&1) status_calc_bl(&hd->bl, SCB_SPEED); hom_save(hd); } else //Warp him to master. unit_warp(&hd->bl,sd->bl.m, sd->bl.x, sd->bl.y,CLR_OUTSIGHT); return true; }