瀏覽代碼

Added party config `change_party_leader_samemap` (#1803)

* Added party config `change_party_leader_samemap`
* Prevent changing the party leader if the specified player is not on the same map (Note 1)
* Default is `yes` as official does
* This config will be ignored by `party_changeleader` script command
* Thanks to @aleos89 and @Lemongrass3110

Signed-off-by: Cydh Ramdh <cydh@pservero.com>
Cydh Ramdh 8 年之前
父節點
當前提交
388e699e15
共有 5 個文件被更改,包括 11 次插入0 次删除
  1. 3 0
      conf/battle/party.conf
  2. 1 0
      src/map/battle.c
  3. 1 0
      src/map/battle.h
  4. 1 0
      src/map/clif.h
  5. 5 0
      src/map/party.c

+ 3 - 0
conf/battle/party.conf

@@ -59,3 +59,6 @@ display_party_name: no
 
 // Prevent multiple characters of the same account to join the same party. (Note 1)
 block_account_in_same_party: yes
+
+// Prevent changing the party leader if the specified player is not on the same map (Note 1)
+change_party_leader_samemap: yes

+ 1 - 0
src/map/battle.c

@@ -8381,6 +8381,7 @@ static const struct _battle_data {
 	{ "atcommand_levelup_events",			&battle_config.atcommand_levelup_events,		0,		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,              },
 
 #include "../custom/battle_config_init.inc"
 };

+ 1 - 0
src/map/battle.h

@@ -612,6 +612,7 @@ extern struct Battle_Config
 	int atcommand_levelup_events;
 	int block_account_in_same_party;
 	int tarotcard_equal_chance; //Official or equal chance for each card
+	int change_party_leader_samemap;
 
 #include "../custom/battle_config_struct.inc"
 } battle_config;

+ 1 - 0
src/map/clif.h

@@ -487,6 +487,7 @@ enum clif_messages {
 	ITEM_REUSE_LIMIT = 0x746,
 	WORK_IN_PROGRESS = 0x783,
 	NEED_REINS_OF_MOUNT = 0x78c,
+	PARTY_MASTER_CHANGE_SAME_MAP = 0x82e, ///< "It is only possible to change the party leader while on the same map."
 	MERGE_ITEM_NOT_AVAILABLE = 0x887,
 };
 

+ 5 - 0
src/map/party.c

@@ -790,6 +790,11 @@ int party_changeleader(struct map_session_data *sd, struct map_session_data *tsd
 		ARR_FIND( 0, MAX_PARTY, tmi, p->data[tmi].sd == tsd);
 		if (tmi == MAX_PARTY)
 			return 0; // Shouldn't happen
+
+		if (battle_config.change_party_leader_samemap && p->party.member[mi].map != p->party.member[tmi].map) {
+			clif_msg(sd, PARTY_MASTER_CHANGE_SAME_MAP);
+			return 0;
+		}
 	} else {
 		ARR_FIND(0,MAX_PARTY,mi,p->party.member[mi].leader);