summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-06-10 22:46:50 +0300
committerAndrei Karas <akaras@inbox.ru>2013-06-10 22:46:50 +0300
commitb6df3c3999d4be067e7314e3887e583c13ad1624 (patch)
treef7f39237cbf1e08440882c295cf3d7a494a2585a /src/net
parent83a142e6917bed619aeb96e217850299eb2a63be (diff)
downloadmanaplus-b6df3c3999d4be067e7314e3887e583c13ad1624.tar.gz
manaplus-b6df3c3999d4be067e7314e3887e583c13ad1624.tar.bz2
manaplus-b6df3c3999d4be067e7314e3887e583c13ad1624.tar.xz
manaplus-b6df3c3999d4be067e7314e3887e583c13ad1624.zip
add partial support for player looks.
Can get packets from server, but cant draw player.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/beinghandler.cpp9
-rw-r--r--src/net/eathena/beinghandler.cpp6
-rw-r--r--src/net/eathena/charserverhandler.cpp4
-rw-r--r--src/net/tmwa/beinghandler.cpp14
-rw-r--r--src/net/tmwa/charserverhandler.cpp11
5 files changed, 25 insertions, 19 deletions
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index 05b7c348a..ea74bc6a2 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -195,13 +195,12 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg,
if (speed == 0)
speed = 150;
- dstBeing->setWalkSpeed(Vector(speed, speed, 0));
- dstBeing->setSubtype(job);
+ const int hairStyle = msg.readInt8();
+ const int look = msg.readInt8();
+ dstBeing->setSubtype(job, look);
if (dstBeing->getType() == ActorSprite::MONSTER && player_node)
player_node->checkNewName(dstBeing);
-
- const int hairStyle = msg.readInt8();
- msg.readInt8(); // free
+ dstBeing->setWalkSpeed(Vector(speed, speed, 0));
const uint16_t weapon = msg.readInt16();
const uint16_t headBottom = msg.readInt16();
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index 633dfff56..3c85fb352 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -298,7 +298,7 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg,
switch (type)
{
case 0: // change race
- dstBeing->setSubtype(static_cast<uint16_t>(id));
+ dstBeing->setSubtype(static_cast<uint16_t>(id), 0);
break;
case 1: // eAthena LOOK_HAIR
dstBeing->setSpriteID(SPRITE_HAIR, id *-1);
@@ -475,7 +475,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
}
dstBeing->setWalkSpeed(Vector(speed, speed, 0));
- dstBeing->setSubtype(job);
+ dstBeing->setSubtype(job, 0);
const int hairStyle = msg.readInt16();
const uint16_t weapon = msg.readInt16();
@@ -705,7 +705,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg,
speed = 150;
dstBeing->setWalkSpeed(Vector(speed, speed, 0));
- dstBeing->setSubtype(job);
+ dstBeing->setSubtype(job, 0);
if (dstBeing->getType() == ActorSprite::MONSTER && player_node)
player_node->checkNewName(dstBeing);
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index 6fafb3aa0..8c82ed85d 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -154,8 +154,8 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
data.mAttributes[PlayerInfo::MP] = msg.readInt16();
data.mAttributes[PlayerInfo::MAX_MP] = msg.readInt16();
- msg.readInt16(); // speed
- tempPlayer->setSubtype(msg.readInt16()); // class (used for race)
+ msg.readInt16(); // speed
+ tempPlayer->setSubtype(msg.readInt16(), 0); // class (used for race)
const int hairStyle = msg.readInt16();
const uint16_t weapon = msg.readInt16();
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 738a81651..e68e9f80b 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -299,11 +299,17 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg,
switch (type)
{
case 0: // change race
- dstBeing->setSubtype(static_cast<uint16_t>(id));
+ dstBeing->setSubtype(static_cast<uint16_t>(id),
+ dstBeing->getLook());
break;
case 1: // eAthena LOOK_HAIR
- dstBeing->setHairStyle(SPRITE_HAIR, id * -1);
+ {
+ const int look = id / 256;
+ const int hair = id % 256;
+ dstBeing->setHairStyle(SPRITE_HAIR, hair * -1);
+ dstBeing->setLook(look);
break;
+ }
case 2: // Weapon ID in id, Shield ID in id2
dstBeing->setSprite(SPRITE_WEAPON, id, "", 1, true);
if (!mHideShield)
@@ -475,10 +481,10 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
}
dstBeing->setWalkSpeed(Vector(speed, speed, 0));
- dstBeing->setSubtype(job);
const int hairStyle = msg.readInt8();
- msg.readInt8(); // free
+ const int look = msg.readInt8();
+ dstBeing->setSubtype(job, look);
const uint16_t weapon = msg.readInt16();
const uint16_t shield = msg.readInt16();
const uint16_t headBottom = msg.readInt16();
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 10be5edf8..68699e327 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -157,11 +157,12 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
data.mAttributes[PlayerInfo::MP] = msg.readInt16();
data.mAttributes[PlayerInfo::MAX_MP] = msg.readInt16();
- msg.readInt16(); // speed
- tempPlayer->setSubtype(msg.readInt16()); // class (used for race)
+ msg.readInt16(); // speed
+ const int race = msg.readInt16(); // class (used for race)
const int hairStyle = msg.readInt8();
- msg.readInt8(); // free
- const uint16_t weapon = msg.readInt16(); // unused on server. need use?
+ const int look = msg.readInt8();
+ tempPlayer->setSubtype(race, look);
+ const uint16_t weapon = msg.readInt16(); // unused on server. need use?
tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", 1, true);
data.mAttributes[PlayerInfo::LEVEL] = msg.readInt16();
@@ -258,7 +259,7 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot,
outMsg.writeInt8(static_cast<int8_t>(hairColor));
outMsg.writeInt8(0); // unused
outMsg.writeInt8(static_cast<int8_t>(hairstyle));
- outMsg.writeInt8(0); // unused
+ outMsg.writeInt8(123); // look
if (serverVersion >= 2)
outMsg.writeInt8(race);
}