summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-27 21:40:58 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-27 21:40:58 +0300
commit815a432c34d1901d14745d8c3386d489abdf3339 (patch)
tree7dd45b9a16a35451771e883b933e8739b91e5697 /src/net
parent4b02d01243eeb6b31c57e5220914b9e5e7c7bfe8 (diff)
downloadmanaverse-815a432c34d1901d14745d8c3386d489abdf3339.tar.gz
manaverse-815a432c34d1901d14745d8c3386d489abdf3339.tar.bz2
manaverse-815a432c34d1901d14745d8c3386d489abdf3339.tar.xz
manaverse-815a432c34d1901d14745d8c3386d489abdf3339.zip
Impliment packet SMSG_MERCENARY_UPDATE 0x02a2.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eathena/mercenaryrecv.cpp36
-rw-r--r--src/net/eathena/sp.h2
2 files changed, 33 insertions, 5 deletions
diff --git a/src/net/eathena/mercenaryrecv.cpp b/src/net/eathena/mercenaryrecv.cpp
index 3f338e61a..b00fd0235 100644
--- a/src/net/eathena/mercenaryrecv.cpp
+++ b/src/net/eathena/mercenaryrecv.cpp
@@ -33,17 +33,45 @@
#include "net/messagein.h"
+#include "net/eathena/sp.h"
+
+#include "utils/checkutils.h"
+
#include "debug.h"
namespace EAthena
{
+#define setMercStat(sp, stat) \
+ case sp: \
+ PlayerInfo::setStatBase(stat, \
+ val); \
+ break;
+
void MercenaryRecv::processMercenaryUpdate(Net::MessageIn &msg)
{
- UNIMPLIMENTEDPACKET;
- // +++ need create if need mercenary being and update stats
- msg.readInt16("type");
- msg.readInt32("value");
+ const int sp = msg.readInt16("type");
+ const int val = msg.readInt32("value");
+ switch (sp)
+ {
+ setMercStat(Sp::ATK1, Attributes::MERC_ATK);
+ setMercStat(Sp::MATK1, Attributes::MERC_MATK);
+ setMercStat(Sp::HIT, Attributes::MERC_HIT);
+ setMercStat(Sp::CRITICAL, Attributes::MERC_CRIT);
+ setMercStat(Sp::DEF1, Attributes::MERC_DEF);
+ setMercStat(Sp::MDEF1, Attributes::MERC_MDEF);
+ setMercStat(Sp::MERCFLEE, Attributes::MERC_FLEE);
+ setMercStat(Sp::ASPD, Attributes::MERC_ATTACK_DELAY);
+ setMercStat(Sp::HP, Attributes::MERC_HP);
+ setMercStat(Sp::MAXHP, Attributes::MERC_MAX_HP);
+ setMercStat(Sp::SP, Attributes::MERC_MP);
+ setMercStat(Sp::MAXSP, Attributes::MERC_MAX_MP);
+ setMercStat(Sp::MERCKILLS, Attributes::MERC_KILLS);
+ setMercStat(Sp::MERCFAITH, Attributes::MERC_FAITH);
+ default:
+ reportAlways("Unknown mercenary stat %d",
+ sp);
+ }
}
void MercenaryRecv::processMercenaryInfo(Net::MessageIn &msg)
diff --git a/src/net/eathena/sp.h b/src/net/eathena/sp.h
index 7a5e08181..53b12c63f 100644
--- a/src/net/eathena/sp.h
+++ b/src/net/eathena/sp.h
@@ -101,7 +101,7 @@ namespace Sp
MOD_DROP = 126,
MOD_DEATH = 127,
- SP_MERCFLEE = 165,
+ MERCFLEE = 165,
MERCKILLS = 189,
MERCFAITH = 190,