Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -5085,6 +5085,7 @@
- `PCBLOCK_IMMUNE`: 32
- `PCBLOCK_SITSTAND`: 64
- `PCBLOCK_COMMANDS`: 128
- `PCBLOCK_NPC`: 256

### private airship responds

Expand Down
1 change: 1 addition & 0 deletions doc/script_commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6541,6 +6541,7 @@ The <type> listed are a bit mask of the following:
PCBLOCK_IMMUNE
PCBLOCK_SITSTAND
PCBLOCK_COMMANDS
PCBLOCK_NPC

Examples:

Expand Down
6 changes: 4 additions & 2 deletions src/map/clif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/map/pc.h
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ END_ZEROED_BLOCK;
unsigned immune : 1;
unsigned sitstand : 1;
unsigned commands : 1;
unsigned npc : 1;
} block_action;

/* Achievement System */
Expand Down
7 changes: 7 additions & 0 deletions src/map/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -27228,6 +27234,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);
Expand Down
21 changes: 11 additions & 10 deletions src/map/script.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

/**
Expand Down
6 changes: 4 additions & 2 deletions src/map/unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down