From 9cc52ed1177302c5f43b1eac165a23548f256499 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 27 May 2013 15:56:15 +0300 Subject: Fix spawn of disguised mobs. --- src/net/eathena/beinghandler.cpp | 31 +++++++++++++++++-------- src/net/tmwa/beinghandler.cpp | 50 ++++++++++++++++++++++++---------------- 2 files changed, 51 insertions(+), 30 deletions(-) (limited to 'src/net') diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 71a098510..633dfff56 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -438,6 +438,9 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, statusEffects |= (static_cast(msg.readInt16())) << 16; // status.options; Aethyra uses this as misc2 const int16_t job = msg.readInt16(); + int disguiseId = 0; + if (id < 110000000 && job >= 1000) + disguiseId = job; Being *dstBeing = actorSpriteManager->findBeing(id); @@ -451,6 +454,12 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, if (!dstBeing) return; } + else if (disguiseId) + { + actorSpriteManager->undelete(dstBeing); + if (serverVersion < 1) + requestNameById(id); + } uint8_t dir = dstBeing->getDirectionDelayed(); if (dir) @@ -502,16 +511,18 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, // reserving bit for future usage dstBeing->setGender(Being::intToGender(msg.readInt8() & 3)); - // Set these after the gender, as the sprites may be gender-specific - dstBeing->setSprite(SPRITE_WEAPON, weapon, "", 1, true); - if (!mHideShield) - dstBeing->setSprite(SPRITE_SHIELD, shield); - dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom); - dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid); - dstBeing->setSprite(SPRITE_HAT, headTop); - dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1, - ItemDB::get(-hairStyle).getDyeColorsString(hairColor)); - + if (!disguiseId) + { + // Set these after the gender, as the sprites may be gender-specific + dstBeing->setSprite(SPRITE_WEAPON, weapon, "", 1, true); + if (!mHideShield) + dstBeing->setSprite(SPRITE_SHIELD, shield); + dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom); + dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid); + dstBeing->setSprite(SPRITE_HAT, headTop); + dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1, + ItemDB::get(-hairStyle).getDyeColorsString(hairColor)); + } player_node->imitateOutfit(dstBeing); if (msgType == 3) diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 35f2ded57..3ef060d96 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -439,9 +439,11 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, statusEffects |= (static_cast(msg.readInt16())) << 16; // status.options; Aethyra uses this as misc2 const int16_t job = msg.readInt16(); + int disguiseId = 0; + if (id < 110000000 && job >= 1000) + disguiseId = job; Being *dstBeing = actorSpriteManager->findBeing(id); - if (!dstBeing) { if (actorSpriteManager->isBlocked(id) == true) @@ -452,6 +454,12 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, if (!dstBeing) return; } + else if (disguiseId) + { + actorSpriteManager->undelete(dstBeing); + if (serverVersion < 1) + requestNameById(id); + } uint8_t dir = dstBeing->getDirectionDelayed(); if (dir) @@ -506,27 +514,29 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, dstBeing->setGender(Being::intToGender( static_cast(msg.readInt8() & 3))); - // Set these after the gender, as the sprites may be gender-specific - dstBeing->setSprite(SPRITE_WEAPON, weapon, "", 1, true); - if (!mHideShield) - dstBeing->setSprite(SPRITE_SHIELD, shield); - if (serverVersion > 0) - { - dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom, - "", colors[0]); - dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid, "", colors[2]); - dstBeing->setSprite(SPRITE_HAT, headTop, "", colors[1]); - } - else + if (!disguiseId) { - dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom); - dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid); - dstBeing->setSprite(SPRITE_HAT, headTop); + // Set these after the gender, as the sprites may be gender-specific + dstBeing->setSprite(SPRITE_WEAPON, weapon, "", 1, true); + if (!mHideShield) + dstBeing->setSprite(SPRITE_SHIELD, shield); + if (serverVersion > 0) + { + dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom, + "", colors[0]); + dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid, "", colors[2]); + dstBeing->setSprite(SPRITE_HAT, headTop, "", colors[1]); + } + else + { + dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, headBottom); + dstBeing->setSprite(SPRITE_TOPCLOTHES, headMid); + dstBeing->setSprite(SPRITE_HAT, headTop); + } + dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1, + ItemDB::get(-hairStyle).getDyeColorsString(hairColor)); + dstBeing->setHairColor(hairColor); } - dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1, - ItemDB::get(-hairStyle).getDyeColorsString(hairColor)); - dstBeing->setHairColor(hairColor); - player_node->imitateOutfit(dstBeing); if (msgType == 3) -- cgit v1.2.3-70-g09d2