Преглед на файлове

Implements MF_NOPETCAPTURE (#6618)

* Fixes #6556.
* Implements the nopetcapture mapflag which is used to stop pet-type monsters from being caught.
Thanks to @RagnaWay and @Lemongras3110!
Aleos преди 3 години
родител
ревизия
84248255b7

+ 1 - 1
conf/msg_conf/map_msg.conf

@@ -695,7 +695,7 @@
 666: Pets are not allowed in Guild Wars.
 667: You're not dead.
 668: Your actual memo positions are:
-//669 free
+669: You can't catch any pet on this map.
 670: You can't leave battleground guilds.
 671: Friend already exists.
 672: Name not found in list.

+ 1 - 1
conf/msg_conf/map_msg_chn.conf

@@ -642,7 +642,7 @@
 666: 公會戰不允許有寵物
 667: 你沒死亡
 668: 你實際儲存點是:
-//669 free
+669: You can't catch any pet on this map.
 670: 你無法離開戰場公會
 671: 這朋友已存在
 672: 該名稱不在清單內

+ 1 - 1
conf/msg_conf/map_msg_frn.conf

@@ -654,7 +654,7 @@
 666: Pets non-autorisés lors d'une guerre entre guilde.
 667: Vous n'êtes pas mort(e).
 668: Votre position memo actuelle est:
-//669 free
+669: You can't catch any pet on this map.
 670: Vous ne pouvez pas quitter votre guilde.
 671: Cette personne est déjà dans votre liste d'ami.
 672: Nom introuvable dans la liste.

+ 1 - 0
conf/msg_conf/map_msg_grm.conf

@@ -573,6 +573,7 @@
 659: Todes Zeitpunkt : ^EE0000%s^000000
 660: Besiegt von
 661: [^EE0000%s^000000]
+669: You can't catch any pet on this map.
 
 681: Rune Knight T
 682: Warlock T

+ 1 - 1
conf/msg_conf/map_msg_idn.conf

@@ -688,7 +688,7 @@
 666: Peliharaan tidak diperbolehkan di Guild Wars.
 667: Kamu tidak mati.
 668: Posisi memomu saat ini adalah:
-//669 kosong
+669: You can't catch any pet on this map.
 670: Kamu tidak dapat meninggalkan guild battleground.
 671: Teman sudah ada.
 672: Nama tidak ditemukan di daftar.

+ 1 - 1
conf/msg_conf/map_msg_por.conf

@@ -699,7 +699,7 @@
 666: Bichinhos de estimação não são permitidos na Guerra de Clãs.
 667: Você não está morto.
 668: Seu ponto de retorno atual é:
-//669 livre
+669: You can't catch any pet on this map.
 670: Você não pode deixar os campos de batalha em uma guerra.
 671: Amigo já existente.
 672: Nome não encontrado na lista.

+ 1 - 1
conf/msg_conf/map_msg_rus.conf

@@ -654,7 +654,7 @@
 666: Питомцы запрещены во время Войны за Империум.
 667: Вы не мертвы.
 668: Ваши текущие точки сохранения:
-//669 НЕ ИСПОЛЬЗУЕТСЯ
+669: You can't catch any pet on this map.
 670: Вы не можете покинуть БГ.
 671: Друг уже добавлен.
 672: Имя не найдено в списке.

+ 1 - 1
conf/msg_conf/map_msg_spn.conf

@@ -689,7 +689,7 @@
 666: Las mascotas están prohibidas en la guerra de clanes.
 667: No estás muerto.
 668: Tus puntos de memorización actuales son los siguientes:
-//669 vacío
+669: You can't catch any pet on this map.
 670: No puedes abandonar un clan especial de battleground.
 671: Ese jugador ya es amigo tuyo.
 672: No se ha encontrado el nombre que has introducido.

+ 1 - 1
conf/msg_conf/map_msg_tha.conf

@@ -648,7 +648,7 @@
 666: ÊѵÇìàÅÕé§äÁèä´é¶Ù¡ÃѺ͹حҵãËé¹Óà¢éÒã¹¾×é¹·Õè Guild Wars.
 667: ¤Ø³äÁèä´éµÒÂ.
 668: µÓá˹觷Õè¤Ø³ä´éºÑ¹·Ö¡äÇéÁմѧ¹Õé:
-//669 free
+669: You can't catch any pet on this map.
 670: ¤Ø³äÁèÊÒÁÒöÍÍ¡¨Ò¡ Guild ä´éã¹¢³ÐÍÂÙèã¹ battleground.
 671: à¾×è͹·ÕèÁÕÍÂÙèáÅéÇ.
 672: äÁ辺ª×èÍã¹ÃÒ¡ÒÃ.

+ 44 - 37
doc/mapflags.txt

@@ -235,6 +235,50 @@ player who has group level below it.
 
 ---------------------------------------
 
+
+*nomapchannelautojoin
+
+Stops players from automatically joining the #map channel on a map.
+
+This only applies if map channels are enabled and 'map_local_channel_autojoin' is true
+in '/conf/channels.conf'.
+
+---------------------------------------
+
+*notomb
+
+Disables MVP tombs from appearing on a map.
+
+---------------------------------------
+
+*nocostume
+
+Disables costume sprites on a map.
+
+This only disables the sprites and not the effect of the items.
+If a player logs out on a nocostume map the costume sprites will also not be shown in the
+character server.
+
+---------------------------------------
+
+*norenewaldroppenalty
+
+Disable renewal drop rate penalty due to level difference on a map.
+
+---------------------------------------
+
+*norenewalexppenalty
+
+Disable renewal experience penalty due to level difference on a map.
+
+---------------------------------------
+
+*nopetcapture
+
+Disable the ability to capture pets on a map.
+
+---------------------------------------
+
 =====================
 | 2. Battle-related |
 =====================
@@ -403,46 +447,9 @@ atcommand is enabled on all maps by default.
 
 ---------------------------------------
 
-*nomapchannelautojoin
-
-Stops players from automatically joining the #map channel on a map.
-
-This only applies if map channels are enabled and 'map_local_channel_autojoin' is true
-in '/conf/channels.conf'.
-
----------------------------------------
-
-*notomb
-
-Disables MVP tombs from appearing on a map.
-
----------------------------------------
-
-*nocostume
-
-Disables costume sprites on a map.
-
-This only disables the sprites and not the effect of the items.
-If a player logs out on a nocostume map the costume sprites will also not be shown in the
-character server.
-
----------------------------------------
-
 *hidemobhpbar
 
 Hides monster's HP bar on a map.
 Ignores config value of 'monster_hp_bars_info'.
 
 ---------------------------------------
-
-*norenewaldroppenalty
-
-Disable renewal drop rate penalty due to level difference on a map.
-
----------------------------------------
-
-*norenewalexppenalty
-
-Disable renewal experience penalty due to level difference on a map.
-
----------------------------------------

+ 1 - 0
src/map/map.hpp

@@ -647,6 +647,7 @@ enum e_mapflag : int16 {
 	MF_NORODEX,
 	MF_NORENEWALEXPPENALTY,
 	MF_NORENEWALDROPPENALTY,
+	MF_NOPETCAPTURE,
 	MF_MAX
 };
 

+ 5 - 0
src/map/pc.cpp

@@ -5843,6 +5843,11 @@ int pc_useitem(struct map_session_data *sd,int n)
 		return 0;/* regardless, effect is not run */
 	}
 
+	if (pet_db_search(id->nameid, PET_CATCH) != nullptr && map_getmapflag(sd->bl.m, MF_NOPETCAPTURE)) {
+		clif_displaymessage(sd->fd, msg_txt(sd, 669)); // You can't catch any pet on this map.
+		return 0;
+	}
+
 	sd->itemid = item.nameid;
 	sd->itemindex = n;
 	if(sd->catch_target_class != PET_CATCH_FAIL) //Abort pet catching.

+ 14 - 0
src/map/pet.cpp

@@ -1219,6 +1219,11 @@ int pet_catch_process1(struct map_session_data *sd,int target_class)
 {
 	nullpo_ret(sd);
 
+	if (map_getmapflag(sd->bl.m, MF_NOPETCAPTURE)) {
+		clif_displaymessage(sd->fd, msg_txt(sd, 669)); // You can't catch any pet on this map.
+		return 0;
+	}
+
 	sd->catch_target_class = target_class;
 	clif_catch_process(sd);
 
@@ -1248,6 +1253,15 @@ int pet_catch_process2(struct map_session_data* sd, int target_id)
 		return 1;
 	}
 
+	if (map_getmapflag(sd->bl.m, MF_NOPETCAPTURE)) {
+		clif_pet_roulette(sd, 0);
+		sd->catch_target_class = PET_CATCH_FAIL;
+		sd->itemid = 0;
+		sd->itemindex = -1;
+		clif_displaymessage(sd->fd, msg_txt(sd, 669)); // You can't catch any pet on this map.
+		return 1;
+	}
+
 	//FIXME: delete taming item here, if this was an item-invoked capture and the item was flagged as delay-consume [ultramage]
 
 	std::shared_ptr<s_pet_db> pet = pet_db.find(md->mob_id);

+ 1 - 0
src/map/script_constants.hpp

@@ -533,6 +533,7 @@
 	export_constant(MF_NORODEX);
 	export_constant(MF_NORENEWALDROPPENALTY);
 	export_constant(MF_NORENEWALEXPPENALTY);
+	export_constant(MF_NOPETCAPTURE);
 
 	/* setcell types */
 	export_constant(CELL_WALKABLE);