From a8f264a9aad2ec9d90759a65d556cc97d7785fb6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 25 Sep 2014 17:56:16 +0300 Subject: eathena: add packet SMSG_HOMUNCULUS_SKILL_UP 0x0239. --- src/net/eathena/homunculushandler.cpp | 28 ++++++++++++++++++++++++++++ src/net/eathena/homunculushandler.h | 2 ++ src/net/eathena/protocol.h | 1 + 3 files changed, 31 insertions(+) (limited to 'src') diff --git a/src/net/eathena/homunculushandler.cpp b/src/net/eathena/homunculushandler.cpp index 5a6d3e5fa..6f7aaaa40 100644 --- a/src/net/eathena/homunculushandler.cpp +++ b/src/net/eathena/homunculushandler.cpp @@ -48,6 +48,7 @@ HomunculusHandler::HomunculusHandler() : SMSG_HOMUNCULUS_SKILLS, SMSG_HOMUNCULUS_DATA, SMSG_HOMUNCULUS_INFO, + SMSG_HOMUNCULUS_SKILL_UP, 0 }; handledMessages = _messages; @@ -70,6 +71,10 @@ void HomunculusHandler::handleMessage(Net::MessageIn &msg) processHomunculusInfo(msg); break; + case SMSG_HOMUNCULUS_SKILL_UP: + processHomunculusSkillUp(msg); + break; + default: break; } @@ -179,6 +184,29 @@ void HomunculusHandler::processHomunculusInfo(Net::MessageIn &msg) PlayerInfo::setHomunculusBeing(dstBeing); } +void HomunculusHandler::processHomunculusSkillUp(Net::MessageIn &msg) +{ + const int skillId = msg.readInt16("skill id"); + const int level = msg.readInt16("level"); + const int sp = msg.readInt16("sp"); + const int range = msg.readInt16("range"); + const int up = msg.readUInt8("up flag"); + + if (skillDialog && PlayerInfo::getSkillLevel(skillId) != level) + skillDialog->playUpdateEffect(skillId); + PlayerInfo::setSkillLevel(skillId, level); + if (skillDialog) + { + if (!skillDialog->updateSkill(skillId, range, + up, SkillType::Unknown, sp)) + { + skillDialog->addSkill(SkillOwner::Homunculus, + skillId, "", level, + range, up, SkillType::Unknown, sp); + } + } +} + void HomunculusHandler::setName(const std::string &name) const { createOutPacket(CMSG_HOMUNCULUS_SET_NAME); diff --git a/src/net/eathena/homunculushandler.h b/src/net/eathena/homunculushandler.h index 3b7a82ace..c86dfb58e 100644 --- a/src/net/eathena/homunculushandler.h +++ b/src/net/eathena/homunculushandler.h @@ -57,6 +57,8 @@ class HomunculusHandler final : public MessageHandler, void processHomunculusData(Net::MessageIn &msg); void processHomunculusInfo(Net::MessageIn &msg); + + void processHomunculusSkillUp(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 13a5f5132..c7a652751 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -261,6 +261,7 @@ #define SMSG_HOMUNCULUS_SKILLS 0x0235 #define SMSG_HOMUNCULUS_DATA 0x0230 #define SMSG_HOMUNCULUS_INFO 0x022e +#define SMSG_HOMUNCULUS_SKILL_UP 0x0239 /********************************** * Packets from client to server * -- cgit v1.2.3-60-g2f50