From 827bbb15f7a4cc5483b1d0dddb3e40fd208b8880 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 28 Nov 2014 22:26:47 +0300 Subject: eathena: show npc gender based on normal sex id. --- src/net/eathena/beinghandler.cpp | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'src/net/eathena/beinghandler.cpp') diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index d321adc91..7736c5298 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -1034,11 +1034,10 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) dstBeing->setStatusEffectBlock(32, static_cast( msg.readInt32("opt3"))); dstBeing->setKarma(msg.readUInt8("karma")); - uint8_t gender = msg.readUInt8("gender"); + uint8_t gender = msg.readUInt8("gender") & 3; if (dstBeing->getType() == ActorType::Player) { - gender &= 3; dstBeing->setGender(Being::intToGender(gender)); // Set these after the gender, as the sprites may be gender-specific setSprite(dstBeing, SPRITE_HAIR, hairStyle * -1, @@ -1054,7 +1053,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) } else if (dstBeing->getType() == ActorType::Npc) { - setServerGender(dstBeing, gender); + dstBeing->setGender(Being::intToGender(gender)); } uint8_t dir; @@ -1199,11 +1198,10 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) dstBeing->setStatusEffectBlock(32, static_cast( msg.readInt32("opt3"))); dstBeing->setKarma(msg.readUInt8("karma")); - uint8_t gender = msg.readUInt8("gender"); + uint8_t gender = msg.readUInt8("gender") & 3; if (dstBeing->getType() == ActorType::Player) { - gender &= 3; dstBeing->setGender(Being::intToGender(gender)); // Set these after the gender, as the sprites may be gender-specific setSprite(dstBeing, SPRITE_HAIR, hairStyle * -1, @@ -1219,7 +1217,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) } else if (dstBeing->getType() == ActorType::Npc) { - setServerGender(dstBeing, gender); + dstBeing->setGender(Being::intToGender(gender)); } uint16_t srcX, srcY, dstX, dstY; @@ -1366,11 +1364,10 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg) dstBeing->setStatusEffectBlock(32, static_cast( msg.readInt32("opt3"))); dstBeing->setKarma(msg.readUInt8("karma")); - uint8_t gender = msg.readUInt8("gender"); + uint8_t gender = msg.readUInt8("gender") & 3; if (dstBeing->getType() == ActorType::Player) { - gender &= 3; dstBeing->setGender(Being::intToGender(gender)); // Set these after the gender, as the sprites may be gender-specific setSprite(dstBeing, SPRITE_HAIR, hairStyle * -1, @@ -1386,7 +1383,7 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg) } else if (dstBeing->getType() == ActorType::Npc) { - setServerGender(dstBeing, gender); + dstBeing->setGender(Being::intToGender(gender)); } uint8_t dir; @@ -1726,22 +1723,6 @@ void BeingHandler::processBeingSoundEffect(Net::MessageIn &msg) msg.readInt32("source being id"); } -void BeingHandler::setServerGender(Being *const being, const uint8_t gender) -{ - switch (gender) - { - case 2: - being->setGender(Gender::FEMALE); - break; - case 3: - being->setGender(Gender::MALE); - break; - default: - being->setGender(Gender::UNSPECIFIED); - break; - } -} - void BeingHandler::applyPlayerAction(Being *const being, const uint8_t type) { switch (type) -- cgit v1.2.3-70-g09d2