summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsheraf <acheraf1998@gmail.com>2019-11-24 21:48:24 +0100
committerAsheraf <acheraf1998@gmail.com>2020-01-29 13:20:09 +0100
commite75ecacc2f3b2171a24df6abb089df4f3ecd9ebd (patch)
tree23d1b942aad72770b18aa71f3031f41fb407efda
parentc03722679a01e5f181c2138565e95a6b0981a124 (diff)
downloadhercules-e75ecacc2f3b2171a24df6abb089df4f3ecd9ebd.tar.gz
hercules-e75ecacc2f3b2171a24df6abb089df4f3ecd9ebd.tar.bz2
hercules-e75ecacc2f3b2171a24df6abb089df4f3ecd9ebd.tar.xz
hercules-e75ecacc2f3b2171a24df6abb089df4f3ecd9ebd.zip
Implement support for switching madogear type
-rw-r--r--conf/messages.conf2
-rw-r--r--db/constants.conf2
-rw-r--r--db/sc_config.conf11
-rw-r--r--doc/script_commands.txt8
-rw-r--r--src/map/atcommand.c11
-rw-r--r--src/map/pc.c12
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/script.c19
-rw-r--r--src/map/script.h12
-rw-r--r--src/map/skill.c2
-rw-r--r--src/map/status.c3
-rw-r--r--src/map/status.h1
12 files changed, 74 insertions, 11 deletions
diff --git a/conf/messages.conf b/conf/messages.conf
index b91b03921..bb96b7ebc 100644
--- a/conf/messages.conf
+++ b/conf/messages.conf
@@ -191,7 +191,7 @@
170: The item is not equippable.
171: %d - void
172: Speed returned to normal.
-//173 FREE
+173: Please enter a valid madogear type.
174: Number of status points changed.
175: Number of skill points changed.
176: Current amount of zeny changed.
diff --git a/db/constants.conf b/db/constants.conf
index f76f2ea6a..6f87b2d51 100644
--- a/db/constants.conf
+++ b/db/constants.conf
@@ -1416,6 +1416,7 @@ constants_db: {
SC_RESIST_PROPERTY_FIRE: 666
SC_RESIST_PROPERTY_WIND: 667
SC_CLIENT_ONLY_EQUIP_ARROW: 668
+ SC_MADOGEAR: 669
comment__: "Emotes"
e_gasp: 0
@@ -4730,4 +4731,5 @@ constants_db: {
SI_FRESHSHRIMP: 921
SI_SUHIDE: 933
SI_SPRITEMABLE: 937
+ SI_MADOGEAR: 1149
}
diff --git a/db/sc_config.conf b/db/sc_config.conf
index 1d8f50e1c..2520fc595 100644
--- a/db/sc_config.conf
+++ b/db/sc_config.conf
@@ -3664,3 +3664,14 @@ SC_SV_ROOTTWIST: {
NoBoss: true
}
}
+SC_MADOGEAR: {
+ Visible: true
+ Flags: {
+ NoDeathReset: true
+ NoDispelReset: true
+ NoClearanceReset: true
+ NoAllReset: true
+ NoBoss: true
+ }
+ Icon: "SI_MADOGEAR"
+}
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 1d8ed786b..243d91dfa 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -4378,7 +4378,7 @@ falcon and false if they don't.
---------------------------------------
-*setmount({<flag>})
+*setmount({<flag>{, <type>}})
*checkmount()
If <flag> is MOUNT_NONE this command will remove the mount from the
@@ -4414,6 +4414,12 @@ The following flag values are accepted:
Unlike 'setfalcon' and 'setcart' this will not work at all if they aren't of a
class which can ride a mount.
+For clients PACKETVER_MAIN_NUM >= 20191120 || PACKETVER_RE_NUM >= 20191106
+you can pass a <type> flag which specifies the madogear wanted.
+The Available types:
+ MADO_ROBOT
+ MADO_SUITE
+
The accompanying function will return MOUNT_NONE if the invoking
character is not on a mount, and a non-zero value (according to the
above constants) if they are.
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 3cd26079d..d6b6100be 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 26bd678fe..6eba1e36a 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);
@@ -26363,7 +26372,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"),
@@ -27449,6 +27458,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 d652f2155..f48c485f0 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 4579b2ea7..f34998dab 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -9433,7 +9433,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