summaryrefslogtreecommitdiff
path: root/src/emap/script_buildins.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emap/script_buildins.c')
-rw-r--r--src/emap/script_buildins.c70
1 files changed, 65 insertions, 5 deletions
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;
}