Added pcblock and checkpcblock script commands. (#3951)

* Added getpcblock and setpcblock script commands.
* Added the docs
* Added the message 'This action is currently blocked.' when the player attempts to perform the following blocked actions
* PCBLOCK_USEITEM
* PCBLOCK_SITSTAND
* PCBLOCK_NPCCLICK
* The actions blocked are saved in state.block_action
* Click to the npc returns the WORK_IN_PROGRESS message when PCBLOCK_NPCCLICK is enabled
* Blocked action and reload script.
The player will return to his/her original state after reload script.

Thanks to @aleos89, @Lemongrass3110, @secretdataz
This commit is contained in:
Atemo
2019-03-26 16:18:59 +01:00
committed by Jittapan Pluemsumran
parent 7cc8c96467
commit 3e0d3d2fe6
14 changed files with 169 additions and 19 deletions

View File

@@ -6133,6 +6133,55 @@ Examples:
---------------------------------------
*setpcblock <type>{,<account ID>};
*getpcblock {<account ID>};
'setpcblock' command prevents/allows the player from doing the given <type> of action
during the player session (note: @reloadscript also removes all <type>).
The <type> values are bit-masks, multiples of <type> can be added to change the player 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
Examples:
// Make the attached player invulnerable to monster (same as @monsterignore)
setpcblock (getpcblock() & PCBLOCK_IMMUNE);
// Prevents the attached player from attacking and using skills
setpcblock (getpcblock() & (PCBLOCK_ATTACK|PCBLOCK_SKILL));
// Re-enables attack, skills and item use
setpcblock (getpcblock() & ~(PCBLOCK_ATTACK|PCBLOCK_SKILL|PCBLOCK_USEITEM));
// getpcblock related checks
if (getpcblock() & PCBLOCK_IMMUNE)
mes "You are invulnerable!";
if (getpcblock() & (PCBLOCK_MOVE|PCBLOCK_SITSTAND))
mes "You can't walk or sit.";
if ((getpcblock() & (PCBLOCK_ATTACK|PCBLOCK_SKILL)) == 0)
mes "You can attack and use skills.";
if (getpcblock() & PCBLOCK_CHAT)
mes "You can't chat.";
---------------------------------------
==================================
|5.- Mob / NPC -related commands.|
==================================