From 97b6801abb61b12b36593fa0c38cdc7cdac7d413 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 17 Aug 2019 21:19:58 -0300 Subject: Homunculus Dispatch core rules --- src/emap/script_buildins.c | 70 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 65 insertions(+), 5 deletions(-) (limited to 'src/emap/script_buildins.c') diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index 01982a8..99bae19 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -2556,16 +2556,76 @@ BUILDIN(gethomunexp) if (base < 0) return true; - // Cannot give EXP to inactive homunculus + // Cannot give EXP to inactive or dead homunculus + if (!homun_alive(sd->hd)) + return true; + + homun->gainexp(sd->hd, base); + return true; +} + +/*========================================== + * Send resting homunculus in a mission + * Homun must be resting. Returns true on success. + *------------------------------------------*/ +BUILDIN(deployhomunculus) +{ + struct map_session_data *sd = script->rid2sd(st); + if (sd == NULL || sd->hd == NULL) + return true; + /* - if (sd->hd->homunculus.vaporize == HOM_ST_ACTIVE) + // Homunculus must be resting + if (sd->hd->homunculus.vaporize != HOM_ST_REST) return true; + + // Add morph state. + //sd->hd->homunculus.vaporize=HOM_ST_MORPH; */ - //pc->gainexp(sd, &sd->bl, base, job, true); - homun->gainexp(sd->hd, base); - // send_homun_exp(sd->hd, base); + // Using the function, I don't need it resting + homun->vaporize(sd, HOM_ST_MORPH); + + // Return true + script_pushint(st,true); + return true; +} + +/*========================================== + * Returns the Homunculus from a mission + * Homun must be morph. Returns true on success. + *------------------------------------------*/ +BUILDIN(recallhomunculus) +{ + struct map_session_data *sd = script->rid2sd(st); + if (sd == NULL || sd->hd == NULL) + return true; + + // Homunculus must be vapor + if (sd->hd->homunculus.vaporize != HOM_ST_MORPH) + return true; + + // Remove morph state. + sd->hd->homunculus.vaporize=HOM_ST_REST; + homun->call(sd); // Respawn homunculus. + + // Return true + script_pushint(st,true); + return true; +} + + +/*========================================== + * Returns the Homunculus sleep status + *------------------------------------------*/ +BUILDIN(homstatus) +{ + struct map_session_data *sd = script->rid2sd(st); + if (sd == NULL || sd->hd == NULL) + return true; + // Return the status (0 - active; 1 - resting ; 2 - mission) + script_pushint(st,sd->hd->homunculus.vaporize); return true; } -- cgit v1.2.3-60-g2f50