summaryrefslogtreecommitdiff
path: root/src/net/eathena/mercenaryhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-20 15:07:13 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-20 15:07:13 +0300
commita4e455a2ce74cac174bf1ae00f4f95e2b65c7374 (patch)
tree46e840678d9274d1f37cc6563320c366c0f4ce8e /src/net/eathena/mercenaryhandler.cpp
parent2f8076f6c51cd969da927d12d6cd89a46899322e (diff)
downloadplus-a4e455a2ce74cac174bf1ae00f4f95e2b65c7374.tar.gz
plus-a4e455a2ce74cac174bf1ae00f4f95e2b65c7374.tar.bz2
plus-a4e455a2ce74cac174bf1ae00f4f95e2b65c7374.tar.xz
plus-a4e455a2ce74cac174bf1ae00f4f95e2b65c7374.zip
eathena: set mercenary name and some other basic stats.
Diffstat (limited to 'src/net/eathena/mercenaryhandler.cpp')
-rw-r--r--src/net/eathena/mercenaryhandler.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/net/eathena/mercenaryhandler.cpp b/src/net/eathena/mercenaryhandler.cpp
index b48a6b39b..0000d0139 100644
--- a/src/net/eathena/mercenaryhandler.cpp
+++ b/src/net/eathena/mercenaryhandler.cpp
@@ -20,8 +20,11 @@
#include "net/eathena/mercenaryhandler.h"
+#include "actormanager.h"
#include "logger.h"
+#include "being/being.h"
+
#include "net/ea/eaprotocol.h"
#include "net/eathena/messageout.h"
@@ -79,7 +82,7 @@ void MercenaryHandler::processMercenaryUpdate(Net::MessageIn &msg)
void MercenaryHandler::processMercenaryInfo(Net::MessageIn &msg)
{
// +++ need create if need mercenary being and update stats
- msg.readInt32("account id"); // owner
+ Being *const dstBeing = actorManager->findBeing(msg.readInt32("being id"));
msg.readInt16("atk");
msg.readInt16("matk");
msg.readInt16("hit");
@@ -88,8 +91,8 @@ void MercenaryHandler::processMercenaryInfo(Net::MessageIn &msg)
msg.readInt16("mdef");
msg.readInt16("flee");
msg.readInt16("attack speed");
- msg.readString(24, "name");
- msg.readInt16("level");
+ const std::string name = msg.readString(24, "name");
+ const int level = msg.readInt16("level");
msg.readInt32("hp");
msg.readInt32("max hp");
msg.readInt32("sp");
@@ -98,7 +101,13 @@ void MercenaryHandler::processMercenaryInfo(Net::MessageIn &msg)
msg.readInt16("faith");
msg.readInt32("calls");
msg.readInt32("kills");
- msg.readInt16("attack range");
+ const int range = msg.readInt16("attack range");
+ if (dstBeing)
+ {
+ dstBeing->setName(name);
+ dstBeing->setLevel(level);
+ dstBeing->setAttackRange(range);
+ }
}
void MercenaryHandler::processMercenarySkills(Net::MessageIn &msg)