diff options
author | Haru <haru@dotalux.com> | 2020-02-09 23:10:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-09 23:10:59 +0100 |
commit | 1a0619fcedf573c7004489470f169e112fa1bb62 (patch) | |
tree | 47b502114376a2a8cd59604731703b93504fb4e5 /src/map | |
parent | 66b624165ba2e7c868b38081230a61691be447df (diff) | |
parent | 7510db3f7b8990bbbcebcb1c3de8d20f8f27d011 (diff) | |
download | hercules-1a0619fcedf573c7004489470f169e112fa1bb62.tar.gz hercules-1a0619fcedf573c7004489470f169e112fa1bb62.tar.bz2 hercules-1a0619fcedf573c7004489470f169e112fa1bb62.tar.xz hercules-1a0619fcedf573c7004489470f169e112fa1bb62.zip |
Merge pull request #2586 from Asheraf/madostatueffect
Implement support for switching madogear type
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 11 | ||||
-rw-r--r-- | src/map/pc.c | 12 | ||||
-rw-r--r-- | src/map/pc.h | 2 | ||||
-rw-r--r-- | src/map/script.c | 19 | ||||
-rw-r--r-- | src/map/script.h | 12 | ||||
-rw-r--r-- | src/map/skill.c | 2 | ||||
-rw-r--r-- | src/map/status.c | 3 | ||||
-rw-r--r-- | src/map/status.h | 1 |
8 files changed, 53 insertions, 9 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index c9191d27d..707522423 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -4212,12 +4212,19 @@ ACMD(mount_peco) return true; } if ((sd->job & MAPID_THIRDMASK) == MAPID_MECHANIC) { + int mtype = MADO_ROBOT; + if (!*message) + sscanf(message, "%d", &mtype); + if (mtype < MADO_ROBOT || mtype >= MADO_MAX) { + clif->message(fd, msg_fd(fd, 173)); // Please enter a valid madogear type. + return false; + } if (!pc_ismadogear(sd)) { clif->message(sd->fd,msg_fd(fd,1123)); // You have mounted your Mado Gear. - pc->setmadogear(sd, true); + pc->setmadogear(sd, true, (enum mado_type)mtype); } else { clif->message(sd->fd,msg_fd(fd,1124)); // You have released your Mado Gear. - pc->setmadogear(sd, false); + pc->setmadogear(sd, false, (enum mado_type)mtype); } return true; } diff --git a/src/map/pc.c b/src/map/pc.c index c4f9d8be0..9d2816f3d 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -9345,15 +9345,23 @@ static void pc_setridingpeco(struct map_session_data *sd, bool flag) * * @param sd Target player. * @param flag New state. + * @param mtype Type of the mado gear. **/ -static void pc_setmadogear(struct map_session_data *sd, bool flag) +static void pc_setmadogear(struct map_session_data *sd, bool flag, enum mado_type mtype) { nullpo_retv(sd); + Assert_retv(mtype >= MADO_ROBOT && mtype < MADO_MAX); + if (flag) { - if ((sd->job & MAPID_THIRDMASK) == MAPID_MECHANIC) + if ((sd->job & MAPID_THIRDMASK) == MAPID_MECHANIC) { pc->setoption(sd, sd->sc.option|OPTION_MADOGEAR); +#if PACKETVER_MAIN_NUM >= 20191120 || PACKETVER_RE_NUM >= 20191106 + sc_start(&sd->bl, &sd->bl, SC_MADOGEAR, 100, (int)mtype, INFINITE_DURATION); +#endif + } } else if (pc_ismadogear(sd)) { pc->setoption(sd, sd->sc.option&~OPTION_MADOGEAR); + // pc->setoption resets status effects when changing mado, no need to re do it here. } } diff --git a/src/map/pc.h b/src/map/pc.h index f4f0044a9..a3a3ee48d 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -1037,7 +1037,7 @@ END_ZEROED_BLOCK; /* End */ int (*setcart) (struct map_session_data* sd, int type); void (*setfalcon) (struct map_session_data *sd, bool flag); void (*setridingpeco) (struct map_session_data *sd, bool flag); - void (*setmadogear) (struct map_session_data *sd, bool flag); + void (*setmadogear) (struct map_session_data *sd, bool flag, enum mado_type mtype); void (*setridingdragon) (struct map_session_data *sd, unsigned int type); void (*setridingwug) (struct map_session_data *sd, bool flag); int (*changelook) (struct map_session_data *sd,int type,int val); diff --git a/src/map/script.c b/src/map/script.c index 875f193eb..b77e6a376 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -10694,6 +10694,7 @@ static BUILDIN(checkmount) /** * Mounts or dismounts a combat mount. * + * setmount <flag>, <mtype>; * setmount <flag>; * setmount; * @@ -10712,6 +10713,8 @@ static BUILDIN(checkmount) * If an invalid value or no flag is specified, the appropriate mount is * auto-detected. As a result of this, there is no need to specify a flag at * all, unless it is a dragon color other than green. + * + * In newer clients you can specify the mado gear type though the mtype argument. */ static BUILDIN(setmount) { @@ -10724,6 +10727,12 @@ static BUILDIN(setmount) if (script_hasdata(st,2)) flag = script_getnum(st,2); + enum mado_type mtype = script_hasdata(st, 3) ? script_getnum(st, 3) : MADO_ROBOT; + if (mtype < MADO_ROBOT || mtype >= MADO_MAX) { + ShowError("script_setmount: Invalid mado type has been passed (%d).\n", flag); + return false; + } + // Color variants for Rune Knight dragon mounts. if (flag != SETMOUNT_TYPE_NONE) { if (flag < SETMOUNT_TYPE_AUTODETECT || flag >= SETMOUNT_TYPE_MAX) { @@ -10750,7 +10759,7 @@ static BUILDIN(setmount) } else if ((sd->job & MAPID_THIRDMASK) == MAPID_MECHANIC) { // Mechanic (Mado Gear) if (pc->checkskill(sd, NC_MADOLICENCE)) - pc->setmadogear(sd, true); + pc->setmadogear(sd, true, mtype); } else { // Knight / Crusader (Peco Peco) if (pc->checkskill(sd, KN_RIDING)) @@ -10764,7 +10773,7 @@ static BUILDIN(setmount) pc->setridingwug(sd, false); } if (pc_ismadogear(sd)) { - pc->setmadogear(sd, false); + pc->setmadogear(sd, false, mtype); } if (pc_isridingpeco(sd)) { pc->setridingpeco(sd, false); @@ -26732,7 +26741,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(checkcart,""), BUILDIN_DEF(setfalcon,"?"), BUILDIN_DEF(checkfalcon,""), - BUILDIN_DEF(setmount,"?"), + BUILDIN_DEF(setmount,"??"), BUILDIN_DEF(checkmount,""), BUILDIN_DEF(checkwug,""), BUILDIN_DEF(savepoint,"sii"), @@ -27825,6 +27834,10 @@ static void script_hardcoded_constants(void) script->set_constant("GUILDINFO_MASTER_NAME", GUILDINFO_MASTER_NAME, false, false); script->set_constant("GUILDINFO_MASTER_CID", GUILDINFO_MASTER_CID, false, false); + script->constdb_comment("madogear types"); + script->set_constant("MADO_ROBOT", MADO_ROBOT, false, false); + script->set_constant("MADO_SUITE", MADO_SUITE, false, false); + script->constdb_comment("Renewal"); #ifdef RENEWAL script->set_constant("RENEWAL", 1, false, false); diff --git a/src/map/script.h b/src/map/script.h index 00a206ce3..8d7669d68 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -553,6 +553,18 @@ enum siege_type { }; /** + * Types of MadoGear + */ +enum mado_type { + MADO_ROBOT = 0x00, + // unused = 0x01, + MADO_SUITE = 0x02, +#ifndef MADO_MAX + MADO_MAX +#endif +}; + +/** * Structures **/ diff --git a/src/map/skill.c b/src/map/skill.c index ede3a4c52..0f0a72dce 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -9454,7 +9454,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list * case NC_SELFDESTRUCTION: if (sd) { if (pc_ismadogear(sd)) - pc->setmadogear(sd, false); + pc->setmadogear(sd, false, MADO_ROBOT); clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); skill->castend_damage_id(src, src, skill_id, skill_lv, tick, flag); status->set_sp(src, 0, STATUS_HEAL_DEFAULT); diff --git a/src/map/status.c b/src/map/status.c index 3b99b99b8..1f0f31119 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -9798,6 +9798,9 @@ static int status_get_val_flag(enum sc_type type) case SC_DAILYSENDMAILCNT: val_flag |= 1 | 2; break; + case SC_MADOGEAR: + val_flag |= 1; + break; } return val_flag; } diff --git a/src/map/status.h b/src/map/status.h index ecf27d411..ada18bc0a 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -853,6 +853,7 @@ typedef enum sc_type { SC_RESIST_PROPERTY_FIRE, SC_RESIST_PROPERTY_WIND, SC_CLIENT_ONLY_EQUIP_ARROW, + SC_MADOGEAR, #ifndef SC_MAX SC_MAX, //Automatically updated max, used in for's to check we are within bounds. #endif |