summaryrefslogtreecommitdiff
path: root/src/net/ea/beinghandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-10-10 01:36:09 +0300
committerAndrei Karas <akaras@inbox.ru>2011-10-10 01:36:09 +0300
commit994ce665a9a32899a0f7efadf1253faa9a3cdbed (patch)
treeb46d2bbf36d85143c95f35c987817ca3f1d25fab /src/net/ea/beinghandler.cpp
parent2d449d99cc4b42faf246bd24a87ec76da1363e41 (diff)
downloadmanaplus-994ce665a9a32899a0f7efadf1253faa9a3cdbed.tar.gz
manaplus-994ce665a9a32899a0f7efadf1253faa9a3cdbed.tar.bz2
manaplus-994ce665a9a32899a0f7efadf1253faa9a3cdbed.tar.xz
manaplus-994ce665a9a32899a0f7efadf1253faa9a3cdbed.zip
Add support for reading monsters attack range.
Tmw server not supported.
Diffstat (limited to 'src/net/ea/beinghandler.cpp')
-rw-r--r--src/net/ea/beinghandler.cpp34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index 2ac1f87c5..8fca76353 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -209,14 +209,22 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible)
if (dstBeing->getType() == ActorSprite::MONSTER)
{
- int hp = msg.readInt32();
- int maxHP = msg.readInt32();
- if (hp && maxHP)
+ if (serverVersion > 0)
{
- int oldHP = dstBeing->getHP();
- if (!oldHP || oldHP > hp)
- dstBeing->setHP(hp);
- dstBeing->setMaxHP(maxHP);
+ int hp = msg.readInt32();
+ int maxHP = msg.readInt32();
+ if (hp && maxHP)
+ {
+ int oldHP = dstBeing->getHP();
+ if (!oldHP || oldHP > hp)
+ dstBeing->setHP(hp);
+ dstBeing->setMaxHP(maxHP);
+ }
+ }
+ else
+ {
+ msg.readInt32();
+ msg.readInt32();
}
gloves = 0;
}
@@ -236,14 +244,22 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, bool visible)
msg.readInt16(); // manner
dstBeing->setStatusEffectBlock(32, msg.readInt16()); // opt3
- msg.readInt8(); // karma
+ if (serverVersion > 0 && dstBeing->getType() == ActorSprite::MONSTER)
+ {
+ int attackRange = msg.readInt8(); // karma
+ dstBeing->setAttackRange(attackRange);
+ }
+ else
+ {
+ msg.readInt8(); // karma
+ }
gender = msg.readInt8();
// reserving bits for future usage
- gender &= 1;
if (dstBeing->getType() == ActorSprite::PLAYER)
{
+ gender &= 1;
dstBeing->setGender((gender == 0) ? GENDER_FEMALE : GENDER_MALE);
// Set these after the gender, as the sprites may be gender-specific
setSprite(dstBeing, EA_SPRITE_HAIR, hairStyle * -1,