diff options
author | Haru <haru@dotalux.com> | 2020-04-05 23:41:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-05 23:41:17 +0200 |
commit | a77dc973845efc6e45c5eea9513f6a161893c201 (patch) | |
tree | 47ac11b91dd4343a3d429b3651dc3c0202a546f3 | |
parent | 413b7bbe5905bdd4ae790b8dce3ef869433e2b25 (diff) | |
parent | 588a8997817621f1bc65c9ccb999d5cda3e3fb4d (diff) | |
download | hercules-a77dc973845efc6e45c5eea9513f6a161893c201.tar.gz hercules-a77dc973845efc6e45c5eea9513f6a161893c201.tar.bz2 hercules-a77dc973845efc6e45c5eea9513f6a161893c201.tar.xz hercules-a77dc973845efc6e45c5eea9513f6a161893c201.zip |
Merge pull request #2668 from Kenpachi2k13/extend_pcblock_commands
Extend *pcblock script commands
-rw-r--r-- | doc/script_commands.txt | 11 | ||||
-rw-r--r-- | src/map/script.c | 13 |
2 files changed, 16 insertions, 8 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 392aa0c1f..3b77aeb2c 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -6575,17 +6575,22 @@ Examples: --------------------------------------- -*setpcblock(<type>,<option>) -*checkpcblock() +*setpcblock(<type>, <option>{, <account id>}) +*checkpcblock({<account id>}) -Prevents the player from doing the following action. +Prevents a character from doing the following action. For setpcblock, when the <option> is true(1) will block them, and false(0) will allow those actions again. +The setpcblock command returns 1 on success or 0 if no character was attached. + The checkpcblock command returned value is a bit mask of the currently enabled block flags (or PCBLOCK_NONE when none is set). +Parameter <account id> is optional for both commands. +If omitted, the currently attached character is used. + The <type> listed are a bit mask of the following: PCBLOCK_NONE (only used by checkpcblock) PCBLOCK_MOVE diff --git a/src/map/script.c b/src/map/script.c index ca13e8861..3d5534a47 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -19263,12 +19263,14 @@ static BUILDIN(pcblockmove) static BUILDIN(setpcblock) { - struct map_session_data *sd = script->rid2sd(st); + struct map_session_data *sd = script_hasdata(st, 4) ? script->id2sd(st, script_getnum(st, 4)) : script->rid2sd(st); enum pcblock_action_flag type = script_getnum(st, 2); int state = (script_getnum(st, 3) > 0) ? 1 : 0; - if (sd == NULL) + if (sd == NULL) { + script_pushint(st, 0); return true; + } if ((type & PCBLOCK_MOVE) != 0) sd->block_action.move = state; @@ -19297,12 +19299,13 @@ static BUILDIN(setpcblock) if ((type & PCBLOCK_NPC) != 0) sd->block_action.npc = state; + script_pushint(st, 1); return true; } static BUILDIN(checkpcblock) { - struct map_session_data *sd = script->rid2sd(st); + struct map_session_data *sd = script_hasdata(st, 2) ? script->id2sd(st, script_getnum(st, 2)) : script->rid2sd(st); int retval = PCBLOCK_NONE; if (sd == NULL) { @@ -27146,8 +27149,8 @@ static void script_parse_builtin(void) BUILDIN_DEF(pcfollow,"ii"), BUILDIN_DEF(pcstopfollow,"i"), BUILDIN_DEF_DEPRECATED(pcblockmove,"ii"), // Deprecated 2018-05-04 - BUILDIN_DEF(setpcblock, "ii"), - BUILDIN_DEF(checkpcblock, ""), + BUILDIN_DEF(setpcblock, "ii?"), + BUILDIN_DEF(checkpcblock, "?"), // <--- [zBuffer] List of player cont commands // [zBuffer] List of mob control commands ---> BUILDIN_DEF(getunittype,"i"), |