From a4e455a2ce74cac174bf1ae00f4f95e2b65c7374 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 20 Sep 2014 15:07:13 +0300 Subject: eathena: set mercenary name and some other basic stats. --- src/net/eathena/mercenaryhandler.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/net') 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) -- cgit v1.2.3-70-g09d2