summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-02 16:41:10 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-02 16:41:10 +0300
commit00e080c7230e68ec62ba30a32ac13fbafcab1946 (patch)
tree612bcdfcd339f83cb86eb31a27287d2b455ac531
parenta4fb6c80502e707c19ab70432418295ea4c48d6a (diff)
downloadmanaverse-00e080c7230e68ec62ba30a32ac13fbafcab1946.tar.gz
manaverse-00e080c7230e68ec62ba30a32ac13fbafcab1946.tar.bz2
manaverse-00e080c7230e68ec62ba30a32ac13fbafcab1946.tar.xz
manaverse-00e080c7230e68ec62ba30a32ac13fbafcab1946.zip
eathena: add packet SMSG_PLAYER_UPDATE_SKILL 0x07e1.
-rw-r--r--src/net/eathena/packets.h2
-rw-r--r--src/net/eathena/protocol.h1
-rw-r--r--src/net/eathena/skillhandler.cpp32
-rw-r--r--src/net/eathena/skillhandler.h2
4 files changed, 36 insertions, 1 deletions
diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h
index dfffeb661..b83881c46 100644
--- a/src/net/eathena/packets.h
+++ b/src/net/eathena/packets.h
@@ -210,7 +210,7 @@ int16_t packet_lengths[] =
// #0x07C0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 8, 268, 0, 0, 0, 0, 0, 0,
- 0, 0, 8, 0, 6, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 15, 8, 0, 6, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 8, 25, 0, 0, 0, 0,
//0 1 2 3 4 5 6 7 8 9 a b c d e f
//0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h
index cbb1221fb..d9c477033 100644
--- a/src/net/eathena/protocol.h
+++ b/src/net/eathena/protocol.h
@@ -80,6 +80,7 @@
#define SMSG_PLAYER_SKILLS 0x010f
#define SMSG_PLAYER_ADD_SKILL 0x0111
#define SMSG_PLAYER_DELETE_SKILL 0x0441
+#define SMSG_PLAYER_UPDATE_SKILL 0x07e1
#define SMSG_PLAYER_SKILL_UP 0x010e
#define SMSG_PLAYER_HEAL 0x013d
#define SMSG_PLAYER_SKILL_COOLDOWN 0x043d
diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp
index 595f5a8a2..73a3793ef 100644
--- a/src/net/eathena/skillhandler.cpp
+++ b/src/net/eathena/skillhandler.cpp
@@ -60,6 +60,7 @@ SkillHandler::SkillHandler() :
SMSG_SKILL_SNAP,
SMSG_PLAYER_ADD_SKILL,
SMSG_PLAYER_DELETE_SKILL,
+ SMSG_PLAYER_UPDATE_SKILL,
0
};
handledMessages = _messages;
@@ -98,6 +99,10 @@ void SkillHandler::handleMessage(Net::MessageIn &msg)
processSkillAdd(msg);
break;
+ case SMSG_PLAYER_UPDATE_SKILL:
+ processSkillUpdate(msg);
+ break;
+
case SMSG_PLAYER_DELETE_SKILL:
processSkillDelete(msg);
break;
@@ -212,6 +217,33 @@ void SkillHandler::processSkillAdd(Net::MessageIn &msg)
}
}
+void SkillHandler::processSkillUpdate(Net::MessageIn &msg)
+{
+ int updateSkill = 0;
+ const int skillId = msg.readInt16("skill id");
+ const SkillType::SkillType inf = static_cast<SkillType::SkillType>(
+ msg.readInt32("inf"));
+ const int level = msg.readInt16("skill level");
+ const int sp = msg.readInt16("sp");
+ const int range = msg.readInt16("range");
+ const int up = msg.readUInt8("up flag");
+ const int oldLevel = PlayerInfo::getSkillLevel(skillId);
+ if (oldLevel && oldLevel != level)
+ updateSkill = skillId;
+ PlayerInfo::setSkillLevel(skillId, level);
+ if (skillDialog)
+ {
+ if (!skillDialog->updateSkill(skillId, range, up, inf, sp))
+ {
+ skillDialog->addSkill(SkillOwner::Player,
+ skillId, "", level, range, up, inf, sp);
+ }
+ skillDialog->update();
+ if (updateSkill)
+ skillDialog->playUpdateEffect(updateSkill);
+ }
+}
+
void SkillHandler::processSkillDelete(Net::MessageIn &msg)
{
// ignored, because after this packet server will send all skills.
diff --git a/src/net/eathena/skillhandler.h b/src/net/eathena/skillhandler.h
index 509b0fd71..3d6dfd28e 100644
--- a/src/net/eathena/skillhandler.h
+++ b/src/net/eathena/skillhandler.h
@@ -64,6 +64,8 @@ class SkillHandler final : public MessageHandler, public Ea::SkillHandler
void processSkillAdd(Net::MessageIn &msg);
+ void processSkillUpdate(Net::MessageIn &msg);
+
void processSkillDelete(Net::MessageIn &msg);
};