Pārlūkot izejas kodu

Implementing atcommand_disable_npc config (#4043)

Sader Fawall 6 gadi atpakaļ
vecāks
revīzija
c2abd6d1fe
6 mainītis faili ar 11 papildinājumiem un 3 dzēšanām
  1. 6 0
      conf/battle/gm.conf
  2. 1 1
      conf/groups.conf
  3. 1 1
      doc/script_commands.txt
  4. 1 0
      src/map/battle.cpp
  5. 1 0
      src/map/battle.hpp
  6. 1 1
      src/map/script.cpp

+ 6 - 0
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

+ 1 - 1
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

+ 1 - 1
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'.
 
 ---------------------------------------
 //

+ 1 - 0
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,              },

+ 1 - 0
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;

+ 1 - 1
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);