From c2abd6d1fe181ca2dfa3daa9010780ba64808755 Mon Sep 17 00:00:00 2001 From: Sader Fawall Date: Fri, 29 Mar 2019 09:32:07 +0200 Subject: [PATCH] Implementing atcommand_disable_npc config (#4043) --- conf/battle/gm.conf | 6 ++++++ conf/groups.conf | 2 +- doc/script_commands.txt | 2 +- src/map/battle.cpp | 1 + src/map/battle.hpp | 1 + src/map/script.cpp | 2 +- 6 files changed, 11 insertions(+), 3 deletions(-) diff --git a/conf/battle/gm.conf b/conf/battle/gm.conf index adaea3c2d4..4e46c95e65 100644 --- a/conf/battle/gm.conf +++ b/conf/battle/gm.conf @@ -34,3 +34,9 @@ atcommand_mobinfo_type: 1 // This option is for @baselevelup and @joblevelup // Default: no atcommand_levelup_events: no + +// Disable atcommands while a player is attached to a npc? (Note 1) +// This can be changed by script commands 'enable_command' and 'disable_command'. +// Anyone with the 'command_enable' permission in the 'conf/group.conf' can bypass this. +// Default: yes +atcommand_disable_npc: yes diff --git a/conf/groups.conf b/conf/groups.conf index 75198f7594..f709776ee9 100644 --- a/conf/groups.conf +++ b/conf/groups.conf @@ -93,7 +93,6 @@ groups: ( trade or party */ can_trade: true can_party: true - command_enable: true attendance: true } }, @@ -284,6 +283,7 @@ groups: ( permissions: { can_trade: true can_party: true + command_enable: true all_skill: false all_equipment: false skill_unconditional: false diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 8b2e30c14e..354c6b474b 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -5354,7 +5354,7 @@ Example: These commands toggle the ability to use atcommand while interacting with an NPC. -The default setting, 'atcommand_enable_npc', is defined in 'conf/battle/gm.conf'. +The default setting, 'atcommand_disable_npc', is defined in 'conf/battle/gm.conf'. --------------------------------------- // diff --git a/src/map/battle.cpp b/src/map/battle.cpp index fc07187a86..ebce77f960 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -8488,6 +8488,7 @@ static const struct _battle_data { { "mvp_exp_reward_message", &battle_config.mvp_exp_reward_message, 0, 0, 1, }, { "can_damage_skill", &battle_config.can_damage_skill, 1, 0, BL_ALL, }, { "atcommand_levelup_events", &battle_config.atcommand_levelup_events, 0, 0, 1, }, + { "atcommand_disable_npc", &battle_config.atcommand_disable_npc, 1, 0, 1, }, { "block_account_in_same_party", &battle_config.block_account_in_same_party, 1, 0, 1, }, { "tarotcard_equal_chance", &battle_config.tarotcard_equal_chance, 0, 0, 1, }, { "change_party_leader_samemap", &battle_config.change_party_leader_samemap, 1, 0, 1, }, diff --git a/src/map/battle.hpp b/src/map/battle.hpp index 87995481ea..3c22e7fb25 100644 --- a/src/map/battle.hpp +++ b/src/map/battle.hpp @@ -623,6 +623,7 @@ struct Battle_Config int mvp_exp_reward_message; int can_damage_skill; //Which BL types can damage traps int atcommand_levelup_events; + int atcommand_disable_npc; int block_account_in_same_party; int tarotcard_equal_chance; //Official or equal chance for each card int change_party_leader_samemap; diff --git a/src/map/script.cpp b/src/map/script.cpp index 328d534132..25a4251c3d 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -4235,7 +4235,7 @@ void script_attach_state(struct script_state* st){ sd->st = st; sd->npc_id = st->oid; sd->npc_item_flag = st->npc_item_flag; // load default. - sd->state.disable_atcommand_on_npc = (!pc_has_permission(sd, PC_PERM_ENABLE_COMMAND)); + sd->state.disable_atcommand_on_npc = battle_config.atcommand_disable_npc && (!pc_has_permission(sd, PC_PERM_ENABLE_COMMAND)); #ifdef SECURE_NPCTIMEOUT if( sd->npc_idle_timer == INVALID_TIMER ) sd->npc_idle_timer = add_timer(gettick() + (SECURE_NPCTIMEOUT_INTERVAL*1000),npc_secure_timeout_timer,sd->bl.id,0);