/** * Make a player resurect an homon (player must have one) * @param sd : player pointer * @param per : hp percentage to revive homon * @param x : x map coordinate * @param y : Y map coordinate * @return 0:failure, 1:success */ int hom_ressurect(struct map_session_data* sd, unsigned char per, short x, short y) { struct homun_data* hd; nullpo_ret(sd); if (!sd->status.hom_id) return 0; // no homunculus if (!sd->hd) //Load homun data; return intif_homunculus_requestload(sd->status.account_id, sd->status.hom_id); hd = sd->hd; if (hd->homunculus.vaporize == HOM_ST_REST) return 0; // vaporized homunculi need to be 'called' if (!status_isdead(&hd->bl)) return 0; // already alive hom_init_timers(hd); if (!hd->bl.prev) { //Add it back to the map. hd->bl.m = sd->bl.m; hd->bl.x = x; hd->bl.y = y; if(map_addblock(&hd->bl)) return 0; clif_spawn(&hd->bl); } return status_revive(&hd->bl, per, 0); }
int merc_resurrect_homunculus(struct map_session_data* sd, unsigned char per, short x, short y) { struct homun_data* hd; nullpo_ret(sd); if (!sd->status.hom_id) return 0; // no homunculus if( map[sd->bl.m].flag.ancient ) return 0; // Cannot revive homunculus on Ancient WoE if (!sd->hd) //Load homun data; return intif_homunculus_requestload(sd->status.account_id, sd->status.hom_id); hd = sd->hd; if (hd->homunculus.vaporize) return 0; // vaporized homunculi need to be 'called' if (!status_isdead(&hd->bl)) return 0; // already alive merc_hom_init_timers(hd); if (!hd->bl.prev) { //Add it back to the map. hd->bl.m = sd->bl.m; hd->bl.x = x; hd->bl.y = y; map_addblock(&hd->bl); clif_spawn(&hd->bl); } status_revive(&hd->bl, per, 0); return 1; }
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; }