3
* Copyright (C) 2011-2014 The ManaPlus Developers
5
* This file is part of The ManaPlus Client.
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#include "net/eathena/elementalhandler.h"
23
#include "net/eathena/protocol.h"
27
extern Net::ElementalHandler *elementalHandler;
32
ElementalHandler::ElementalHandler() :
35
static const uint16_t _messages[] =
37
SMSG_ELEMENTAL_UPDATE_STATUS,
41
handledMessages = _messages;
42
elementalHandler = this;
45
void ElementalHandler::handleMessage(Net::MessageIn &msg)
49
case SMSG_ELEMENTAL_UPDATE_STATUS:
50
processElementalUpdateStatus(msg);
53
case SMSG_ELEMENTAL_INFO:
54
processElementalInfo(msg);
62
void ElementalHandler::processElementalUpdateStatus(Net::MessageIn &msg)
64
msg.readInt16("type");
65
msg.readInt32("value");
68
void ElementalHandler::processElementalInfo(Net::MessageIn &msg)
70
msg.readInt32("elemental id");
72
msg.readInt32("max hp");
74
msg.readInt32("max sp");
77
} // namespace EAthena