From ecef66ec4e58ac44fe3d144c5157e799173cef91 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 9 Dec 2015 20:14:21 +0300 Subject: Add per char gender into tmwa. --- src/net/tmwa/charserverrecv.cpp | 8 ++++++-- src/net/tmwa/serverfeatures.cpp | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/net/tmwa/charserverrecv.cpp b/src/net/tmwa/charserverrecv.cpp index 6c47f5e05..8f8498a37 100644 --- a/src/net/tmwa/charserverrecv.cpp +++ b/src/net/tmwa/charserverrecv.cpp @@ -34,6 +34,7 @@ #include "net/character.h" #include "net/charserverhandler.h" #include "net/messagein.h" +#include "net/serverfeatures.h" #include "net/ea/token.h" @@ -71,7 +72,6 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg, LocalPlayer *const tempPlayer = new LocalPlayer( msg.readBeingId("account id"), BeingTypeId_zero); - tempPlayer->setGender(token.sex); PlayerInfoBackend &data = character->data; data.mAttributes[Attributes::EXP] = msg.readInt32("exp"); @@ -145,7 +145,11 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg, tempPlayer->setSprite(SPRITE_HEAD_MID, misc2); character->slot = msg.readUInt8("slot"); - msg.readUInt8("unused"); + const uint8_t sex = static_cast(msg.readUInt8("gender")); + if (serverFeatures->haveCreateCharGender()) + tempPlayer->setGender(Being::intToGender(sex)); + else + tempPlayer->setGender(token.sex); } void CharServerRecv::processCharLogin(Net::MessageIn &msg) diff --git a/src/net/tmwa/serverfeatures.cpp b/src/net/tmwa/serverfeatures.cpp index 78d06c523..f3329a66e 100644 --- a/src/net/tmwa/serverfeatures.cpp +++ b/src/net/tmwa/serverfeatures.cpp @@ -116,7 +116,7 @@ bool ServerFeatures::haveAccountOtherGender() const bool ServerFeatures::haveCharOtherGender() const { - return false; + return tmwServerVersion > 0x0f0b17; } bool ServerFeatures::haveMonsterAttackRange() const @@ -181,7 +181,7 @@ bool ServerFeatures::haveNpcWhispers() const bool ServerFeatures::haveCreateCharGender() const { - return false; + return tmwServerVersion > 0x0f0b17; } bool ServerFeatures::haveAttackDirections() const -- cgit v1.2.3-70-g09d2