summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2020-01-12 20:29:39 +0100
committerGitHub <noreply@github.com>2020-01-12 20:29:39 +0100
commit7391e5d257587ec92b96f6ebbdc77f82072ee23d (patch)
tree16d15357ca2073eb37eca7e02d57ea149a9c65cb
parent5ee3fcc3fc89304b8be221a9cb1406002ce0b0e3 (diff)
parente6199edca8ad4eee32b7e34318f99f365d8520db (diff)
downloadhercules-7391e5d257587ec92b96f6ebbdc77f82072ee23d.tar.gz
hercules-7391e5d257587ec92b96f6ebbdc77f82072ee23d.tar.bz2
hercules-7391e5d257587ec92b96f6ebbdc77f82072ee23d.tar.xz
hercules-7391e5d257587ec92b96f6ebbdc77f82072ee23d.zip
Merge pull request #2606 from Ridley8819/pcblocknpc
Adding PCBLOCK_NPC to setpcblock script command
-rw-r--r--doc/constants.md1
-rw-r--r--doc/script_commands.txt1
-rw-r--r--src/map/clif.c6
-rw-r--r--src/map/pc.h1
-rw-r--r--src/map/script.c7
-rw-r--r--src/map/script.h21
-rw-r--r--src/map/unit.c6
7 files changed, 29 insertions, 14 deletions
diff --git a/doc/constants.md b/doc/constants.md
index bc2a16f52..257696c4e 100644
--- a/doc/constants.md
+++ b/doc/constants.md
@@ -5085,6 +5085,7 @@
- `PCBLOCK_IMMUNE`: 32
- `PCBLOCK_SITSTAND`: 64
- `PCBLOCK_COMMANDS`: 128
+- `PCBLOCK_NPC`: 256
### private airship responds
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 36702b6f1..842968f42 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -6551,6 +6551,7 @@ The <type> listed are a bit mask of the following:
PCBLOCK_IMMUNE
PCBLOCK_SITSTAND
PCBLOCK_COMMANDS
+ PCBLOCK_NPC
Examples:
diff --git a/src/map/clif.c b/src/map/clif.c
index c963c1680..6ba0db2f3 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -11467,7 +11467,9 @@ static void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action
{
struct npc_data *nd = map->id2nd(target_id);
if (nd != NULL) {
- npc->click(sd, nd);
+ if (sd->block_action.npc == 0) { // *pcblock script command
+ npc->click(sd, nd);
+ }
return;
}
@@ -11942,7 +11944,7 @@ static void clif_parse_NpcClicked(int fd, struct map_session_data *sd)
clif->clearunit_area(&sd->bl,CLR_DEAD);
return;
}
- if (sd->npc_id || sd->state.workinprogress & 2) {
+ if (sd->npc_id > 0 || (sd->state.workinprogress & 2) == 2 || sd->block_action.npc == 1) { // *pcblock script command
#if PACKETVER >= 20110308
clif->msgtable(sd, MSG_BUSY);
#else
diff --git a/src/map/pc.h b/src/map/pc.h
index 5957a3319..e44b9cdda 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -635,6 +635,7 @@ END_ZEROED_BLOCK;
unsigned immune : 1;
unsigned sitstand : 1;
unsigned commands : 1;
+ unsigned npc : 1;
} block_action;
/* Achievement System */
diff --git a/src/map/script.c b/src/map/script.c
index ffccd3b59..4319506d3 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -19126,6 +19126,9 @@ static BUILDIN(setpcblock)
if ((type & PCBLOCK_COMMANDS) != 0)
sd->block_action.commands = state;
+ if ((type & PCBLOCK_NPC) != 0)
+ sd->block_action.npc = state;
+
return true;
}
@@ -19163,6 +19166,9 @@ static BUILDIN(checkpcblock)
if (sd->block_action.commands != 0)
retval |= PCBLOCK_COMMANDS;
+ if (sd->block_action.npc != 0)
+ retval |= PCBLOCK_NPC;
+
script_pushint(st, retval);
return true;
}
@@ -27262,6 +27268,7 @@ static void script_hardcoded_constants(void)
script->set_constant("PCBLOCK_IMMUNE", PCBLOCK_IMMUNE, false, false);
script->set_constant("PCBLOCK_SITSTAND", PCBLOCK_SITSTAND, false, false);
script->set_constant("PCBLOCK_COMMANDS", PCBLOCK_COMMANDS, false, false);
+ script->set_constant("PCBLOCK_NPC", PCBLOCK_NPC, false, false);
script->constdb_comment("private airship responds");
script->set_constant("P_AIRSHIP_NONE", P_AIRSHIP_NONE, false, false);
diff --git a/src/map/script.h b/src/map/script.h
index 1cec02b97..7bcb5298c 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -529,16 +529,17 @@ enum script_petinfo_types {
* Player blocking actions related flags.
*/
enum pcblock_action_flag {
- PCBLOCK_NONE = 0x00,
- PCBLOCK_MOVE = 0x01,
- PCBLOCK_ATTACK = 0x02,
- PCBLOCK_SKILL = 0x04,
- PCBLOCK_USEITEM = 0x08,
- PCBLOCK_CHAT = 0x10,
- PCBLOCK_IMMUNE = 0x20,
- PCBLOCK_SITSTAND = 0x40,
- PCBLOCK_COMMANDS = 0x80,
- PCBLOCK_ALL = 0xFF,
+ PCBLOCK_NONE = 0x000,
+ PCBLOCK_MOVE = 0x001,
+ PCBLOCK_ATTACK = 0x002,
+ PCBLOCK_SKILL = 0x004,
+ PCBLOCK_USEITEM = 0x008,
+ PCBLOCK_CHAT = 0x010,
+ PCBLOCK_IMMUNE = 0x020,
+ PCBLOCK_SITSTAND = 0x040,
+ PCBLOCK_COMMANDS = 0x080,
+ PCBLOCK_NPC = 0x100,
+ PCBLOCK_ALL = 0x1FF,
};
/**
diff --git a/src/map/unit.c b/src/map/unit.c
index b9176fa69..d7d95c57b 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1932,8 +1932,10 @@ static int unit_attack(struct block_list *src, int target_id, int continuous)
if (src->type == BL_PC) {
struct map_session_data *sd = BL_UCAST(BL_PC, src);
- if( target->type == BL_NPC ) { // monster npcs [Valaris]
- npc->click(sd, BL_UCAST(BL_NPC, target)); // submitted by leinsirk10 [Celest]
+ if (target->type == BL_NPC) { // monster npcs [Valaris]
+ if (sd->block_action.npc == 0) { // *pcblock script command
+ npc->click(sd, BL_UCAST(BL_NPC, target)); // submitted by leinsirk10 [Celest]
+ }
return 0;
}
if( pc_is90overweight(sd) || pc_isridingwug(sd) ) { // overweight or mounted on warg - stop attacking