From b8d7c1f17c3c4f2ce951652c0763fccf44b2f1c4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 24 Jan 2019 02:40:09 +0300 Subject: Update packet versions for packet SMSG_HOMUNCULUS_INFO --- src/net/eathena/homunculusrecv.cpp | 104 ++++++++++++++++++++++++++++++------- 1 file changed, 85 insertions(+), 19 deletions(-) (limited to 'src/net/eathena/homunculusrecv.cpp') 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); -- cgit v1.2.3-60-g2f50