summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-25 03:45:07 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-25 03:45:07 +0300
commitd863f7b334d30cf3dfd22f879a59f66ad4248c3f (patch)
treeb75c3abe3caf3c187c32ea3edeb34c3e3b32ad26
parent2fa664c6c3aa7b6a83283bd9fc040cb65a332734 (diff)
downloadplus-d863f7b334d30cf3dfd22f879a59f66ad4248c3f.tar.gz
plus-d863f7b334d30cf3dfd22f879a59f66ad4248c3f.tar.bz2
plus-d863f7b334d30cf3dfd22f879a59f66ad4248c3f.tar.xz
plus-d863f7b334d30cf3dfd22f879a59f66ad4248c3f.zip
Add mercenary attributes. Set mercenary attributes from server.
-rw-r--r--src/enums/being/attributes.h20
-rw-r--r--src/net/eathena/mercenaryrecv.cpp52
2 files changed, 56 insertions, 16 deletions
diff --git a/src/enums/being/attributes.h b/src/enums/being/attributes.h
index e8bf69b51..0c9225548 100644
--- a/src/enums/being/attributes.h
+++ b/src/enums/being/attributes.h
@@ -84,6 +84,26 @@ enumStart(Attributes)
HOMUN_DEF,
HOMUN_ATK,
+ // mercenary attributes
+ MERC_LEVEL,
+ MERC_HP,
+ MERC_MAX_HP,
+ MERC_MP,
+ MERC_MAX_MP,
+ MERC_ATTACK_DELAY,
+ MERC_ATTACK_RANGE,
+ MERC_CRIT,
+ MERC_FLEE,
+ MERC_HIT,
+ MERC_MDEF,
+ MERC_MATK,
+ MERC_DEF,
+ MERC_ATK,
+ MERC_EXPIRE,
+ MERC_FAITH,
+ MERC_CALLS,
+ MERC_KILLS,
+
MAX_ATTRIBUTE
}
enumEnd(Attributes);
diff --git a/src/net/eathena/mercenaryrecv.cpp b/src/net/eathena/mercenaryrecv.cpp
index a4d98a7e9..5ca5433ae 100644
--- a/src/net/eathena/mercenaryrecv.cpp
+++ b/src/net/eathena/mercenaryrecv.cpp
@@ -51,25 +51,45 @@ void MercenaryRecv::processMercenaryInfo(Net::MessageIn &msg)
// +++ need create if need mercenary being and update stats
Being *const dstBeing = actorManager->findBeing(
msg.readBeingId("being id"));
- msg.readInt16("atk");
- msg.readInt16("matk");
- msg.readInt16("hit");
- msg.readInt16("crit/10");
- msg.readInt16("def");
- msg.readInt16("mdef");
- msg.readInt16("flee");
- msg.readInt16("attack speed");
+ PlayerInfo::setAttribute(Attributes::MERC_ATK,
+ msg.readInt16("atk"));
+ PlayerInfo::setAttribute(Attributes::MERC_MATK,
+ msg.readInt16("matk"));
+ PlayerInfo::setAttribute(Attributes::MERC_HIT,
+ msg.readInt16("hit"));
+ PlayerInfo::setAttribute(Attributes::MERC_CRIT,
+ msg.readInt16("crit/10"));
+ PlayerInfo::setAttribute(Attributes::MERC_DEF,
+ msg.readInt16("def"));
+ PlayerInfo::setAttribute(Attributes::MERC_MDEF,
+ msg.readInt16("mdef"));
+ PlayerInfo::setAttribute(Attributes::MERC_FLEE,
+ msg.readInt16("flee"));
+ PlayerInfo::setAttribute(Attributes::MERC_ATTACK_DELAY,
+ msg.readInt16("attack speed"));
const std::string name = msg.readString(24, "name");
const int level = msg.readInt16("level");
- msg.readInt32("hp");
- msg.readInt32("max hp");
- msg.readInt32("sp");
- msg.readInt32("max sp");
- msg.readInt32("expire time");
- msg.readInt16("faith");
- msg.readInt32("calls");
- msg.readInt32("kills");
+ PlayerInfo::setAttribute(Attributes::MERC_LEVEL,
+ level);
+ PlayerInfo::setAttribute(Attributes::MERC_HP,
+ msg.readInt32("hp"));
+ PlayerInfo::setAttribute(Attributes::MERC_MAX_HP,
+ msg.readInt32("max hp"));
+ PlayerInfo::setAttribute(Attributes::MERC_MP,
+ msg.readInt32("sp"));
+ PlayerInfo::setAttribute(Attributes::MERC_MAX_MP,
+ msg.readInt32("max sp"));
+ PlayerInfo::setAttribute(Attributes::MERC_EXPIRE,
+ msg.readInt32("expire time"));
+ PlayerInfo::setAttribute(Attributes::MERC_FAITH,
+ msg.readInt16("faith"));
+ PlayerInfo::setAttribute(Attributes::MERC_CALLS,
+ msg.readInt32("calls"));
+ PlayerInfo::setAttribute(Attributes::MERC_KILLS,
+ msg.readInt32("kills"));
const int range = msg.readInt16("attack range");
+ PlayerInfo::setAttribute(Attributes::MERC_ATTACK_RANGE,
+ range);
if (dstBeing && localPlayer)
{
MercenaryInfo *const mercenary = new MercenaryInfo;