summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-27 15:56:15 +0300
committerAndrei Karas <akaras@inbox.ru>2013-05-27 15:56:15 +0300
commit9cc52ed1177302c5f43b1eac165a23548f256499 (patch)
tree6bf2adfb938a85ff40afff4a40913476e937aa42
parent735a152850846b203a3696c6644cf299f2093196 (diff)
downloadmv-9cc52ed1177302c5f43b1eac165a23548f256499.tar.gz
mv-9cc52ed1177302c5f43b1eac165a23548f256499.tar.bz2
mv-9cc52ed1177302c5f43b1eac165a23548f256499.tar.xz
mv-9cc52ed1177302c5f43b1eac165a23548f256499.zip
Fix spawn of disguised mobs.
-rw-r--r--src/net/eathena/beinghandler.cpp31
-rw-r--r--src/net/tmwa/beinghandler.cpp50
2 files changed, 51 insertions, 30 deletions
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<uint32_t>(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<uint32_t>(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<uint8_t>(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)