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 ++++++++++++++++++++++++++++++------- src/net/eathena/homunculusrecv.h | 3 +- src/net/eathena/packetsin.inc | 29 +++++++++-- 3 files changed, 113 insertions(+), 23 deletions(-) (limited to 'src/net/eathena') 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); diff --git a/src/net/eathena/homunculusrecv.h b/src/net/eathena/homunculusrecv.h index e4c42c7ea..8183db1f9 100644 --- a/src/net/eathena/homunculusrecv.h +++ b/src/net/eathena/homunculusrecv.h @@ -32,7 +32,8 @@ namespace EAthena { void processHomunculusSkills(Net::MessageIn &msg); void processHomunculusData(Net::MessageIn &msg); - void processHomunculusInfo(Net::MessageIn &msg); + void processHomunculusInfo1(Net::MessageIn &msg); + void processHomunculusInfo2(Net::MessageIn &msg); void processHomunculusSkillUp(Net::MessageIn &msg); void processHomunculusFood(Net::MessageIn &msg); void processHomunculusExp(Net::MessageIn &msg); diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index d701d6e8e..b85d5a901 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -366,7 +366,6 @@ packet(SMSG_HOMUNCULUS_DATA, 0x0230, 12, &HomunculusRecv::process // 20050530 packet(SMSG_HOMUNCULUS_SKILLS, 0x0235, -1, &HomunculusRecv::processHomunculusSkills, 20050530); packet(SMSG_PK_RANKS_LIST, 0x0238, 282, &BeingRecv::processPkRanksList, 20050530); -packet(SMSG_HOMUNCULUS_INFO, 0x022e, 71, &HomunculusRecv::processHomunculusInfo, 20050530); // 20050531 packet(SMSG_HOMUNCULUS_SKILL_UP, 0x0239, 11, &HomunculusRecv::processHomunculusSkillUp, 20050531); @@ -513,6 +512,7 @@ packet(SMSG_NPC_PROGRESS_BAR_ABORT, 0x02f2, 2, &NpcRecv::processProgres if (packetVersionRe >= 20080827) { packet(SMSG_MVP_EXP, 0x010b, 6, &ChatRecv::processMVPExp, 20080827); + packet(SMSG_HOMUNCULUS_INFO, 0x022e, 71, &HomunculusRecv::processHomunculusInfo1, 20080827); } // 20080827 @@ -669,6 +669,12 @@ if (packetVersion >= 20100701) // 20100803 packet(SMSG_GUILD_EXPULSION, 0x0839, 66, &GuildRecv::processGuildExpulsion, 20100803); +// 20101005 main +if (packetVersionMain >= 20101005) +{ + packet(SMSG_HOMUNCULUS_INFO, 0x022e, 71, &HomunculusRecv::processHomunculusInfo1, 20101005); +} + // 20101124 if (packetVersion >= 20101124) { @@ -826,6 +832,12 @@ if (packetVersion >= 20131223) // 20131230 packet(SMSG_MAIL2_SEND_RESULT, 0x09ed, 3, &Mail2Recv::processSendResult, 20131230); +// 20131230 +if (packetVersion >= 20131230) +{ + packet(SMSG_HOMUNCULUS_INFO, 0x09f7, 75, &HomunculusRecv::processHomunculusInfo2, 20131230); +} + // 20140122 packet(SMSG_PET_EVOLUTION_RESULT, 0x09fc, 6, &PetRecv::processPetEvolution, 20140122); @@ -971,7 +983,6 @@ if (packetVersion >= 20150513) packet(SMSG_BEING_SPAWN, 0x09fe, -1, &BeingRecv::processBeingSpawn, 20150513); packet(SMSG_BEING_MOVE, 0x09fd, -1, &BeingRecv::processBeingMove, 20150513); packet(SMSG_PLAYER_HEAL, 0x0a27, 8, &PlayerRecv::processPlayerHeal, 20150513); - packet(SMSG_HOMUNCULUS_INFO, 0x09f7, 75, &HomunculusRecv::processHomunculusInfo, 20150513); packet(SMSG_QUEST_LIST, 0x09f8, -1, &QuestRecv::processAddQuests, 20150513); packet(SMSG_QUEST_ADD, 0x09f9, 143, &QuestRecv::processAddQuest, 20150513); packet(SMSG_QUEST_UPDATE_OBJECTIVES, 0x09fa, -1, &QuestRecv::processUpdateQuestsObjectives, 20150513); @@ -1339,7 +1350,7 @@ if (packetVersionRe >= 20180704) packet(SMSG_PARTY_ITEM_PICKUP, 0x02b8, 32, &PartyRecv::processPartyItemPickup, 20180704); packet(SMSG_BUYINGSTORE_SELLER_SELL_FAILED, 0x0824, 8, &BuyingStoreRecv::processBuyingStoreSellerSellFailed, 20180704); packet(SMSG_BUYINGSTORE_REPORT, 0x09e6, 24, &BuyingStoreRecv::processBuyingStoreReport, 20180704); - packet(SMSG_HOMUNCULUS_INFO, 0x09f7, 77, &HomunculusRecv::processHomunculusInfo, 20180704); + packet(SMSG_HOMUNCULUS_INFO, 0x09f7, 77, &HomunculusRecv::processHomunculusInfo2, 20180704); packet(SMSG_MAIL2_ADD_ITEM_RESULT, 0x0a05, 63, &Mail2Recv::processAddItemResult, 20180704); packet(SMSG_TRADE_ITEM_ADD, 0x0a09, 55, &TradeRecv::processTradeItemAdd, 20180704); packet(SMSG_PLAYER_STORAGE_ADD, 0x0a0a, 57, &InventoryRecv::processPlayerStorageAdd, 20180704); @@ -1466,6 +1477,18 @@ if (packetVersionRe >= 20181114) packet(SMSG_LOGIN_MOBILE_OTP, 0x09a2, 6, &LoginRecv::processMobileOtp, 20181114); } +// 20181114 zero +if (packetVersionZero >= 20181114) +{ + packet(SMSG_HOMUNCULUS_INFO, 0x09f7, 77, &HomunculusRecv::processHomunculusInfo2, 20181114); +} + +// 20181121 main +if (packetVersionMain >= 20181121) +{ + packet(SMSG_HOMUNCULUS_INFO, 0x09f7, 77, &HomunculusRecv::processHomunculusInfo2, 20181121); +} + // 20181128 main if (packetVersionMain >= 20181128) { -- cgit v1.2.3-60-g2f50