summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsheraf <Asheraf@users.noreply.github.com>2017-10-05 19:42:48 +0100
committerGitHub <noreply@github.com>2017-10-05 19:42:48 +0100
commit143f49f515c25f64af2c1b986dca07de24eb73c1 (patch)
treef12a9bc7afe12207b401c4a241d93bdcfc536338
parent5b95508aa6da3ceeb2990791a9e85d8102ec364d (diff)
parentb01d20d34077f805e51756ab199deaad7b796826 (diff)
downloadhercules-143f49f515c25f64af2c1b986dca07de24eb73c1.tar.gz
hercules-143f49f515c25f64af2c1b986dca07de24eb73c1.tar.bz2
hercules-143f49f515c25f64af2c1b986dca07de24eb73c1.tar.xz
hercules-143f49f515c25f64af2c1b986dca07de24eb73c1.zip
Merge pull request #1850 from MuzTank/issue-1624
Added dressroom script commands to open/close Dress Room window closes #1624
-rw-r--r--doc/script_commands.txt17
-rw-r--r--src/map/script.c49
2 files changed, 66 insertions, 0 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index c9bdce7c5..331bed1c7 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -5622,6 +5622,23 @@ character.
end;
---------------------------------------
+
+*dressroom({<mode>})
+
+This command controls the dressing room for the attached player. If no <mode>
+is passed, DRESSROOM_OPEN is used by default.
+
+Valid <mode> for dressroom() are:
+ DRESSROOM_OPEN opens the dressing room window
+ DRESSROOM_CLOSE closes the dressing room window
+
+Example:
+ mes("Close this window to open the Dress Room window.");
+ close2();
+ dressroom(DRESSROOM_OPEN);
+ end;
+
+---------------------------------------
//=====================================
4.2 - Guild-Related Commands
//=====================================
diff --git a/src/map/script.c b/src/map/script.c
index 533e421d8..367c9927d 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -23384,6 +23384,50 @@ BUILDIN(activatepset);
BUILDIN(deactivatepset);
BUILDIN(deletepset);
+enum dressroom_mode {
+ DRESSROOM_CLOSE = 0,
+ DRESSROOM_OPEN = 1
+};
+
+/**
+ * dressroom({<enum dressroom_mode>});
+ */
+BUILDIN(dressroom)
+{
+#if PACKETVER >= 20150513
+ struct map_session_data *sd = script->rid2sd(st);
+ enum dressroom_mode mode = DRESSROOM_OPEN;
+
+ if (sd == NULL) {
+ return false;
+ }
+
+ if (script_hasdata(st, 2)) {
+ mode = script_getnum(st, 2);
+ }
+
+ switch (mode) {
+ case DRESSROOM_OPEN:
+ clif->dressroom_open(sd, 1);
+ break;
+ case DRESSROOM_CLOSE:
+ clif->dressroom_open(sd, 0);
+ break;
+ default:
+ ShowWarning("script:dressroom: unknown mode (%i).\n", mode);
+ script_pushint(st, 0);
+ return false;
+ }
+
+ script_pushint(st, 1);
+ return true;
+#else
+ ShowError("The dressing room works only with packet version >= 20150513");
+ script_pushint(st, 0);
+ return false;
+#endif
+}
+
BUILDIN(pcre_match)
{
const char *input = script_getstr(st, 2);
@@ -24039,6 +24083,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(activatepset,"i"), // Activate a pattern set [MouseJstr]
BUILDIN_DEF(deactivatepset,"i"), // Deactive a pattern set [MouseJstr]
BUILDIN_DEF(deletepset,"i"), // Delete a pattern set [MouseJstr]
+ BUILDIN_DEF(dressroom,"?"),
BUILDIN_DEF(pcre_match,"ss"),
BUILDIN_DEF(dispbottom,"s?"), //added from jA [Lupus]
BUILDIN_DEF(getusersname,""),
@@ -24599,6 +24644,10 @@ void script_hardcoded_constants(void)
script->set_constant("ITEMUPPER_THIRDBABY", ITEMUPPER_THIRDBABY, false, false);
script->set_constant("ITEMUPPER_ALL", ITEMUPPER_ALL, false, false);
+ script->constdb_comment("dressroom modes");
+ script->set_constant("DRESSROOM_OPEN", DRESSROOM_OPEN, false, false);
+ script->set_constant("DRESSROOM_CLOSE", DRESSROOM_CLOSE, false, false);
+
script->constdb_comment("Renewal");
#ifdef RENEWAL
script->set_constant("RENEWAL", 1, false, false);