summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-25 02:54:24 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-25 02:54:24 +0300
commit2fa664c6c3aa7b6a83283bd9fc040cb65a332734 (patch)
tree6b17283ef1f8022fa6454ae8c709501974cd1eed
parentc9795055ee1b6079ef9b0c0e3faf4bb79704bd98 (diff)
downloadmanaplus-2fa664c6c3aa7b6a83283bd9fc040cb65a332734.tar.gz
manaplus-2fa664c6c3aa7b6a83283bd9fc040cb65a332734.tar.bz2
manaplus-2fa664c6c3aa7b6a83283bd9fc040cb65a332734.tar.xz
manaplus-2fa664c6c3aa7b6a83283bd9fc040cb65a332734.zip
Add homunculus attributes. Set homunculus attributes from server.
-rw-r--r--src/enums/being/attributes.h23
-rw-r--r--src/net/eathena/homunculusrecv.cpp48
2 files changed, 56 insertions, 15 deletions
diff --git a/src/enums/being/attributes.h b/src/enums/being/attributes.h
index ca4f0289b..e8bf69b51 100644
--- a/src/enums/being/attributes.h
+++ b/src/enums/being/attributes.h
@@ -26,6 +26,7 @@
enumStart(Attributes)
{
+ // player attributes
PLAYER_LEVEL = 0,
PLAYER_HP,
PLAYER_MAX_HP,
@@ -61,6 +62,28 @@ enumStart(Attributes)
PLAYER_ATK,
CART_TOTAL_WEIGHT = 1000,
CART_MAX_WEIGHT,
+
+ // homunculus attributes
+ HOMUN_LEVEL,
+ HOMUN_HP,
+ HOMUN_MAX_HP,
+ HOMUN_MP,
+ HOMUN_MAX_MP,
+ HOMUN_EXP,
+ HOMUN_EXP_NEEDED,
+ HOMUN_SKILL_POINTS,
+ HOMUN_ATTACK_DELAY,
+ HOMUN_ATTACK_RANGE,
+ HOMUN_WALK_SPEED,
+ HOMUN_ATTACK_SPEED,
+ HOMUN_CRIT,
+ HOMUN_FLEE,
+ HOMUN_HIT,
+ HOMUN_MDEF,
+ HOMUN_MATK,
+ HOMUN_DEF,
+ HOMUN_ATK,
+
MAX_ATTRIBUTE
}
enumEnd(Attributes);
diff --git a/src/net/eathena/homunculusrecv.cpp b/src/net/eathena/homunculusrecv.cpp
index 54c585424..c836e07bb 100644
--- a/src/net/eathena/homunculusrecv.cpp
+++ b/src/net/eathena/homunculusrecv.cpp
@@ -113,25 +113,43 @@ void HomunculusRecv::processHomunculusInfo(Net::MessageIn &msg)
const std::string name = msg.readString(24, "name");
msg.readUInt8("flags"); // 0x01 - renamed, 0x02 - vaporize, 0x04 - alive
const int level = msg.readInt16("level");
+ PlayerInfo::setAttribute(Attributes::HOMUN_LEVEL, level);
const int hungry = msg.readInt16("hungry");
const int intimacy = msg.readInt16("intimacy");
const int equip = msg.readInt16("equip");
- msg.readInt16("atk");
- msg.readInt16("matk");
- msg.readInt16("hit");
- msg.readInt16("luk/3 or crit/10");
- msg.readInt16("def");
- msg.readInt16("mdef");
- msg.readInt16("flee");
- msg.readInt16("attack speed");
- msg.readInt16("hp");
- msg.readInt16("max hp");
- msg.readInt16("sp");
- msg.readInt16("max sp");
- msg.readInt32("exp");
- msg.readInt32("next exp");
- msg.readInt16("skill points");
+ PlayerInfo::setAttribute(Attributes::HOMUN_ATK,
+ msg.readInt16("atk"));
+ PlayerInfo::setAttribute(Attributes::HOMUN_MATK,
+ msg.readInt16("matk"));
+ PlayerInfo::setAttribute(Attributes::HOMUN_HIT,
+ msg.readInt16("hit"));
+ PlayerInfo::setAttribute(Attributes::HOMUN_CRIT,
+ msg.readInt16("luk/3 or crit/10"));
+ PlayerInfo::setAttribute(Attributes::HOMUN_DEF,
+ msg.readInt16("def"));
+ PlayerInfo::setAttribute(Attributes::HOMUN_MDEF,
+ msg.readInt16("mdef"));
+ PlayerInfo::setAttribute(Attributes::HOMUN_FLEE,
+ msg.readInt16("flee"));
+ PlayerInfo::setAttribute(Attributes::HOMUN_ATTACK_DELAY,
+ msg.readInt16("attack speed"));
+ PlayerInfo::setAttribute(Attributes::HOMUN_HP,
+ msg.readInt16("hp"));
+ PlayerInfo::setAttribute(Attributes::HOMUN_MAX_HP,
+ msg.readInt16("max hp"));
+ PlayerInfo::setAttribute(Attributes::HOMUN_MP,
+ msg.readInt16("sp"));
+ PlayerInfo::setAttribute(Attributes::HOMUN_MAX_MP,
+ msg.readInt16("max sp"));
+ PlayerInfo::setAttribute(Attributes::HOMUN_EXP,
+ msg.readInt32("exp"));
+ PlayerInfo::setAttribute(Attributes::HOMUN_EXP_NEEDED,
+ msg.readInt32("next exp"));
+ PlayerInfo::setAttribute(Attributes::HOMUN_SKILL_POINTS,
+ msg.readInt16("skill points"));
const int range = msg.readInt16("attack range");
+ PlayerInfo::setAttribute(Attributes::HOMUN_ATTACK_RANGE,
+ range);
HomunculusInfo *const info = PlayerInfo::getHomunculus();
if (!info) // we can't find homunculus being because id is missing