diff options
author | Emistry Haoyan <equinox1991@gmail.com> | 2020-03-08 05:18:26 +0800 |
---|---|---|
committer | Emistry Haoyan <equinox1991@gmail.com> | 2020-07-06 00:50:48 +0800 |
commit | d3c24f7d9ae64354e446a85ba0dad21daca589c1 (patch) | |
tree | 194c6e85100d516fe73425f6aed1c72ea05d61fe /src | |
parent | 1dfebbd4966310387357cbddae600418a56df658 (diff) | |
download | hercules-d3c24f7d9ae64354e446a85ba0dad21daca589c1.tar.gz hercules-d3c24f7d9ae64354e446a85ba0dad21daca589c1.tar.bz2 hercules-d3c24f7d9ae64354e446a85ba0dad21daca589c1.tar.xz hercules-d3c24f7d9ae64354e446a85ba0dad21daca589c1.zip |
Add NoPet mapflag
- allow to set nopet mapflag at any maps.
- mapflag to disable pet, and force return to egg.
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 2 | ||||
-rw-r--r-- | src/map/battle.c | 1 | ||||
-rw-r--r-- | src/map/battle.h | 1 | ||||
-rw-r--r-- | src/map/clif.c | 8 | ||||
-rw-r--r-- | src/map/map.c | 13 | ||||
-rw-r--r-- | src/map/map.h | 1 | ||||
-rw-r--r-- | src/map/npc.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 3 | ||||
-rw-r--r-- | src/map/script.h | 3 |
9 files changed, 27 insertions, 7 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 9d5c601bf..c1a717439 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -4101,6 +4101,8 @@ ACMD(mapinfo) strcat(atcmd_output, msg_fd(fd, 1292)); // PrivateAirshipStartable | if (map->list[m_id].flag.pairship_endable) strcat(atcmd_output, msg_fd(fd, 1293)); // PrivateAirshipEndable | + if (map->list[m_id].flag.nopet != 0) + strcat(atcmd_output, msg_fd(fd, 853)); // NoPet | clif->message(fd, atcmd_output); switch (list) { diff --git a/src/map/battle.c b/src/map/battle.c index 689622cf4..a571a555d 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -7100,7 +7100,6 @@ static const struct battle_data { { "pet_max_stats", &battle_config.pet_max_stats, 99, 0, INT_MAX, }, { "pet_max_atk1", &battle_config.pet_max_atk1, 750, 0, INT_MAX, }, { "pet_max_atk2", &battle_config.pet_max_atk2, 1000, 0, INT_MAX, }, - { "pet_disable_in_gvg", &battle_config.pet_no_gvg, 0, 0, 1, }, { "pet_remove_immediately", &battle_config.pet_remove_immediately, 1, 0, 1, }, { "skill_min_damage", &battle_config.skill_min_damage, 2|4, 0, 1|2|4, }, { "finger_offensive_type", &battle_config.finger_offensive_type, 0, 0, 1, }, diff --git a/src/map/battle.h b/src/map/battle.h index f4ad9c556..abf4c0f68 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -228,7 +228,6 @@ struct Battle_Config { int pet_max_stats; //[Skotlex] int pet_max_atk1; //[Skotlex] int pet_max_atk2; //[Skotlex] - int pet_no_gvg; //Disables pets in gvg. [Skotlex] int pet_equip_required; int pet_remove_immediately; diff --git a/src/map/clif.c b/src/map/clif.c index fd84961d9..f44d9a716 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7661,8 +7661,8 @@ static void clif_sendegg(struct map_session_data *sd) nullpo_retv(sd); fd = sd->fd; - if (battle_config.pet_no_gvg && map_flag_gvg2(sd->bl.m)) { //Disable pet hatching in GvG grounds during Guild Wars [Skotlex] - clif->message(fd, msg_sd(sd, 866)); // "Pets are not allowed in Guild Wars." + if (map->list[sd->bl.m].flag.nopet != 0) { + clif->message(fd, msg_sd(sd, 866)); // "Pets are disabled in this map." return; } @@ -10982,8 +10982,8 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) // Spawn pet. if (sd->pd != NULL) { - if (battle_config.pet_no_gvg != 0 && map_flag_gvg2(sd->bl.m)) { // Return the pet to egg. [Skotlex] - clif->message(sd->fd, msg_sd(sd, 866)); // "Pets are not allowed in Guild Wars." + if (map->list[sd->bl.m].flag.nopet != 0) { // Return the pet to egg. [Skotlex] + clif->message(sd->fd, msg_sd(sd, 866)); // Pets are not allowed in Guild Wars. pet->menu(sd, 3); // Option 3 is return to egg. } else { pet->spawn(sd, false); diff --git a/src/map/map.c b/src/map/map.c index 221d60fa4..c88118b43 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -5469,6 +5469,19 @@ static bool map_zone_mf_cache(int m, char *flag, char *params) map_zone_mf_cache_add(m, rflag); } } + } else if (strcmpi(flag, "nopet") == 0) { + if (state == 0) { + if (map->list[m].flag.nopet != 0) { + sprintf(rflag, "nopet\t%d", map->list[m].flag.nopet); + map_zone_mf_cache_add(m, rflag); + } + } + if (sscanf(params, "%d", &state) == 1) { + if (state != map->list[m].flag.nopet) { + sprintf(rflag, "nopet\t%d", state); + map_zone_mf_cache_add(m, rflag); + } + } } return false; diff --git a/src/map/map.h b/src/map/map.h index 17f210bc3..e7c0cb50d 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -799,6 +799,7 @@ struct map_data { unsigned pairship_endable : 1; unsigned nostorage : 2; unsigned nogstorage : 2; + unsigned nopet : 1; uint32 noviewid; ///< noviewid (bitmask - @see enum equip_pos) } flag; struct point save; diff --git a/src/map/npc.c b/src/map/npc.c index 055c1843b..f293a67ac 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -5239,6 +5239,8 @@ static const char *npc_parse_mapflag(const char *w1, const char *w2, const char map->list[m].flag.nostorage = (state) ? cap_value(atoi(w4), 1, 3) : 0; } else if (!strcmpi(w3, "nogstorage")) { map->list[m].flag.nogstorage = (state) ? cap_value(atoi(w4), 1, 3) : 0; + } else if (strcmpi(w3, "nopet") == 0) { + map->list[m].flag.nopet = (state != 0) ? 1 : 0; } else { npc->parse_unknown_mapflag(mapname, w3, w4, start, buffer, filepath, retval); } diff --git a/src/map/script.c b/src/map/script.c index b49844320..6e161bcc6 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -14045,6 +14045,7 @@ static BUILDIN(getmapflag) case MF_PAIRSHIP_ENDABLE: script_pushint(st, map->list[m].flag.pairship_endable); break; case MF_NOSTORAGE: script_pushint(st, map->list[m].flag.nostorage); break; case MF_NOGSTORAGE: script_pushint(st, map->list[m].flag.nogstorage); break; + case MF_NOPET: script_pushint(st, map->list[m].flag.nopet); break; } } @@ -14177,6 +14178,7 @@ static BUILDIN(setmapflag) case MF_PAIRSHIP_ENDABLE: map->list[m].flag.pairship_endable = 1; break; case MF_NOSTORAGE: map->list[m].flag.nostorage = cap_value(val, 0, 3); break; case MF_NOGSTORAGE: map->list[m].flag.nogstorage = cap_value(val, 0, 3); break; + case MF_NOPET: map->list[m].flag.nopet = 1; break; } } @@ -14270,6 +14272,7 @@ static BUILDIN(removemapflag) case MF_NOVIEWID: map->list[m].flag.noviewid = EQP_NONE; break; case MF_NOSTORAGE: map->list[m].flag.nostorage = 0; break; case MF_NOGSTORAGE: map->list[m].flag.nogstorage = 0; break; + case MF_NOPET: map->list[m].flag.nopet = 0; break; } } diff --git a/src/map/script.h b/src/map/script.h index 4bf8c436b..60f403d2d 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -345,7 +345,8 @@ enum { MF_PAIRSHIP_STARTABLE, MF_PAIRSHIP_ENDABLE, MF_NOSTORAGE, - MF_NOGSTORAGE + MF_NOGSTORAGE, + MF_NOPET, }; enum navigation_service { |