summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-03 23:54:24 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-03 23:54:24 +0300
commit7fec02806b7aece2504b1f9920b6252788067d86 (patch)
tree4d5175eca2322df5d08e8f88f5808d10d5916879 /src/net
parent38655cc38ff163fd5944c45427c7d3e8f0c58658 (diff)
downloadmanaverse-7fec02806b7aece2504b1f9920b6252788067d86.tar.gz
manaverse-7fec02806b7aece2504b1f9920b6252788067d86.tar.bz2
manaverse-7fec02806b7aece2504b1f9920b6252788067d86.tar.xz
manaverse-7fec02806b7aece2504b1f9920b6252788067d86.zip
Impliment packets SMSG_ELEMENTAL_INFO and SMSG_ELEMENTAL_UPDATE_STATUS.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eathena/elementalrecv.cpp40
1 files changed, 32 insertions, 8 deletions
diff --git a/src/net/eathena/elementalrecv.cpp b/src/net/eathena/elementalrecv.cpp
index 04507b23c..57f78619a 100644
--- a/src/net/eathena/elementalrecv.cpp
+++ b/src/net/eathena/elementalrecv.cpp
@@ -22,28 +22,52 @@
#include "logger.h"
+#include "being/playerinfo.h"
+
#include "net/messagein.h"
+#include "net/eathena/sp.h"
+
+#include "utils/checkutils.h"
+
#include "debug.h"
namespace EAthena
{
+#define setElementalStat(sp, stat) \
+ case sp: \
+ PlayerInfo::setStatBase(stat, \
+ val); \
+ break;
+
void ElementalRecv::processElementalUpdateStatus(Net::MessageIn &msg)
{
- UNIMPLIMENTEDPACKET;
- msg.readInt16("type");
- msg.readInt32("value");
+ const int sp = msg.readInt16("type");
+ const int val = msg.readInt32("value");
+ switch (sp)
+ {
+ setElementalStat(Sp::HP, Attributes::ELEMENTAL_HP);
+ setElementalStat(Sp::MAXHP, Attributes::ELEMENTAL_MAX_HP);
+ setElementalStat(Sp::SP, Attributes::ELEMENTAL_MP);
+ setElementalStat(Sp::MAXSP, Attributes::ELEMENTAL_MAX_MP);
+ default:
+ reportAlways("Unknown elemental stat %d",
+ sp);
+ }
}
void ElementalRecv::processElementalInfo(Net::MessageIn &msg)
{
- UNIMPLIMENTEDPACKET;
msg.readInt32("elemental id");
- msg.readInt32("hp");
- msg.readInt32("max hp");
- msg.readInt32("sp");
- msg.readInt32("max sp");
+ PlayerInfo::setStatBase(Attributes::ELEMENTAL_HP,
+ msg.readInt32("hp"));
+ PlayerInfo::setStatBase(Attributes::ELEMENTAL_MAX_HP,
+ msg.readInt32("max hp"));
+ PlayerInfo::setStatBase(Attributes::ELEMENTAL_MP,
+ msg.readInt32("sp"));
+ PlayerInfo::setStatBase(Attributes::ELEMENTAL_MAX_MP,
+ msg.readInt32("max sp"));
}
} // namespace EAthena