summaryrefslogtreecommitdiff
path: root/src/net/eathena/homunculusrecv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/eathena/homunculusrecv.cpp')
-rw-r--r--src/net/eathena/homunculusrecv.cpp104
1 files changed, 85 insertions, 19 deletions
diff --git a/src/net/eathena/homunculusrecv.cpp b/src/net/eathena/homunculusrecv.cpp
index 3ea57cdbb..95117e967 100644
--- a/src/net/eathena/homunculusrecv.cpp
+++ b/src/net/eathena/homunculusrecv.cpp
@@ -111,7 +111,7 @@ void HomunculusRecv::processHomunculusData(Net::MessageIn &msg)
}
}
-void HomunculusRecv::processHomunculusInfo(Net::MessageIn &msg)
+void HomunculusRecv::processHomunculusInfo1(Net::MessageIn &msg)
{
if (actorManager == nullptr)
return;
@@ -148,24 +148,90 @@ void HomunculusRecv::processHomunculusInfo(Net::MessageIn &msg)
PlayerInfo::setStatBase(Attributes::HOMUN_ATTACK_DELAY,
msg.readInt16("attack speed"),
Notify_true);
- if (msg.getVersion() >= 20150513)
- {
- PlayerInfo::setStatBase(Attributes::HOMUN_HP,
- msg.readInt32("hp"),
- Notify_true);
- PlayerInfo::setStatBase(Attributes::HOMUN_MAX_HP,
- msg.readInt32("max hp"),
- Notify_true);
- }
- else
- {
- PlayerInfo::setStatBase(Attributes::HOMUN_HP,
- msg.readInt16("hp"),
- Notify_true);
- PlayerInfo::setStatBase(Attributes::HOMUN_MAX_HP,
- msg.readInt16("max hp"),
- Notify_true);
- }
+ PlayerInfo::setStatBase(Attributes::HOMUN_HP,
+ msg.readInt16("hp"),
+ Notify_true);
+ PlayerInfo::setStatBase(Attributes::HOMUN_MAX_HP,
+ msg.readInt16("max hp"),
+ Notify_true);
+ PlayerInfo::setStatBase(Attributes::HOMUN_MP,
+ msg.readInt16("sp"),
+ Notify_true);
+ PlayerInfo::setStatBase(Attributes::HOMUN_MAX_MP,
+ msg.readInt16("max sp"),
+ Notify_true);
+ PlayerInfo::setStatBase(Attributes::HOMUN_EXP,
+ msg.readInt32("exp"),
+ Notify_true);
+ PlayerInfo::setStatBase(Attributes::HOMUN_EXP_NEEDED,
+ msg.readInt32("next exp"),
+ Notify_true);
+ PlayerInfo::setStatBase(Attributes::HOMUN_SKILL_POINTS,
+ msg.readInt16("skill points"),
+ Notify_true);
+ const int range = msg.readInt16("attack range");
+ PlayerInfo::setStatBase(Attributes::HOMUN_ATTACK_RANGE,
+ range,
+ Notify_true);
+
+ PlayerInfo::updateAttrs();
+ HomunculusInfo *const info = PlayerInfo::getHomunculus();
+ if (info == nullptr)
+ return;
+ Being *const dstBeing = actorManager->findBeing(info->id);
+
+ info->name = name;
+ info->level = level;
+ info->range = range;
+ info->hungry = hungry;
+ info->intimacy = intimacy;
+ info->equip = equip;
+ PlayerInfo::setHomunculusBeing(dstBeing);
+}
+
+void HomunculusRecv::processHomunculusInfo2(Net::MessageIn &msg)
+{
+ if (actorManager == nullptr)
+ return;
+ const std::string name = msg.readString(24, "name");
+ msg.readUInt8("flags"); // 0x01 - renamed, 0x02 - vaporize, 0x04 - alive
+ const int level = msg.readInt16("level");
+ PlayerInfo::setStatBase(Attributes::HOMUN_LEVEL,
+ level,
+ Notify_true);
+ const int hungry = msg.readInt16("hungry");
+ const int intimacy = msg.readInt16("intimacy");
+ const int equip = msg.readItemId("item id");
+ PlayerInfo::setStatBase(Attributes::HOMUN_ATK,
+ msg.readInt16("atk"),
+ Notify_true);
+ PlayerInfo::setStatBase(Attributes::HOMUN_MATK,
+ msg.readInt16("matk"),
+ Notify_true);
+ PlayerInfo::setStatBase(Attributes::HOMUN_HIT,
+ msg.readInt16("hit"),
+ Notify_true);
+ PlayerInfo::setStatBase(Attributes::HOMUN_CRIT,
+ msg.readInt16("luk/3 or crit/10"),
+ Notify_true);
+ PlayerInfo::setStatBase(Attributes::HOMUN_DEF,
+ msg.readInt16("def"),
+ Notify_true);
+ PlayerInfo::setStatBase(Attributes::HOMUN_MDEF,
+ msg.readInt16("mdef"),
+ Notify_true);
+ PlayerInfo::setStatBase(Attributes::HOMUN_FLEE,
+ msg.readInt16("flee"),
+ Notify_true);
+ PlayerInfo::setStatBase(Attributes::HOMUN_ATTACK_DELAY,
+ msg.readInt16("attack speed"),
+ Notify_true);
+ PlayerInfo::setStatBase(Attributes::HOMUN_HP,
+ msg.readInt32("hp"),
+ Notify_true);
+ PlayerInfo::setStatBase(Attributes::HOMUN_MAX_HP,
+ msg.readInt32("max hp"),
+ Notify_true);
PlayerInfo::setStatBase(Attributes::HOMUN_MP,
msg.readInt16("sp"),
Notify_true);