ManaPlus
beinghandler.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2018 The ManaPlus Developers
6  *
7  * This file is part of The ManaPlus Client.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
24 
25 #include "net/eathena/messageout.h"
27 #include "net/eathena/sprite.h"
28 
29 #include "debug.h"
30 
31 extern int packetVersion;
32 extern int serverVersion;
33 
34 namespace EAthena
35 {
36 
37 BeingHandler::BeingHandler(const bool enableSync) :
38  Ea::BeingHandler(enableSync)
39 {
40  beingHandler = this;
41 }
42 
44 {
45  beingHandler = nullptr;
46 }
47 
49 {
51  if (packetVersion >= 20080827 && packetVersion < 20101124)
52  {
53  outMsg.writeInt32(0, "unused");
54  outMsg.writeInt32(0, "unused");
55  }
56  outMsg.writeBeingId(id, "being id");
57 }
58 
59 void BeingHandler::undress(Being *const being) const
60 {
61  if (being == nullptr)
62  return;
63  being->unSetSprite(SPRITE_WEAPON);
68  being->unSetSprite(SPRITE_SHIELD);
69  being->unSetSprite(SPRITE_FLOOR);
70  being->unSetSprite(SPRITE_ROBE);
71  being->unSetSprite(SPRITE_EVOL2);
72  being->unSetSprite(SPRITE_EVOL3);
73  being->unSetSprite(SPRITE_EVOL4);
74  being->unSetSprite(SPRITE_EVOL5);
75  being->unSetSprite(SPRITE_EVOL6);
76  being->unSetSprite(SPRITE_HAIR);
77  being->unSetSprite(SPRITE_SHOES);
78 }
79 
80 void BeingHandler::requestRanks(const RankT rank) const
81 {
82  if (packetVersion < 20130605)
83  return;
84 
86  outMsg.writeInt16(CAST_S16(rank), "type");
87 }
88 
89 void BeingHandler::viewPlayerEquipment(const Being *const being) const
90 {
91  if (being == nullptr)
92  return;
93 
95  outMsg.writeBeingId(being->getId(), "account id");
96 }
97 
98 void BeingHandler::requestNameByCharId(const int id) const
99 {
101  if (packetVersion >= 20080827 && packetVersion < 20101124)
102  {
103  outMsg.writeInt32(9, "unused");
104  outMsg.writeInt32(9, "unused");
105  }
106  outMsg.writeInt32(id, "character id");
107 }
108 
109 } // namespace EAthena
int CMSG_REQUEST_RANKS
int CMSG_PLAYER_VIEW_EQUIPMENT
Definition: protocolout.cpp:95
BeingId getId() const
Definition: actorsprite.h:63
int serverVersion
Definition: client.cpp:123
int BeingId
Definition: beingid.h:29
void viewPlayerEquipment(const Being *const being) const
void requestNameById(const BeingId id) const
int packetVersion
Definition: client.cpp:124
int CMSG_SOLVE_CHAR_NAME
void requestRanks(const RankT rank) const
Rank ::T RankT
Definition: rank.h:33
Net::BeingHandler * beingHandler
Definition: net.cpp:96
#define createOutPacket(name)
Definition: messageout.h:36
void undress(Being *const being) const
void requestNameByCharId(const int id) const
int CMSG_NAME_REQUEST
Definition: protocolout.cpp:38
#define CAST_S16
Definition: cast.h:27
Definition: being.h:93
void unSetSprite(const unsigned int slot)
Definition: being.cpp:2861