setpcblock script command (#4052)
* Added setpcblock and getpcblock script commands. 'setpcblock' command prevents/allows the player from doing the given type of action. 'getpcblock' command return the bit-mask value of the currently enabled block flags. The available type are: PCBLOCK_MOVE PCBLOCK_ATTACK PCBLOCK_SKILL PCBLOCK_USEITEM PCBLOCK_CHAT PCBLOCK_IMMUNE PCBLOCK_SITSTAND PCBLOCK_COMMANDS PCBLOCK_NPCCLICK PCBLOCK_EMOTION PCBLOCK_ALL Thanks to @sigtus, @secretdataz, @Lemongrass3110 and @aleos89 for the help and reviews ! Credit to https://github.com/HerculesWS/Hercules/pull/842 for the idea.
This commit is contained in:
@@ -984,6 +984,9 @@ int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y)
|
||||
//if(sd->npc_id)
|
||||
// return 1;
|
||||
|
||||
if (sd->state.block_action & PCBLOCK_NPCCLICK)
|
||||
return 0;
|
||||
|
||||
struct map_data *mapdata = map_getmapdata(m);
|
||||
|
||||
for(i=0;i<mapdata->npc_num;i++)
|
||||
@@ -1284,7 +1287,12 @@ int npc_click(struct map_session_data* sd, struct npc_data* nd)
|
||||
//Hidden/Disabled npc.
|
||||
if (nd->class_ < 0 || nd->sc.option&(OPTION_INVISIBLE|OPTION_HIDE))
|
||||
return 1;
|
||||
|
||||
|
||||
if (sd->state.block_action & PCBLOCK_NPCCLICK) {
|
||||
clif_msg(sd, WORK_IN_PROGRESS);
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch(nd->subtype) {
|
||||
case NPCTYPE_SHOP:
|
||||
clif_npcbuysell(sd,nd->bl.id);
|
||||
|
||||
Reference in New Issue
Block a user