summaryrefslogtreecommitdiff
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
parent2f8076f6c51cd969da927d12d6cd89a46899322e (diff)
downloadmanaplus-a4e455a2ce74cac174bf1ae00f4f95e2b65c7374.tar.gz
manaplus-a4e455a2ce74cac174bf1ae00f4f95e2b65c7374.tar.bz2
manaplus-a4e455a2ce74cac174bf1ae00f4f95e2b65c7374.tar.xz
manaplus-a4e455a2ce74cac174bf1ae00f4f95e2b65c7374.zip
eathena: set mercenary name and some other basic stats.
-rw-r--r--src/being/being.cpp4
-rw-r--r--src/net/eathena/mercenaryhandler.cpp17
2 files changed, 15 insertions, 6 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index f52371d78..40d20fe98 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -221,7 +221,7 @@ Being::Being(const int id,
setMap(map);
setSubtype(subtype, 0);
- if (mType == ActorType::Player)
+ if (mType == ActorType::Player || mType == ActorType::Mercenary)
mShowName = config.getBoolValue("visiblenames");
else if (mType != ActorType::Npc)
mGotComment = true;
@@ -838,7 +838,7 @@ void Being::setName(const std::string &name)
{
mName = name;
- if (mType == ActorType::Player && getShowName())
+ if (getShowName())
showName();
}
}
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)