From c9a5b5756469661c26e469390980472aac072510 Mon Sep 17 00:00:00 2001
From: Kenpachi Developer <Kenpachi.Developer@gmx.de>
Date: Sat, 28 Mar 2020 00:06:45 +0100
Subject: Add optional paramter <account id> to setpcblock() script command

---
 src/map/script.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/map/script.c b/src/map/script.c
index b8a7979a7..45c1d125e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -19267,7 +19267,7 @@ 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;
 
@@ -27085,7 +27085,7 @@ 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(setpcblock, "ii?"),
 		BUILDIN_DEF(checkpcblock, ""),
 		// <--- [zBuffer] List of player cont commands
 		// [zBuffer] List of mob control commands --->
-- 
cgit v1.2.3-70-g09d2


From 03a2937f7714aa7a4e3f13f8170f6a66e403a077 Mon Sep 17 00:00:00 2001
From: Kenpachi Developer <Kenpachi.Developer@gmx.de>
Date: Sat, 28 Mar 2020 00:10:51 +0100
Subject: Add return values to setpcblock() script command

---
 src/map/script.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/map/script.c b/src/map/script.c
index 45c1d125e..1bb6c5cb3 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -19271,8 +19271,10 @@ static BUILDIN(setpcblock)
 	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;
@@ -19301,6 +19303,7 @@ static BUILDIN(setpcblock)
 	if ((type & PCBLOCK_NPC) != 0)
 		sd->block_action.npc = state;
 
+	script_pushint(st, 1);
 	return true;
 }
 
-- 
cgit v1.2.3-70-g09d2


From 18b3aca223b8383dc51bb33886421196181543af Mon Sep 17 00:00:00 2001
From: Kenpachi Developer <Kenpachi.Developer@gmx.de>
Date: Sat, 28 Mar 2020 00:12:00 +0100
Subject: Add optional paramter <account id> to checkpcblock() script command

---
 src/map/script.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/map/script.c b/src/map/script.c
index 1bb6c5cb3..7b07c9b7b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -19309,7 +19309,7 @@ static BUILDIN(setpcblock)
 
 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) {
@@ -27089,7 +27089,7 @@ static void script_parse_builtin(void)
 		BUILDIN_DEF(pcstopfollow,"i"),
 		BUILDIN_DEF_DEPRECATED(pcblockmove,"ii"), // Deprecated 2018-05-04
 		BUILDIN_DEF(setpcblock, "ii?"),
-		BUILDIN_DEF(checkpcblock, ""),
+		BUILDIN_DEF(checkpcblock, "?"),
 		// <--- [zBuffer] List of player cont commands
 		// [zBuffer] List of mob control commands --->
 		BUILDIN_DEF(getunittype,"i"),
-- 
cgit v1.2.3-70-g09d2


From 588a8997817621f1bc65c9ccb999d5cda3e3fb4d Mon Sep 17 00:00:00 2001
From: Kenpachi Developer <Kenpachi.Developer@gmx.de>
Date: Sat, 28 Mar 2020 00:17:23 +0100
Subject: Update doc/script_commands.txt

---
 doc/script_commands.txt | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 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
-- 
cgit v1.2.3-70-g09d2