~ubuntu-branches/ubuntu/vivid/manaplus/vivid-proposed

« back to all changes in this revision

Viewing changes to src/net/eathena/elementalhandler.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi, Andrei Karas, Patrick Matthäi
  • Date: 2014-10-27 18:15:40 UTC
  • mfrom: (1.1.37)
  • Revision ID: package-import@ubuntu.com-20141027181540-jvyjufjo9igruklh
Tags: 1.4.10.25-1
[ Andrei Karas ]
* Updated debian/copyright.

[ Patrick Matthäi ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  The ManaPlus Client
 
3
 *  Copyright (C) 2011-2014  The ManaPlus Developers
 
4
 *
 
5
 *  This file is part of The ManaPlus Client.
 
6
 *
 
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
 
10
 *  any later version.
 
11
 *
 
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.
 
16
 *
 
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/>.
 
19
 */
 
20
 
 
21
#include "net/eathena/elementalhandler.h"
 
22
 
 
23
#include "net/eathena/protocol.h"
 
24
 
 
25
#include "debug.h"
 
26
 
 
27
extern Net::ElementalHandler *elementalHandler;
 
28
 
 
29
namespace EAthena
 
30
{
 
31
 
 
32
ElementalHandler::ElementalHandler() :
 
33
    MessageHandler()
 
34
{
 
35
    static const uint16_t _messages[] =
 
36
    {
 
37
        SMSG_ELEMENTAL_UPDATE_STATUS,
 
38
        SMSG_ELEMENTAL_INFO,
 
39
        0
 
40
    };
 
41
    handledMessages = _messages;
 
42
    elementalHandler = this;
 
43
}
 
44
 
 
45
void ElementalHandler::handleMessage(Net::MessageIn &msg)
 
46
{
 
47
    switch (msg.getId())
 
48
    {
 
49
        case SMSG_ELEMENTAL_UPDATE_STATUS:
 
50
            processElementalUpdateStatus(msg);
 
51
            break;
 
52
 
 
53
        case SMSG_ELEMENTAL_INFO:
 
54
            processElementalInfo(msg);
 
55
            break;
 
56
 
 
57
        default:
 
58
            break;
 
59
    }
 
60
}
 
61
 
 
62
void ElementalHandler::processElementalUpdateStatus(Net::MessageIn &msg)
 
63
{
 
64
    msg.readInt16("type");
 
65
    msg.readInt32("value");
 
66
}
 
67
 
 
68
void ElementalHandler::processElementalInfo(Net::MessageIn &msg)
 
69
{
 
70
    msg.readInt32("elemental id");
 
71
    msg.readInt32("hp");
 
72
    msg.readInt32("max hp");
 
73
    msg.readInt32("sp");
 
74
    msg.readInt32("max sp");
 
75
}
 
76
 
 
77
}  // namespace EAthena