summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-08-17 21:19:58 -0300
committerJesusaves <cpntb1@ymail.com>2019-08-17 21:19:58 -0300
commit97b6801abb61b12b36593fa0c38cdc7cdac7d413 (patch)
tree4e5a2e092057b49d412a8614369264c55827f475
parente81f9d181143d788038334f33d53e997f2abbafd (diff)
downloadevol-hercules-97b6801abb61b12b36593fa0c38cdc7cdac7d413.tar.gz
evol-hercules-97b6801abb61b12b36593fa0c38cdc7cdac7d413.tar.bz2
evol-hercules-97b6801abb61b12b36593fa0c38cdc7cdac7d413.tar.xz
evol-hercules-97b6801abb61b12b36593fa0c38cdc7cdac7d413.zip
Homunculus Dispatch core rules
-rw-r--r--src/emap/init.c3
-rw-r--r--src/emap/script_buildins.c70
-rw-r--r--src/emap/script_buildins.h3
3 files changed, 71 insertions, 5 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index 76910fb..1ea0ae9 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -220,6 +220,9 @@ HPExport void plugin_init (void)
addScriptCommand("setguildrole","iiiis",setguildrole);
addScriptCommand("getguildmember","i?",getguildmember);
addScriptCommand("gethomunexp","i",gethomunexp);
+ addScriptCommand("deployhomunculus","",deployhomunculus);
+ addScriptCommand("recallhomunculus","",recallhomunculus);
+ addScriptCommand("homstatus","",homstatus);
do_init_langs();
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;
}
diff --git a/src/emap/script_buildins.h b/src/emap/script_buildins.h
index 19c3b30..269df3a 100644
--- a/src/emap/script_buildins.h
+++ b/src/emap/script_buildins.h
@@ -109,5 +109,8 @@ BUILDIN(getguildnxp);
BUILDIN(setguildrole);
BUILDIN(getguildmember);
BUILDIN(gethomunexp);
+BUILDIN(deployhomunculus);
+BUILDIN(recallhomunculus);
+BUILDIN(homstatus);
#endif // EVOL_MAP_SCRIPT_BUILDINS