diff options
author | gumi <git@gumi.ca> | 2019-08-17 21:34:34 -0400 |
---|---|---|
committer | gumi <git@gumi.ca> | 2020-04-25 14:55:36 -0400 |
commit | db2fa04439ded43b55ca2e7fdc3509ac2041c9fd (patch) | |
tree | 7e3eb6233b25ecdf861c87ecd0ad14e328105c22 /src/emap/pc.c | |
parent | 9e88b3b422781630a18c13e40cda1c5ea7c111e8 (diff) | |
download | evol-hercules-db2fa04439ded43b55ca2e7fdc3509ac2041c9fd.tar.gz evol-hercules-db2fa04439ded43b55ca2e7fdc3509ac2041c9fd.tar.bz2 evol-hercules-db2fa04439ded43b55ca2e7fdc3509ac2041c9fd.tar.xz evol-hercules-db2fa04439ded43b55ca2e7fdc3509ac2041c9fd.zip |
add full support for non-binary gender
Diffstat (limited to 'src/emap/pc.c')
-rw-r--r-- | src/emap/pc.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/emap/pc.c b/src/emap/pc.c index 011743e..5a8b527 100644 --- a/src/emap/pc.c +++ b/src/emap/pc.c @@ -25,6 +25,8 @@ #include "plugins/HPMHooking.h" +#include "ecommon/enum/gender.h" + #include "emap/clif.h" #include "emap/pc.h" #include "emap/send.h" @@ -53,6 +55,51 @@ int64 epc_readparam_pre(const TBL_PC **sdPtr, return 0; } +/** + * change sex without the complicated RO stuff + * @return 1 on success +**/ +static int epc_changesex(TBL_PC *sd, unsigned char sex) +{ + // because this is evol we do not any of the bulky sex change stuff + // since every gender can use every job and every item + switch (sex) { + case GENDER_FEMALE: + case GENDER_MALE: + case GENDER_NONBINARY: + sd->status.sex = sex; + break; + default: + return 0; + } + + // FIXME: there's no way to tell manaplus we changed gender! + //clif->updatestatus(sd, SP_SEX); + + // FIXME: show gender change to other players: + //pc->stop_following(sd); // fixpos + + // TODO: add a packet to manaplus that calls dstBeing->setGender() in ea/beingrecv or modify an existing packet and bump the protocol version + + // tell char server we changed sex + chrif->changesex(sd, 0); + + // XXX: we kick to the char server because we currently can't update in manaplus + eclif_force_charselect(sd); + return 1; +} + +int epc_setparam_pre(TBL_PC **sd, int *type, int64 *val) +{ + if (*type == SP_SEX) + { + int ret = epc_changesex(*sd, *val); + hookStop(); + return ret; + } + return 1; +} + int epc_setregistry_pre(TBL_PC **sdPtr, int64 *reg, int *val) |